Anomaly Detection
Flag defects you have few or no pictures of by training on normal images, then deploy your own anomaly detection model on Roboflow.
What is anomaly detection?
Anomaly detection learns what a normal image looks like from normal images only, then flags images that differ. For each image, the model returns a "normal" or "anomalous" verdict, an anomaly score, and a heatmap of where the image differs. You do not need pictures of every defect, so it fits problems where defects are rare or vary a lot.

Supported anomaly detection models
Roboflow supports these anomaly detection models. See the Anomaly Detection models table for export and deployment support per model.
Choosing an anomaly detection model
FoundAD is more accurate, especially when you only have a few normal images. More normal images help both models, and PatchCore the most.

FoundAD takes the same time per image at any training set size. PatchCore slows down as you add normal images or raise the image size (see PatchCore inference speed). Which one is faster depends on your hardware and settings.

inference benchmark api-speed on Roboflow Inference 1.8 (the public Jetson 6.2 image on both Jetsons). PatchCore at 224×224, FoundAD at 512×512.PatchCore trains in minutes. FoundAD takes longer, up to hours on large datasets.
Fine-tuning an anomaly detection model
The PatchCore and FoundAD pages cover the split and preprocessing rules for this task.
Create an anomaly detection project
Create a Project and pick "Anomaly Detection" as the project type.

Upload and label images
Upload images, then label each image "normal" or "anomalous" in the annotation editor. Most of your images should be normal. The model trains on normal images only. Anomalous images set the decision threshold and measure accuracy, so they go to the valid and test splits only.

Generate a dataset version
Generate a dataset version with only the auto-orient and "Stretch to" resize preprocessing steps, and no augmentation.
Train an anomaly detection model
Click "Train" and pick PatchCore or FoundAD. See Train a Model for every option.

Deploy an anomaly detection model
After training, deploy your anomaly detection model with the Serverless Cloud API, a Dedicated Deployment, or on your own hardware with Roboflow Inference. See Choosing a Deployment to compare the options.
Last updated
Was this helpful?