GithubHelp home page GithubHelp logo

pjwu1997 / saliencymix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from afm-shahab-uddin/saliencymix

0.0 1.0 0.0 65 KB

SaliencyMix: A Saliency Guided Data Augmentation Strategy for Better Regularization

Shell 2.27% Python 82.28% Lua 15.45%

saliencymix's Introduction

SaliencyMix

SaliencyMix: A Saliency Guided Data Augmentation Strategy for Better Regularization

CIFAR training and testing code is based on

The ImageNet is based on

Requirements

  • Python3
  • PyTorch (> 1.0)
  • torchvision (> 0.2)
  • NumPy
  • OpenCV-contrib-python (4.2.0.32)

CIFAR

Please use "SaliencyMix_CIFAR" directory

CIFAR 10

-To train ResNet18 on CIFAR10 with SaliencyMix and traditional data augmentation:

CUDA_VISIBLE_DEVICES=0,1 python saliencymix.py \
--dataset cifar10 \
--model resnet18 \
--beta 1.0 \
--salmix_prob 0.5 \
--batch_size 128 \
--data_augmentation \
--learning_rate 0.1

-To train ResNet50 on CIFAR10 with SaliencyMix and traditional data augmentation:

CUDA_VISIBLE_DEVICES=0,1 python saliencymix.py \
--dataset cifar10 \
--model resnet50 \
--beta 1.0 \
--salmix_prob 0.5 \
--batch_size 128 \
--data_augmentation \
--learning_rate 0.1

-To train WideResNet on CIFAR10 with SaliencyMix and traditional data augmentation:

CUDA_VISIBLE_DEVICES=0,1 python saliencymix.py \
--dataset cifar10 \
--model wideresnet \
--beta 1.0 \
--salmix_prob 0.5 \
--batch_size 128 \
--data_augmentation \
--learning_rate 0.1

CIFAR 100

-To train ResNet18 on CIFAR100 with SaliencyMix and traditional data augmentation:

CUDA_VISIBLE_DEVICES=0,1 python saliencymix.py \
--dataset cifar100 \
--model resnet18 \
--beta 1.0 \
--salmix_prob 0.5 \
--batch_size 128 \
--data_augmentation \
--learning_rate 0.1

-To train ResNet50 on CIFAR100 with SaliencyMix and traditional data augmentation:

--dataset cifar100 \
--model resnet50 \
--beta 1.0 \
--salmix_prob 0.5 \
--batch_size 128 \
--data_augmentation \
--learning_rate 0.1

-To train WideResNet on CIFAR100 with SaliencyMix and traditional data augmentation:

CUDA_VISIBLE_DEVICES=0,1 python saliencymix.py \
--dataset cifar100 \
--model wideresnet \
--beta 1.0 \
--salmix_prob 0.5 \
--batch_size 128 \
--data_augmentation \
--learning_rate 0.1

ImageNet

-Please use "SaliencyMix-ImageNet" directory

Train Examples

  • ImageNet with 4 NVIDIA GeForce RTX 2080 Ti GPUs
python train.py \
--net_type resnet \
--dataset imagenet \
--batch_size 256 \
--lr 0.1 \
--depth 50 \
--epochs 300 \
--expname ResNet50 \
-j 40 \
--beta 1.0 \
--salmix_prob 1.0 \
--no-verbose

Test Examples using ImageNet Pretrained models

  • Trained models can be downloaded from here

  • ResNet-50

python test.py \
--net_type resnet \
--dataset imagenet \
--batch_size 64 \
--depth 50 \
--pretrained /runs/ResNet50_SaliencyMix_21.26/model_best.pth.tar
  • ResNet-101
python test.py \
--net_type resnet \
--dataset imagenet \
--batch_size 64 \
--depth 101 \
--pretrained /runs/ResNet101_SaliencyMix_20.09/model_best.pth.tar

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.