Home

Awesome

Wide Residual Networks Using Ensemble

Wide-residual network implementations for cifar10, cifar100, and other kaggle challenges

Torch Implementation of Sergey Zagoruyko's Wide Residual Networks.

In order to figure out what 'width' & 'height' does on wide-residual networks, several experiments were conducted on different settings of weights and heights. It turns out that increasing the number of filters(increasing width) gave more positive influence to the model than making the model deeper.

Last but not least, simply averaging a few models with different parameter settings showed a significant increase in both top1 and top5 accuracy. The CIFAR dataset test results approached to 97.12% for CIFAR-10, and 84.19% for CIFAR-100 with only meanstd normalization.

Requirements

See the installation instruction for a step-by-step installation guide. See the server instruction for server setup.

$ luarocks install cutorch
$ luarocks install xlua
$ luarocks install optnet

Directions and datasets

Best Results

CIFAR-10's top1 accuracy reaches to 97.12% only with average ensembling without any weight adjustments.

Adapting weight adjustments for each model will promise a more improved accuracy.

You can see that the ensemble network improves the results of single WRNs.

Test error (%, random flip, meanstd normaliztion, median of 5 runs) on CIFAR:

DatasetnetworkTop1 Err(%)
CIFAR-10WRN-28x103.89
CIFAR-10Ensemble-WRN2.88
CIFAR-100WRN-28x1018.85
CIFAR-100Ensemble-WRN15.81

How to run

You can train each dataset of either cifar10, cifar100 or svhn by running the script below.

$ ./scripts/[:dataset]_train.sh

# For example, if you want to train the model on cifar10, you simply type
$ ./scripts/cifar10_train.sh

You can test your own trained model of either cifar10, cifar100, svhn by running the script below.

$ ./scripts/[:dataset]_test.sh

To ensemble your multiple trained models of different parameters, follow the steps below.

$ vi ensemble.lua
# Press :32 in vi, which will move your cursor to line 32
ens_depth         = torch.Tensor({28, 28, 28, 28, 40, 40, 40})
ens_widen_factor  = torch.Tensor({20, 20, 20, 20, 10, 14, 14})
ens_nExperiment   = torch.Tensor({ 2,  3,  4,  5,  5,  4,  5})

After you set each parameter for your models, open scripts/ensemble.sh

$ vi scripts/ensemble.sh
# on the second line
export dataset=[:dataset] # put the dataset you want to ensemble your models.
export mode=[:mode]       # you can either choose 'avg', 'min', 'max'

Finally, run the script file.

$ ./scripts/ensemble.sh

Implementation Details

epochlearning rateweight decayOptimizerMomentumNesterov
0 ~ 600.10.0005Momentum0.9true
61 ~ 1200.020.0005Momentum0.9true
121 ~ 1600.0040.0005Momentum0.9true
161 ~ 2000.00080.0005Momentum0.9true
epochlearning rateweight decayOptimizerMomentumNesterov
0 ~ 800.010.0005Momentum0.9true
81 ~ 1200.0010.0005Momentum0.9true
121 ~ 1600.00010.0005Momentum0.9true

CIFAR-10 Results

alt tag

Below is the result of the test set accuracy for CIFAR-10 dataset training.

Accuracy is the average of 5 runs

networkdropoutpreprocessGPU:0GPU:1per epochaccuracy(%)
pre-ResNet-10010meanstd--3 min 25 sec95.08
wide-resnet 28x100ZCA5.90G-2 min 03 sec95.84
wide-resnet 28x100meanstd5.90G-2 min 03 sec96.01
wide-resnet 28x100.3meanstd5.90G-2 min 03 sec96.19
wide-resnet 28x200.3meanstd8.13G6.93G4 min 10 sec96.52
wide-resnet 40x100.3meanstd8.08G-3 min 13 sec96.26
wide-resnet 40x140.3meanstd7.37G6.46G3 min 23 sec96.31

CIFAR-100 Results

alt tag

Below is the result of the test set accuracy for CIFAR-100 dataset training.

Accuracy is the average of 5 runs

networkdropoutpreprocessGPU:0GPU:1per epochTop1 acc(%)Top5 acc(%)
pre-ResNet-10010meanstd--3 min 25 sec77.2993.44
wide-resnet 28x100ZCA5.90G-2 min 03 sec80.0395.01
wide-resnet 28x100meanstd5.90G-2 min 03 sec81.0195.44
wide-resnet 28x100.3meanstd5.90G-2 min 03 sec81.4795.53
wide-resnet 28x200.3meanstd8.13G6.93G4 min 05 sec82.4396.02
wide-resnet 40x100.3meanstd8.93G-3 min 06 sec81.4795.65
wide-resnet 40x140.3meanstd7.39G6.46G3 min 23 sec81.8395.50

SVHN Results

alt tag

Below is the result of the test set accrucay for SVHN dataset training.

Accuracy is the result of 1 run

networkdropoutpreprocessGPU:0per epochTop1 acc(%)
wide-resnet 10x10.4meanstd0.91G1 min 37 sec93.815
wide-resnet 10x80.4meanstd2.03G7 min 32 sec97.411
wide-resnet 16x80.4meanstd2.92G14 min 8 sec98.229
wide-resnet 22x80.4meanstd3.73G21 min 11 sec98.348