DEV Community

Todd Sullivan
Todd Sullivan

Posted on

The Newer YOLO Model Had Better mAP. It Counted Sheep Worse.

I nearly shipped a newer YOLO model because the headline benchmark said it was better.

The iOS app already bundled yolov8n. I exported yolo11n, yolo26n, yolo11s and yolo26s to CoreML. All five had the same usable interface: 640×640 input, 80 COCO classes, NMS built into the model, and matching output shapes. From the app's point of view, the upgrade was a file swap and one model-name change.

That made the tempting test simple: compare COCO mAP and pick the newest model.

I tested the behaviour the app actually depends on instead.

The benchmark ported the production photo pipeline to Python:

  • full-frame inference
  • a 3×3 grid of overlapping tiles
  • edge-fragment rejection
  • class-agnostic duplicate merging
  • the app's 0.25 confidence threshold

I ran 300 COCO validation images through each nano model and scored count error rather than detection mAP.

Model Overall relative error Sheep Cattle Birds
YOLOv8n, current 43.8% 46.2% 28.0% 56.7%
YOLO11n 44.1% 70.7% 29.1% 47.5%
YOLO26n 41.2% 60.3% 23.2% 46.8%

The newer models improved some categories. YOLO26n was better on cattle and birds. But both regressed sheep, the main use case.

Across the evaluated sheep images there were 230 animals. The current model predicted 262. YOLO26n predicted 278. YOLO11n predicted 301. The newer models were not just missing differently; the tiled pipeline amplified their over-counting.

The first benchmark run also took 37 minutes because I ran it beside a simulator build and starved the machine. Serialising the work restored normal inference speed. The clean baseline remained 71 tests with zero failures.

So the release decision was deliberately boring: no model swap.

A model upgrade is not an architecture name or a better aggregate metric. It is an improvement after preprocessing, tiling, thresholds, merging and the product's actual error function have all had their say.

Measure the deployed pipeline, not the model card.

Top comments (3)

Collapse
 
userxnom profile image
Abdullah Naseer •

The 230 vs 301 number is the one that sticks — YOLO11n over-counted sheep by nearly a third while its overall error looked flat. The detail I'd want to pull on is the tiling: if the newer models' boxes are slightly smaller or shifted, the same sheep can appear in two tiles with an IoU just under your merge threshold, and the pipeline counts it twice. Did you check whether the extra counts were duplicates of the same animal across tile boundaries, or genuinely new false positives? If it's the former, the model might not be worse at sheep at all — the merge step might just be tuned to v8n's box geometry.

Collapse
 
toddsullivan profile image
Todd Sullivan •

That’s the next thing I need to isolate. I held the merge settings constant, so the comparison is fair, but that doesn’t show whether YOLO11n produced more genuine false positives or more boundary duplicates. Breaking those out separately should answer it.

Collapse
 
toddsullivan profile image
Todd Sullivan • • Edited

You made me go check, and the answer is: not duplicates — but you were right not to trust the headline number.

I re-ran it logging each surviving box's provenance and matching detections against the COCO ground-truth boxes, so I could split the over-count into "second box on a sheep already counted" vs "box on something that isn't a sheep". Three things came out:

Tile-seam duplicates are essentially identical across all three models — 12 for v8n, 13 for 11n, 12 for 26n. That's the mechanism you predicted, and it's flat, so it can't explain a 71-box spread.

The box-geometry premise doesn't hold either. Median detection area over matched GT area is 1.00 / 1.00 / 0.99 — the newer models' boxes aren't tighter or shifted. And sweeping the merge IoU from 0.6 down to 0.3 moves the total by only 4-7 boxes for any model, so the merge isn't sitting near
a cliff for any of them.

Where the difference actually lives is plain false positives: 96 / 122 / 108.

But here's the part that makes your skepticism land anyway. Decomposing it also showed the newer models find MORE real sheep — 228 -> 238 -> 241 true hits. They're better at recall and worse at precision, and the precision loss outruns the recall gain. "YOLO11n is worse at sheep" was too blunt a reading of my own number. Worse still, v8n's flattering +0% total is partly luck: 108 misses happening to cancel 96 false positives.

So I compared each model at its own best confidence threshold instead of at v8n's, which is the comparison I should have run first. Best mean absolute count error per photo: v8n 2.64 @ 0.35, 26n 2.66 @ 0.40, 11n 2.77 @ 0.45. The first two are indistinguishable.

One caveat I'd flag on my own numbers, since it bit me an hour later: this is 47 COCO photos / 336 sheep, and that's small. When I tried to cash in the "0.35 beats 0.25" finding as a real change, it evaporated on a held-out split — 0.35 was tuned noise and 0.25 was better on data it hadn't seen. Read those per-model optima with the same suspicion.