I'm new to TensorFlow. I'm trying to import a trained TensorFlow network with checkpoint files. The network which I'm using has a custom op which works fine when I'm using it in Python. However, I have to freeze the graph because I have to use the C++ API. I'm invoking freeze_graph
with the following command from the TensorFlow base directory:
bazel-bin/tensorflow/python/tools/freeze_graph --input_graph=<local path>/data/graph_vgg.pb --input_checkpoint=<local path>/data/VGGnet_fast_rcnn_iter_70000.ckpt --output_node_names="cls_prob,bbox_pred" --output_graph=<local path>/graph_frozen.pb
But, I'm getting the following error when I'm trying to freeze the graph.
Traceback (most recent call last):
File "<local path>/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/tools/freeze_graph.py", line 202, in <module>
app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "<local path>/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "<local path>/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/tools/freeze_graph.py", line 134, in main
FLAGS.variable_names_blacklist)
File "<local path>/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/tools/freeze_graph.py", line 99, in freeze_graph
_ = importer.import_graph_def(input_graph_def, name="")
File "<local path>/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/framework/importer.py", line 260, in import_graph_def
raise ValueError('No op named %s in defined operations.' % node.op)
ValueError: No op named RoiPool in defined operations.
The input graph has a node with an op of type RoiPool
, which TensorFlow does not recognize. I investigated the code which throws this error and it looks something like the op is not registered with TensorFlow. I have the built .so
file with me. Am I supposed to copy it somewhere? I couldn't find anything like that online though. Any help or pointers would be great. I've spent a lot of time on this problem. The code works fine in python and the layer which uses the op is in the project directory. Please help me understand what I need to do to make it work.
Edit: This is the code of custom op that is used in the network.