# Business rules — object_detection_py

Evidence date: 2026-10-08. Revision: `main` `b53f138` (2024-03-26).

This repository has no application code, so it enforces no business rules at runtime. The items below are constraints written in `readme.md` or visible in git. Anything inferred is marked **Inferred**. Rules that are not listed were not found. They were not invented to fill the catalogue.

## Who may use the notes

No access-control rule is implemented. The repository is a Bitbucket git repo under `overdrive/object_detection_py`. Who may clone it is a Bitbucket permission, and that policy is **Unknown / Requires Confirmation** from this tree.

The only people recorded in history are Jaco Brits (initial commit, 2024-03-19) and Dirk (the gitlink and both readme commits). That is authorship, not a product role.

## Environment

| Rule | Statement | Provenance |
|---|---|---|
| BR-001 | The documented interpreter is Python 3.9, created with conda. | **Documented** in `readme.md` |
| BR-002 | The conda environment name is a placeholder `{name}`, not a fixed name. | **Documented** |
| BR-003 | numpy is installed with conda, not with the `pip install .` line. | **Documented** by the separate command. Whether that split is required is **Unknown** |
| BR-004 | Protobuf compilation is a step of its own: `python use_protobuff.py object_detection/protos protoc`. | **Documented**. The script is not in the tree, so the rule is not enforceable from this repo |

No rule pins TensorFlow, CUDA, cuDNN, protobuf, or OS version.

## Inference

| Rule | Statement | Provenance |
|---|---|---|
| BR-005 | The recorded detector is the saved model at `ssd_mobilenet_v2_320x320_coco17_tpu-8\saved_model`. | **Documented** as a command argument |
| BR-006 | The recorded label map is `.\data\mscoco_label_map.pbtxt`. | **Documented** as a command argument |
| BR-007 | The recorded image input directory is `.\images`. | **Documented** as `-i .\images` |
| BR-008 | No confidence threshold, max detections, class filter, or device (CPU/GPU) is specified. | **Documented** by absence. The runtime defaults are **Unknown** because `detect_from_image.py` is not in git |

**Inferred:** the label-map filename and the `coco17` segment of the model directory mean the detector's classes are MS COCO, not a custom label set. The readme does not say this in prose.

## Labelling and custom data

| Rule | Statement | Provenance |
|---|---|---|
| BR-009 | Labelling is done by running LabelImg (`labelimg.exe`) after `pip install labelimg`. | **Documented** |
| BR-010 | The next recorded step is `python xml_to_csv.py` with no arguments. | **Documented**. Paths and required XML shape are **Unknown** |
| BR-011 | Commented notes split data into `images/test` + `images/test_labels.csv` and `images/train` + `images/train_labels.csv`. | **Documented** as comments. Not an active rule |
| BR-012 | Commented notes name the record outputs `test.record` and `train.record`. | **Documented** as comments |

**Inferred:** `xml_to_csv.py` after LabelImg means LabelImg was expected to save Pascal VOC XML. The readme does not say which LabelImg save format to use. **Requires Confirmation**.

No class list, minimum box size, train/test ratio, or "empty image" rule is written.

## Training

| Rule | Statement | Provenance |
|---|---|---|
| BR-013 | TFRecord generation and `model_main_tf2.py` are comments, so they are not instructions a reader is told to run. | **Documented** |
| BR-014 | The commented trainer uses pipeline config `ssd_efficientdet_d0_512x512_coco17_tpu-8.config` and model directory `training`. | **Documented** inside a comment, corrected by `b53f138` |
| BR-015 | No epoch count, batch size, checkpoint interval, or early-stopping rule is written. | **Documented** by absence |

Whether BR-013 means "do not train" or "training was left for later" is **Requires Confirmation**. The git history shows Dirk edited that commented line on 2024-03-26 rather than deleting it.

## Data that must not be committed

`.gitignore` ignores Python bytecode, logs, `TEST*.xml`, JetBrains `.idea/`, macOS and Windows junk, `*.exe`, `*.jar`, `*.war`, and video/TIFF extensions (`*.mp4`, `*.tiff`, `*.avi`, `*.flv`, `*.mov`, `*.wmv`).

Provenance: **Implemented** file. The file header says it is "some examples of commonly ignored file patterns" and tells the reader to customize it. Provenance of that header: **Documented** in `.gitignore`. It was added in the initial commit and never edited.

**Inferred:** `*.exe` would ignore `labelimg.exe` if someone tried to commit it. That consequence is from the pattern, not from a stated policy.

Images (`*.jpg`, `*.png`, `*.xml`) are not ignored. No images or XML labels are in git anyway.

## Conflicts that need a human decision

- The readme tells the reader to run four Python scripts that are not in the repository. There is no rule that says where those scripts are kept.
- Training is written down and commented out. Promoting those lines to real steps would be a product decision, not a documentation correction.
- The 2026-09-28 scan saw Sonar files that git does not contain. Do not treat Sonar as a project rule until someone confirms those files.
