Anomaly detection algorithms model the statistical signature of a conforming product by training exclusively on a corpus of non-defective images. By learning the manifold of normal variance—including acceptable lighting shifts and surface textures—the model can flag any pattern that falls outside this high-dimensional boundary as a potential defect without requiring prior examples of failure modes.
Glossary
Anomaly Detection

What is Anomaly Detection?
Anomaly detection is an unsupervised or semi-supervised machine learning technique that identifies rare items, events, or observations which deviate significantly from a learned distribution of normality, making it critical for discovering novel and previously unseen manufacturing defects.
In manufacturing, this technique is essential for catching novel defects that were not represented in a supervised training set. Architectures like autoencoders and generative adversarial networks (GANs) reconstruct a normal image from an input; a high reconstruction error signals an anomaly. This approach directly reduces the escape rate in quality inspection systems.
Core Anomaly Detection Techniques
The mathematical and algorithmic approaches that power unsupervised defect discovery in manufacturing. These techniques learn the statistical signature of normality to flag deviations without requiring labeled examples of every possible flaw.
Isolation Forest
An ensemble method that explicitly isolates anomalies rather than profiling normal data points. It constructs an ensemble of random decision trees and exploits the property that anomalous instances are few and different—they require fewer random splits to be isolated from the rest of the data.
- Anomaly Score: Derived from the average path length across all trees; shorter paths indicate higher anomaly likelihood.
- Linear Time Complexity: Scales efficiently to high-dimensional sensor telemetry with low memory requirements.
- No Distance Metric: Unlike k-Nearest Neighbors, it does not rely on pairwise distance calculations, making it robust to the curse of dimensionality.
Manufacturing Use Case: Detecting a sudden deviation in vibration frequency from a CNC spindle that has never failed before, without a pre-labeled failure dataset.
Autoencoder Reconstruction Error
A neural network architecture trained to compress high-dimensional input data into a lower-dimensional latent bottleneck and then reconstruct the original input. The core assumption is that the network will learn the dominant patterns of normality.
- Anomaly Score: The Mean Squared Error (MSE) between the input and its reconstruction. Normal data reconstructs with low error; anomalous data, containing unseen patterns, yields high error.
- Non-Linear Manifold Learning: Captures complex, non-linear relationships between sensor readings that linear methods like PCA miss.
- Variational Autoencoders (VAEs): A probabilistic variant that learns a distribution over the latent space, providing a more principled anomaly score via reconstruction probability.
Manufacturing Use Case: A convolutional autoencoder processing images of pristine circuit boards will produce a high reconstruction error when presented with a board containing a subtle, previously unseen solder bridge.
One-Class Support Vector Machine (OC-SVM)
A kernel method that learns a decision boundary encapsulating the region of the feature space where normal data points are densely concentrated. It separates the normal data distribution from the origin in a high-dimensional space.
- Nu Parameter: Controls the upper bound on the fraction of training errors and the lower bound on the fraction of support vectors, effectively setting the sensitivity to outliers.
- Kernel Trick: Using a Radial Basis Function (RBF) kernel allows the algorithm to learn complex, non-spherical decision boundaries around the normal class.
- Unsupervised by Design: Trained exclusively on data assumed to be normal, making it ideal for cold-start scenarios where failure data is nonexistent.
Manufacturing Use Case: Modeling the normal operating envelope of a hydraulic press's pressure and temperature curves to detect a slow internal leak that manifests as a subtle drift outside the learned boundary.
Local Outlier Factor (LOF)
A density-based algorithm that computes the local density deviation of a given data point with respect to its neighbors. It identifies anomalies as points that have a substantially lower density than their neighbors, rather than just being far from the global mass of data.
- Local vs. Global: Excels at detecting anomalies in datasets with varying density clusters, where a point might be normal in one region but anomalous in another.
- Reachability Distance: The core metric, which is the maximum of the k-distance of a neighbor and the actual distance to that neighbor, used to stabilize density estimates.
- LOF Score ~1: Indicates a point has similar density to its neighbors. A score significantly greater than 1 flags a local outlier.
Manufacturing Use Case: Identifying a specific production batch that, while within global spec limits, exhibits a unique combination of process parameters that is locally sparse compared to all other batches, indicating a subtle process drift.
Mahalanobis Distance
A multivariate distance metric that measures the distance between a point and a distribution. Unlike Euclidean distance, it accounts for the covariance structure of the data, effectively measuring distance in units of standard deviation along each principal component.
- Correlation-Aware: A deviation in a highly correlated variable is weighted less than a deviation in an independent variable, preventing false alarms from normal correlated fluctuations.
- Ellipsoidal Threshold: The decision boundary forms a hyper-ellipsoid around the mean of the normal data, defined by the chi-squared distribution.
- Computationally Lightweight: Requires only the inverse covariance matrix and mean vector of the training data, making it suitable for real-time edge inference on a PLC.
Manufacturing Use Case: Monitoring a motor's current and rotational speed simultaneously. A high-current, low-speed reading might be normal, but a high-current, high-speed reading is a multivariate anomaly flagged by the Mahalanobis distance.
Gaussian Mixture Models (GMMs)
A probabilistic model that represents the normal data as a weighted sum of multiple Gaussian distributions. It assumes the data is generated from a mixture of a finite number of Gaussian distributions with unknown parameters.
- Log-Likelihood Score: Anomalies are identified as data points with a very low probability density under the learned mixture model, falling in low-density regions between or far from the Gaussian components.
- Soft Clustering: Unlike k-means, GMMs provide a probability of a point belonging to each component, capturing the multi-modal nature of complex manufacturing processes with distinct operating modes.
- Expectation-Maximization (EM): The iterative algorithm used to fit the model, alternating between assigning points to components and updating the Gaussian parameters.
Manufacturing Use Case: Modeling a furnace's temperature profile, which has distinct normal distributions for 'ramp-up,' 'steady-state,' and 'cool-down' phases. A temperature reading that is improbable under any of these learned modes is flagged as anomalous.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about applying anomaly detection techniques to automated visual quality inspection on the factory floor.
Anomaly detection in computer vision quality inspection is an unsupervised or semi-supervised machine learning technique that identifies rare items, events, or observations which deviate significantly from a learned distribution of normality, without requiring pre-labeled examples of every possible defect type. Unlike supervised defect classification models that must be trained on labeled images of specific defect categories like scratches or dents, an anomaly detection model is trained exclusively on a dataset of conforming, non-defective products. The model learns a compressed, latent representation of what 'good' looks like. During inference, when the model encounters an image that it cannot faithfully reconstruct or that falls outside the learned normal manifold, it flags that sample as anomalous. This approach is critical for manufacturing lines where novel, previously unseen defect types can appear, and where collecting a comprehensive dataset of every possible failure mode is impractical or impossible. Architecturally, these systems often leverage convolutional autoencoders, generative adversarial networks (GANs) like AnoGAN, or vision transformers (ViTs) paired with student-teacher feature distillation. The core mathematical principle involves minimizing a reconstruction error or maximizing a likelihood estimate on normal data, then setting a statistical threshold on the anomaly score—often using the Mahalanobis distance or a percentile of the reconstruction loss distribution—to trigger a defect alert.
Anomaly Detection vs. Supervised Classification
Contrasting the core assumptions, data requirements, and operational behavior of anomaly detection against standard supervised classification for quality inspection tasks.
| Feature | Anomaly Detection | Supervised Classification |
|---|---|---|
Core Objective | Identify deviations from a learned normality distribution | Assign inputs to one of several predefined, known classes |
Training Data Requirement | Primarily normal (non-defective) samples; few or no defect examples required | Large, balanced, and labeled dataset of all defect types and non-defective samples |
Handling of Novel Defect Types | ||
Labeling Effort | Low; only normal data needs labeling, or labels are entirely absent | High; every image must be meticulously labeled with its specific defect class |
Susceptibility to Class Imbalance | Low; designed to model the majority normal class | High; severe imbalance causes bias toward the majority class, missing rare defects |
Model Interpretability | Moderate; reconstruction error or distance metrics highlight anomalous regions | High; techniques like Class Activation Mapping (CAM) directly show discriminative regions for a known class |
Typical Algorithms | Autoencoders, Gaussian Mixture Models, Isolation Forest, One-Class SVM | ResNet, EfficientNet, Vision Transformer (ViT), YOLO |
Primary Metric | Area Under the Receiver Operating Characteristic (AUROC) for anomaly score | F1-Score, Mean Average Precision (mAP) per defect class |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core concepts and techniques that form the foundation of unsupervised and semi-supervised anomaly detection in manufacturing quality inspection.
One-Class SVM
A support vector machine variant trained exclusively on normal samples to learn a decision boundary that encapsulates the normality distribution. During inference, any data point falling outside this boundary is flagged as anomalous.
- Learns a hypersphere around normal data in high-dimensional space
- Effective for high-dimensional, low-sample-size problems
- Kernel trick enables non-linear boundary fitting
- Common use: detecting novel defect patterns never seen in training
Isolation Forest
An ensemble method that isolates observations by randomly selecting a feature and a split value, exploiting the property that anomalous points are few and different.
- Anomalies require fewer random splits to isolate
- Linear time complexity with low memory footprint
- Does not rely on distance or density measures
- Well-suited for high-velocity streaming sensor data
Autoencoder Reconstruction Error
A neural network trained to compress and reconstruct input data. The model learns to accurately reconstruct normal patterns but produces high reconstruction error on anomalies it has never encountered.
- Encoder compresses input into latent bottleneck
- Decoder reconstructs from latent representation
- Mean squared error between input and output serves as anomaly score
- Effective for high-dimensional image and waveform data
Gaussian Mixture Models
A probabilistic model that represents the normal data distribution as a weighted sum of multiple Gaussian components. Anomalies are identified by their low likelihood under the learned density.
- Models multi-modal normal distributions
- Outputs interpretable probability scores
- Expectation-Maximization algorithm for parameter estimation
- Useful when normal operation has distinct modes or states
Mahalanobis Distance
A multivariate distance metric that measures how many standard deviations a point is from the mean of a distribution, accounting for covariance between variables.
- Unlike Euclidean distance, it accounts for feature correlations
- Assumes data follows a multivariate Gaussian distribution
- Computationally efficient for real-time scoring
- Foundation for Hotelling's T² control charts in SPC
Local Outlier Factor
A density-based algorithm that computes the local density deviation of a data point relative to its neighbors. Points with substantially lower density than their neighbors are labeled as anomalies.
- Detects local anomalies missed by global methods
- Effective for clustered normal data with varying densities
- Score of ~1 indicates normal, >>1 indicates anomalous
- Sensitive to the choice of k-neighbors parameter

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us