chuanqi305 / MobileNet-SSD

Caffe implementation of Google MobileNet SSD detection network, with pretrained weights on VOC0712 and mAP=0.727.
MIT License
2.03k stars 1.18k forks source link

Converting classification model from tensorflow to caffe #32

Open MayankSingal opened 7 years ago

MayankSingal commented 7 years ago

Hello! I have been trying to train mobilenet-ssd on my own using the method described by you. However I have been facing a lot of issues while importing the weights learnt by tensorflow-mobilenet into a working caffemodel. Can you please let me know of the procedure that you followed while converting the classifier MobileNet checkpoint from tensorflow to a working caffemodel? I have imported the weights into caffe and tried running the caffemodel but the activations turn to NaNs after a certain layer. I think there is a problem with importing batchnorm/scale layer weights but I haven't been able to pinpoint the problem yet. Thank you!

samuel1208 commented 7 years ago

@MayankSingal I have the same problem. Have you solved it?

chuanqi305 commented 7 years ago

@MayankSingal @samuel1208 First I converted the tensorflow weights to numpy format, and then loaded it into caffemodel. See my meger_bn.py to find how to load a numpy data into caffemodel. The converting program is not universal.

MayankSingal commented 7 years ago

@chuanqi305 Thank you for the suggestion. I was able to do what you wrote in the comment but it seems that my problem is related to exporting the batch_normalization layer weights to caffe. More specifically, how do I import the tensorflow batch-norm layer weights into the bn and scale layers of caffe. Can you suggest a method to do this?