Research Careers Contact

GlossaryAnomaly detection

Anomaly detection

Anomaly detection is the task of finding data points, images or events that differ from normal patterns. Instead of learning what each kind of defect looks like, an anomaly detector learns what normal looks like and flags anything that does not fit.

How it works

Methods range from simple statistics to deep learning.

  • Statistical methods flag values far from the expected range, such as readings more than a set number of standard deviations from the mean. The NIST/SEMATECH e-Handbook of Statistical Methods describes formal tests for outliers. Control charts in SPC are a time-based version of the same idea.
  • Distance and density methods flag points far from their neighbors in a feature space, often built from embeddings.
  • Reconstruction methods train a model to reproduce normal data, then flag inputs it reproduces poorly.
  • Feature memory methods for images store features from normal images and score new images by how far each region is from the nearest stored feature. A 2021 paper on industrial anomaly detection used this approach to find and localize defects using only images of good parts for training.

The output is usually a score, and a threshold turns it into a decision. Setting that threshold is a trade-off: a low threshold flags more real problems and more normal variation, and a high one flags fewer of both. Image methods often also produce a heat map showing where the anomaly is.

Anomaly detection vs classification

A classifier is trained on labeled examples of each class, including each defect type, and assigns new items to those classes. An anomaly detector needs only normal examples and flags anything unusual, including defect types it has never seen. Classifiers say what the problem is. Anomaly detectors say that something is wrong. Many machine vision inspection systems use anomaly detection to flag and defect classification to name.

Why it matters

In manufacturing, defects are rare and varied. A new product has few or no defect images to train a classifier on, and new defect types appear without warning. Anomaly detection works from good examples, which are plentiful, and it catches the unexpected.

Its weakness is that unusual is not the same as defective. A new supplier's part with a different marking, a board from a new laminate lot or a deliberate process change all look anomalous. Without human review and updates to what counts as normal, an anomaly detector produces a stream of alerts that people learn to ignore. The same idea applies to process data: a sudden change in reflow oven temperatures, placement offsets or test currents is an anomaly worth investigating before it becomes a defect.

How to get it right

  • Define normal carefully. Train on data that represents real, acceptable variation, including different lots and finishes, or every normal variation becomes a false call.
  • Set thresholds from data. Choose thresholds based on the cost of false calls versus missed defects.
  • Localize. For images, use methods that show where the anomaly is, so reviewers can judge it quickly.
  • Pair it with review. Send flagged items to a person or a classifier, and record the decisions.
  • Update normal. When a part or process changes on purpose, retrain on the new normal.

Anomaly detection in robotics and drone hardware

For high-mix board production, anomaly detection lets inspection start on a new product with only a few good boards as reference, rather than waiting for many labeled defects. On test data, it flags units whose motor currents, sensor readings or power draw differ from their siblings, even when they pass fixed limits.

Robots and drones also use anomaly detection in the field, on motor currents, vibration and sensor data, to spot wear and faults before they cause failures.

Learn more