o.O
o.O

Reputation: 501

Freezing fine-tuned graph for TensorFlowSharp with TF 1.4

I've fine-tuned a model (using TF 1.9) from Object Detection Zoo Model and right now I am trying to freeze the graph for TensorFlowSharp using TF 1.9.

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")

It worked but then after I imported it to Unity it returned the following error:

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.

I find out that TensorFlowSharp works with TensorFlow 1.4 and when I tried to freeze graph with 1.4 it returns the same NonMaxSuppressionV3 error. Do you know any way to solve this issue? Thank you so much for the support.

Upvotes: 0

Views: 264

Answers (0)

Related Questions