Code Monkey home page Code Monkey logo

soda's Introduction

SODA

The implementation of SODA on CIFAR-10-C, CIFAR-100-C and ImageNet-C.

Prerequisites:

  • python == 3.10.8
  • cudatoolkit == 11.7
  • pytorch ==1.13.1
  • torchvision == 0.14.1
  • numpy, PIL, argparse, collections, math, random

Datasets

Please download and organize CIFAR-10-C, CIFAR-100-C and ImageNet-C in this structure:

(ImageNet-C data can also be generated following instructions in this repository)

BETA
├── data
    ├──CIFAR-10
    │   ├── CIFAR-10-C
    │   │   ├── brightness.npy
    │   │   ├── contrast.npy
    │   │   ├── ...
    │   │   ├── labels.npy
    ├──CIFAR-100
    │   ├── CIFAR-100-C
    │   │   ├── brightness.npy
    │   │   ├── contrast.npy
    │   │   ├── ...
    │   │   ├── labels.npy
    ├──ImageNet
    │   ├── ImageNet-C
    │   │   ├── brightness.pth
    │   │   ├── contrast.pth
    │   │   ├── ...
    │   │   ├── labels.pth

Pre-trained Models

The checkpoints of pre-trained Resnet-50 can be downloaded (197MB) using the following command:

mkdir -p results/cifar10_joint_resnet50 && cd results/cifar10_joint_resnet50
gdown https://drive.google.com/uc?id=1MZN19o-5b2w-BI1ObIlnsJ8XBZvMuL77 && cd ../..
mkdir -p results/cifar100_joint_resnet50 && cd results/cifar100_joint_resnet50
gdown https://drive.google.com/uc?id=1C7knE2S9kKDYZrqd4Bo4S5lOgp7Le_DP && cd ../..
mkdir -p results/imagenet && cd results/imagenet
gdown https://drive.google.com/uc?id=1GSGzOv0MNBBMEYeRRQlp1WGD1USDl0iP && cd ../..

The CIFAR-10/100 pre-trained models are obtained by training on the clean CIFAR-10/100 images using semi-supervised SimCLR. The ImageNet pre-trained model is obtained from TorchVision

Adaptation on CIFAR-10-C

# offline SODA
bash scripts/run_offline_soda_10.sh

# offline SODA-R
bash scripts/run_offline_soda_r_10.sh

# offline MA-SO
bash scripts/run_offline_ma_10.sh

# online SODA-O
bash scripts/run_online_soda_10.sh

Adaptation on CIFAR-100-C

# offline SODA
bash scripts/run_offline_soda_100.sh

# offline SODA-R
bash scripts/run_offline_soda_r_100.sh

# offline MA-SO
bash scripts/run_offline_ma_100.sh

# online SODA-O
bash scripts/run_online_soda_100.sh

Adaptation on ImageNet-C

# offline SODA
bash scripts/run_offline_soda_imagenet.sh

# offline SODA-R
bash scripts/run_offline_soda_r_imagenet.sh

# offline MA-SO
bash scripts/run_offline_ma_imagenet.sh

soda's People

Contributors

zigew avatar

Watchers

 avatar

Forkers

tmlr-group

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.