| Full Precision<sup>[2](#ft2)</sup> | 32,32,32 | 40.3% |
| TTQ | t,32,32 | 42.0% |
| TTQ | t,32,32 | 42.0% |
| BWN | 1,32,32 | 44.6% |
| BWN | 1,32,32 | 44.6% |
| BNN | 1,1,32 | 51.9% |
| BNN | 1,1,32 | 51.9% |
| DoReFa | 1,2,32 | 46.6% |
| DoReFa | 1,2,32 | 46.6% |
| DoReFa | 1,2,6 | 46.8% |
| DoReFa | 1,2,6 | 46.8% |
| DoReFa | 1,2,4 | 54.0% |
| DoReFa | 1,2,4 | 54.0% |
These numbers were obtained by training on 8 GPUs with a total batch size of 256.
<aid="ft1">1</a>: These numbers were obtained by training on 8 GPUs with a total batch size of 256.
The DoReFa-Net models reach slightly better performance than our paper, due to
The DoReFa-Net models reach slightly better performance than our paper, due to
more sophisticated augmentations.
more sophisticated augmentations.
We hosted a demo at CVPR16 on behalf of Megvii, Inc, running a real-time 1/4-VGG size DoReFa-Net on ARM and half-VGG size DoReFa-Net on FPGA.
<aid="ft2">2</a>: Not directly comparable with the original AlexNet. Check out
We're not planning to release our C++ runtime for bit-operations.
[../ImageNetModels](../ImageNetModels) for a more faithful implementation of the original AlexNet.
In this repo, quantized operations are all performed through `tf.float32`.
Pretrained model for (1,4,32)-ResNet18 and (1,2,6)-AlexNet are available at
## Speed:
[tensorpack model zoo](http://models.tensorpack.com/DoReFa-Net/).
__DoReFa-Net works on mobile and FPGA!__
They're provided in the format of numpy dictionary.
We hosted a demo at CVPR16 on behalf of Megvii, Inc, running a 1/4-VGG size DoReFa-Net on a phone and a half-VGG size DoReFa-Net on an FPGA, in real time.
The __binary-weight 4-bit-activation ResNet-18__ model has 59.2% top-1 validation accuracy.
DoReFa-Net and its variants have been deployed widely in Megvii's embeded products.
Alternative link to this page: [http://dorefa.net](http://dorefa.net)
This code release is meant for research purpose. We're not planning to release our C++ runtime for bit-operations.
In this implementation, quantized operations are all performed through `tf.float32`.
## Use
## Use
...
@@ -43,6 +46,12 @@ Alternative link to this page: [http://dorefa.net](http://dorefa.net)
...
@@ -43,6 +46,12 @@ Alternative link to this page: [http://dorefa.net](http://dorefa.net)
+ Look at the docstring in `*-dorefa.py` to see detailed usage and performance.
+ Look at the docstring in `*-dorefa.py` to see detailed usage and performance.
Pretrained model for (1,4,32)-ResNet18 and (1,2,6)-AlexNet are available at
[tensorpack model zoo](http://models.tensorpack.com/DoReFa-Net/).
They're provided in the format of numpy dictionary.
The __binary-weight 4-bit-activation ResNet-18__ model has 59.2% top-1 validation accuracy.
## Support
## Support
Please use [github issues](https://github.com/tensorpack/tensorpack/issues) for any issues related to the code itself.
Please use [github issues](https://github.com/tensorpack/tensorpack/issues) for any issues related to the code itself.