Student-Teacher Feature Pyramid Matching - Directory for Training and Testing
Download dataset from MvTec website.
Download checkpoint from (https://drive.google.com/file/d/1s4g-ymPedorhmPmlfOFvp_Ls6tJgghEs/view?usp=sharing).
gym_env.yaml
Train a model:
Dataset path is set as deafult in the code as 'STAD/data/' in the below way, so downloaded data has to be stored in this heirarchy.
parser.add_argument("--mvtec-ad", type=str, default='../STAD/data', help="MvTec-AD dataset path")
python main.py train --epochs 400
After running this command, a directory `snapshots/` should be created, inside which checkpoint will be saved.
Evaluate a model:
python main.py test --category carpet --checkpoint snapshots/best_394_83.pt
This command will evaluate the model specified by --checkpoint argument.
python main_ptq.py test --category carpet --checkpoint snapshots/best_394_83.pt
Note - PyTorch Quantization is not supported in CUDA, so it runs in CPU.
python TRT_main_STFPM.py test --category carpet --checkpoint snapshots/best_394_83.pt
Note - TensorRT Quantization is not supported in CPU, so it tested in NVIDIA Jetson Xavier NX.
python main_qat.py train --epochs 400
Note - PyTorch Quantization is not supported in CUDA, so it runs in CPU.
If you find the work useful in your research, please cite our papar.
@article{jena2024unified,
title={Unified Anomaly Detection methods on Edge Device using Knowledge Distillation and Quantization},
author={Jena, Sushovan and Pulkit, Arya and Singh, Kajal and Banerjee, Anoushka and Joshi, Sharad and Ganesh, Ananth and Singh, Dinesh and Bhavsar, Arnav},
journal={arXiv preprint arXiv:2407.02968},
year={2024}
}