我已经从Object Detection Zoo Model对模型进行了微调(使用TF 1.9),现在我正尝试使用TF 1.9冻结TensorFlowSharp的图形。
import tensorflow as tf
import os
from tensorflow.python.tools import freeze_graph
from tensorflow.core.protobuf import saver_pb2
#print("current tensorflow version: ", tf.version)
sess=tf.Session()
model_path = 'latest_cp/'
saver = tf.train.import_meta_graph('model.ckpt.meta')
saver.restore(sess,tf.train.latest_checkpoint('.')) #current dir of the checkpoint file
tf.train.write_graph(sess.graph_def, '.', 'test.pbtxt') #output in pbtxt format
freeze_graph.freeze_graph(input_graph = 'test.pbtxt',
input_binary = False,
input_checkpoint = model_path + 'model.ckpt',
output_node_names = "num_detections,detection_boxes,detection_scores,detection_classes",
output_graph = 'test.bytes' ,
clear_devices = True, initializer_nodes = "",input_saver = "",
restore_op_name = "save/restore_all", filename_tensor_name = "save/Const:0")
它起作用了,但是当我将其导入Unity之后,它返回了以下错误:
TFException: Op type not registered 'NonMaxSuppressionV3' in binary running on AK38713. Make sure the Op and Kernel are registered in the binary running in this process.
我发现TensorFlowSharp可与TensorFlow 1.4一起使用,当我尝试使用1.4冻结图时,它返回相同的NonMaxSuppressionV3
错误。
您知道解决此问题的任何方法吗?非常感谢您的支持。