All Projects → Eric-mingjie → Network Slimming

Eric-mingjie / Network Slimming

Licence: mit
Network Slimming (Pytorch) (ICCV 2017)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Network Slimming

Robustness
Corruption and Perturbation Robustness (ICLR 2019)
Stars: ✭ 463 (-18.91%)
Mutual labels:  convolutional-neural-networks
Vnet.pytorch
A PyTorch implementation for V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation
Stars: ✭ 506 (-11.38%)
Mutual labels:  convolutional-neural-networks
Sketch simplification
Models and code related to sketch simplification of rough sketches.
Stars: ✭ 531 (-7.01%)
Mutual labels:  convolutional-neural-networks
Dropblock
Implementation of DropBlock: A regularization method for convolutional networks in PyTorch.
Stars: ✭ 466 (-18.39%)
Mutual labels:  convolutional-neural-networks
Tensorflow Book
Accompanying source code for Machine Learning with TensorFlow. Refer to the book for step-by-step explanations.
Stars: ✭ 4,448 (+678.98%)
Mutual labels:  convolutional-neural-networks
Convnet Drawer
Python script for illustrating Convolutional Neural Networks (CNN) using Keras-like model definitions
Stars: ✭ 516 (-9.63%)
Mutual labels:  convolutional-neural-networks
Food Recipe Cnn
food image to recipe with deep convolutional neural networks.
Stars: ✭ 448 (-21.54%)
Mutual labels:  convolutional-neural-networks
Trending Deep Learning
Top 100 trending deep learning repositories sorted by the number of stars gained on a specific day.
Stars: ✭ 543 (-4.9%)
Mutual labels:  convolutional-neural-networks
Regl Cnn
Digit recognition with Convolutional Neural Networks in WebGL
Stars: ✭ 490 (-14.19%)
Mutual labels:  convolutional-neural-networks
Mtcnn Pytorch
Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks
Stars: ✭ 531 (-7.01%)
Mutual labels:  convolutional-neural-networks
Eeglearn
A set of functions for supervised feature learning/classification of mental states from EEG based on "EEG images" idea.
Stars: ✭ 469 (-17.86%)
Mutual labels:  convolutional-neural-networks
Stn Ocr
Code for the paper STN-OCR: A single Neural Network for Text Detection and Text Recognition
Stars: ✭ 473 (-17.16%)
Mutual labels:  convolutional-neural-networks
Faced
🚀 😏 Near Real Time CPU Face detection using deep learning
Stars: ✭ 528 (-7.53%)
Mutual labels:  convolutional-neural-networks
Cnn lstm ctc ocr
Tensorflow-based CNN+LSTM trained with CTC-loss for OCR
Stars: ✭ 464 (-18.74%)
Mutual labels:  convolutional-neural-networks
Stanford Cs 230 Deep Learning
VIP cheatsheets for Stanford's CS 230 Deep Learning
Stars: ✭ 5,149 (+801.75%)
Mutual labels:  convolutional-neural-networks
Pba
Efficient Learning of Augmentation Policy Schedules
Stars: ✭ 461 (-19.26%)
Mutual labels:  convolutional-neural-networks
Tracking With Darkflow
Real-time people Multitracker using YOLO v2 and deep_sort with tensorflow
Stars: ✭ 515 (-9.81%)
Mutual labels:  convolutional-neural-networks
Fchd Fully Convolutional Head Detector
Code for FCHD - A fast and accurate head detector
Stars: ✭ 555 (-2.8%)
Mutual labels:  convolutional-neural-networks
Layer
Neural network inference the Unix way
Stars: ✭ 539 (-5.6%)
Mutual labels:  convolutional-neural-networks
Music recommender
Music recommender using deep learning with Keras and TensorFlow
Stars: ✭ 528 (-7.53%)
Mutual labels:  convolutional-neural-networks

Network Slimming (Pytorch)

This repository contains an official pytorch implementation for the following paper
Learning Efficient Convolutional Networks Through Network Slimming (ICCV 2017).
Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, Changshui Zhang.

Original implementation: slimming in Torch.
The code is based on pytorch-slimming. We add support for ResNet and DenseNet.

Citation:

@InProceedings{Liu_2017_ICCV,
    author = {Liu, Zhuang and Li, Jianguo and Shen, Zhiqiang and Huang, Gao and Yan, Shoumeng and Zhang, Changshui},
    title = {Learning Efficient Convolutional Networks Through Network Slimming},
    booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
    month = {Oct},
    year = {2017}
}

