# Machine Vision in Quality Inspection: How to Introduce It Step by Step

Author: Marin Niehues, Niehues Consulting · Published: 2024-02-01 · AI Adoption & Operations
Source: https://www.niehuesconsulting.de/en/blog/machine-vision-quality-inspection/

You introduce machine vision in quality inspection by fixing the inspection task and the permitted error rate first, then choosing optics and lighting, and only then the evaluation software. Software is seen as the hard part, yet in practice a repeatable image and a station that keeps pace with production decide the outcome more often. This article sets out the decisions in the right order.

Machine vision is one of the oldest industrial uses of automated sight, and learning-based methods have set it in motion again. For the management of a manufacturing business the question is when a camera system supplements or replaces visual inspection, and what has to be done before operation is stable.

**A camera-based inspection system is a measuring system. It is introduced like one: with a defined inspection feature, demonstrated capability and a named owner for day-to-day operation.**

## How does machine vision work in quality inspection?

Machine vision in quality inspection photographs every workpiece, evaluates the image with software and passes a verdict to the line, such as good, bad or recheck. A system has five building blocks: the lighting, the lens, the camera, the evaluation and the interface to the line controller. The lighting decides which features become visible in the image at all. A scratch on a glossy surface shows up only under a particular direction of light, and the same scratch stays invisible under diffuse light. Experienced machine vision engineers therefore spend most of the development time on light and optics.

The evaluation follows one of two basic principles. Rule-based methods measure edges and distances as well as areas and colour values, and compare them with tolerances set by a person. Learning-based methods, usually deep neural networks, learn from labelled example images what a defect is. They suit features that are hard to put into rules, such as surface defects on castings, textiles or food. A special case is anomaly detection, which is trained only on images of defect-free parts and flags anything that deviates. It helps where examples of defects are rare.

## Rule-based or deep learning: which method fits?

Rule-based image processing fits when the inspection feature can be described in dimensions and tolerances. Deep learning fits when defects vary widely in shape and location and an experienced inspector recognises them in the image but cannot express them as rules. The table orders the criteria.

**Rule-based and learning-based methods compared**
Criterion | Rule-based image processing | Deep learning | With Niehues Consulting
Typical inspection feature | Dimension, position, completeness, code | Surface, texture, variable defect patterns | Inspection feature and defect catalogue fixed before the technology is chosen
Data requirement | A few sample parts for set-up | Hundreds to thousands of labelled images per defect class | Data plan with a named owner for labelling
Traceability | Every decision can be explained as a rule | Decision comes from the model, explanation only through add-on tools | Release criteria that treat both methods alike
Behaviour with new defect patterns | Defects outside the rules go undetected | Unknown defects are caught when they resemble learned ones | Sample checks by people during regular operation
Upkeep in operation | Adjusting parameters | Retraining with new images and renewed release | Roles and rhythm for retraining defined

The choice does not have to be exclusive. Many inspection stations combine both: rules check dimensions and completeness, while a network assesses the surface. The combination raises the release effort, though, because both parts must prove that they work reliably.

## How do you introduce machine vision in five steps?

An introduction succeeds in five steps, each closed by a decision of the people responsible. The sequence follows the logic that applies to other AI initiatives as well: understand first, then build, then roll out.

1. Define the inspection task: Which defects must be found, at what size, at which location and at what cycle time? This includes the question of what defect rate the company has today and which defects customers complain about today. These figures form the baseline against which success is measured.
2. Clarify image capture: Lighting and optics are tested together with the camera on real parts from running production, not on clean samples. Vibration and dirt belong in the test, as do part tolerances and changing light in the hall. The guideline series VDI/VDMA 2632 describes how requirement and specification documents for vision systems are structured, so that user and supplier mean the same thing. The EMVA 1288 standard of the European Machine Vision Association defines how characteristic figures of cameras and image sensors are measured, so that data sheets from different manufacturers can be compared.
3. Develop the evaluation: The method is selected and developed on a data set that reflects the spread of production. For learning-based methods this includes the split into training and test images. The test images must never appear in training, otherwise the test measures memorisation.
4. Demonstrate capability: The system inspects a sample with known defects, and the result is compared with the reference. The same part must receive the same verdict when inspected repeatedly. The proof follows the methods of measurement system analysis that are established in quality assurance.
5. Move into operation: The station first runs alongside the existing inspection, deviations are discussed, and only then does the system take over. By then it is settled who steps in on false alarms, who changes parameters and who retrains the model.

## Which figures decide the release?

Two types of error decide the release: the escape, where a faulty part passes as good, and the false reject, where a good part is sorted out as bad. Both values depend on the same decision threshold. If the threshold is set more strictly, escapes fall and false rejects rise. The costs of the two types differ greatly: an escape can trigger a complaint, a recall or a stoppage at the customer, while a false reject costs the part and the recheck.

The release therefore fixes the permitted escape rate first, usually at a value that is acceptable to the customer and the industry, and optimises false rejects afterwards. A system that finds every bad part and sorts out every tenth good part along the way is a cost driver on the shop floor. Rechecking by people catches false rejects, but it ties up exactly the capacity the system was meant to free.

## How does an inspection system pay back?

An inspection system pays back when the saved inspection costs and the avoided failure costs exceed investment and running costs. The following example works with assumed values that every company must replace with its own figures.

