keijiro / FaceLandmarkBarracuda

MediaPipe face landmark detection model for Unity Barracuda
Apache License 2.0
116 stars 25 forks source link

New version model conversion error #8

Open psiydown opened 1 year ago

psiydown commented 1 year ago

New version model: https://storage.googleapis.com/mediapipe-assets/face_landmark.tflite tflite2onnx face_landmark.tflite face_landmark.onnx Error prompt: Data type float16 not supported/tested yet, the generated model may contain error Data type float16 not supported/tested yet, the generated model may contain error Data type float16 not supported/tested yet, the generated model may contain error Data type float16 not supported/tested yet, the generated model may contain error Data type float16 not supported/tested yet, the generated model may contain error Traceback (most recent call last): File "N:\anaconda3\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "N:\anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "N:\anaconda3\Scripts\tflite2onnx.exe__main__.py", line 7, in File "N:\anaconda3\lib\site-packages\tflite2onnx\convert.py", line 58, in cmd_convert convert(args.tflite_path, args.onnx_path) File "N:\anaconda3\lib\site-packages\tflite2onnx\convert.py", line 44, in convert model.convert(explicit_layouts) File "N:\anaconda3\lib\site-packages\tflite2onnx\model.py", line 42, in convert g.convert(explicit_layouts) File "N:\anaconda3\lib\site-packages\tflite2onnx\graph.py", line 102, in convert self._propagateLayout() File "N:\anaconda3\lib\site-packages\tflite2onnx\graph.py", line 173, in _propagateLayout t.transform() File "N:\anaconda3\lib\site-packages\tflite2onnx\tensor.py", line 126, in transform self.shape = self.layout.transform(self.shape) File "N:\anaconda3\lib\site-packages\tflite2onnx\layout.py", line 27, in transform output = transform(input, self.source, self.target) File "N:\anaconda3\lib\site-packages\tflite2onnx\layout.py", line 16, in transform transfrom_axis = [input[p] for p in perm] File "N:\anaconda3\lib\site-packages\tflite2onnx\layout.py", line 16, in transfrom_axis = [input[p] for p in perm] IndexError: list index out of range

@keijiro Can you give me any help? Thank you

keijiro commented 1 year ago

That's basically an issue with tflite2onnx. Could you ask them first?

psiydown commented 1 year ago

@keijiro I have already asked tflite2onnx but have not replied yet. Additionally, I have successfully converted onnx through another method: python - m tf2onnx.convert --opset 9 --tflite face_Landmark.tflite --output face_Landmark.onnx But there was an error running your Python script:

Traceback (most recent call last): File "D:\python\scripts\1\face_landmark_barracuda.py", line 73, in replace_pad_ops(model) File "D:\python\scripts\1\face_landmark_barracuda.py", line 28, in replace_pad_ops data = next(n for n in model.graph.value_info if n.name == node.input[0]) StopIteration

keijiro commented 1 year ago

Then how about using Colab instead of your local Python environment?

psiydown commented 1 year ago

@keijiro I tried, it's not an environmental issue, the result is the same. Local use of old version face_landmark.onnx model is fine, but the new version cannot generate Barracuda after tf2onnx.convert.

keijiro commented 1 year ago

Thanks for the clarification. The model design (or its architecture) might be changed. I think you don't only need updating the Python script but also modifying the C# code. In other words, you can't try the new model with a quick hack.