Git Product home page Git Product logo

ranet-pytorch's Introduction

Resolution Adaptive Networks for Efficient Inference (CVPR2020)

Le Yang*, Yizeng Han*, Xi Chen*, Shiji Song, Jifeng Dai, Gao Huang

This repository contains the implementation of the paper, 'Resolution Adaptive Networks for Efficient Inference'. The proposed Resolution Adaptive Networks (RANet) conduct the adaptive inferece by exploiting the spatial redundancy of input images. Our motivation is that low-resolution representations are sufficient for classifying easy samples containing large objects with prototypical features, while only some hard samples need spatially detailed information, which can be demonstrated by the follow figure.

Results

Accuracy (top-1) of anytime prediction models as a function of computational budget on the CIFAR-10 (left), CIFAR-100 (middle) and ImageNet (right) datasets. Higher is better.

Accuracy (top-1) of budgeted batch classification models as a function of average computational budget per image the on CIFAR- 10 (left), CIFAR-100 (middle) and ImageNet (right) datasets. Higher is better.

Dependencies:

  • Python3

  • PyTorch >= 1.0

Usage

We Provide shell scripts for training a RANet on CIFAR and ImageNet.

Train a RANet on CIFAR

  • Modify the train_cifar.sh to config your path to the dataset, your GPU devices and your saving directory. Then run
bash train_cifar.sh
  • You can train your RANet with other configurations.
python main.py --arch RANet --gpu '0' --data-root YOUR_DATA_PATH --data 'cifar10' --step 2 --nChannels 16 --stepmode 'lg' --scale-list '1-2-3' --grFactor '4-2-1' --bnFactor '4-2-1'

Train a RANet on ImageNet

  • Modify the train_imagenet.sh to config your path to the dataset, your GPU devices and your saving directory. Then run
bash train_imagenet.sh
  • You can train your RANet with other configurations.
python main.py --arch RANet --gpu '0,1,2,3' --data-root YOUR_DATA_PATH --data 'ImageNet' --step 8 --growthRate 16 --nChannels 32 --stepmode 'even' --scale-list '1-2-3-4' --grFactor '4-2-2-1' --bnFactor '4-2-2-1'

Citation

If you find this work useful or use our codes in your own research, please use the following bibtex:

@inproceedings{yang2020resolution,
  title={Resolution Adaptive Networks for Efficient Inference},
  author={Yang, Le and Han, Yizeng and Chen, Xi and Song, Shiji and Dai, Jifeng and Huang, Gao},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  year={2020}
}

Contact

If you have any questions, please feel free to contact the authors. Le Yang: [email protected]

Acknowledgments

We use the pytorch implementation of MSDNet in our experiments. The code can be found here.

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.