bumble-tech/private-detector

What's the output node names?

jasonhe88 opened this issue · 4 comments

I tried to convert model to frozen graph, but couldn't find the output names need in freee_graph tool

freeze_graph --input_saved_model_dir=saved_model --output_node_names= --output_graph=frozen_graph.pb

thanks a lot!

Last layer is a dense layer, shooooould just be called dense

self._fc = tf.keras.layers.Dense(
self._mconfig.num_classes,
kernel_initializer=dense_kernel_initializer,
bias_initializer=tf.constant_initializer(self._mconfig.headbias or 0))

>>> print(model.model.layers[-1].name)
dense

Does that work?

Thank you

it doesn't work out, here is the error message:

AssertionError: dense is not in graph

here is the script I used to do convert

from tensorflow.python.tools import freeze_graph
from tensorflow.python.saved_model import tag_constants

input_saved_model_dir = './saved_model'
output_node_names = 'dense'
input_binary = True
input_saver_def_path = False
restore_op_name = None
filename_tensor_name = None
clear_devices = False
input_meta_graph = False
checkpoint_path = './saved_checkpoint/ckpt-0.9375-14.data-00000-of-00001'
input_graph_filename = None
saved_model_tags = tag_constants.SERVING
output_graph_filename='frozen_graph.pb'

freeze_graph.freeze_graph(input_graph_filename,
  input_saver_def_path,
  input_binary,
  checkpoint_path,
  output_node_names,
  restore_op_name,
  filename_tensor_name,
  output_graph_filename,
  clear_devices,
  "", "", "",
  input_meta_graph,
  input_saved_model_dir,
  saved_model_tags)

solved as per #7