All Projects → he-y → Filter Pruning Geometric Median

he-y / Filter Pruning Geometric Median

Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration (CVPR 2019 Oral)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Filter Pruning Geometric Median

SViTE
[NeurIPS'21] "Chasing Sparsity in Vision Transformers: An End-to-End Exploration" by Tianlong Chen, Yu Cheng, Zhe Gan, Lu Yuan, Lei Zhang, Zhangyang Wang
Stars: ✭ 50 (-85.21%)
Mutual labels:  pruning, model-compression
Soft Filter Pruning
Soft Filter Pruning for Accelerating Deep Convolutional Neural Networks
Stars: ✭ 291 (-13.91%)
Mutual labels:  model-compression, pruning
Awesome Pruning
A curated list of neural network pruning resources.
Stars: ✭ 1,017 (+200.89%)
Mutual labels:  model-compression, pruning
Micronet
micronet, a model compression and deploy lib. compression: 1、quantization: quantization-aware-training(QAT), High-Bit(>2b)(DoReFa/Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference)、Low-Bit(≤2b)/Ternary and Binary(TWN/BNN/XNOR-Net); post-training-quantization(PTQ), 8-bit(tensorrt); 2、 pruning: normal、regular and group convolutional channel pruning; 3、 group convolution structure; 4、batch-normalization fuse for quantization. deploy: tensorrt, fp32/fp16/int8(ptq-calibration)、op-adapt(upsample)、dynamic_shape
Stars: ✭ 1,232 (+264.5%)
Mutual labels:  model-compression, pruning
Awesome Ai Infrastructures
Infrastructures™ for Machine Learning Training/Inference in Production.
Stars: ✭ 223 (-34.02%)
Mutual labels:  model-compression, pruning
Model Optimization
A toolkit to optimize ML models for deployment for Keras and TensorFlow, including quantization and pruning.
Stars: ✭ 992 (+193.49%)
Mutual labels:  model-compression, pruning
Regularization-Pruning
[ICLR'21] PyTorch code for our paper "Neural Pruning via Growing Regularization"
Stars: ✭ 44 (-86.98%)
Mutual labels:  pruning, model-compression
Paddleslim
PaddleSlim is an open-source library for deep model compression and architecture search.
Stars: ✭ 677 (+100.3%)
Mutual labels:  model-compression, pruning
Torch Pruning
A pytorch pruning toolkit for structured neural network pruning and layer dependency maintaining.
Stars: ✭ 193 (-42.9%)
Mutual labels:  model-compression, pruning
Kd lib
A Pytorch Knowledge Distillation library for benchmarking and extending works in the domains of Knowledge Distillation, Pruning, and Quantization.
Stars: ✭ 173 (-48.82%)
Mutual labels:  model-compression, pruning
Awesome Ml Model Compression
Awesome machine learning model compression research papers, tools, and learning material.
Stars: ✭ 166 (-50.89%)
Mutual labels:  model-compression, pruning
torch-model-compression
针对pytorch模型的自动化模型结构分析和修改工具集,包含自动分析模型结构的模型压缩算法库
Stars: ✭ 126 (-62.72%)
Mutual labels:  pruning, model-compression
DS-Net
(CVPR 2021, Oral) Dynamic Slimmable Network
Stars: ✭ 204 (-39.64%)
Mutual labels:  pruning, model-compression
ATMC
[NeurIPS'2019] Shupeng Gui, Haotao Wang, Haichuan Yang, Chen Yu, Zhangyang Wang, Ji Liu, “Model Compression with Adversarial Robustness: A Unified Optimization Framework”
Stars: ✭ 41 (-87.87%)
Mutual labels:  pruning, model-compression
allie
🤖 A machine learning framework for audio, text, image, video, or .CSV files (50+ featurizers and 15+ model trainers).
Stars: ✭ 93 (-72.49%)
Mutual labels:  model-compression
sparsify
Easy-to-use UI for automatically sparsifying neural networks and creating sparsification recipes for better inference performance and a smaller footprint
Stars: ✭ 138 (-59.17%)
Mutual labels:  pruning
nuxt-prune-html
🔌⚡ Nuxt module to prune html before sending it to the browser (it removes elements matching CSS selector(s)), useful for boosting performance showing a different HTML for bots/audits by removing all the scripts with dynamic rendering
Stars: ✭ 69 (-79.59%)
Mutual labels:  pruning
Yolov3v4 Modelcompression Multidatasettraining Multibackbone
YOLO ModelCompression MultidatasetTraining
Stars: ✭ 287 (-15.09%)
Mutual labels:  pruning
jp-ocr-prunned-cnn
Attempting feature map prunning on a CNN trained for Japanese OCR
Stars: ✭ 15 (-95.56%)
Mutual labels:  pruning
Deep-Compression.Pytorch
Unofficial Pytorch implementation of Deep Compression in CIFAR10
Stars: ✭ 29 (-91.42%)
Mutual labels:  pruning

Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration

i1

CVPR 2019 Oral.

Implementation with PyTorch. This implementation is based on soft-filter-pruning.

Table of Contents

Requirements

  • Python 3.6
  • PyTorch 0.3.1
  • TorchVision 0.3.0

Models and log files

The trained models with log files can be found in Google Drive. Specifically:

models for pruning ResNet on ImageNet

models for pruning ResNet on CIFAR-10

models for pruning VGGNet on CIFAR-10

models for ablation study

The pruned model without zeros, refer to this issue.

Training ResNet on ImageNet

Usage of Pruning Training

We train each model from scratch by default. If you wish to train the model with pre-trained models, please use the options --use_pretrain --lr 0.01.

Run Pruning Training ResNet (depth 152,101,50,34,18) on Imagenet:

python pruning_imagenet.py -a resnet152 --save_path ./snapshots/resnet152-rate-0.7 --rate_norm 1 --rate_dist 0.4 --layer_begin 0 --layer_end 462 --layer_inter 3  /path/to/Imagenet2012

python pruning_imagenet.py -a resnet101 --save_path ./snapshots/resnet101-rate-0.7 --rate_norm 1 --rate_dist 0.4 --layer_begin 0 --layer_end 309 --layer_inter 3  /path/to/Imagenet2012

python pruning_imagenet.py -a resnet50  --save_path ./snapshots/resnet50-rate-0.7 --rate_norm 1 --rate_dist 0.4 --layer_begin 0 --layer_end 156 --layer_inter 3  /path/to/Imagenet2012

python pruning_imagenet.py -a resnet34  --save_path ./snapshots/resnet34-rate-0.7 --rate_norm 1 --rate_dist 0.4 --layer_begin 0 --layer_end 105 --layer_inter 3  /path/to/Imagenet2012

python pruning_imagenet.py -a resnet18  --save_path ./snapshots/resnet18-rate-0.7 --rate_norm 1 --rate_dist 0.4 --layer_begin 0 --layer_end 57 --layer_inter 3  /path/to/Imagenet2012

Explanation:

Note1: rate_norm = 0.9 means pruning 10% filters by norm-based criterion, rate_dist = 0.2 means pruning 20% filters by distance-based criterion.

Note2: the layer_begin and layer_end is the index of the first and last conv layer, layer_inter choose the conv layer instead of BN layer.

Usage of Normal Training

Run resnet(100 epochs):

python original_train.py -a resnet50 --save_dir ./snapshots/resnet50-baseline  /path/to/Imagenet2012 --workers 36

Inference the pruned model with zeros

sh function/inference_pruned.sh

Inference the pruned model without zeros

The pruned model without zeros, refer to this issue.

Scripts to reproduce the results in our paper

To train the ImageNet model with / without pruning, see the directory scripts. Full script is here.

Training ResNet on Cifar-10

sh scripts/pruning_cifar10.sh

Please be care of the hyper-parameter layer_end for different layer of ResNet.

Reproduce ablation study of Cifar-10:

sh scripts/ablation_pruning_cifar10.sh

Training VGGNet on Cifar-10

Refer to the directory VGG_cifar.

Reproduce previous paper Pruning Filters for Efficient ConvNets

sh VGG_cifar/scripts/PFEC_train_prune.sh

Four function included in the script, including training baseline, pruning from pretrain, pruning from scratch, finetune the pruend

Our method

sh VGG_cifar/scripts/pruning_vgg_my_method.sh

Including pruning the pretrained, pruning the scratch.

Notes

Torchvision Version

We use the torchvision of 0.3.0. If the version of your torchvision is 0.2.0, then the transforms.RandomResizedCrop should be transforms.RandomSizedCrop and the transforms.Resize should be transforms.Scale.

Why use 100 epochs for training

This can improve the accuracy slightly.

Process of ImageNet dataset

We follow the Facebook process of ImageNet. Two subfolders ("train" and "val") are included in the "/path/to/ImageNet2012". The correspding code is here.

FLOPs Calculation

Refer to the file.

Citation

@inproceedings{he2019filter,
  title     = {Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration},
  author    = {He, Yang and Liu, Ping and Wang, Ziwei and Hu, Zhilan and Yang, Yi},
  booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year      = {2019}
}
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].