Work 13 / 18
AI-assisted annotation
A labelling pipeline that uses a vision-language model to find things, SAM to outline them, and plain image processing where a model would be the wrong tool. Four projects came out of it, with 10,130 annotations on 53 images. The pipeline made the first pass, and I then went through all four projects by hand.
- Annotations
- 10,130
- 53 images, four projects
- Larvae in one frame
- 1,761
- 21-megapixel image
- Model calls per larvae image
- 1
- To find the dish
- Images reviewed
- about 3,900
- 3.4 GB
How it works
Qwen2.5-VL (32B, running locally through Ollama on an RTX 3090) proposes boxes, and SAM turns boxes into masks. Each project then gets its own rules.
For larvae in a dish, the model is called once per image, to find the dish. Classical image processing inside the dish does the rest: 10,002 polygons across 12 images, up to 1,761 in one 21-megapixel frame. I shrink the dish outline inward first, because the bright glass rim otherwise creates hundreds of false instances.
For mask or no-mask labels on office CCTV, the model kept boxing a poster, staff photos on the wall, monitors and the printer. Requiring every face box to sit inside a detected person, and to contain at least 12% skin-coloured pixels, removed them.
Caching the expensive model pass to JSON let me re-run the filters more than 30 times without calling the model again.
What the output looks like
Car damage and car parts: these are rendered ground truth from two public datasets, which I prepared for taxonomy review. They are not model output.
Car damage (CarDD)
CarDD: Wang et al., IEEE T-ITS 2023. Non-commercial research and educational use, credit required.
Limits
What the pipeline produces is a first pass, and it needs a person to go through it, as I did on all four projects. Touching larvae can merge into one polygon, so counts are a lower bound where the dish is most crowded.
Three of the four projects are not shown here: the person and mask-compliance images contain identifiable faces, and the logo images contain trademarks.
From the run log
an.01Counting larvae without calling the model per larva10,002 polygons on 12 imagesShipped
Setup: The vision-language model finds the dish once; contours find the larvae
The model is called once per image, to find the petri dish. Contour extraction inside the dish does the rest: 10,002 larva polygons across 12 images, up to 1,761 in a single dish.
an.03Person anchoring and a skin-tone gate81 boxes keptShipped
Setup: A face box must sit inside a detected person and contain at least 12% skin-coloured pixels (YCrCb)
On 20 to 60 pixel CCTV faces the detector boxed anything face-shaped: a poster of masked faces, staff photos, monitors, the office printer. The two gates rejected all of them. The 14 to 67 split between mask and no-mask is a fact about that room.
an.04Shrinking the dish outline inwardRim artefacts removedShipped
Setup: Segment the dish, erode the region, then extract contours
The bright glass rim of the dish read as hundreds of small bright objects. Eroding the region inward removed the ring. Instances are then filtered by area to reject dust and clumps. Touching larvae sometimes merge, so counts are a lower bound where the dish is most crowded.
Tools
Qwen2.5-VL (Ollama), SAM ViT-B, OpenCV, CVAT, COCO.
The full write-up
There is a longer write-up of this project. It has client details in it, so email me if you’d like a redacted copy.





































