huggingface / pytorch-image-models

The largest collection of PyTorch image encoders / backbones. Including train, eval, inference, export scripts, and pretrained weights -- ResNet, ResNeXT, EfficientNet, NFNet, Vision Transformer (ViT), MobileNetV4, MobileNet-V3 & V2, RegNet, DPN, CSPNet, Swin Transformer, MaxViT, CoAtNet, ConvNeXt, and more
https://huggingface.co/docs/timm
Apache License 2.0
32.45k stars 4.77k forks source link

[FEATURE] More Adversarially trained ImageNet models #621

Closed tao-bai closed 2 years ago

tao-bai commented 3 years ago

Is your feature request related to a problem? Please describe. It would be better if more adversarially trained imagenet models could be included.

Describe the solution you'd like Here are some pretrained models by TF1. https://github.com/tensorflow/models/tree/archive/research/adv_imagenet_models Thank you!

rwightman commented 3 years ago

Two are already here, I doubt the others add much more diversity... https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/inception_v3.py#L37 https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/inception_resnet_v2.py#L26

tao-bai commented 3 years ago

They do. As shown below, the training methods of these models are different. They are indeed different models though some have the same arch.

Network Architecture Adversarial training Checkpoint
Inception v3 Step L.L. adv_inception_v3_2017_08_18.tar.gz
Inception v3 Step L.L. on ensemble of 3 models ens3_adv_inception_v3_2017_08_18.tar.gz
Inception v3 Step L.L. on ensemble of 4 models ens4_adv_inception_v3_2017_08_18.tar.gz
Inception ResNet v2 Step L.L. adv_inception_resnet_v2_2017_12_18.tar.gz
Inception ResNet v2 Step L.L. on ensemble of 3 models ens_adv_inception_resnet_v2_2017_08_18.tar.gz

In some papers, they compare these models. e.g. inception-v3

Dong, Yinpeng, Tianyu Pang, Hang Su, and Jun Zhu. "Evading defenses to transferable adversarial examples by translation-invariant attacks." In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4312-4321. 2019.

image

I appreciate that you convert them into PyTorch. It would be more convenient for guys like me to do such experiments. Thank you!

logicred commented 2 years ago

I agree with tao-bai. Most works on adversarial attacks are only based on TensorFlow, which blocks the diverse applications on other frameworks (e.g., PyTorch, MXNet) and troubles many researchers. I hope you can convert them into PyTorch or share the way of conversion with us, which may have profound changes in this field. I am looking forward to your prompt reply and thank you!

rwightman commented 2 years ago

@tao-bai @logicred I did look at this a few months back to see if I could find the code I had hacked together for conversion. Unfortunately my greps didn't turn up the code. I believe it was on a new defunct machine ... it was supposed to be a one time conversion so I never made an effort to keep it :(

I'm open to a PR if someone else does the conversion, but it's a fair bit of fiddly hacking to get it to work (from my fuzzy recollection). Closing for now.

CHENBIN99 commented 10 months ago

These models are also very needed for me, too. So far I have only found the ensemble training model of inception resnet v2 on TIMM.