Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate .pbtxt file from a .pb file for dnn module in opencv?

I have a custom tensorflow model .pb file. I want to import that in OpenCV using the dnn module. dnn module function requires 2 parameters: .pb file and .pbtxt file? How can I generate .pbtxt file from the .pb file?

cvNet = cv2.dnn.readNetFromTensorflow('FrozenMaster.pb', 'graph.pbtxt')

How to get this graph.pbtxt file?

like image 282
hgarg Avatar asked Jun 11 '19 20:06

hgarg


People also ask

What .PB file contains?

The PB file extension is a data file format associated to Corel WordPerfect software. PB files and WordPerfect were developed by Corel Corporation. These files contain search and index information for referencing WordPerfect documents and are used for fast lookups or backups of documents.

What is .pbtxt file in Tensorflow?

pbtxt file that contains text graph definition in protobuf format. Resulting "Net" object is built by text graph using weights from a binary one that let us make it more flexible.

How do I open a Pbtxt file?

You can open it in any text editor, like Sublime Text or whatever your OS has to offer by default. Save this answer. Show activity on this post.


1 Answers

import cv2 
cv2.dnn.writeTextGraph('FrozenMaster.pb', 'graph.pbtxt')

Moreover the following link of opencv github might as well be useful https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API

like image 116
prixi Avatar answered Oct 21 '22 04:10

prixi