/msgc

Source code of our TNNLS paper "Boosting Convolutional Neural Networks with Middle Spectrum Grouped Convolution"

Primary LanguagePythonOtherNOASSERTION

Middle Spectrum Grouped Convolution (MSGC)

This repository contains the PyTorch implementation for Boosting Convolutional Neural Networks with Middle Spectrum Grouped Convolution by Zhuo Su, Jiehua Zhang, Tianpeng Liu, Zhen Liu, Shuanghui Zhang, Matti Pietikäinen, and Li Liu (corresponding author).

Running environment

Ubuntu 18.04 system + cuda 11.1 and cudnn 8.2.1 + Pytorch 1.9 + python 3.9

Other versions may also work~ :)

Performance

The performances of MSGC equipped models (on ImageNet) are listed below. The checkpoints of our trained models can be downloaded at link to our trained models. For evaluation, please unzip the checkpoints to folder checkpoints. The evaluation scripts to reproduce the following results can be found in scripts.sh.

Model Attention Top-1 (%) Top-5 (%) MAC Training script Training log
ResNet-18 - 69.76 89.08 1817 M - -
ResNet-18 + MSGC 70.30 89.27 883 M script log
ResNet-18 + MSGC 71.51 90.21 885 M script log
ResNet-18 + MSGC 72.33 90.53 1630 M script log
ResNet-50 - 76.13 92.86 4099 M - -
ResNet-50 + MSGC 77.20 93.37 1886 M script log
ResNet-50 + MSGC 76.76 92.99 1892 M script log
MobileNetV2 - 71.88 90.27 307 M - -
MobileNetV2 + MSGC 72.10 90.41 198 M script log
MobileNetV2 + MSGC 72.59 90.82 197 M script log
CondenseNet - 73.80 91.70 529 M - -
CondenseNet + MSGC 74.81 92.17 523 M script log

Training

An example script for training on two gpus is:

CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch \
--master_port=12345 \
--nproc_per_node=2 \
main_dist.py \
--model msgc_resnet18 \
--attention \
-j 16 \
--data imagenet \
--datadir /to/imagenet/dataset \
--savedir ./results \
--resume \
--target 0.5

The above script trains the MSGC equipped ResNet-18 architecture with a target MAC reduction of 50%.
Other training scripts can be seen in scripts.sh.

For more detailed illustraion of the training set up, please refer to main_dist.py, or run:

python main_dist.py -h

Acknowledgement

The coding is inspired by: