Skip to content
AI & Automation15 min read

AI Visual Quality Inspection for Manufacturing: How to Build an Inspection System

How to build AI visual inspection for manufacturing: cameras and lighting, defect models, edge deployment, line integration, false rejects and traceability.

01

The short answer

An AI visual inspection system photographs every part or product on the line under controlled conditions, uses a trained model to decide whether it is good, defective or uncertain, rejects or holds parts accordingly, and records the result against the batch. Building one that works is mostly about the physical setup (camera, optics, lighting and triggering), a clear definition of each defect agreed with quality engineers, enough representative images, and careful tuning of the trade-off between missed defects and false rejects. AI inspection reduces escapes and inspection effort; it doesn't eliminate defects.

This guide is for plant, quality and manufacturing engineering leaders. It covers when AI inspection fits, the station design, model approaches, deployment at the edge, integration with the line and MES, and how to measure performance. For computer vision projects in general, see computer vision development.

02

When AI inspection fits, and when rule-based vision is better

Machine vision has been used on production lines for decades with rule-based tools: measuring dimensions, checking presence, reading codes and matching patterns. AI adds value where defects vary in appearance and are hard to describe with rules.

Inspection taskRule-based visionAI (deep learning)
Measuring dimensions and positionsBest fit: precise and explainableRarely needed
Presence or absence of componentsGood fitUseful when appearance varies a lot
Reading codes and textStandard tools work wellHelps with damaged or variable print
Cosmetic defects (scratches, dents, stains, porosity)Hard: defects vary in shape and sizeStrong fit
Natural products (food, wood, textiles)Hard: natural variation looks like defectsStrong fit
Assembly verification with many variantsBrittle as variants growGood fit

Pro tip

Many good inspection systems combine both: rules for measurements and presence checks, AI for cosmetic and variable defects.

03

The station: get the image right first

Most failed inspection projects fail at the camera, not the model. A model can't detect a defect the image doesn't show clearly and consistently.

  • Camera and resolution: enough pixels across the smallest defect you must find; area-scan cameras for discrete parts, line-scan cameras for continuous material such as sheet, film or fabric
  • Optics: a lens and working distance that keep the whole inspected area in focus
  • Lighting: the single biggest factor. Backlights for silhouettes, low-angle or dome lighting for scratches and surface texture, and enclosures to block changing ambient light
  • Triggering: a sensor or PLC signal that captures each part at the same position, synchronised with conveyor speed
  • Multiple views: extra cameras or rotation where defects can appear on several faces
  • Standard interfaces: industrial cameras commonly use standards such as GigE Vision, USB3 Vision and GenICam, which keeps the software independent of one camera vendor
04

Defining defects with quality engineers

Before collecting data, agree a defect catalogue: each defect type, how it looks, the size or severity at which it becomes a reject, and example images of acceptable and unacceptable cases. Borderline cases cause most disagreements, between inspectors as well as models, so collect examples of them deliberately. This catalogue becomes the labelling guide and the basis for acceptance testing.

05

Model approaches

ApproachWhat it needsGood for
Anomaly detectionMostly images of good partsNew lines, rare defects, when defect examples are scarce; flags anything unusual
ClassificationLabelled images of good parts and each defect typeSorting parts into known categories
Object detection or segmentationImages with defects outlined or boxedLocating defects and measuring their size, which supports severity rules
HybridAnomaly model first, classifier for known defect typesCatching both known and unexpected defects

Worth noting

Defects are usually rare, so datasets are heavily imbalanced. Anomaly detection lets you start with good-part images, and public benchmarks such as the MVTec anomaly detection datasets are widely used to compare methods. Those datasets are licensed for non-commercial use, the newer MVTec AD 2 benchmark shows current methods are far from solving hard cases, and results on benchmarks don't transfer automatically to your parts, lighting and line. Production systems are trained on your own images.

06

Missed defects vs false rejects

Every inspection system trades off two errors. A missed defect (false negative) reaches the next process or the customer. A false reject (false positive) scraps or reworks a good part and costs throughput. You can't minimise both at once; the threshold decides the balance.

Set it deliberately with quality and production: what does an escaped defect cost compared with a false reject? For safety-critical features, accept more false rejects and route them to human review. For cosmetic grades, tolerate a few more escapes to avoid scrapping good product. A three-way result (pass, fail and uncertain, with uncertain parts sent to a person) usually works better than a strict pass/fail.

07

Architecture

  • Edge inference on an industrial PC or embedded AI module beside the line, because decisions must be made within the line's cycle time and shouldn't depend on internet connectivity
  • Line integration with the PLC: trigger signals in, pass/fail and reject signals out, plus a safe default if the system fails
  • Image and result storage: every image (or a sample of good parts plus all rejects and uncertain cases) with the decision, model version and timestamp
  • Review application where inspectors confirm or overturn uncertain and rejected parts; their decisions become new training labels
  • Training and deployment pipeline in the cloud or on-premises, with versioned datasets and models and controlled roll-out to stations
  • MES and quality integration: results linked to work orders, lots and serial numbers, and non-conformances raised in the quality system; see MES development and quality management software
  • Dashboards: defect rates by type, line, shift and supplier lot, so quality engineers can find root causes

