Digital AIUpdated 24 October 20268 min read

Machine Learning for Quality Control in Manufacturing

Machine learning for quality control uses trained models to classify defects, flag anomalies and predict out-of-spec parts from images and process data. This guide covers the three approaches, how to measure them honestly, and a UK worked example.

Machine LearningQuality ControlManufacturingDefect DetectionComputer Vision
Engineer studying data and terminal output on a large monitor in a dim room

Key takeaways

  • Machine learning quality control follows three patterns: image classification or detection, anomaly detection on good parts only, and process-based prediction from machine data.
  • It works beside statistical process control and gauging, not instead of them; SPC watches key dimensions while models handle images and many interacting variables.
  • Judge a quality model on escape rate, false reject rate and results on data from a different day or shift, not on headline accuracy.
  • Lighting, optics and a fixed camera position usually matter more than the choice of algorithm.
  • BAE Systems and the start-up Machine Intelligence trialled a machine learning tool for X-ray defect detection under Made Smarter Innovation.

Machine learning for quality control in manufacturing means training a model on examples of good and bad parts, or on process data from good and bad batches, so that it can flag defects or predict out-of-specification output faster and more consistently than a person looking at every item. It supplements statistical process control and gauging; it does not replace the quality system around them.

What are the three ways machine learning is used for quality?

Most factory quality projects fit one of three patterns. Choosing the right one is half the work.

1. Image classification and detection. A camera captures each part and a model decides pass or fail, or draws a box around a scratch, void or missing component. This needs labelled images of both good and defective parts. It is the most common pattern and is covered in more depth in our computer vision inspection guide.

2. Anomaly detection. When defects are rare or varied, you train only on good parts and let the model flag anything that looks different. You need far fewer defect examples, but you get more false alarms and less explanation of what is wrong.

3. Process-based prediction. Instead of looking at the part, the model uses machine settings, temperatures, pressures and material data to predict whether the output will be in specification. This is sometimes called a soft sensor. It can warn an operator before scrap is made, but it only works when the process data is stable and well recorded.

Automated inspection station with industrial cameras above a parts fixture
Automated inspection station with industrial cameras above a parts fixturePhoto: Yingz, CC BY-SA 4.0, via Wikimedia Commons
M3L2 AI for Semiconductor Manufacturing / Module - Defect Classification - Lecture 2

How does it compare with statistical process control?

Statistical process control (SPC) watches a measured characteristic over time and signals when the process drifts. It is cheap, well understood and auditable, and every quality engineer should be fluent in it. Its limit is that control charts look at one or a few variables at a time.

Machine learning handles inputs that charts cannot: images, sound, vibration spectra and dozens of interacting variables. In practice the two work together. SPC keeps watching the key dimensions; a model watches the surface finish or the pattern of settings that SPC cannot see. If a model's alert cannot be linked to a measurable cause, a quality engineer will rightly distrust it.

How do you measure whether a quality model is good enough?

Accuracy alone is misleading. If 1 part in 200 is defective, a model that passes everything is 99.5 percent "accurate" and useless. Measure these instead:

  • Escape rate (false negatives): defective parts the model passed. This is what reaches the customer, so it usually matters most.
  • False reject rate (false positives): good parts the model scrapped. This costs money and erodes operator trust.
  • Precision and recall per defect type: a model may be excellent at scratches and poor at porosity.
  • Performance on a held-out set from a different day and shift, not a random split of the same batch. Splitting at random from the same batch leaks information and gives results that collapse on the line.

Treat the model like any other inspection method. Check it against a reference set of known good and known defective parts at the start of each shift, record the result, and set a rule for when it must be recalibrated or taken out of service. Many sites fold this into their existing measurement system analysis and ISO 9001 controls.

What does a UK example look like?

Under the Made Smarter Innovation Technology Accelerator programme, the Somerset start-up Machine Intelligence worked with BAE Systems' Air division in the North West of England. They developed and tested a tool that uses machine learning to analyse X-ray images and find defects in the joints of metal parts, assisting human inspectors. The brief asked for something explainable that could adapt to other assemblies with limited data. BAE applied the result to an existing inspection process and is trialling it on another.

