Computer-vision quality inspection uses cameras and machine-learning models to find defects in products automatically, at line speed. A model trained on images of good and bad parts classifies each item, locates the flaw, and routes rejects, doing the visual check a person does, but the same way on every unit, all shift.

The idea is simple; the engineering is where projects live or die. This is a deep dive into the parts that decide success: the different ways a model can "look" for a defect, why lighting and optics matter more than the algorithm, the training-data problem that trips up every team, and what it takes to run inference at the line. For the higher-level view of where AI fits in quality overall, start with AI quality control; this post is the vision specifics underneath it.

What Are the Ways a Model Can "Look" for a Defect?

There is no single "AI inspection." There are four distinct approaches, and choosing the wrong one is a common early mistake because each needs different data and answers a different question.

Four ways a vision model finds a defect Four ways to ask "is this part good?" CLASSIFYwhole image:PASS / FAIL DETECTbox aroundeach defect SEGMENTexact defectpixels / area ANOMALYlearns "good",flags anything off Classify/detect/segment need labeled defects. Anomaly detection needs mostly good parts, the answer when defects are rare or you cannot predict what they will look like.
The same part, four questions: is it bad, where is it bad, exactly how bad, or simply not like the good ones. The last is the escape hatch for rare defects.

Classification labels the whole image pass or fail, simple and fast, but it does not tell you where or why. Object detection draws a box around each defect, which is what you want when defects can appear anywhere and you need to count or locate them. Segmentation outlines the exact defective pixels, the choice when you must measure a flaw's size or area, such as a scratch length or a stain. Anomaly detection is the one teams overlook and often need most: it learns what "good" looks like from good parts alone and flags anything that deviates, which sidesteps the hardest part of the whole endeavor, collecting enough examples of every defect.

Why Is Lighting the Real Make-or-Break?

Ask anyone who has shipped a vision system and they will tell you the same thing: the model is maybe 20% of the work, and lighting and optics are most of the rest. A deep network cannot recover detail the camera never captured. If the defect is not visible to a well-set-up camera, no algorithm invents it. The job of lighting is to make the defect obvious to the sensor before the software ever runs.

Lighting techniques for vision inspection Light first, algorithm second BRIGHT-FIELDdirect, even lightgeneral surface,print, presence DARK-FIELDlow-angle grazing lightscratches, edges,engraving, dents BACKLIGHTlit from behindsilhouette: shape,gaps, dimensions DIFFUSE DOMEsoft, wraparound lightshiny, curved,reflective parts COAXIAL / ON-AXISlight along the lens axisflat specular faces,kills glare TELECENTRIC LENSno perspective errorprecise gaugingand measurement
Each technique reveals a different defect. Choosing light and optics for the specific flaw is the highest-leverage decision in a vision project, far more than the model.

Optics carry the other half of the burden. A standard lens introduces perspective error, parts farther from the center look smaller, which is fine for a pass/fail check but fatal for precise measurement. A telecentric lens removes that distortion so a gauge reading is trustworthy regardless of where the part sits in the frame. Resolution matters too: the smallest defect you must catch has to span several pixels, not one, or the camera simply cannot resolve it. These are decisions made with a tape measure and a spec sheet before a single image is captured, and getting them wrong caps the accuracy of everything downstream.

The pattern to internalize: match the light to the defect, not the part. A scratch on brushed metal disappears under bright, direct light and jumps out under grazing dark-field light. A missing component is trivial in silhouette against a backlight and hard to see head-on. Glare on a glossy label vanishes under coaxial light and ruins a bright-field image. Repeatability matters as much as technique, ambient light from a nearby window or a changing shift can shift the image enough to break a model that worked in a demo, which is why serious cells shroud the inspection station and control its light completely.

Why Is Training Data the Hardest Part?

