Anomaly Detection Model
Score an image against a model of normal images and locate what differs.
Run an anomaly detection model (PatchCore or FoundAD) trained on an anomaly detection project hosted on Roboflow.
An anomaly model learns what normal looks like from normal images only and scores a new image by how far it departs from that. The block reports:
predictions: the classification-style response, withtopbeingnormaloranomalousand the two class confidences. The anomalous confidence issigmoid((anomaly_score - anomaly_threshold) / scale), with the scale saved with the model, so it is exactly 0.5 at the threshold.anomaly_score: the raw image score (unbounded, larger means more anomalous).anomaly_threshold: the threshold in effect for this image (saved with the model, or the override).is_anomalous: whether the anomalous confidence reachedconfidence.anomaly_decision_threshold: the raw score at which the anomalous confidence equalsconfidence(anomaly_thresholditself at 0.5). Connect it to the heatmap'sanomaly_thresholdso the middle of its ramp marks the decision.anomaly_map: the local anomaly evidence as a float32(height, width)array at the network's input resolution (square), in the same units asanomaly_score. The map covers the whole image as the network saw it, so stretching it to the image size overlays it. Connect it to the Anomaly Heatmap Visualization block to draw it. Setinclude_anomaly_maptoFalseto skip the map when only the verdict is needed.
confidence sets the operating point without retraining: the default 0.5 reproduces the decision calibrated during training; lower it to catch more defects at the cost of more false alarms, raise it to do the opposite. anomaly_threshold replaces the saved threshold on the raw score; the class confidences are then recomputed relative to it and confidence applies to them the same way.
You will need to set your Roboflow API key in your Inference environment to use this block. To learn more about setting your Roboflow API key, refer to the Inference documentation.
Type identifier
Use the following identifier in step "type" field: roboflow_core/anomaly_detection_model@v1 to add the block as a step in your workflow.
Properties
Name
Type
Description
Refs
name
str
Enter a unique identifier for this step..
❌
model_id
str
Roboflow model identifier..
✅
include_anomaly_map
bool
Return the local anomaly map at the network input resolution. Disable it when only the verdict and score are needed..
✅
confidence
float
Minimum anomalous confidence for an anomalous verdict. 0.5 reproduces the decision calibrated during training; lower it to flag more images as anomalous..
✅
anomaly_threshold
float
Threshold on the raw anomaly score, replacing the one saved with the model; the anomalous confidence is recomputed relative to it. Leave empty to use the saved threshold..
✅
disable_active_learning
bool
Boolean flag to disable project-level active learning for this block..
✅
active_learning_target_dataset
str
Target dataset for active learning, if enabled..
✅
The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.
Input and Output Bindings
The available connections depend on its binding kinds. Check what binding kinds Anomaly Detection Model in version v1 has.
Last updated
Was this helpful?