Home

Awesome

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

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

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

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