In order to run the code from this repository you run ImageNet.py to download validation set. It consists of several data folders that are used for different parts of this project.
cd "/home/cchoi/data/Thesis_Vision/VisionTransformer/VisionTransformer/VisionTransformer"
VisionTransformer/
├── vit_foolbox_robust_original.py
├── vit_foolbox_frequency.py
├── vit_foolbox_robust_Calibration
├── vit_explain_gradcam
└── vit_explain_ViT
cd "/home/cchoi/data/Thesis_Vision" To install them, run: pip install -r Thesis_Vision/requirements.txt
cd "/home/cchoi/data/Thesis_Vision/VisionTransformer/VisionTransformer/VisionTransformer"
python vit_foolbox_robust_original.py --model_name vit --attack_name PGD --batch_size 16 --data_divide 62 --data_path full_server
- High-frequency
python vit_foolbox_frequency.py --model_name vit_hybrid --attack_name PGD --batch_size 16 --data_divide 10 --filter y --data_path full_server --filter_f high
- Low-frequency
python vit_foolbox_frequency.py --model_name vit_hybrid --attack_name PGD --batch_size 16 --data_divide 10 --filter y --data_path full_server --filter_f low
python vit_foolbox_robust_Calibration.py --model_name efficient_b4 --attack_name PGD --batch_size 16 --data_divide 10 --data_path full_server
python vit_explain.py --image_path "/image.png" --head_fusion "min" --discard_ratio 0.8
python vit_explain_gradcam.py --model_name VGG --attack_name LinfPGD --visual Grad_Cam --use_cuda --category_index 726