All Projects → yihui-he → Channel Pruning

yihui-he / Channel Pruning

Licence: mit
Channel Pruning for Accelerating Very Deep Neural Networks (ICCV'17)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Channel Pruning

Iresnet
Improved Residual Networks (https://arxiv.org/pdf/2004.04989.pdf)
Stars: ✭ 163 (-83.35%)
Mutual labels:  deep-neural-networks, image-classification, image-recognition
Saliency
TensorFlow implementation for SmoothGrad, Grad-CAM, Guided backprop, Integrated Gradients and other saliency techniques
Stars: ✭ 648 (-33.81%)
Mutual labels:  object-detection, deep-neural-networks, image-recognition
Tensorflow2.0 Examples
🙄 Difficult algorithm, Simple code.
Stars: ✭ 1,397 (+42.7%)
Mutual labels:  object-detection, deep-neural-networks, image-classification
Dmsmsgrcg
A photo OCR project aims to output DMS messages contained in sign structure images.
Stars: ✭ 18 (-98.16%)
Mutual labels:  object-detection, image-classification, image-recognition
Computer Vision Guide
📖 This guide is to help you understand the basics of the computerized image and develop computer vision projects with OpenCV. Includes Python, Java, JavaScript, C# and C++ examples.
Stars: ✭ 244 (-75.08%)
Mutual labels:  object-detection, deep-neural-networks, image-classification
Yolo Tf2
yolo(all versions) implementation in keras and tensorflow 2.4
Stars: ✭ 695 (-29.01%)
Mutual labels:  object-detection, deep-neural-networks
Imageai
A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
Stars: ✭ 6,734 (+587.84%)
Mutual labels:  object-detection, image-recognition
Cvpr2021 Paper Code Interpretation
cvpr2021/cvpr2020/cvpr2019/cvpr2018/cvpr2017 论文/代码/解读/直播合集,极市团队整理
Stars: ✭ 8,075 (+724.82%)
Mutual labels:  object-detection, image-classification
Kur
Descriptive Deep Learning
Stars: ✭ 811 (-17.16%)
Mutual labels:  deep-neural-networks, image-recognition
Photonix
This is a new web-based photo management application. Run it on your home server and it will let you find the right photo from your collection on any device. Smart filtering is made possible by object recognition, location awareness, color analysis and other ML algorithms.
Stars: ✭ 592 (-39.53%)
Mutual labels:  object-detection, image-recognition
Ailab
Experience, Learn and Code the latest breakthrough innovations with Microsoft AI
Stars: ✭ 6,896 (+604.39%)
Mutual labels:  object-detection, image-classification
Albumentations
Fast image augmentation library and an easy-to-use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about the library: https://www.mdpi.com/2078-2489/11/2/125
Stars: ✭ 9,353 (+855.36%)
Mutual labels:  object-detection, image-classification
Tensorflow object counting api
🚀 The TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems!
Stars: ✭ 956 (-2.35%)
Mutual labels:  object-detection, deep-neural-networks
Bmw Tensorflow Training Gui
This repository allows you to get started with a gui based training a State-of-the-art Deep Learning model with little to no configuration needed! NoCode training with TensorFlow has never been so easy.
Stars: ✭ 736 (-24.82%)
Mutual labels:  object-detection, deep-neural-networks
Tf trt models
TensorFlow models accelerated with NVIDIA TensorRT
Stars: ✭ 621 (-36.57%)
Mutual labels:  object-detection, image-classification
Quickdraw
Implementation of Quickdraw - an online game developed by Google
Stars: ✭ 805 (-17.77%)
Mutual labels:  deep-neural-networks, image-classification
Image classification cifar 10
Image Classification on CIFAR-10 Dataset using Multi Layer Perceptrons in Python from Scratch.
Stars: ✭ 18 (-98.16%)
Mutual labels:  deep-neural-networks, image-classification
Medicaldetectiontoolkit
The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.
Stars: ✭ 917 (-6.33%)
Mutual labels:  object-detection, deep-neural-networks
Pytorch Toolbelt
PyTorch extensions for fast R&D prototyping and Kaggle farming
Stars: ✭ 942 (-3.78%)
Mutual labels:  object-detection, image-classification
Tracking With Darkflow
Real-time people Multitracker using YOLO v2 and deep_sort with tensorflow
Stars: ✭ 515 (-47.4%)
Mutual labels:  object-detection, deep-neural-networks

Channel Pruning for Accelerating Very Deep Neural Networks

ICCV 2017, by Yihui He, Xiangyu Zhang and Jian Sun

Please have a look our new works on compressing deep models:

In this repository, we released code for the following models:

model Speed-up Accuracy
VGG-16 channel pruning 5x 88.1 (Top-5), 67.8 (Top-1)
VGG-16 3C1 4x 89.9 (Top-5), 70.6 (Top-1)
ResNet-50 2x 90.8 (Top-5), 72.3 (Top-1)
faster RCNN 2x 36.7 ([email protected]:.05:.95)
faster RCNN 4x 35.1 ([email protected]:.05:.95)
1 3C method combined spatial decomposition (Speeding up Convolutional Neural Networks with Low Rank Expansions) and channel decomposition (Accelerating Very Deep Convolutional Networks for Classification and Detection) (mentioned in 4.1.2)
i2 i1
Structured simplification methods Channel pruning (d)

Citation

If you find the code useful in your research, please consider citing:

@InProceedings{He_2017_ICCV,
author = {He, Yihui and Zhang, Xiangyu and Sun, Jian},
title = {Channel Pruning for Accelerating Very Deep Neural Networks},
booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
month = {Oct},
year = {2017}
}

Contents

  1. Requirements
  2. Installation
  3. Channel Pruning and finetuning
  4. Pruned models for download
  5. Pruning faster RCNN
  6. FAQ

requirements

  1. Python3 packages you might not have: scipy, sklearn, easydict, use sudo pip3 install to install.
  2. For finetuning with 128 batch size, 4 GPUs (~11G of memory)

Installation (sufficient for the demo)

  1. Clone the repository

    # Make sure to clone with --recursive
    git clone --recursive https://github.com/yihui-he/channel-pruning.git
    
  2. Build my Caffe fork (which support bicubic interpolation and resizing image shorter side to 256 then crop to 224x224)

    cd caffe
    
    # If you're experienced with Caffe and have all of the requirements installed, then simply do:
    make all -j8 && make pycaffe
    # Or follow the Caffe installation instructions here:
    # http://caffe.berkeleyvision.org/installation.html
    
    # you might need to add pycaffe to PYTHONPATH, if you've already had a caffe before
    
  3. Download ImageNet classification dataset http://www.image-net.org/download-images

  4. Specify imagenet source path in temp/vgg.prototxt (line 12 and 36)

Channel Pruning

For fast testing, you can directly download pruned model. See next section

  1. Download the original VGG-16 model http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel
    move it to temp/vgg.caffemodel (or create a softlink instead)

  2. Start Channel Pruning

    python3 train.py -action c3 -caffe [GPU0]
    # or log it with ./run.sh python3 train.py -action c3 -caffe [GPU0]
    # replace [GPU0] with actual GPU device like 0,1 or 2
    
  3. Combine some factorized layers for further compression, and calculate the acceleration ratio. Replace the ImageData layer of temp/cb_3c_3C4x_mem_bn_vgg.prototxt with temp/vgg.prototxt's

    ./combine.sh | xargs ./calflop.sh
    
  4. Finetuning

    caffe train -solver temp/solver.prototxt -weights temp/cb_3c_vgg.caffemodel -gpu [GPU0,GPU1,GPU2,GPU3]
    # replace [GPU0,GPU1,GPU2,GPU3] with actual GPU device like 0,1,2,3
    
  5. Testing

    Though testing is done while finetuning, you can test anytime with:

    caffe test -model path/to/prototxt -weights path/to/caffemodel -iterations 5000 -gpu [GPU0]
    # replace [GPU0] with actual GPU device like 0,1 or 2
    

Pruned models (for download)

For fast testing, you can directly download pruned model from release: VGG-16 3C 4X, VGG-16 5X, ResNet-50 2X. Or follow Baidu Yun Download link

Test with:

caffe test -model channel_pruning_VGG-16_3C4x.prototxt -weights channel_pruning_VGG-16_3C4x.caffemodel -iterations 5000 -gpu [GPU0]
# replace [GPU0] with actual GPU device like 0,1 or 2

Pruning faster RCNN

For fast testing, you can directly download pruned model from release
Or you can:

  1. clone my py-faster-rcnn repo: https://github.com/yihui-he/py-faster-rcnn
  2. use the pruned models from this repo to train faster RCNN 2X, 4X, solver prototxts are in https://github.com/yihui-he/py-faster-rcnn/tree/master/models/pascal_voc

FAQ

You can find answers of some commonly asked questions in our Github wiki, or just create a new issue

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].