Creating a reliable vision model is useful, but the model is only one part of a production inspection system. When images come from live video, the system also has to determine whether the selected frame is clear enough to support a reliable decision.
A correctly detected object can still be unusable because of motion blur, missed focus, glare, poor framing, or excessive distance from the camera. Passing those frames into a downstream vision-language model forces it to reason from incomplete visual evidence and can produce inconsistent cosmetic-inspection results.
The obvious solution would be to run a separate image-quality model. The problem was computation time. The application was already processing live video through a segmentation model, so the quality gate needed to add very little latency and could not rely on another heavy neural network.
The existing segmentation result provided an important advantage. Because the system already knew which pixels belonged to the relevant surface, the quality checks did not need to analyze the entire camera frame. Background pixels, surrounding objects, and unrelated edges could be excluded before calculating image quality.
The legacy gate combined several inexpensive signals. It checked whether the segmented surface occupied a reasonable portion of the frame, estimated whether excessive glare covered the useful region, and calculated a localized sharpness score to determine whether the surface was sufficiently focused.
For blur detection, I used Laplacian variance as a lightweight measure of local edge response. A sharp image generally produces stronger local intensity changes, while a blurred image produces a weaker response. The calculation is inexpensive, but applying it blindly across an entire object surface creates several problems.
Different object models naturally contain different amounts of texture and visible detail. Cosmetic defects can also create strong edges. A crack, scratch, logo, button, or decorative feature may increase a global variance score even when the underlying frame is poorly focused.
To reduce that sensitivity, the segmentation mask was converted into a smaller controlled sampling region. A custom ring-like region allowed the quality gate to evaluate a consistent portion of the detected surface while avoiding much of the background, mask boundary, and highly variable center detail.
The ring technique reduced the number of pixels being processed and made the blur measurement less dependent on differences between individual object models. It also reduced the chance that a defect or unusually detailed area would dominate the sharpness score.
The final decision did not rely on one universal number. Surface size, glare, and blur were evaluated using bounded criteria calibrated for the type of surface being captured. The exact production thresholds remain implementation-specific, but the general approach was deliberately rule-based, explainable, and inexpensive.
Frames that failed the gate could be rejected before reaching the more expensive inspection stage. In a live workflow, that rejection could also be translated into immediate guidance asking the operator to move closer, stabilize the device, refocus, or change the viewing angle.
The main lesson was that improving downstream model performance does not always require changing the model itself. In many cases, the most effective improvement is controlling the quality of the evidence presented to it.