tensorflow-yolov4-tflite icon indicating copy to clipboard operation
tensorflow-yolov4-tflite copied to clipboard

How can I generate the .pbtxt file from .pb saved?

Open ELERKSOSY opened this issue 4 years ago • 1 comments

Hello,

I used the script "save_model.py" to generate .pb file, which is generated successfully and runs fine.

My problem is, I need to generate the .pbtxt file from the .pb file saved. I already try several ways but nothing work!

This the code I use:

filename = "saved_model.pb"
with gfile.FastGFile(filename,'rb') as f:
        graph_def = tf.compat.v1.GraphDef()
        graph_def.ParseFromString(f.read())
        tf.import_graph_def(graph_def, name='')
        in_dir = os.path.dirname(filename)
        out_filename = "saved_model.pbtxt"
        tf.train.write_graph(graph_def, in_dir, out_filename, as_text=True)

I always get this error: google.protobuf.message.DecodeError: Error parsing message At this line: graph_def.ParseFromString(f.read())

Can you please advise the method to get the .pbtxt file from the saved .pd file? thanks a lot

ELERKSOSY avatar Jun 12 '21 21:06 ELERKSOSY

Have you solved?

MrIronstone avatar Jan 27 '22 20:01 MrIronstone