How to generate a .pbtxt file using a tensor flow model .pb file for dnn module?

asked 2019-06-11 13:48:02 -0600

hgarg gravatar image

Hello, I have a tensorflow model (.pb file). I want to import it using dnn module in OpenCV. "cv2.dnn.readNetFromTensorflow" function requires 2 parameters , .pb file, and .pbtxt file. Please tell me how to generate .pbtxt file in this case?

Thank you

edit retag flag offensive close merge delete

Comments

read this wiki

LBerger gravatar imageLBerger ( 2019-06-11 16:01:19 -0600 )edit

Thank you for your reply. The wiki tell that I should use "python tf_text_graph_faster_rcnn.py --input /path/to/model.pb --config /path/to/example.config --output /path/to/graph.pbtxt" For this command, I have the model.pb file and I have copied the tf_text_graph_faster_rcnn.py file. There is a list of config files, can I use any one of them?

hgarg gravatar imagehgarg ( 2019-06-11 16:04:45 -0600 )edit
1

sorry, but your question is far too broad (and can't be answered "as is")

  • what kind of model / architecture do you use ?
  • did you train on your own data ?
  • you might not need a .pbtxt at all, it is only needed to "rewire" network layers for opencv's dnn in some cases
berak gravatar imageberak ( 2019-06-12 00:34:53 -0600 )edit

Hello Berak, Yes, one of my friends trained the model with his data. I am not able to understand the first point. How can I check if .pbtxt file is required for my .pb file?

hgarg gravatar imagehgarg ( 2019-06-12 08:31:19 -0600 )edit