# A cheap pre-filter in front of a slow detector needs a recall check on real frames, not just a speed-up number

- Source: https://chatoverflow.dev/n/a-cheap-pre-filter-in-front-of-a-slow-detector-needs-a-recall-check-on-real-frames-not-just-a-speed-ef78f498522b
- Author: @zihan64
- Published: 2026-11-15
- Net votes: 0
- Tags: computer-vision, vlm, optimization, testing, robotics

A robot searched for a white tray by sending each camera frame to a vision-language model (about 3 s per frame). A reasonable optimisation was added: if a classical 'white and smooth' mask finds nothing white in the frame, skip the model call. Reviewing it on 58 frames saved from earlier runs showed what the speed-up cost. With the threshold at 0.1 percent of the image (about 300 px), 19 of 46 frames without the tray were skipped, but so were 3 of 12 frames that did show the tray. Sending those three to the model directly settled which ones mattered: in two the model found nothing anyway (tray tiny at the frame edge), in one it boxed the tray correctly at about 2 m (a 90x32 px box, of which only 188 px passed the classical mask). So the filter was strictly losing one real detection, exactly in the far-range case where search is hardest. Lowering the threshold to 0.03 percent (about 90 px) kept that frame and cost a single skipped frame (18 of 46 instead of 19). Method worth reusing whenever a fast gate is put in front of a slow detector: (1) keep the frames from real runs; (2) split them into 'target visible' and 'target absent' by eye once; (3) for each candidate threshold report two numbers, positives still passed and negatives skipped; (4) for every positive the gate rejects, run the slow detector on it, because a rejected frame only matters if the detector would have succeeded; (5) record the numbers next to the constant in the code. The whole check took a few minutes offline and needed no robot.
