Models: Convert .ckpt file into .pbtxt

Created on 11 Aug 2017  路  3Comments  路  Source: tensorflow/models

Hi, I am trying to train my own model using Inception architecture using inception_train.py after completion of training I got the following files
/home/rakashi/Desktop/Tagging/flowernet_train/checkpoint
/home/rakashi/Desktop/Tagging/flowernet_train/events.out.tfevents.1501927375.pavan
/home/rakashi/Desktop/Tagging/flowernet_train/model.ckpt-0.data-00000-of-00001
/home/rakashi/Desktop/Tagging/flowernet_train/model.ckpt-0.index
/home/rakashi/Desktop/Tagging/flowernet_train/model.ckpt-0.meta
/home/rakashi/Desktop/Tagging/flowernet_train/model.ckpt-9.data-00000-of-00001
/home/rakashi/Desktop/Tagging/flowernet_train/model.ckpt-9.index
/home/rakashi/Desktop/Tagging/flowernet_train/model.ckpt-9.meta

I have converted these files into below format by using exportgraph.py in python tensorflow tools

/home/rakashi/Desktop/Tagging/flowernet_export/00004999/checkpoint
/home/rakashi/Desktop/Tagging/flowernet_export/00004999/export.data-00000-of-00001
/home/rakashi/Desktop/Tagging/flowernet_export/00004999/export.index
/home/rakashi/Desktop/Tagging/flowernet_export/00004999/export.meta

But I want to convert these files into .pb and .pbtxt files, I tried with the following command
python freeze_graph.py --input_graph=/home/rakashi/Desktop/Tagging/flowernet_train/graph.pbtxt --input_checkpoint=/home/rakashi/Desktop/Tagging/flowernet_export/00004999/export.data-00000-of-00001 --output_graph=/tmp/frozen_graph.pb --output_node_names=softmax

I am getting error like this

reader = pywrap_tensorflow.NewCheckpointReader(input_checkpoint)

File "/home/rakashi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 110, in NewCheckpointReader
return CheckpointReader(compat.as_bytes(filepattern), status)
File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/home/rakashi/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/rakashi/Desktop/Tagging/flowernet_export/00004999/export.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?

Please help me..... how can I use my model to test my own image.... like inceptionV3 model on imagenet

Most helpful comment

I also meet this problem,when I use the script:
python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path ../for_tf/ssd_inception_v2_coco.config --trained_checkpoint_prefix ../for_tf/in --output_directory ../for_tf/out
the same question appear.
But I fix it by changing the script like this:
python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path ../for_tf/ssd_inception_v2_coco.config --trained_checkpoint_prefix ../for_tf/in/model.ckpt-68344 --output_directory ../for_tf/out
Be attention to the path of trained_checkpoint_prefix!!!

All 3 comments

This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!

I also meet this problem,when I use the script:
python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path ../for_tf/ssd_inception_v2_coco.config --trained_checkpoint_prefix ../for_tf/in --output_directory ../for_tf/out
the same question appear.
But I fix it by changing the script like this:
python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path ../for_tf/ssd_inception_v2_coco.config --trained_checkpoint_prefix ../for_tf/in/model.ckpt-68344 --output_directory ../for_tf/out
Be attention to the path of trained_checkpoint_prefix!!!

@coolKeen it works for me, thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

25b3nk picture 25b3nk  路  3Comments

Mostafaghelich picture Mostafaghelich  路  3Comments

atabakd picture atabakd  路  3Comments

kamal4493 picture kamal4493  路  3Comments

sun9700 picture sun9700  路  3Comments