This repository contains the codes for training and testing Stocastic Quantization described in the paper "Learning Accurate Low-bit Deep Neural Networks with Stochastic Quantization" (BMVC 2017, Oral).
We implement our codes based on Caffe framework. Our codes can be used for training BWN (Binary Weighted Networks), TWN (Ternary Weighted Networks), SQ-BWN and SQ-TWN.
Please follow the standard installation of Caffe.
cd caffe/ make cd ..
Training and Testing
For CIFAR-10(100), we provide two network architectures VGG-9 and ResNet-56 (See details in the paper). For example, use the following commands to train ResNet-56:
For ImageNet, we provide AlexNet-BN and ResNet-18 network architectures. For example, use the following commands to train ResNet-18:
We add two more parameters in
inner_product_param, which are
sq means whether to use stochastic quantization (default to
ratio is the SQ ratio (default to 100).
Our codes can only run appropriately on GPU. CPU version should be further implemented.
Have fun to deploy your own low-bits DNNs!