This set of scripts allows train and evaluate robust to PGD attack classification models on ImageNet dataset. Implementations of models are taken from the pytorchcv library, which means robust weights can be substituted to existing scripts that rely on pytorchcv.
All the models are trained on adversarial samples obtained after 3 iterations of PGD with step=2/3*eps.
Model | Input Resolution | Params(M) | MACs(G) | eps | dist | Top-1 accuracy | Top-5 accuracy | Top-1 adv accuracy | Top-5 adv accuracy |
---|---|---|---|---|---|---|---|---|---|
MobilenetV2 1x | 224x224 | 3.4 | 0.3 | 0.02 | l2 | 72.16 | 90.62 | 71.72 | 90.40 |
MobilenetV2 1x | 224x224 | 3.4 | 0.3 | 0.05 | l2 | 72.12 | 90.34 | 71.11 | 89.84 |
MobilenetV2 1x | 224x224 | 3.4 | 0.3 | 0.3 | l2 | 71.38 | 89.8 | 68.79 | 88.50 |
An example of training command:
python train.py \
-a mobilenetv2_w1 \
-b 256 \
-d $IMAGENET_FOLDER \
--epochs 150 \
--lr-decay cos \
--lr 0.05 \
--wd 4e-5 \
-c ./snapshots \
--input-size 224 \
--adv-eps 0.3 \
--euclidean \
-j 40
An example of an evaluation command:
python3 train.py \
-a mobilenetv2_w1 \
-d $IMAGENET_FOLDER \
-b 128 \
--weight ./snapshots/model_best.pth.tar \
--evaluate \
--input-size 224 \
-j 8 \
--adv-eps 0.3 \
--euclidean