municipalbench-full / docs /evaluation.md
Yuquanlee's picture
Update dataset documentation and provenance
268c55e verified
|
Raw History Blame Contribute Delete
4.93 kB
# Evaluation and reproduction
The primary benchmark scores the six released prediction files against the final
annotations for all 11,534 images. Use exact class identity for the main
comparison. Semantic relaxation and older experiments are explained in the
[supplementary guide](supplementary.md).
## What counts as a correct prediction?
**Classification** compares the set of predicted classes with the gold set on
each image. A class present in both is a true positive (TP); an extra predicted
class is a false positive (FP); a missed gold class is a false negative (FN).
Repeated detections of the same class count once for classification.
**Localisation** compares individual boxes. A correct match requires the same
class and intersection-over-union (IoU) of at least 0.50. IoU is the area shared
by two boxes divided by their combined area. Maximum-cardinality matching finds
the largest possible set of one-to-one matches: neither box can be used twice.
Each match is a TP; unmatched predictions and gold boxes are FP and FN.
For example, suppose gold contains two litter boxes and one pothole box. A
prediction with two litter boxes and no pothole has classification TP=1 and
FN=1. If only one predicted litter box matches a gold box at the required IoU,
localisation has TP=1, FP=1 and FN=2. Predicting the right class does not by
itself localise every instance.
## Metrics and populations
Precision is `TP / (TP + FP)` and recall is `TP / (TP + FN)`. The benchmark
emphasises recall through `F2 = 5TP / (5TP + FP + 4FN)`. Scores are reported on
a 0–1 scale. Micro metrics pool counts across classes before computing a score;
macro metrics average class-level scores over the classes represented in the
metric output. Domain micro scores pool only that domain's classes; averaging
domain scores does not recover the overall micro score.
A valid empty prediction contributes missed targets on a positive image and no
TP/FP/FN on a negative image. Correct negatives therefore do not inflate F2. The
separate negative-image false-positive rate measures the fraction of clean
images with at least one predicted violation. A malformed response is excluded
and counted as invalid, never treated as a correct negative.
`valid` scores use each model's valid images. `common` scores use their
intersection across the compared models. All six published runs have 11,534
valid responses, so the two scopes coincide here. Always report coverage when
scoring another run; invalid or missing responses can change the population.
Evaluation retains every saved detection without confidence filtering, weighting
or ranking. Inference retention is separate: YOLO used `conf=0.10`, and VLMs
used no numerical confidence cutoff, although output-count caps can apply. These
metrics are not detection AP/mAP or ROC-AUC. Exact localisation at IoU 0.30 and
0.40 is also supplied as sensitivity analysis.
See [model provenance](../evaluation/models/synthetic11534/README.md) for
recorded settings and limitations, including Gemini's box-axis interpretation.
## Reproduce the published primary results
Download the full dataset snapshot, including the image files, and run these
commands from its root. Install dependencies in your existing Python
environment:
```bash
python -m pip install -r code/requirements.txt
python examples/load_dataset.py --root .
python examples/render_annotation.py --root . --output /tmp/municipalbench.png
python examples/score_predictions.py --root . --output /tmp/model-scores.json
python examples/reproduce_agreement.py --root . --output /tmp/municipalbench-iaa
```
| Example | Successful result |
| --------- | -------------------------------------------------------------------------------------------- |
| Load | 11,534 unique image IDs, matching streaming and local loads |
| Render | An image with final gold boxes and class IDs at the chosen output path |
| Score | Exact classification/localisation summaries and per-class counts match both published scopes |
| Agreement | All first-pass groups, estimates and confidence intervals match |
Scoring uses the supplied predictions; it makes no model API calls. Agreement
reproduction uses 2,000 image-bootstrap replicates and can take several minutes.
Outputs are written outside the downloaded inventory. Preserve the snapshot and
record its HF commit SHA when reporting results.
`code/` contains the scoring and agreement implementation, with file hashes in
`code/source_inventory.json`. The examples verify primary scoring and agreement;
they do not rerun inference, recreate image generation, or replay historical
studies. The supplied semantic matrix and metric code support secondary
rescoring, but the scoring example above checks exact primary metrics only.