uhfband / keras2caffe

Keras to Caffe model converter tool
MIT License
67 stars 22 forks source link

result error #15

Open to-be-snail opened 5 years ago

to-be-snail commented 5 years ago

I have tried convert_vgg.py and make a test,found that the result of keras model is different with the result of caffemodel, can you tell me why?

uhfband commented 5 years ago

What do you mean as different result? Wrong class prediction?

to-be-snail commented 5 years ago

yeah,the prob and prediction is different. In addition,when I convert a unet keras model to caffe model ,also get the wrong result,so I trying to observe the intermediate layer output and found the output of the first conv of caffe model and keras model is different?I'm very confused,Thanks for your reply

to-be-snail commented 5 years ago

What do you mean as different result? Wrong class prediction?

yeah,the prob and prediction is different. In addition,when I convert a unet keras model to caffe model ,also get the wrong result,so I trying to observe the intermediate layer output and found the output of the first conv of caffe model and keras model is different?I'm very confused,Thanks for your reply

uhfband commented 5 years ago

The small difference is present due to layers different implementation in tf and caffe, as noted here #3. But overall Keras VGG16 model conversion works well for me and gives correct prediction. Please see examples/VGG16/convert.py

to-be-snail commented 5 years ago

The small difference is present due to layers different implementation in tf and caffe, as noted here #3. But overall Keras VGG16 model conversion works well for me and gives correct prediction. Please see examples/VGG16/convert.py

Thank you!But how can I solve this problem?Modify the source code? I have tried the examples/VGG16/convert.py and the result is image I'm not sure this is the correct answer

uhfband commented 5 years ago

Which Keras and caffe version are you using?

to-be-snail commented 5 years ago

using

I'm using keras2.2.4,the backend is tensorflow 1.9.0, caffe is 1.0 and built on python3.6

uhfband commented 5 years ago

With Keras (2.2.4), tensorflow CPU (1.9.0), numpy (1.16.2), opencv-python (4.0.0.21) and the latest bvlc-caffe, I got right output 0.8001104 294 n02132136 brown bear, bruin, Ursus arctos