Mughees Ul Haq

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.

When
July to August 2026
My part
Pipeline design and build, per-project rules, hand labelling and QA, CVAT/COCO delivery
Status
Delivered as CVAT and COCO files
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

Larvae in a dish

A petri dish of larvae with 509 outlined instances, next to an enlarged detail crop.
509 instances: dish overview with a detail crop.
A denser petri dish with 1,153 outlined larvae, next to an enlarged detail crop.
1,153 instances: a denser plate.

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)

Car damage ground truth, plate 1Car damage ground truth, plate 2Car damage ground truth, plate 3Car damage ground truth, plate 4Car damage ground truth, plate 5Car damage ground truth, plate 6
Show 12 more
Car damage ground truth, plate 7Car damage ground truth, plate 8Car damage ground truth, plate 9Car damage ground truth, plate 10Car damage ground truth, plate 11Car damage ground truth, plate 12Car damage ground truth, plate 13Car damage ground truth, plate 14Car damage ground truth, plate 15Car damage ground truth, plate 16Car damage ground truth, plate 17Car damage ground truth, plate 18

CarDD: Wang et al., IEEE T-ITS 2023. Non-commercial research and educational use, credit required.

Car parts (carparts-seg)

Car parts ground truth, plate 1Car parts ground truth, plate 2Car parts ground truth, plate 3Car parts ground truth, plate 4Car parts ground truth, plate 5Car parts ground truth, plate 6
Show 12 more
Car parts ground truth, plate 7Car parts ground truth, plate 8Car parts ground truth, plate 9Car parts ground truth, plate 10Car parts ground truth, plate 11Car parts ground truth, plate 12Car parts ground truth, plate 13Car parts ground truth, plate 14Car parts ground truth, plate 15Car parts ground truth, plate 16Car parts ground truth, plate 17Car parts ground truth, plate 18

carparts-seg: Ultralytics, AGPL-3.0.

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.

All 4 runs for this project

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.