Sub topic 3
Choosing and configuring an annotation tool
This chapter assumes you know basic Python, can read JSON, and understand that a supervised model learns from labelled examples. It covers six parts of the plan in order.
Choosing and configuring an annotation tool
Pick a tool that exports the format your training code reads (COCO or YOLO), supports your task types, and lets you lock a class list. Load the label list before labelling starts, and link the labelling guideline inside the tool so annotators see it while they work.
Speeding up labelling with model-assisted pre-labels
Train a detector on a small labelled set, run it over unlabelled images, and load its boxes into the tool. Humans then correct boxes instead of drawing every one. Review every pre-label. A model that is wrong on hard images will bias the dataset if you accept its output unchecked.
Measuring consistency with IoU and annotator agreement
Intersection over union (IoU) is the overlap area of two boxes divided by the area they cover together. Two annotators who box the same object should score high IoU. A common threshold for a match is 0.5, but set your own per class.
def box_iou(a, b):
"""Boxes in (x_min, y_min, x_max, y_max) format."""
ix1, iy1 = max(a[0], b[0]), max(a[1], b[1])
ix2, iy2 = min(a[2], b[2]), min(a[3], b[3])
inter = max(0, ix2 - ix1) * max(0, iy2 - iy1)
area_a = (a[2] - a[0]) * (a[3] - a[1])
area_b = (b[2] - b[0]) * (b[3] - b[1])
union = area_a + area_b - inter
return inter / union if union > 0 else 0.0
print(box_iou((50, 40, 150, 90), (60, 45, 160, 95)))Quality control: review passes, audits and validation scripts
Combine three checks:
| Check | What it catches |
|---|---|
| Second-pass review of a random sample | Judgement errors on edge cases |
| Box inside image bounds | Export and rounding errors |
| Positive width and height | Empty or inverted boxes |
Track the rejection rate per annotator. A rate that rises over time usually means the guideline is unclear.
Splitting data without leakage
Frames cut from one video are near-duplicates. If they land in both train and validation sets, validation scores look better than real performance. Group images by source (video, scene, or capture session), then split by group.
Finding label errors from model mistakes
Sort images where the model strongly disagrees with a label. A confident prediction that contradicts a label often points to a wrong label. Fix the label, then check whether the guideline covers that case.
Exercise
Using box_iou, what is the IoU of the boxes (0, 0, 10, 10) and (5, 0, 15, 10)?
Show answer
The intersection is 5 × 10 = 50, and the union is 100 + 100 − 50 = 150. The IoU is 50 / 150 = 1/3, about 0.333.