Planning AI inspection on your line?

ZSpace Labs builds computer vision inspection models, edge deployment and the review, traceability and dashboard applications around them, integrated with your line controls and MES.

Start a Project
08

Validating before you trust it

Treat acceptance like any other change to a quality process:

  • Run the system in parallel with existing inspection (shadow mode) before it can reject parts
  • Test on a held-out set that includes borderline cases and every defect type, collected across shifts, batches and seasons
  • Report missed-defect and false-reject rates per defect type, not a single accuracy figure
  • Re-validate after changes to the product, material supplier, lighting, camera or model
  • Keep a fallback procedure if the system goes down
09

Keeping it accurate over time

Inspection models drift when things change: a new material supplier, a worn fixture, dust on a lens, seasonal light leaks, or a product revision. Monitor reject and uncertain rates per station and defect type, sample passed parts for human audit, and retrain from the reviewed images on a regular schedule. Treat model updates as controlled changes, with the same validation as the first release.

10

Sampling standards and regulation

AI inspection usually checks every part, but statistical sampling still has a place. Acceptance sampling by attributes, as in ISO 2859-1 and its acceptable quality limit (AQL) plans, often governs incoming material, customer lot acceptance and audits of the automated system itself. Keep your sampling procedures aligned with what the AI station does.

In the EU, the AI Act treats an AI system as high-risk under its product-safety route only when it is a safety component of a product covered by EU harmonisation legislation, such as machinery, and that product needs third-party conformity assessment. A system that checks cosmetic or dimensional quality is usually not in that category, while one that performs a safety function can be. Take advice if your inspection system has a safety role.

11

Build, buy or extend

Machine vision vendors sell inspection systems with built-in deep learning tools, and these are often the fastest route for a single, standard inspection. Managed cloud services have been less stable: Amazon Lookout for Vision was discontinued in October 2025, and Microsoft has announced that Azure Custom Vision will be retired in September 2028. That is a good reason to own your images, labels and models in portable formats whichever route you choose.

A custom build makes sense when you need inspections across many products and lines with one shared data and review platform, tight integration with your MES and quality systems, models for defects the packaged tools handle poorly, or inspection embedded in equipment you sell.

12

A phased rollout

An illustrative order of work:

PhaseScopeExit criteria
1. FeasibilityDefect catalogue; image tests with candidate cameras and lighting on real partsDefects clearly visible in images
2. Data and modelCollect and label images; train and test modelsAgreed missed-defect and false-reject targets met on held-out data
3. Shadow modeStation on the line, running in parallel, not rejectingResults compare well with existing inspection over several weeks
4. Live with reviewRejects and uncertain parts routed to inspectorsStable rates; reviewer workload acceptable
5. Scale and integrateMore stations or lines, MES and QMS integration, dashboards, retraining routineEach new station passes the same acceptance tests
13

What drives cost

The main cost drivers are the number of stations and camera views, line speed, defect complexity and how many defect types must be distinguished, the effort to collect and label images, integration with PLCs, MES and quality systems, validation requirements in regulated sectors, and ongoing support for retraining. Hardware (cameras, lighting, enclosures and edge computers) is often a significant share of the first station.

14

Common mistakes

  • Starting with the model before fixing camera, lighting and triggering
  • No written defect catalogue, so labellers and inspectors disagree
  • Training only on images from one shift, batch or season
  • Reporting one accuracy number instead of missed defects and false rejects per defect type
  • Going straight to automatic rejection without a shadow period
  • Not storing images and model versions, so escapes can't be investigated
  • Promising zero defects
15

Conclusion

AI visual inspection works when the station produces consistent images, defects are defined with quality engineers, models are validated per defect type, uncertain parts go to people, and results flow into traceability and root-cause analysis. Start with one well-defined inspection point, prove it in shadow mode, and then scale. For condition monitoring of the machines themselves, see predictive maintenance.

Considering AI inspection?

Tell us about your product, defects, line speed and current inspection process. ZSpace Labs will suggest a feasibility test. Discuss your inspection project.

Start a Project
FAQ

Common questions.

Using cameras and machine learning models to check products on a production line for defects such as scratches, dents, contamination, missing components or assembly errors. The system decides pass, fail or uncertain for each part, triggers rejection or human review, and records the result for traceability.

No. It can find defects more consistently than manual inspection and check every part, but it still misses some defects and rejects some good parts. The balance between the two is set deliberately, uncertain parts go to people, and performance is monitored and revalidated over time.

It depends on the defect types and the approach. Anomaly detection can start mainly with images of good parts. Classification and detection models need labelled examples of each defect type, including borderline cases, collected across shifts, batches and conditions. A feasibility test on real parts tells you more than a general rule.

Usually at the edge, on an industrial PC or embedded AI module beside the line, because decisions must keep pace with the line and can't depend on internet connectivity. The cloud or a central server is useful for storing images, training models and dashboards.

Through the line's PLC: a trigger signal tells the camera when a part is in position, and the system returns a pass, fail or hold signal that drives a reject mechanism or diverter. Results are also sent to the MES or quality system with the lot or serial number.

Get in touch

Have a project in mind?

Whether you're building a new digital product, improving an existing website, or looking to automate part of your business — let's talk.