Automated visual inspection uses cameras and software to evaluate parts or products against defined quality criteria. It can verify presence, position, dimensions, labels, surface condition, assembly, or packaging at production speed. The camera is only one component. Stable presentation, lighting, optics, triggering, image processing, reject handling, and validation determine whether the system works.

Computer vision is a good fit when the defect is visually observable and the process can present it consistently. It is not a universal replacement for human inspection. Tactile properties, hidden internal faults, and highly subjective cosmetic judgments may require other sensing or a combined process.

Define the inspection before choosing a model

Write an acceptance specification with examples. What defect types matter? What is the smallest defect that must be found? How much positional and appearance variation is acceptable? What are the consequences of a false accept and a false reject? What line speed and decision time are required?

A vague requirement such as “find damaged parts” is not testable. “Detect missing O-rings and surface cuts longer than 2 mm on the visible sealing face, with fewer than one false reject per 1,000 conforming parts” provides a starting target.

The imaging system

Lighting

Lighting creates contrast between the feature and background. Backlighting reveals silhouettes and dimensions. Diffuse lighting reduces glare on reflective parts. Dark-field lighting emphasizes scratches or edges. Structured light helps recover shape. Controlling ambient light with an enclosure often improves results more than changing algorithms.

Lens and camera

Resolution must be calculated at the object. If a 100 mm field spans 2,000 pixels, each pixel represents about 0.05 mm before considering optics and blur. Detecting a 0.1 mm defect with only two pixels is fragile. Lens distortion, depth of field, working distance, shutter speed, motion blur, and sensor type all matter.

Part presentation and trigger

The part needs a repeatable view. Fixtures, guides, encoders, and presence sensors may be required. The trigger should capture at the correct position and associate the image with a part identifier. An accurate algorithm cannot compensate for a hidden surface.

Rules-based vision and machine learning

Traditional tools—thresholds, edge detection, blob analysis, template matching, and measurement—are effective when geometry and contrast are consistent. They are interpretable, fast, and require few examples. Machine learning is useful when acceptable appearance varies or defects have complex texture and shape.

Classification answers whether an image belongs to a category. Object detection locates defect types with boxes. Segmentation identifies affected pixels, supporting size measurement. Anomaly detection learns normal appearance and flags deviations, but unusual does not always mean defective. The choice must follow the quality question.

Building a representative dataset

Collect images from actual production across shifts, lots, suppliers, machine states, and acceptable variation. Include difficult good parts, rare defects, contamination, partial views, and startup conditions. Keep product or lot groups separate between training and final testing to avoid measuring memorization.

Labels need a written guide. Quality experts should resolve ambiguous examples. If inspectors disagree, a model cannot learn a consistent target until the acceptance standard is clarified.

Example: cap and label inspection

A bottling line must verify cap presence, cap alignment, label presence, and readable batch code. Separate views may be needed: side lighting for the cap and label, plus a close camera for print. Deterministic geometry checks cap position. Optical character recognition reads the code, followed by a rule that validates the expected date and format.

Each decision is linked to the encoder position. Failed items are tracked to a reject station, and a downstream sensor confirms rejection. If the reject confirmation fails, the line alarms. Saving a sample of pass images and all fail images supports traceability and diagnosis.

Evaluation beyond a single accuracy number

Measure false accepts and false rejects by defect type. A dataset with 99.9% good products can yield 99.9% “accuracy” by always predicting good, while detecting no defects. Use a confusion matrix, defect recall, false-reject rate, and performance at the chosen threshold. Test end-to-end timing and reject accuracy, not only offline images.

Run a challenge set with edge cases and a production trial beside existing inspection. Review misses with quality engineers. Validate after changes to lighting, camera position, product, supplier, or upstream process.

Production integration and monitoring

The vision controller communicates results to a PLC or line controller through an approved interface. Define timeouts and safe behavior for no result, camera disconnect, disk pressure, or model failure. Monitor exposure, image brightness, focus indicators, processing time, class rates, and rejection trends. A sudden fall to zero defects may indicate improvement—or a broken camera.

Version models, recipes, thresholds, code, and acceptance data together. Access to change production settings should be role-based and audited.

Where to begin

Select one costly, visually clear defect and perform a feasibility study using real parts at representative speed. Prove the image can reveal the feature before investing in model tuning. Then validate the complete decision-and-reject chain.

KarasTechs develops computer vision and industrial software integrations. For a broader discussion of learning-based systems and governance, see how AI is used in manufacturing inspection.