Ano-SuPs: Multisize Anomaly Detection for Manufactured Products by Identifying Suspected Patches via Vision Transformer

Published Online:https://doi.org/10.1287/ijds.2024.0058

Supplemental Material

Software and Data: ijds.2024.0058.cd.zip


Description of Software and Data

The code and data in the zip file referenced above are a snapshot of the software and data that were used in the research reported in the paper "Ano-SuPs: Multi-size anomaly detection for manufactured products by identifying suspected patches via Vision Transformer" by Hao Xu, Juan Du, Andi Wang, and Ying-Cong Chen. This repository is also available via Github.

The goal of this repository is to replicate the numerical experiments in the paper.

Computer and Software Environment

The following describes the computer hardware conditions and software environment on which the authors produce the results reported in the paper.

All experiments were conducted on Ubuntu 20.04 with a single NVIDIA RTX 4090 (24 GB) GPU, an Intel Xeon Gold 6430 processor (16 vCPUs), and 120 GB of memory. The software environment uses Python 3.8, PyTorch 1.11.0, and CUDA 11.3.

Dependencies

The code in this repository requires the following dependencies. The dependency version number corresponds to the version of the package with which the code was tested.

  • numpy>=1.19.0
  • torch>=1.9.0
  • matplotlib>=3.3.0
  • Pillow>=9.0.0
  • opencv-python>=4.5.0
  • requests>=2.25.0
  • timm==0.4.12
  • gdown>=4.6.0

Installation

  1. Clone or download this repository.
  2. Install dependencies: pip install -r requirements.txt
  3. Test images and ground-truth masks are included in the images/ directory. Pretrained model checkpoints will be automatically downloaded from Google Drive on first run and saved to models/.
  4. Run experiments: python main_anosups.py --data where is 01, 02, or hazelnut. To run all datasets sequentially: bash run_all_datasets.sh

Reproducibility Workflow

To reproduce the results in Figure 9, Figure 11 (row 1), Table 1 (Experiment 1, disk-shaped product, dataset 01)
  • Data Files: images/01/ (included in zip)
  • Code Files: main_anosups.py --data 01
  • Output: Per-image Dice/IoU text files and summary (mean Dice, mean IoU, STD) for line, color, hole anomaly types; visualization images under results/
  • Run Time at the Above-Specified Computer Conditions: ~95 s on RTX 4090
To reproduce the results in Figure 10, Figure 11 (row 2), Table 1 (Experiment 1, wood surface product, dataset 02)
  • Data File: images/02/ (included in zip)
  • Code File: main_anosups.py --data 02
  • Output: Per-image Dice/IoU text files and summary (mean Dice, mean IoU, STD) for line, color, hole anomaly types; visualization images under results/
  • Run Time at the Above-Specified Computer Conditions: ~115 s on RTX 4090
To reproduce the results in Figure 12, Table 2 (Hazelnut case study, MVTec dataset)
  • Data File: images/hazelnut/ (included in zip)
  • Code File: main_anosups.py --data hazelnut
  • Output: Per-image Dice/IoU text files and summary (mean Dice, mean IoU, STD) for crack, cut, print, hole anomaly types; visualization images under results/
  • Run Time at the Above-Specified Computer Conditions: ~56 s on RTX 4090

Note

The pretrained checkpoints for datasets 01, 02, and hazelnut are automatically downloaded from Google Drive on first run (requires internet connection).

Cite

To cite the contents of this repository, please cite both the paper and this repository using their respective DOIs.

Article: https://doi.org/10.1287/ijds.2024.0058
Software and Data Repository: https://doi.org/10.1287/ijds.2024.0058.cd

License

Copyright (c) (2026 Xu, Du, Wang, Chen)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

INFORMS site uses cookies to store information on your computer. Some are essential to make our site work; Others help us improve the user experience. By using this site, you consent to the placement of these cookies. Please read our Privacy Statement to learn more.