Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
zonghuia 8254897e60 | 11 months ago | |
---|---|---|
CIFAR_10 | 11 months ago | |
ImageNet | 11 months ago | |
MNIST | 11 months ago | |
notes | 11 months ago | |
.gitignore | 11 months ago | |
README.md | 11 months ago |
This a PyTorch implementation of the XNOR-Net. I implemented Binarized Neural Network (BNN) for:
Dataset | Network | Accuracy | Accuracy of floating-point |
---|---|---|---|
MNIST | LeNet-5 | 99.23% | 99.34% |
CIFAR-10 | Network-in-Network (NIN) | 86.28% | 89.67% |
ImageNet | AlexNet | Top-1: 44.87% Top-5: 69.70% | Top-1: 57.1% Top-5: 80.2% |
I implemented the LeNet-5 structure for the MNIST dataset. I am using the dataset reader provided by torchvision. To run the training:
$ cd <Repository Root>/MNIST/
$ python main.py
Pretrained model can be downloaded here. To evaluate the pretrained model:
$ cp <Pretrained Model> <Repository Root>/MNIST/models/
$ python main.py --pretrained models/LeNet_5.best.pth.tar --evaluate
I implemented the NIN structure for the CIFAR-10 dataset. You can download the training and validation datasets here and uncompress the .zip file. To run the training:
$ cd <Repository Root>/CIFAR_10/
$ ln -s <Datasets Root> data
$ python main.py
Pretrained model can be downloaded here. To evaluate the pretrained model:
$ cp <Pretrained Model> <Repository Root>/CIFAR_10/models/
$ python main.py --pretrained models/nin.best.pth.tar --evaluate
I implemented the AlexNet for the ImageNet dataset.
The training supports torchvision.
If you have installed Caffe, you can download the preprocessed dataset here and uncompress it.
To set up the dataset:
$ cd <Repository Root>/ImageNet/networks/
$ ln -s <Datasets Root> data
To train the network:
$ cd <Repository Root>/ImageNet/networks/
$ python main.py # add "--caffe-data" if you are training with the Caffe dataset
The pretrained models can be downloaded here: pretrained with Caffe dataset; pretrained with torchvision. To evaluate the pretrained model:
$ cp <Pretrained Model> <Repository Root>/ImageNet/networks/
$ python main.py --resume alexnet.baseline.pth.tar --evaluate # add "--caffe-data" if you are training with the Caffe dataset
The training log can be found here: log - Caffe dataset; log - torchvision.
In the paper, the gradient in backward after the scaled sign function is
However, this equation is actually inaccurate. The correct backward gradient should be
Details about this correction can be found in the notes (section 1).
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》