ATSAnomaly anomaly detection¶
Suitable for building a memory bank from normal OK images only, then identifying new images that deviate from the normal distribution. The current implementation uses the PatchCore method, without multi-epoch gradient training as in ordinary classification.
Training and calibration data¶
Training and independent calibration directories must contain only OK images. If calibration is blank, images are deduplicated by content and approximately 20% is held out using fixed random seed 42; at least 3 distinct images are required. Calibration images do not enter the memory bank; content duplicates between training and independent calibration cause an error.
Thresholds estimated only from OK images cannot establish defect recall, false-positive rate or production accuracy. Validate business performance using independent OK/NG samples.
Construction parameters¶
| Parameter | Effect |
|---|---|
| Backbone | ResNet18 (faster) or Wide ResNet50-2 (higher capacity), using bundled pretrained weights with frozen parameters. |
| Image size | Default 256; resizes the whole image to a square without center-cropping edges, potentially changing aspect ratio; 64–1024 and a multiple of 32 |
| Extraction batch size | Default 2, range 1–16; controls feature extraction batch size; reduce if GPU memory is insufficient |
| Coreset retention fraction | Default 0.01; fraction of candidate features retained, not the fraction of training images retained |
| Candidate feature limit | Default 50000; bounded sampling above this limit caps candidates entering coreset selection |
| Coreset feature limit | Default 5000; caps the final memory bank feature count |
The final coreset size is min(coreset feature limit, max(1, int(candidate feature count × retention fraction))). Larger memory banks and image sizes generally increase RAM, GPU memory and inference computation requirements.
This page has no learning rate, optimizer, epochs or early stopping settings. Progress consists of normal feature extraction, coreset sampling and OK threshold calibration.
Thresholds and inference¶
The model is saved as model.patchcore.pt. Use Anomaly inference validation on this page for inference, with a single image or image folder.
Anomaly scores are feature distances, not probabilities, and need not be within 0–1. During construction, OK calibration scores estimate image-level and pixel-level thresholds. The inference threshold multiplier defaults to 1: below 1 is more sensitive; above 1 is more permissive. An image score reaching the image threshold is classified as NG; the pixel threshold determines the pixel mask. These are different statistics.
Results include OK/NG, anomaly scores, heatmaps, overlays, masks, raw score maps and JSON/CSV. The output directory must not be inside the input image directory, preventing generated results from becoming inputs again.
This model format is not a generic ONNX, ordinary classification PT or classic inference model; do not select it on the main Model inference validation page. CPU and single NVIDIA GPU execution both use the independent anomaly detection environment.
See the anomaly parameter table for complete ranges.