A supervised vision model learns from labeled examples, which creates the defining tension of the field: to reliably catch a defect, the model needs many examples of it, but a well-run line, by design, barely produces any. You end up needing pictures of the very thing you are trying to prevent. Three tactics manage this. First, anomaly detection which trains on good parts and needs few or no defect images. Second, data augmentation synthetically rotating, cropping, and re-lighting the defect images you do have to stretch a small set further. Third, disciplined labeling because a model is only as consistent as the humans who tagged its training images, two inspectors who disagree on borderline parts will teach the model to be confused in exactly the same place.

None of this is set-and-forget. Products change, new defect types appear, suppliers shift material, and a model trained last year quietly drifts out of date. A vision system is a program to be maintained, like any other part of the quality system not an appliance you install once. This is also where inspection meets statistical process control and defect tracking: the labeled rejects a vision system produces are perfect fuel for the trending that finds the root cause upstream.

How Does a Vision System Deploy at the Line?

Getting from a working model on a laptop to a reliable check on a moving line is its own discipline. The pieces have to fit the cycle time, the environment, and the plant's tolerance for false rejects.

  1. Choose the camera and interface. Area-scan for discrete parts, line-scan for continuous web or cylinders. Industrial cameras commonly use the GigE Vision standard so the camera and processor speak a common language over standard networking.
  2. Fix the optics and lighting. Lens, working distance, and controlled light are set and locked so every image looks the same. This is the step that repays the most care.
  3. Run inference at the edge. At line speed there is no time for a round trip to a distant server, so the model usually runs on hardware next to the camera, classifying each part in the fraction of a second the line allows.
  4. Actuate the reject. A fail signal drives an air blast, diverter, or stop, and, just as important, logs the image so every decision is auditable and reviewable.
  5. Tune the operating point. Set the threshold deliberately between missed defects (escapes) and good product wrongly scrapped (false rejects); this is a business decision about cost, not a technical default.
  6. Watch for drift and retrain. Monitor accuracy over time, feed reviewed rejects and escapes back into training, and treat the model as a living asset with its own monitoring.

The false-reject economics deserve a hard look, because they are where a vision system quietly destroys margin. Tighten a model to catch every last defect and it starts throwing away good product; loosen it to protect yield and defects escape to the customer. Neither error is free, and the right balance depends on the cost of a defect reaching a customer versus the cost of scrapping a good unit, which ties inspection straight to cost of quality and to first-pass yield.

Where Do Humans Still Belong?

In the loop, not out of it. The most durable designs let the vision system handle the high-volume, repetitive judgment it does best and escalate the uncertain, novel, or borderline cases to a person, who resolves them and, in the same motion, labels them to teach the system. That human-in-the-loop pattern turns every hard case into training data and keeps a person accountable for the calls that carry real cost. A camera on a cobot arm can present or scan the part; the model can flag it; but a human still owns the decision to change what "good" means. Connected into an operational layer, a failed inspection does more than light a reject lamp: it can trigger the right action automatically, from notifying a team to holding the batch, the kind of closed loop covered in agentic AI in manufacturing.

By the Numbers

In controlled conditions, machine-vision defect detection is genuinely strong, peer-reviewed surveys report accuracy frequently above 95%, and some systems reaching 98–100% on well-defined tasks with good imaging (Deep learning defect detection survey, PMC). The prize behind that accuracy is large: the American Society for Quality estimates the cost of poor quality at roughly 15–20% of sales for many organizations (ASQ, Cost of Quality), which is the waste consistent inspection targets. But the accuracy figures come with a condition worth repeating, "controlled conditions" means the lighting, optics, and data pipeline were handled deliberately. Where Harmony fits: an inspection result is one signal, and it is worth more connected than alone. Harmony links vision results to the machine event, the batch, and the paperwork in one real-time operational layer, so a fail can drive the right next step and the labeled data can feed the rest of the plant's analytics (see the platform or a real deployment). It also depends on data with context, which is why contextualizing OT data sits next to inspection in any serious build.