Sub topic 9
Speeding up labelling with model-assisted pre-labels
This chapter assumes you can read basic Python, know the COCO box convention ([x_min, y_min, width, height] in pixels), and know how box IoU is computed. It also assumes you understand the difference between a ground-truth label and a model prediction. Earlier chapters cover these.
What pre-labelling is
Model-assisted pre-labelling means a model proposes boxes, polygons or masks before any person touches the image. Annotators then review each proposal and accept, edit, delete or add to it. Drawing a box from scratch takes several seconds. Nudging a nearly correct box takes one or two. Deleting a false positive takes one click.
The model does not produce the labels. It produces drafts, and a human decides what is true. The rest of this chapter is about keeping that distinction intact while you save time.
Pre-labelling helps most when:
- The dataset is large and the classes are visually clear, such as cars, pedestrians or bottles.
- You already have a model, even a weak one trained on a few hundred images, or a general pretrained detector that covers your classes.
- Images contain many instances per image, so manual drawing dominates the cost.
It helps least when classes are subtle or rely on domain judgement, such as grading a defect as minor or major. In those cases annotators spend their time on the decision, and a draft saves little.
The workflow
Pre-labelling is a loop. The model improves as reviewed labels are fed back in.
Each pass through the loop should make the model's drafts better and the review faster. This only works if the reviewed labels are accurate. If reviewers rubber-stamp bad drafts, retraining teaches the model its own mistakes.
Choosing the proposal model
You have three common options.
| Source of drafts | Strength | Weakness |
|---|---|---|
| Pretrained detector with overlapping classes | No training needed | Class names and box style may not match your guidelines |
| Model trained on your first labelled batch | Matches your taxonomy and box conventions | Needs a manual seed set first |
| Interactive segmentation model driven by clicks | Fast masks for any object | Needs a person for every object, so it is less automatic |
Interactive segmentation tools let the annotator click on an object, or drag a rough box, and receive a polygon or mask. This suits segmentation tasks, where drawing polygons by hand is the slowest step. It is "assisted" rather than "pre-labelled", because a person initiates each mask.
A practical start is to hand-label 100 to 300 images, train a small detector, and use it for the next batch. The first batch also sets the box conventions, so the model learns your tight-versus-loose box style from your own data.
Choosing a confidence threshold
Detectors output a score with every proposal. The threshold you choose decides what annotators see.
- A high threshold (for example 0.7) shows few false positives, but annotators must draw every missed object themselves.
- A low threshold (for example 0.2) catches most objects, but annotators spend time deleting junk boxes.
Deleting is usually cheaper than drawing, so pre-labelling thresholds are set lower than deployment thresholds. A value between 0.25 and 0.4 is a common start. Tune it by measuring review time or the counts of deleted and added boxes, as shown later.
You can also use the score to route work. This is called triage.
| Score band | Policy |
|---|---|
| 0.8 and above | Show as a draft, reviewer glances and accepts |
| 0.3 to 0.8 | Show as a draft, reviewer checks the box edges and class |
| Below 0.3 | Hide, reviewer draws missed objects manually |
Do not auto-accept any band without human review, even a high-confidence one. High scores can still be systematically wrong, for example a confident class confusion between two similar vehicle types.
Writing drafts into the tool
Most annotation tools import drafts as a COCO file, or in their own JSON format. The sketch below filters predictions by score and writes a COCO-style file. It keeps the score and marks the source so you can tell model-made boxes from human ones later.
import json
predictions = [
{"image_id": 1, "category_id": 1, "bbox": [48, 42, 104, 50], "score": 0.93},
{"image_id": 1, "category_id": 1, "bbox": [300, 200, 40, 30], "score": 0.12},
{"image_id": 1, "category_id": 2, "bbox": [400, 60, 60, 90], "score": 0.41},
]
def to_prelabels(preds, threshold=0.3):
annotations = []
for p in preds:
if p["score"] < threshold:
continue
x, y, w, h = p["bbox"]
annotations.append({
"id": len(annotations) + 1,
"image_id": p["image_id"],
"category_id": p["category_id"],
"bbox": [x, y, w, h],
"area": w * h,
"iscrowd": 0,
"score": p["score"],
"source": "model",
})
return annotations
doc = {
"images": [{"id": 1, "file_name": "street_001.jpg", "width": 640, "height": 480}],
"categories": [{"id": 1, "name": "car"}, {"id": 2, "name": "pedestrian"}],
"annotations": to_prelabels(predictions),
}
with open("prelabels.json", "w") as f:
json.dump(doc, f, indent=2)
print(len(doc["annotations"]), "pre-labels written")The script prints 2 pre-labels written, because the 0.12 box falls below the threshold.
Check the coordinate convention before importing. If your model emits [x_min, y_min, x_max, y_max] or normalised YOLO values, convert them first. A wrong convention does not raise an error. It produces boxes in the wrong place, and a tired reviewer may "fix" them one by one.
Automation bias and anchoring
The main risk of pre-labelling is not wasted time. It is that people anchor on what they see. A reviewer shown a plausible box tends to accept it, even when a careful look would reveal that it cuts off a wheel or misses a partially hidden object. This is called automation bias. Its effects include:
- Boxes inherit model bias. If the model draws loose boxes, accepted boxes stay loose, and the next model learns loose boxes.
- Missed objects stay missed. Reviewers check what is shown. Objects the model did not propose, such as small, truncated or occluded ones, are skipped more often than in manual labelling.
- Errors reinforce themselves. Retraining on accepted errors makes the next drafts repeat them.
You can reduce these effects:
- Write review rules into the guidelines: check every box edge, scan the whole image for missed objects, and apply the occlusion and truncation rules as usual.
- Include a small share of images with no pre-labels in each batch, labelled from scratch. Compare their quality and missed-object rate with the assisted images.
- Run a gold set, which is a set of images labelled and checked by experts, through both workflows and compare agreement with it.
- Keep the evaluation split free of model influence. Label validation and test images without drafts, or at minimum without drafts from any model that was trained on related data. Otherwise your test labels are biased towards what the model already does, and the metrics look better than the real quality.
Measuring the speedup
"Faster" needs numbers. Compare each draft with the final reviewed label and count what happened to it. A high share of kept or lightly edited boxes means the drafts are useful. A high number of deleted drafts means the threshold is too low or the model is poor. A high number of added boxes means it is too high or the model misses objects.
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
def compare(pre, final, match_iou=0.5, keep_iou=0.9):
"""pre and final are lists of (class_id, (x1, y1, x2, y2))."""
used = set()
counts = {"kept": 0, "edited": 0, "added": 0, "deleted": 0}
for f_cls, f_box in final:
best_j, best_iou = None, 0.0
for j, (p_cls, p_box) in enumerate(pre):
if j in used or p_cls != f_cls:
continue
iou = box_iou(f_box, p_box)
if iou > best_iou:
best_j, best_iou = j, iou
if best_j is not None and best_iou >= match_iou:
used.add(best_j)
counts["kept" if best_iou >= keep_iou else "edited"] += 1
else:
counts["added"] += 1
counts["deleted"] = len(pre) - len(used)
return counts
pre = [(1, (50, 40, 150, 90)), (1, (200, 100, 260, 160)), (2, (300, 300, 340, 340))]
final = [(1, (50, 40, 150, 90)), (1, (205, 105, 270, 165)), (1, (400, 50, 450, 120))]
print(compare(pre, final))The output is {'kept': 1, 'edited': 1, 'added': 1, 'deleted': 1}. The second draft has IoU of about 0.68 with its final box, so it counts as edited. The class-2 draft has no match, so it counts as deleted. The class-1 box at the right has no draft, so it counts as added.
The matching is greedy and class-aware, which is good enough for monitoring. For polygons and masks, replace box_iou with mask IoU. Also log the time per image for assisted and unassisted work. Counts show draft quality, but only timing shows whether the workflow is cheaper.
Retraining and active learning
After each reviewed batch, retrain on all labelled data. Retrain only on data that has passed quality control, not on raw accepted drafts.
You can also choose which images to label next. Uncertain images are the most informative, for example those with many mid-range scores or detections that disagree between two models. This is active learning. Use it carefully, because a labelled set picked only from hard images no longer reflects the real data. Keep a randomly sampled portion in every batch so you can still estimate real-world performance.
Failure modes
- Silent drift. Box style slowly shifts towards the model's habits. Audit a random sample each week against the guidelines.
- Class collapse. Rare classes get fewer drafts, so annotators label them less often. Check the per-class label counts after each batch.
- Stale drafts. After the guidelines change, old drafts follow the old rules. Regenerate drafts with a retrained model, and do not reuse cached ones.
- Leaked models. If a model trained on your test images produces drafts for new data, near-duplicate content passes into the labels. Keep the splits from the splitting chapter in force when you train proposal models.
Exercise
A team sets the pre-label confidence threshold to 0.9 to avoid showing wrong boxes. Reviewers report they are drawing most boxes by hand and the time saving is small. Which counts from the comparison script would confirm the problem, and what would you change?
Show answer
The "added" count would be high relative to "kept" and "edited", and "deleted" would be near zero. At 0.9 the model shows only a few very confident boxes and hides most correct ones, so reviewers must draw the rest. Lower the threshold to about 0.3, because deleting a false positive is cheaper than drawing a missing box. Then re-measure the counts and the time per image.
Exercise
Why should the test split be labelled without model drafts, or without drafts from a model trained on related data?
Show answer
Reviewers anchor on drafts and accept boxes that match the model's habits. Test labels then agree with the model more than with the ground truth, and the measured accuracy is inflated. Independent labels give an honest estimate.