Anomaly and Defect Detection
R2026bSince R2026b
Train deep learning networks using normal images to establish an expected appearance, then identify images or regions that deviate from this learned representation. Visual Inspection Toolbox™ supports these anomaly detection capabilities:
Training — Train with normal data alone, or optionally incorporate anomalous examples when available.
Scoring and localization — Generate anomaly scores for image-level classification and pixel-level spatial anomaly maps that highlight defect regions.
Threshold optimization — Determine classification thresholds using receiver operating characteristic (ROC) curves or precision-recall metrics.
Evaluation — Assess detector performance with confusion matrices and accuracy, precision, recall, and F1 scores.
Visualization — Overlay spatial anomaly maps on images as heat maps and interactively review results. Normalize anomaly maps using percentile statistics of maps from normal examples.
To interactively detect and visualize anomalies, as well as train and evaluate anomaly detection networks, use the Visual Anomaly Detector app.
To get started with anomaly detection, see Get Started with Anomaly Detection Using Deep Learning.
Apps
| Visual Anomaly Detector | Train, evaluate, and compare deep learning anomaly detectors |
Functions
Topics
- Get Started with Anomaly Detection Using Deep Learning
Learn about the basics of anomaly detection.
- Select Detection Approach for Visual Inspection
Choose among anomaly detection, shape matching, object detection, and object counting for your visual inspection application.
- Train and Evaluate Anomaly Detection Model Using Visual Anomaly Detector
This example shows how to train and evaluate an anomaly detection model using the Visual Anomaly Detector app.
- Detect Anomalies Using Visual Anomaly Detector
This example shows how to detect and localize industrial production defects in images using a trained anomaly detector in the Visual Anomaly Detector app.
- Detect PCB Defects in Live Image Stream Using Visual Anomaly Detector
This example shows how to detect and localize defects on printed circuit board (PCB) images in a live image stream using a trained anomaly detector in the Visual Anomaly Detector app.










