4

I trained the MobileNetSSD for object detection. I used object detection API from tensorflow models: https://github.com/tensorflow/models/tree/master/research/object_detection

How to use (how to export) my trained model in opencv dnn? I had tried use this guide:

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/exporting_models.md

But this method proably is not do for opencv.

  • Use "readNetFromTensorflow"... see the full example at https://github.com/opencv/opencv/blob/master/samples/dnn/tf_inception.cpp – Miki Sep 25 '17 at 12:37
  • Yeah, i know this function. But I need to understand how to correctly export the model from tensorflow. I apparently incorrectly formulated the question. – Юрий Турчин Sep 25 '17 at 12:40
  • What's the original format of the tensorflow model? (sorry, but I never tensorflow...). If it's a "pb" (protobuffer) you don't need to export anything, just load it in opencv with "readNetFromTensorflow" – Miki Sep 25 '17 at 13:13
  • Yes, it's pb-file. But opencv get error, when i import this file: "Unknown layer type Cast in op ToFloat in function populateNet". Like [here](https://stackoverflow.com/questions/46386618/opencv3-3-dnn-readnetfromtensorflow-cannot-load-the-module) Therefore, I think that need some preprocessing of the model is necessary before it will be loaded into opencv. – Юрий Турчин Sep 25 '17 at 13:21
  • You're [not alone](https://stackoverflow.com/q/46386618/5008845). I don't think any export operation is needed... You'd better ask also on answers.opencv to get a response from opencv's developers. Good luck – Miki Sep 25 '17 at 13:24
  • https://stackoverflow.com/questions/34343259/is-there-an-example-on-how-to-generate-protobuf-files-holding-trained-tensorflow – Cristi Nov 03 '17 at 11:13
  • Is there any solution for this? – chamathabeysinghe Dec 09 '17 at 07:58

0 Answers0