Diagnose missing or wrong detections
1import lynx2from lynx import LYNX3 4model = LYNX("lynx-basic")5rv = lynx.autotune("frame.jpg", model)6 7if rv["recommendation"]:8 print(rv["hint"])9 # "your image was BGR — pass channel_order='bgr' or swap before predict."10else:11 print(rv["hint"])12 # "no variant produced detections — submit_feedback() if it should."When model(image) returns zero detections or wildly wrong ones, the cause is almost always preprocessing mismatch: BGR loaded as RGB, image stretched when the model expects letterboxing, rotated 90° because the camera mounted sideways. Autotune sweeps the small cartesian product of (channel-order × rotation × resize), runs ~16–24 inferences, and reports which combination produced useful results.
Use it when:
- Onboarding a new model — first thing to run on an example image to confirm your preprocessing pipeline matches what the model wants
- Debugging "I get zero detections" — usually a preprocessing bug; autotune nails it in one shot
- Validating an artifact's declared metadata — if v2 metadata says RGB and autotune finds BGR works, the metadata is wrong (file a bug)
Autotune is a one-shot diagnostic, NOT a predict-loop substitute. 16–24 inferences per call is too expensive to run on every frame. Find the winning config, encode it at load time (pass the right channel order, set the right resize mode in the artifact), then remove the autotune call from your hot path.
If autotune returns recommendation=None, no variant produced detections — the image genuinely doesn't have anything the model can find. That's the case for submit_feedback(): send us the frame plus what you expected, we add it to the next training queue.
As v2 metadata becomes universal in shipped artifacts, autotune's primary role shifts to rotation + diagnostic backstop (channel order and resize mode become known facts, not guesses).