| --- |
| license: mit |
| task_categories: |
| - image-classification |
| tags: |
| - robustness |
| - vssm |
| - mamba |
| --- |
| |
| This repository contains the dataset and evaluation artifacts for the paper [Towards Evaluating the Robustness of Visual State Space Models](https://huggingface.co/papers/2406.09407). |
|
|
| Vision State Space Models (VSSMs) are a novel architecture that combines the strengths of recurrent neural networks and latent variable models. This work presents a comprehensive evaluation of VSSMs' robustness under various perturbation scenarios, including: |
| - **Adversarial attacks**: White-box, Frequency-based, and Transfer-based Black-box attacks. |
| - **Information Drop**: Occlusions along scanning lines and patch dropping. |
| - **Natural/Common Corruptions**: Evaluation on ImageNet-C, ImageNet-A, ImageNet-R, ImageNet-S, ImageNet-B, and ImageNet-E. |
| - **Downstream Tasks**: Robustness on object detection and segmentation (COCO-C, ADE20K-C). |
|
|
| **GitHub Repository:** [HashmatShadab/MambaRobustness](https://github.com/HashmatShadab/MambaRobustness) |
|
|
| ## Installation |
|
|
| To set up the environment, follow these steps from the official repository: |
|
|
| ```bash |
| conda create -n mamba_robust |
| conda install pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 pytorch-cuda=11.7 -c pytorch -c nvidia |
| pip install -r req.txt |
| cd kernels/selective_scan && pip install . |
| ``` |
|
|
| ## Sample Usage |
|
|
| ### Robustness against Adversarial attacks |
|
|
| To craft adversarial examples using Projected Gradient Descent (PGD) at a perturbation budget of 8/255 with 20 attack steps: |
|
|
| ```bash |
| cd classification/ |
| python generate_adv_images.py --data_dir <path to dataset> --attack_name pgd --source_model_name <model_name> --epsilon 8 --attack_steps 20 |
| ``` |
|
|
| ### Inference on ImageNet Corrupted datasets |
|
|
| For evaluating on ImageNet-A, ImageNet-R, or ImageNet-S: |
|
|
| ```bash |
| cd classification/ |
| python inference.py --dataset <dataset name> --data_dir <path to corrupted dataset> --batch_size <batch_size> --source_model_name <model name> |
| ``` |
|
|
| Supported datasets for the `--dataset` argument include: `imagenet-b`, `imagenet-e`, `imagenet-v2`, `imagenet-a`, `imagenet-r`, and `imagenet-s`. |
|
|
| ## Citation |
|
|
| ```bibtex |
| @article{shadab2024towards, |
| title={Towards Evaluating the Robustness of Visual State Space Models}, |
| author={Shadab Malik, Hashmat and Shamshad, Fahad and Naseer, Muzammal and Nandakumar, Karthik and Shahbaz Khan, Fahad and Khan, Salman}, |
| journal={arXiv e-prints}, |
| pages={arXiv--2406}, |
| year={2024} |
| } |
| ``` |