Coder Social home page Coder Social logo

aal-pruning's Introduction

Filter Pruning for Deep Convolutional Neural Networks via Auxiliary Attention

Implementation with PyTorch.

Requirements

  • Python 3.6
  • PyTorch 1.3.1
  • TorchVision 0.4.2

Dataset prepare

ImageNet

Download the ImageNet dataset from here. No need to split the val set into corresponding folders because we provide api codes to load data:

from mydataset.imagenet_dataset import ImageNetDataset

CIFAR10

Use torchvision.datasets.CIFAR10()

Train original model from scratch

python main_resnet_imagenet_org_multigpu.py --model resnet --depth 50 -b 256 -j 16 --gpus 0,1 --epoch 100 
python main_resnet_cifar10_org.py --model resnet --depth 56 -b 256 -j 8 --gpus 0 --epoch 200

Train a pruned model with AAL

  • Train each model from scratch by default.
python prune_resnet_imagenet_multigpu.py --model resnet_bnat --depth 50 -b 256 -j 16 --gpus 0,1 --epoch 100 
python prune_resnet_ciafr10.py --model resnet_bnat --depth 56 -b 256 -j 8 --gpus 0 --epoch 200            
  • Generate a pruned model.
    • resnet18/resnet34 get_imagenet_small_resnet18_34.py
    • resnet50/resnet101 get_imagenet_small_resnet50_101.py
    • resnet_cifar10_20/resnet_cifar10_32/resnet_cifar10_56/resnet_cifar10_110 get_cifar10_small_resnet.py
python get_imagenet_small_resnet18_34.py --model resnet_bnat --depth 18 --get_small --resume [path to the model with AAL]
python get_imagenet_small_resnet50_101.py --model resnet_bnat --depth 50 --get_small --resume [path to the model with AAL]
python get_cifar10_small_resnet.py --model resnet_bnat --depth 56 --get_small --resume [path to the model with AAL]

aal-pruning's People

Contributors

emily0219 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.