Jzz24 / pytorch_quantization

A pytorch implementation of dorefa quantization
MIT License
110 stars 11 forks source link
bn-fold dorefa imagenet nvidia-dali quantization resnet

Dorefa-net

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

Requirements

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 4 4 66.60% 87.15%

Usages

Download the ImageNet dataset and move validation images to labeled subfolders.To do this, you can use the following script

Model on CPU before fuse after fuse
resnet-18 0.74 s 0.51 s
resnet-34 1.41 s 0.92 s
resnet-50 1.96 s 1.02 s

To do