How to Improve the Performance of Anomaly Detection Models

- Introduction: Why this article was created.
- Mysterious findings: A quick overview.
- Image size: Is the large installation size worth it?
- Cropping in between: Focus on something.
- Background removal: Delete everything you don't need.
- Standing in advance: Use an authentication set.
- The conclusion
1. Introduction
There are several methods to improve the performance, which are used by the authors in the studies to make it easier for the proposed model to stand out by showing the most amazing results compared to other models. For example, using a large input size, which helps to find small errors; the other removes part of the background to reduce false positives.
Such an approach can be academically weak because it makes comparisons across different models imprecise and may not perform equally well across data sets. However, these methods can also be used to improve the performance of practical applications if used carefully. In this article, we will review a few of the most powerful methods and explain how they can be used to achieve better results while avoiding potential downsides.
2. Unexpected discovery
Anomaly detection models are often called “unsupervised”, but this term can be misleading because most of them require only one training phase, normal images without feature. Training with one category, the data needs to be labeled in different categories, different from the common definition unsupervised reading.
Based on the standard images used during training, the model learns what the “normal” looks like and should be able to recognize deviations from it as defective images. These errors are usually small
and difficult to see, even for expert inspectors on the production line. The example below shows a drop in solder paste on one of the contacts, which is hard to see without a ground truth mask showing the defect area on the right.
For more information about industrial anomaly detection, see this post or this survey.
3. Image size
If the images in your dataset have small defects (less than 0.2% of the image or more, this number is arbitrary and depends on the model used and other factors.) the model cannot recognize, try increasing the input size. It is very helpful to see such features by making them large enough for the model to see.
When serious problems (10% of the image or more, this number is also unreasonable) are present, you should be very careful about choosing a model. Some models, such as PatchCore, show better results for different sizes with defects with a large input size, others, such as RD4AD, can significantly degrade due to large defects, as described in our benchmarking paper, Tab. 5 and 14. Best practice is to test how the selected model works for the types of disabilities you have.
Another important consideration when using a large input size is the speed of inference and memory constraints. As shown in
MVTec AD 2 paper, Fig.6, reference time and memory consumption increased significantly for almost all tested models with large input sizes.
4. Average yield
If you have data with objects in the middle of the image, and some can be safely scanned, take it. As shown in the image below, cropping close to the tested part helps to avoid false positives. An important negative effect is that the relative size of the analyzed component increases; as explained earlier, this may help you get better results for smaller imperfections or increase the cropping speed by allowing you to make the image smaller.

Possible false positives are circled in red
Warning: Popular data sets present a situation where the main object can be safely determined in the center, as shown in Fig. 2 here, or in the image above. For this reason, many of the early implementations of high-quality methods included growing intermediate crops. Using an average crop can be problematic in real-world applications with defects near the edge of the image; if so, ensure that such cropping is disabled.
5. Background removal
Remove the background for even fewer false positives. Similar to inserting an intermediate plant, make sure that irregularities or defects in the removed area do not affect the quality of the part produced. If you haven't had defects in some part of the object in the past, don't remove it, because defects can appear there in the future, and you don't want to miss it.

Possible false positives are circled in red
6. Stopping early
Most anomaly detection models use a fixed epoch count, which is often optimized for popular data sets. It may be useful to try to set up early on your data to avoid overloading or to train quickly over several periods. Early stopping is sometimes misused by using test set performance to stop training, making the reported results falsely positive. However, if you use it in a different authentication set, you can still achieve significant improvements, as shown in the tab. 9 here.
Warning: Some original applications of high-level models may use early termination in the test set or report the best results for every epoch based on the performance of the test set. Check the code before running it to ensure that you won't have a model that overfits the test set with overly optimistic results.
7. Conclusion
- Increase the image size
- DO: check if the selected model is able to detect different error sizes; make sure the thinking speed is sufficient
- DON'T SAY: you missed big mistakes
- Cropping in the middle
- DO: make sure the checked object is fully in the picture after cropping
- DON'T: miss defects in the removed area
- Remove the background
- DO: make sure the area you are removing is not important for inspection
- DON'T: miss the defects in the background
- Stopping early
- DO: use authentication set
- DON'T: test set overfit
Make sure that using these methods or a combination of them will not cause miss errors. Some of them can be attacked or used in publicly available datasets. In a real world situation, this may result in defective parts being delivered to the customer.
If used carefully, however, they can significantly improve the performance of anomaly detection models in real-world applications by improving the knowledge of your data and anomalies.
Follow the author on LinkedIn to learn more about industrial anomaly detection.
References
- A. Baitieva, Y. Bouaouni, A. Briot, D. Ameln, S. Khalfaoui, and S . Akcay. Beyond Academic Standards: Critical Analysis 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



