keras2caffe icon indicating copy to clipboard operation
keras2caffe copied to clipboard

result error

Open to-be-snail opened this issue 6 years ago • 8 comments

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?

to-be-snail avatar Feb 23 '19 10:02 to-be-snail

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

uhfband avatar Feb 24 '19 14:02 uhfband

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 avatar Feb 25 '19 02:02 to-be-snail

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

to-be-snail avatar Feb 27 '19 07:02 to-be-snail

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

uhfband avatar Feb 27 '19 08:02 uhfband

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

to-be-snail avatar Feb 28 '19 07:02 to-be-snail

Which Keras and caffe version are you using?

uhfband avatar Feb 28 '19 08:02 uhfband

using

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

to-be-snail avatar Feb 28 '19 08:02 to-be-snail

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

uhfband avatar Mar 02 '19 12:03 uhfband