Skip to main content

Why skipping a photo with no target changed which detector won

You give a bicycle-detection program a photo of a street. There’s a lamppost in the picture, but no bicycle. If the program draws a box around the lamppost and calls it a bicycle, you’ve caught a false alarm. An image with nothing to find can still tell you how the program behaves.

We tested two invented detectors on two invented pictures. Both found the only target. When we set aside the picture with no target, the first detector’s score jumped from one-third to 100%. The other stayed at one-half. The ranking reversed without either detector changing a box.

Before counting an empty image, you need to know why the reviewer’s list of labels is empty. A person may have checked the image and found no target, or the image may still be waiting for someone to label it. Our second picture stood for one a reviewer had already checked.

Same find, different false alarms

Picture one contained the only target. Detector A boxed it correctly and drew two wrong boxes on picture two. Detector B found the same target, but drew an extra box on picture one that did not match the target. Both detectors gave their false alarms higher confidence than their correct box. That put the mistakes at the front when we sorted each detector’s boxes from most to least confident.

What the scorer saw when we removed a photo

Average precision (AP) gives more credit to a detector when its real finds come before its mistakes. In this COCO example there was only one target. At the point where each detector found it, we could count how many of its boxes so far were correct. With both pictures in the test, A’s list began with two false alarms. The real find was third, giving A an AP of one-third (33.33%). B’s real find came second, giving B one-half (50.00%).

Then we kept only picture one. A’s two false alarms were on the omitted picture. Its one remaining box correctly found the target, so A’s AP rose to 100.00%. B’s false alarm and its real find were both on the picture we kept. B still scored 50.00%.

Average precision with both pictures and with the target picture alone
Images scoredDetector A APDetector B AP
Both reviewed images33.33%50.00%
Only the image with the target object100.00%50.00%

We used pycocotools 2.0.10, the COCO toolkit for scoring object detections. Asking it for getImgIds(catIds=[target]) returns the images with a label for the target category. The second picture has no such label, so the lookup returned only picture one. We chose to use that result as the image list for the second run. The two scoring runs differed only in imgIds, the list of images included. The category, predicted boxes and default rules for how closely a predicted box must overlap a reference box stayed fixed.

The share of real objects found is called recall. Both detectors still found the only real object in either run, so recall was 100% throughout. What changed was which false alarms counted. COCO image selection · COCO evaluation settings

Keep a record of the photos that were checked

Save two lists: the categories you mean to score (catIds) and the images your test is meant to cover (imgIds). Include confirmed empty images that belong in that test. Keep track of the ones still awaiting review so an unfinished label cannot be read as a confirmed absence.

Sometimes two detectors finish with exactly the same AP. Even then it’s worth checking which boxes contributed to the score.