**Example calculation with assumed values**
Item | Calculation | Result
Investment | Camera system, lighting, mechanics, integration, development (assumed) | 180,000 euros
Saving on inspection staff | Inspection stations in three shifts, 5.5 full-time posts in total at 50,000 euros (assumed) | 275,000 euros a year
Running costs | Maintenance, retraining, spare parts (assumed) | 35,000 euros a year
Avoided failure costs | Two fewer complaints a year at 20,000 euros (assumed) | 40,000 euros a year
Net effect | 275,000 plus 40,000 minus 35,000 | 280,000 euros a year
Payback | 180,000 divided by 280,000 times twelve months | about eight months

The calculation has two weak points that the business case must expose. First, inspector posts only disappear if the company redeploys the people or uses natural turnover. Second, the calculation assumes that false rejects and rechecking are included. The article on [robotics in medium-sized manufacturing](/en/blog/robotics-mid-sized-companies-economic-case/) shows how a robust business case is built, and its logic carries over to inspection stations.

## What goes wrong during introduction?

Three patterns recur with inspection systems. The first is the demonstration on sample parts: the system recognises every defect in the lab and fails in the hall under varying light. The countermeasure is a test with parts from several batches and shifts before the purchase decision is made. The second pattern is the missing defect catalogue. If quality assurance has not defined what a defect is, a network learns the opinion of the labeller, and two labellers give different verdicts for the same image. The third pattern is operation without an owner. After commissioning, workpieces and suppliers change and so does the lighting, and without a responsible person the system slowly loses accuracy without anyone noticing.

The article on [RPA bots](/en/blog/rpa-bot-clean-up-legacy-automation/) shows a parallel: automation that nobody maintains after go-live also becomes a legacy burden.

**Checklist before release**
- Is the inspection feature described in writing, with size and location as well as tolerance?
- Was the test run with parts from several batches, several shifts and different lighting?
- Are the escape rate and the false-reject rate measured on a sample with known defects?
- Did at least two labellers give the same verdicts for the same images?
- Is it settled who steps in on false alarms and who retrains the model?
- Which indicator shows after 90 days that the station has arrived in regular operation?

## Introducing machine vision with Niehues Consulting

[Niehues Consulting](/en/) is a consultancy for AI management and organisation design from a delivery perspective, based in Düsseldorf. Founder Marin Niehues brings AI into operations, in projects ranging from VC-funded scale-ups to DAX 40 groups and in more than 20 countries on six continents. The work covers business analysis and requirements as well as the business case, the selection and sequencing of applications, and introduction and delivery management. The image processing itself comes from system integrators and manufacturers, and responsibility for the result in operation stays with the company.

The approach follows the Niehues Delivery Model. For inspection stations three of its checking questions matter most: What is the baseline, and how do we measure success? Does the prototype prove the benefit in the real process with real data? Who is responsible for operation from day one? The entry point is a free initial consultation of 30 minutes, which you can book through the [contact form](/en/#kontakt). Scope and terms of an engagement are discussed there.

**Conclusion**
Machine vision in quality inspection works when the inspection feature is defined, the image is repeatable and capability is demonstrated before the station replaces people. The choice between rules and deep learning follows the inspection feature. The business case includes escapes and false rejects as well as rechecking, and every station gets an owner who looks after it in operation.

**Sources**
- VDI/VDMA 2632: guideline series on industrial image processing, requirement and specification documents, guideline
- European Machine Vision Association: EMVA Standard 1288, characterisation of cameras and image sensors, standard
- Measurement system analysis in quality assurance: capability proof for inspection systems, specialist literature

## Frequently asked questions

### How much does a machine vision system cost?

Costs range from a few thousand euros for a simple smart camera to six-figure amounts for an integrated inspection station with special mechanics. Integration and development often make up the largest share, along with the lighting, rather than the camera. Scope and terms of an engagement are discussed in the free initial consultation.

### Does machine vision fully replace human visual inspection?

Machine vision replaces visual inspection where the inspection feature is clearly described and the image is repeatable. For complex surfaces or subjective features such as appearance, a sample check by people remains sensible. Many plants run people and system in parallel until the release figures have been stable for several weeks.

### How many images does a deep learning model need for inspection?

The number depends on the defect pattern, and hundreds of labelled images per defect class are a common rule of thumb. For rare defects, anomaly detection methods trained only on images of defect-free parts are enough. What matters is that the images reflect the spread of production.

### How long does it take to introduce an inspection station?

The duration follows the complexity of the inspection feature and the integration into the line. Simple rule-based applications are trialled in a few weeks, whereas learning-based systems usually need several months for data collection and labelling, then for release. The parallel phase alongside the existing inspection often takes the largest share of time.

### When is machine vision worth it compared with manual inspection?

Machine vision is worth it with high volumes, stable inspection features and costly failures. With small batch sizes and changing products, set-up eats the benefit. The calculation in this article shows how many inspection stations it takes for the investment to pay back.

### How do you measure the quality of a vision system?

You measure the quality of an inspection system by its escape rate and false-reject rate against a reference inspection with known defects. Repeatability adds to this: the same part must receive the same verdict across several runs. The methods come from measurement system analysis in quality assurance.
