- Introduction: Why this text was created.
- Anomaly detection: Quick overview.
- Image size: Is a bigger input size value it?
- Center crop: Concentrate on the article.
- Background removal: Remove all you don’t need.
- Early stopping: Use a validation set.
- Conclusion
1. Introduction
There are several methods to enhance performance, that are utilized by authors in academia to make it easier for the proposed model to face out by showing more impressive results in comparison with other models. For instance, using a bigger input size, which helps to detect small defects; one other is removing a part of the background to scale back false positives.
Such an approach may be weak in academia since it makes comparisons across different models less fair and may not perform equally well across all datasets. Nevertheless, these methods can be used to enhance performance in practical applications if applied rigorously. In this text, we are going to review several of probably the most powerful methods and explain use them to realize higher results while avoiding potential downsides.
2. Anomaly detection
Anomaly detection models are sometimes called “unsupervised”, but this name may be misleading because most of them require just one class for training, normal images without defects. To coach with a single class, the information must be labelled into separate classes, which differs from the standard definition of unsupervised learning.
Based on the conventional images used during training, the model learns what “normality” looks like and may give you the option to discover deviations from it as images with defects. These defects are sometimes small
and hard to see, even for skilled inspectors on a production line. The instance below shows a drop of welding paste on one in all the contacts, which is difficult to identify without the bottom truth mask showing the defect location on the appropriate.
For more details on visual industrial anomaly detection, see this post or this survey.
3. Image size
If images in your dataset have small defects () that the model cannot detect, try increasing the input size. It often helps to detect such defects by making them large enough for the model to see.
When large defects () are present, try to be more careful with the model selection. Some models, like PatchCore, show higher results for various defect sizes with larger input size, others, like RD4AD, might degrade significantly for larger defects, as described in our benchmark paper, Tab. 5 and 14. The very best practice is to check how the chosen model performs on different defect types you may have.
One other necessary consideration when using a bigger input size is the inference speed and memory constraints. As shown in
MVTec AD 2 paper, Fig.6, the inference time and memory usage increased significantly for just about all tested models with larger input sizes.
4. Center crop
If you may have data with an object at the middle of a picture, and the remaining may be cropped safely, go for it. As shown within the image below, cropping closer to the inspected part helps to avoid false positives. A crucial side effect is that the relative size of the inspected part also increases; as described earlier, this might assist you to acquire higher results for small defects or increase inference speed by allowing you to make the image smaller.

Warning: Hottest datasets present a case during which the most important object may be safely center-cropped, as shown in Fig. 2 here, or within the image above. Because of this, many original implementations of state-of-the-art methods include center crop augmentation. Using a middle crop could also be problematic in real-world applications with defects near the image edges; in that case, make sure that such cropping is disabled.
5. Background removal
Remove background to have even fewer false positives. Similarly to applying a middle crop, make certain that anomalies or defects within the removed area don’t affect the standard of the produced part. If you may have never had defects in some a part of the article up to now, don’t remove it, because defects can emerge there in the longer term, and also you are not looking for to miss them.

6. Early stopping
Most anomaly detection models use a hard and fast epoch count, which is usually optimized for popular datasets. It may be useful to try early stopping in your data to avoid overfitting or train faster with fewer epochs. Early stopping is typically misused by utilizing test set performance to stop training, making reported results unrealistically good. Nevertheless, should you apply it to a separate validation set, you may still achieve a considerable improvement, as shown in Tab. 9 here.
Warning: Some original implementations of state-of-the-art models may use early stopping on the test set or report the perfect results across all epochs based on test set performance. Take a look at the code before running it to make sure that you won’t have a model overfitting the test set with overly optimistic results.
7. Conclusion
- Increase image size
- DO: check if the chosen model is able to detecting different defect sizes; make certain that the inference speed is sufficient
- DON’T: miss large defects
- Center crop
- DO: make certain that the inspected object is fully within the image after cropping
- DON’T: miss defects within the removed area
- Remove background
- DO: make certain that the world you might be removing is irrelevant for inspection
- DON’T: miss defects within the background
- Early stopping
- DO: use validation set
- DON’T: overfit test set
Be certain that that applying these methods or their combination won’t cause missed defects. A few of them can backfire even when applied to a unique publicly available dataset. In a real-world scenario, this might lead to defective parts being delivered to a customer.
If used rigorously, nevertheless, they will noticeably improve the performance of anomaly detection models in practical applications by leveraging knowledge of your data and defects.
Follow the creator on LinkedIn for more on industrial visual anomaly detection.
References
- A. Baitieva, Y. Bouaouni, A. Briot, D. Ameln, S. Khalfaoui, and S. Akcay. Beyond Academic Benchmarks: Critical Evaluation and Best Practices for Visual Industrial Anomaly Detection (2025), CVPR Workshop on Visual Anomaly and Novelty Detection (VAND)
- Y. Zou, J. Jeong, L. Pemula, D. Zhang, and O. Dabeer, SPot-the-Difference Self-Supervised Pre-training for Anomaly Detection and Segmentation (2022), ECCV
- S. Akcay, D. Ameln, A. Vaidya, B. Lakshmanan, N. Ahuja, and U. Genc, Anomalib (2022), ICIP
- J. Liu, G. Xie, J. Wang, S. Li, C. Wang, F. Zheng, and Y. Jin, Deep Industrial Image Anomaly Detection: A Survey (2024), Machine Intelligence Research
- L. Heckler-Kram, J. Neudeck, U. Scheler, R. König, and C. Steger, The MVTec AD 2 Dataset: Advanced Scenarios for Unsupervised Anomaly Detection (2025), arXiv preprint
- K. Roth, L. Pemula, J. Zepeda, B. Schölkopf, T. Brox, P. Gehler, Towards Total Recall in Industrial Anomaly Detection (2022), CVPR
