So I have an object detection model downloaded from " https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md "; the name of the model is "faster_rcnn_resnet101_fgvc". I tried to convert the model to a .tflite format (since I had the frozen graph "frozen_inference_graph.pb"), using a python code given in https://www.tensorflow.org/lite/guide/ops_select :
import tensorflow as tf
graph_def_file = "/path/to/Downloads/mobilenet_v1_1.0_224/frozen_graph.pb"
input_arrays = ["input"]
output_arrays = ["MobilenetV1/Predictions/Softmax"]
converter = tf.lite.TFLiteConverter.from_frozen_graph(
graph_def_file, input_arrays, output_arrays)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
Running this gave me an error:
ValueError: Invalid tensors 'input' were found.
Is there a way I can find the input and output nodes of the model? I only have the frozen graph, GraphDef, and checkpoints.
To find out input and output nodes of the model you can use, saved_model_cli
!saved_model_cli show --all --dir faster_rcnn_resnet101_fgvc_2018_07_19/saved_model/
It will show detaild information about your model.
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['inputs'] tensor_info:
dtype: DT_UINT8
shape: (-1, -1, -1, 3)
name: image_tensor:0
The given SavedModel SignatureDef contains the following output(s):
outputs['detection_boxes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 5, 4)
name: detection_boxes:0
outputs['detection_classes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 5)
name: detection_classes:0
outputs['detection_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 5)
name: detection_scores:0
outputs['num_detections'] tensor_info:
dtype: DT_FLOAT
shape: (-1)
name: num_detections:0
Method name is: tensorflow/serving/predict
In your case input layer name is "image_tensor"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.