PINTO0309 / PINTO_model_zoo

A repository for storing models that have been inter-converted between various frameworks. Supported frameworks are TensorFlow, PyTorch, ONNX, OpenVINO, TFJS, TFTRT, TensorFlowLite (Float32/16/INT8), EdgeTPU, CoreML.
https://qiita.com/PINTO
MIT License
3.59k stars 572 forks source link

convert movenet tflite failed #419

Closed zhenhao-huang closed 3 months ago

zhenhao-huang commented 3 months ago

Issue Type

Support

OS

Ubuntu

OS architecture

x86_64

Programming Language

Python

Framework

TensorFlow

Model name and Weights/Checkpoints URL

https://www.kaggle.com/models/google/movenet/tfLite/singlepose-lightning-tflite-float16 https://www.kaggle.com/models/google/movenet/tfLite/singlepose-lightning-tflite-int8 https://www.kaggle.com/models/google/movenet/tfLite/singlepose-thunder-tflite-float16 https://www.kaggle.com/models/google/movenet/tfLite/singlepose-thunder-tflite-int8

Description

I want to convert movenet tflite model to onnx model, but it failed.Docker also.

Relevant Log Output

TensorFlow/Keras model building process complete!
saved_model / .pb output started ====================================================
ERROR: The name 'serving_default_input:0:0' looks a like a Tensor name, but is not a valid one. Tensor names must be of the form "<op_name>:<output_index>".
Traceback (most recent call last):
  File "/home/qdwl/anaconda3/envs/mmpose-1.x/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 4005, in _as_graph_element_locked
    op_name, out_n = name.split(":")
ValueError: too many values to unpack (expected 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/qdwl/.local/bin/tflite2tensorflow", line 5976, in main
    inputs= {re.sub(':0*', '', t): graph.get_tensor_by_name(t) for t in input_node_names},
  File "/home/qdwl/.local/bin/tflite2tensorflow", line 5976, in <dictcomp>
    inputs= {re.sub(':0*', '', t): graph.get_tensor_by_name(t) for t in input_node_names},
  File "/home/qdwl/anaconda3/envs/mmpose-1.x/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 4150, in get_tensor_by_name
    return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
  File "/home/qdwl/anaconda3/envs/mmpose-1.x/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 3974, in as_graph_element
    return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
  File "/home/qdwl/anaconda3/envs/mmpose-1.x/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 4008, in _as_graph_element_locked
    raise ValueError("The name %s looks a like a Tensor name, but is "
ValueError: The name 'serving_default_input:0:0' looks a like a Tensor name, but is not a valid one. Tensor names must be of the form "<op_name>:<output_index>".

URL or source code for simple inference testing code

tflite2tensorflow --model_path singlepose_lightning_tflite_float16.tflite --flatc_path flatc --schema_path schema.fbs --model_output_path singlepose_lightning_tflite_float16 --output_pb