[ECCV 2024] An Incremental Unified Framework for Small Defect Inspection
November 16, 2024 ยท View on GitHub
[ECCV 2024] An Incremental Unified Framework for Small Defect Inspection
This is the official repository for IUF (ECCV 2024).
Jiaqi Tang, Hao Lu, Xiaogang Xu, Ruizheng Wu, Sixing Hu,
Tong Zhang, Twz Wa Cheng, Ming Ge, Ying-Cong Chen* and Fugee Tsung.
*: Corresponding Author
Here is our Project Page with Video!
๐ Our Setting: Incremental Unified Framework (IUF)
- ๐ฉ First framework to integrate incremental learning into the unified reconstruction-based detection.
- ๐ฉ Overcoming memory bank capacity limitations.
- ๐ฉ Delivering not only image-level performance but also pixel-level location.
๐ข News and Updates
- โ Step 24, 2024. We release the code and dataset of IUF. Check this Google Cloud link for DOWNLOADING dataset.
โถ๏ธ Getting Started
๐ช Installation
- PyTorch >= 1.11.0
- Install dependencies by
pip install -r requirements.txt
๐พ Dataset Preparation
-
Google Drive Link for DOWNLOADING dataset.
-
The dataset is organized as follows:
โโโ VisA โ โโโ Data โ โ โโโ candle โ โ โ โโโ ground_truth โโ (bad) โ โ โ โโโ test โโ (Bad) (good) โ โ โ โโโ train (good) โ โ โโโ capsules โ โ โ โโโ ... โ โ โโโ ... โ โ โ โโโ orisplit โ โ โโโ candle_test.json # for testing in candle โ โ โโโ candle_test.json # for training in candle โ โ โโโ ... | โ โ โโโ split โ โ โโโ 8_12_train.json # for training in 8-12 class โ โ โโโ 8_test.json # for training in 1-8 class โ โ โโโ 11_test.json # for training in 1-11 class โ โโโ MvTec AD โ โโโ mvtec_anomaly_detection # Data โ โโโ 33333 # for 33333 class โ โโโ json_test # for each class test โ โโโ json_train # for each class train โ โโโ test_X.json # for X class test โ โโโ train_X.json # for X class Train โ โโโ ... -
Task Protocols: Based on the practical requirements of industrial defect inspection, we set up our experiments in both single-step and multi-step settings. We represent our task stream as . Here, denotes the number of base objects before starting incremental learning, represents the number of new objects incremented in each step, and indicates the number of tasks during incremental learning. When training on base objects, , and after one step, . Our task stream is shown as follows:
- MVTec-AD: , , and .
- VisA: , ,
-
Usage: follow the above protocols in incremental learning.
๐จ Configuration
-
The configuration files for
traininginexperiments. -
Dataset Setting:
dataset: type: custom image_reader: type: opencv kwargs: image_dir: /dataset/.../VisA # for data path color_mode: RGB train: meta_file: /dataset/.../A_Data/orisplit/XX.json # for data training json path rebalance: False hflip: False vflip: False rotate: False Val: meta_file: /dataset/.../.../VisA/split/XX.json # for saving previous weight test: meta_file: /dataset/.../A_Data/orisplit/XX.json # for data testing json path -
Saving Setting:
saver: auto_resume: True always_save: True load_path: checkpoints/ckpt.pth.tar save_dir: checkpoints/ log_dir: log/ -
For Testing: uncomment this part in config
vis_compound: save_dir: vis_compound max_score: null min_score: null vis_single: save_dir: ./vis_single max_score: null min_score: null
๐ฅ๏ธ Training and Testing
-
Modify
Dataset Settingintrainingconfiguration, then runsh run.shIn
run.sh, it includes two stages:cd /dataset/.../SmallDefect_Vis/IUF # Stage 1: Training base objects CUDA_VISIBLE_DEVICES=0,1,2,3 python ./tools/train_val.py --config /dataset/.../SmallDefect_Vis/IUF/experiments/VisA/8_1_1_1_1/config_c1.yaml # Stage 2: Training incremental objects CUDA_VISIBLE_DEVICES=0,1,2,3 python ./tools/train_val.py --config /dataset/.../SmallDefect_Vis/IUF/experiments/VisA/8_1_1_1_1/config_c9.yaml CUDA_VISIBLE_DEVICES=0,1,2,3 python ./tools/train_val.py --config /dataset/.../SmallDefect_Vis/IUF/experiments/VisA/8_1_1_1_1/config_c10.yaml CUDA_VISIBLE_DEVICES=0,1,2,3 python ./tools/train_val.py --config /dataset/.../SmallDefect_Vis/IUF/experiments/VisA/8_1_1_1_1/config_c11.yaml CUDA_VISIBLE_DEVICES=0,1,2,3 python ./tools/train_val.py --config /dataset/.../SmallDefect_Vis/IUF/experiments/VisA/8_1_1_1_1/config_c12.yamlYou can edit this to support different task protocals.
-
The logs, models and training states will be saved to
./experiments/checkpoints/...and./experiments/logs/.... You can also usetensorboardfor monitoring for the./events_dec/....
โก Performance
Compared with other baselines, our model achieves state-of-the-art performance:
โญ [Figure 1] Quantitative evaluation in MvTecAD.
โญ [Figure 2] Quantitative evaluation in VisA.
โญ [Figure 3] Qualitative Evaluation.
๐ Citations
The following is a BibTeX reference:
@inproceedings{tang2024incremental,
title = {An Incremental Unified Framework for Small Defect Inspection},
author = {Tang, Jiaqi and Lu, Hao and Xu, Xiaogang and Wu, Ruizheng and Hu, Sixing and Zhang, Tong and Cheng, Tsz Wa and Ge, Ming and Chen, Ying-Cong and Tsung, Fugee},
booktitle = {18th European Conference on Computer Vision (ECCV)},
year = {2024}
}
๐ง Connecting with Us?
If you have any questions, please feel free to send email to jtang092@connect.hkust-gz.edu.cn.
๐ Acknowledgment
The research work was sponsored by AIR@InnoHK. The code is inspired by UniAD.


