0

我已经从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错误。你知道有什么方法可以解决这个问题吗?非常感谢您的支持。

4

0 回答 0