Skip to content

Latest commit

 

History

History
77 lines (66 loc) · 2.22 KB

README.md

File metadata and controls

77 lines (66 loc) · 2.22 KB

Pytorch-XNOR-Net

Build

cd <Repository Root>/csrc/binop
make

MNIST

Usage

Train:

cd <Repository Root>/MNIST/
python3 main.py --arch Bin_LeNet
python3 main.py --arch LeNet

Evaluate:

cd <Repository Root>/MNIST/
python3 main.py --arch Bin_LeNet --evaluate --pretrained ./models/Bin_LeNet.best.pth # --no_cuda (Use CPU)
python3 main.py --arch LeNet --evaluate --pretrained ./models/LeNet.best.pth # --no_cuda (Use CPU)

Result

Network Accuracy Size
LeNet 99.50% 1.7 MB
Bin_LeNet 99.45% 102 KB

Cifar10

Usage

Train:

cd <Repository Root>/Cifar10/
python3 main.py --arch Bin_VGG16 #(11, 13, 16, 19)
python3 main.py --arch VGG16 #(11, 13, 16, 19)

Evaluate:

cd <Repository Root>/Cifar10/
python3 main.py --arch Bin_VGG16 --evaluate --pretrained ./models/Bin_VGG16.best.pth # --no_cuda (Use CPU)
python3 main.py --arch VGG16 --evaluate --pretrained ./models/VGG16.best.pth # --no_cuda (Use CPU)

Result

Network Accuracy Size  
VGG13 92.40% 37.7 MB
Bin_VGG13 88.74% 1.3 MB
VGG16 92.29% 59.0 MB
Bin_VGG16 87.78% 2.0 MB

Pre-trained models

Google Drive

Environment

Software

  • Ubuntu 16.04
  • Python 3.5
  • Pytorch 0.3.1
  • CUDA 8.0
  • gcc 5.4

Hardware

  • NVIDIA GTX 1080
  • Intel i5-6500 CPU @ 3.20GHz × 4

Reference