Skip to main content
MACHINE LEARNING · INDUSTRIAL INSPECTION

What Is an Anomaly Detection Model?

An anomaly detection model is a machine learning model that learns what normal data looks like and flags anything that departs from it. It is used on transactions, networks, machine sensors and images. In industrial inspection, visual models such as PatchCore, PaDiM and EfficientAD train on images of good parts only and highlight where a part looks wrong.

01

What an anomaly detection model is

An anomaly detection model is a machine learning model that learns what normal data looks like and flags anything that departs from it. It answers one question, “is this unusual?”, rather than “which known class is this?”, which is why it can catch problems nobody has seen before.

The same idea runs across very different data. Banks use it on card transactions, IT teams on network traffic, maintenance teams on machine vibration and temperature, and factories on camera images of parts. The model might be a simple statistical limit, an isolation forest, an autoencoder that fails to rebuild unusual inputs, or a deep network comparing image features with a bank of normal ones.

Most anomaly detection is unsupervised or semi-supervised: it trains on data that is mostly or entirely normal, because abnormal examples are rare. This page focuses on the industrial cases, visual inspection and machine sensors, where that property matters most.

02

How visual anomaly detection learns from good parts

In automated visual inspection, an anomaly detection model trains on images of defect-free parts only. At test time it gives each image an anomaly score and a heat map showing where the part differs from normal. Three well-known methods show the main approaches, as their papers describe them.

  • //
    PaDiM (2020). Extracts patch features with a pretrained convolutional network and fits a multivariate Gaussian distribution to the normal features at each position in the image. Patches far from that distribution are anomalous.
  • //
    PatchCore (CVPR 2022). Stores features of normal image patches in a memory bank, reduced by greedy coreset subsampling to keep inference fast, and scores each test patch by its distance to the nearest stored ones. Its authors, at the University of Tübingen and Amazon, report image-level AUROC of up to 99.6% on the MVTec AD benchmark.
  • //
    EfficientAD (WACV 2024). From MVTec, a student network learns to predict a teacher network’s features on normal images and fails on anomalies, and an autoencoder catches logical anomalies such as parts in the wrong order. The paper reports about 2 ms per image and more than 600 images a second on an NVIDIA RTX A6000 GPU.
03

Anomaly detection vs supervised defect detection

The open-source Anomalib library implements PatchCore, PaDiM and many other methods behind one interface, which makes it easy to compare them on your own images. Whichever method wins, anomaly detection answers a different question from supervised detection, and many inspection systems use both.

Aspect Anomaly detection model Supervised detection or segmentation
Training images Good parts, plus some defects to set the threshold Labeled examples of every defect type
Unseen defect types Flagged, because they differ from normal Often missed
Names the defect No, it gives a score and a heat map Yes, a class for each defect
New product set-up Collect good parts and retrain Collect and label defects, which can take a long time on a good line
Normal variation Sensitive, so lighting and positioning must be stable Tolerant, if the variation is in the training set
Typical role Broad first check, new lines, rare defects Classifying and measuring known defects

An anomaly model beats supervised detection when defects are rare, varied or unpredictable, which describes most well-run lines. It is weaker when normal parts vary a lot, as natural products do, because every unusual but acceptable item scores high.

FAQ · 01
Is machine vision AI?
Not necessarily. Classic machine vision uses rule-based image processing. Many systems now add AI models for classification and defect detection, so modern machine vision is often a mix of both.
Read the full FAQ —
04

Setting the anomaly threshold

An anomaly model outputs a score, not a verdict, and the threshold that turns the score into pass or fail is a quality decision. A common approach is to score a held-out set of good parts and a set of real defects, then place the threshold where the miss rate for the worst defect type is acceptable and false rejects are tolerable.

Papers report AUROC, which measures how well scores separate good from bad across every possible threshold. It is useful for comparing methods, but a line runs at one threshold, so check the false reject and miss rates there. The standard benchmark, MVTec AD, has over 5,000 high-resolution images in 15 object and texture categories, with defect-free training sets, and is licensed for non-commercial use. Scores on it do not transfer automatically to your parts.

A pixel-level threshold also sets how large and strong a highlighted region must be before it counts. Because the model learns one set of conditions, recheck the threshold after any change of lighting, camera, material or supplier.

05

Anomaly detection on machine sensors

The same principle works on time-series data. A model learns the normal pattern of vibration, motor current, temperature or pressure for a machine in each operating state, then flags drift or sudden change before a fixed alarm limit would trip. Our white paper on AI predictive maintenance covers the sensors, models and data paths in detail.

Sensor models are usually far lighter than vision models, so one edge computer can watch many machines. The hard part is context: a change of product, speed or load can look anomalous, so the model needs to know the operating state.

06

Running anomaly detection at the edge

Visual anomaly models run beside the camera for the same reason as any inspection model: the decision has to reach the reject gate in time. PaDiM and PatchCore are quick to train, because they fit statistics or fill a memory bank rather than train a network at length, but PatchCore’s nearest-neighbour search grows with its memory bank, which coreset subsampling keeps in check. EfficientAD was designed for millisecond latency from the start.

On NVIDIA Jetson, models are typically exported to ONNX and run with TensorRT. A single-camera station suits Jetson Orin Nano computers, while more cameras or higher resolutions need more GPU and memory, set out module by module in our Jetson comparison and module selector. Lines that combine anomaly models with detectors and rule-based tools often run them together on one of our edge AI computers.

07

Quick answers on anomaly detection models

Anomaly detection models: common questions

What is anomaly detection in machine learning?

Finding data that does not fit the normal pattern. A model learns from mostly normal data and scores how unusual each new input is, from a transaction to a camera image.

What are the best models for anomaly detection?

It depends on the data. Isolation forests and autoencoders are common on tabular and sensor data. For images of parts, PatchCore, PaDiM and EfficientAD are widely used reference methods.

How does anomaly detection work on images?

By comparing each part with a model of good parts. Features from a pretrained network are compared with those learned from defect-free images, giving a score and a heat map of where the part differs.

Can an LLM be used for anomaly detection?

Sometimes, but rarely on a production line. A vision language model can describe what looks wrong in an image, but it is far larger and slower than a dedicated anomaly model that scores parts in milliseconds.

Why is anomaly detection important in maintenance?

It spots faults early. A model that knows a machine’s normal vibration or current can flag a developing problem before it causes a breakdown, so repairs can be planned.

We integrate the edge computers, cameras and sensor interfaces for anomaly detection systems as standard, so each system arrives ready for your models.