Dependencies

torch v0.3.1, torchvision v0.2.0

Channel Selection Layer

We introduce channel selection layer to help the pruning of ResNet and DenseNet. This layer is easy to implement. It stores a parameter indexes which is initialized to an all-1 vector. During pruning, it will set some places to 0 which correspond to the pruned channels.

Baseline

The dataset argument specifies which dataset to use: cifar10 or cifar100. The arch argument specifies the architecture to use: vgg,resnet or densenet. The depth is chosen to be the same as the networks used in the paper.

python main.py --dataset cifar10 --arch vgg --depth 19
python main.py --dataset cifar10 --arch resnet --depth 164
python main.py --dataset cifar10 --arch densenet --depth 40

Train with Sparsity

python main.py -sr --s 0.0001 --dataset cifar10 --arch vgg --depth 19
python main.py -sr --s 0.00001 --dataset cifar10 --arch resnet --depth 164
python main.py -sr --s 0.00001 --dataset cifar10 --arch densenet --depth 40

Prune

python vggprune.py --dataset cifar10 --depth 19 --percent 0.7 --model [PATH TO THE MODEL] --save [DIRECTORY TO STORE RESULT]
python resprune.py --dataset cifar10 --depth 164 --percent 0.4 --model [PATH TO THE MODEL] --save [DIRECTORY TO STORE RESULT]
python denseprune.py --dataset cifar10 --depth 40 --percent 0.4 --model [PATH TO THE MODEL] --save [DIRECTORY TO STORE RESULT]

The pruned model will be named pruned.pth.tar.

Fine-tune

python main.py --refine [PATH TO THE PRUNED MODEL] --dataset cifar10 --arch vgg --depth 19 --epochs 160

Results

The results are fairly close to the original paper, whose results are produced by Torch. Note that due to different random seeds, there might be up to ~0.5%/1.5% fluctation on CIFAR-10/100 datasets in different runs, according to our experiences.

CIFAR10

CIFAR10-Vgg Baseline Sparsity (1e-4) Prune (70%) Fine-tune-160(70%)
Top1 Accuracy (%) 93.77 93.30 32.54 93.78
Parameters 20.04M 20.04M 2.25M 2.25M
CIFAR10-Resnet-164 Baseline Sparsity (1e-5) Prune(40%) Fine-tune-160(40%) Prune(60%) Fine-tune-160(60%)
Top1 Accuracy (%) 94.75 94.76 94.58 95.05 47.73 93.81
Parameters 1.71M 1.73M 1.45M 1.45M 1.12M 1.12M
CIFAR10-Densenet-40 Baseline Sparsity (1e-5) Prune (40%) Fine-tune-160(40%) Prune(60%) Fine-tune-160(60%)
Top1 Accuracy (%) 94.11 94.17 94.16 94.32 89.46 94.22
Parameters 1.07M 1.07M 0.69M 0.69M 0.49M 0.49M

CIFAR100

CIFAR100-Vgg Baseline Sparsity (1e-4) Prune (50%) Fine-tune-160(50%)
Top1 Accuracy (%) 72.12 72.05 5.31 73.32
Parameters 20.04M 20.04M 4.93M 4.93M
CIFAR100-Resnet-164 Baseline Sparsity (1e-5) Prune (40%) Fine-tune-160(40%) Prune(60%) Fine-tune-160(60%)
Top1 Accuracy (%) 76.79 76.87 48.0 77.36 --- ---
Parameters 1.73M 1.73M 1.49M 1.49M --- ---

Note: For results of pruning 60% of the channels for resnet164-cifar100, in this implementation, sometimes some layers are all pruned and there would be error. However, we also provide a mask implementation where we apply a mask to the scaling factor in BN layer. For mask implementaion, when pruning 60% of the channels in resnet164-cifar100, we can also train the pruned network.

CIFAR100-Densenet-40 Baseline Sparsity (1e-5) Prune (40%) Fine-tune-160(40%) Prune(60%) Fine-tune-160(60%)
Top1 Accuracy (%) 73.27 73.29 67.67 73.76 19.18 73.19
Parameters 1.10M 1.10M 0.71M 0.71M 0.50M 0.50M

Contact

sunmj15 at gmail.com liuzhuangthu at gmail.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].