allenai / XNOR-Net

ImageNet classification using binary Convolutional Neural Networks
https://xnor.ai/
Other
856 stars 239 forks source link

XNOR-Net in Caffe #19

Open gombru opened 7 years ago

gombru commented 7 years ago

Is there any implementation of XNOR-Net in Caffe? I'm very interested to embed a net in a phone.

deepsemantic commented 7 years ago

Hi, here I found the implemenation of XNOR-Net in Caffe: https://github.com/loswensiana/BWN-XNOR-caffe. I am currently trying that, can you share your results on cifar10 after you tried it.

gombru commented 7 years ago

Thank you, I will!

gleybo commented 7 years ago

Hi, were you able to get it to work on Caffe?

gombru commented 7 years ago

I haven't had the chance to try it :(

gleybo commented 7 years ago

thanks :)

leoagueci commented 7 years ago

Hi, did someone find out how to compile this caffe version? The new defined layers (BinActive etc..) which version of cuDNN and CUDA require? Thanks

siftr commented 7 years ago

I tried the caffe verison mentioned above on cifar10. Well the accuracy achieved is ~75% same as original cifar10 trained on simple convolution using Caffe. But I am quite disappointed with the prediction time of single image. prediction time of Image on original architecture of cifar10 - ~38ms prediction time of Image on BWN-convolution architecture of cifar10 - ~77ms

I expected the prediction time of BWN-convolution to be less than the convolutional network but it didn't achieve that. :(

michaelholm-ce commented 7 years ago

I am having a similar experience as @siftr:

Prediction time for original caffe architecture: 39sec/10K-images Prediction time for trained xnor-net model: 49sec/10K-images.

If there is something I'm missing here, I would appreciate any advice, as I was hoping for a big speed-up based on the paper.

renebow commented 7 years ago

Why is this caffe implementation different from what I was familiar with? For example, I had a squeezenet.prototxt. It was something like this.

please cite:

@article{SqueezeNet,

Author = {Forrest N. Iandola and Matthew W. Moskewicz and Khalid Ashraf and Song Han and William J. Dally and Kurt Keutzer},

Title = {SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and $<$1MB model size},

Journal = {arXiv:1602.07360},

Year = {2016}

}

input: "data" input_shape { dim: 1 dim: 3 dim: 227 dim: 227 } layer { name: "conv1" type: "Convolution" bottom: "data" top: "conv1" convolution_param { num_output: 64 kernel_size: 3 stride: 2 } } layer { name: "relu_conv1" type: "ReLU" bottom: "conv1" top: "conv1" } layer { name: "pool1" type: "Pooling" bottom: "conv1" top: "pool1" pooling_param { pool: MAX kernel_size: 3 stride: 2 } } layer { name: "fire2/squeeze1x1" type: "Convolution" bottom: "pool1" top: "fire2/squeeze1x1" convolution_param { num_output: 16 kernel_size: 1 } } ...

Tyler-D commented 7 years ago

@siftr @michaelholm-ce that caffe version is just a simulation of XNOR-NET using single precision operators. You can find that the computation in binary_conv_layer.cu is almost the same as cudnn_conv_layer.cu.

zfc929 commented 6 years ago

I detect face base on MTCNN ,CAFFE version Prediction time 60ms/image using openblas,when I chang Conv to BinconvConv and modify binaryconv code ,prediction time 50ms/image , How to modify the code to increase the speed by 50%