Skip to content
A pytorch implementation of dorefa quantization
Python
Branch: master
Clone or download
Latest commit c26ddc7 Dec 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
models Delete .DS_Store Dec 2, 2019
utils 4x faster dali_dataloader Dec 6, 2019
LICENSE Initial commit Nov 27, 2019
README.md Update README.md Dec 6, 2019
cifar_train_eval.py 4x faster dali_dataloader Dec 6, 2019
imagenet_dali_loader.py 4x faster dali_dataloader Dec 6, 2019
imagenet_torch_loader.py 4x faster dali_dataloader Dec 6, 2019

README.md

Dorefa-net

A pytorch implementation of dorefa.The code is inspired by LaVieEnRoseSMZ and zzzxxxttt.

Requirements

  • python > 3.5
  • torch >= 1.1.0
  • torchvision >= 0.4.0
  • tb-nightly, future (for tensorboard)
  • nvidia-dali >= 0.12 (faster dataloader)

Cifar-10 Accuracy

Quantized model are trained from scratch

Model W_bit A_bit Acc
resnet-18 32 32 94.71%
resnet-18 4 4 94.36%
resnet-18 1 4 93.87%

ImageNet Accuracy

Quantized model are trained from scratch

Model W_bit A_bit Top1 Top5
resnet-18 32 32 69.80% 89.32%
resnet-18 8 8 ... ...

Usages

config your W_bit and A_bit in models/quant_dorefa.py

  • To train the model
python3 cifar_train_eval.py    or    python3 imagenet_dali_loader.py
  • To check the tensorboard log
tensorboard --logdir='your_log_dir'

from the command line and then navigating to https://localhost:6006 should show the following.

图片名称

To do

  • Train on imagenet2012
  • Fold bn
  • Test speedup from quantization and bn fold
  • Deploy models to embedded devices
  • ...
You can’t perform that action at this time.