The lessons carry over to smaller sites: keep a human in the loop at first, ask for explanations rather than a bare score, and choose methods that work when you have few defect examples.

What hardware and software do you need?

You can prototype with a laptop, a decent industrial camera and open-source libraries such as OpenCV, PyTorch or TensorFlow. For line-speed inspection, models usually run on an edge device, for example an NVIDIA Jetson module or an industrial PC next to the camera, so images do not need to travel to a server. Lighting and optics decide success more than the model: a stable, repeatable image from a fixed camera position beats a clever algorithm fed variable pictures. Our article on machine vision and PLC integration shows how the pass or fail result gets back to the machine.

How do you run a first pilot?

Pick one defect that costs real money and that people already agree on. Collect a few weeks of images or process data with the inspectors' decisions recorded alongside, since those decisions become your labels. Train a first model, then run it silently in parallel with the existing inspection and compare. Review every disagreement with a quality engineer; many turn out to be label errors, which is useful news. Only when escape and false reject rates meet the target should the model take any action on the line, and even then start with a hold-for-review lane rather than automatic scrapping.

What are the common mistakes?

  • Training on too few defect types and then meeting a new one in production.
  • Letting the camera, lighting or fixture change without retraining or re-validating.
  • Reporting results on the same data used for training.
  • Hiding the model from operators instead of showing them the image and the reason for rejection.
  • Ignoring maintenance: nobody owns retraining, so performance drifts silently.

How do quality engineers build these skills?

You do not need a research degree. You need to read images and data critically, run a model through Python notebooks, and judge results with the same rigour you apply to a gauge.

Start free

Take the free Machine Vision and AI Quality Inspection course, try the first five free days of the Computer Vision Engineer job simulation, and see what employers ask for on the computer vision jobs page. For a structured, self-paced route into industrial AI with graded projects, the EDWartens AI Module is available; check its page for the current price and syllabus first.

Start free

Learn AI and machine learning free, then practise the job

Free job simulation

Machine Learning Engineer

Train, evaluate and document a model, and catch target leakage.

The first five days are free, no card needed.

Live UK jobs

AI and ML jobs in the UK

Updated daily, with licensed visa sponsors marked.

Browse all engineering jobs

Frequently asked questions

How is machine learning used in quality control?

Machine learning is used to classify defects from images, flag anomalies by training only on good parts, and predict whether output will be in specification from process data. The result is usually a pass or fail signal or an alert that a human or the line controller acts on.

Does machine learning replace statistical process control?

No. Statistical process control is cheap, auditable and ideal for monitoring key dimensions. Machine learning adds the ability to handle images, sound and many interacting variables. Most good quality systems use both.

How many defect images do I need to train an inspection model?

It depends on the variety of defects and the method. Supervised models typically need many labelled examples of each defect type. Anomaly detection can work from good parts alone but gives less explanation and more false alarms. Start with a small pilot and measure escape and false reject rates before scaling.

How do I know a quality model will keep working?

Check it against a reference set of known good and bad parts at the start of each shift, log the results, and re-validate after any change to lighting, camera, fixture, material or product. Agree who owns retraining before go-live.

Which skills should a quality engineer learn for AI?

Start with Python, image basics and how to evaluate a classifier with precision and recall. Combine that with the SPC, FMEA and 8D skills you already have. Free courses and job simulations on EDWartens UK let you practise before committing to a paid course.

Sources

  1. Machine Intelligence and BAE Systems case story, Made Smarter Innovation
  2. Made Smarter Adoption
  3. NVIDIA Jetson modules
  4. LiteRT (formerly TensorFlow Lite), Google AI Edge
  5. Computer vision jobs in the UK, ITJobsWatch (checked 24 October 2026)

Share this article

About the author

EDWartens Team

EDWartens Instructional Team

The EDWartens instructional team brings together UK-based automation engineers, certified Siemens and Rockwell specialists, and industry practitioners with decades of combined experience in PLC programming, SCADA engineering, and industrial AI.

View all articles by EDWartens

Ready to become job-ready?

Start with a free course today, or train live in Siemens PLC, HMI and SCADA on the Professional Module.