allenai / XNOR-Net

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

Run pre-trained Xnor model failed #8

Open andyhahaha opened 7 years ago

andyhahaha commented 7 years ago

I follow the ReadMe to test pre-trained model. I get accuracy %56.8 from alexnet_BWN, but i only get %10 on alexnet_XNOR. Did I make something wrong? Is there anyone has this problem?

mrastegari commented 7 years ago

No one had this problem before. Is this 10% on the pre-trained model?

andyhahaha commented 7 years ago

Yes. I run on the pre-trained model. This is my command XNOR th main.lua -data /media/VSlab3/ILSVRC14/imagenet_andyhaha -nGPU 4 -batchSize 800 -netType alexnetxnor -binaryWeight -epochSize 1500 -retrain alexnet_XNOR.t7 -testOnly

BWN th main.lua -data /media/VSlab3/ILSVRC14/imagenet_andyhaha -nGPU 1 -netType alexnet -binaryWeight -retrain alexnet_BWN.t7 -testOnly -batchSize 128

The BWN pre-trained model get the right accuracy, so the data preprocessing should be right. Why I can't get 43.3% on XNOR?

andyhahaha commented 7 years ago

I found that I can get right accuracy 43.24% when I use only one GPU (-nGPU 1) on XNOR. Maybe there is something wrong when GPUs communicate with each other. I haven't figure out.

mrastegari commented 7 years ago

Yes, make sure that your mainboard and GPUs are compatible. You can simply try to see if you can train alexnet on multi GPUs.

andyhahaha commented 7 years ago

I use CUDA_VISIBLE_DEVICES=1,5,6,7 to choose which GPU to use. I have 8 GPU on my computer. I try different combination of GPUs. Some get the right accuracy, some get lower accuracy. I can train alexnet by running imagenet-multiGPU.torch, so I think my mainboard and GPUs are compatible.

mrastegari commented 7 years ago

No use this code for BWN without "-binaryWeight" flag and with "-nGPU 4". If you can not train this it means that your GPU set up has some problem.

yanyongluan commented 7 years ago

I also have the same problem. I follow the README to test models on pre-trained model. However, I only get 52.8% top1 accuracy from alexnet_BWN, and 38% top1 accuracy from alexnet_XNOR many times. I wonder why I can't get the results you mentioned.

mrastegari commented 7 years ago

In your first message you said you got the 56.8 for alexnet_BWN. How come that dropped now? Maybe same issue resolves the alexnet_XNOR in your machine? Have you verified my previous message about training BWN without "-binaryWeghit"flag and "-nGPU 4"?

yanyongluan commented 7 years ago

I'm not the issue proposer. I just meet the similar problem. For more detailed about this, I just download this code, pre-trained model, and ILSVRC2012 validation dataset, and want to reproduce this experiment for my further study. I just run the command 'th main.lua -nGPU 2 -binaryWeight -retrain ./pre-trained/alexnet_BWN.t7 -testOnly', but I still get 52.8% top 1 accuracy from alexnet_BWN.

mrastegari commented 7 years ago

Have you done the same pre-processing as I mentioned in the README?