tensorlayer / HyperPose

Library for Fast and Flexible Human Pose Estimation
https://hyperpose.readthedocs.io
1.25k stars 275 forks source link

How can I convert the .npz model to onnx #351

Closed mzgong1 closed 3 years ago

mzgong1 commented 3 years ago

Thanks for your work. I trained a .nzp model by your readme, but I can't convert the model to onnx.

I even tried following the command line, fail too. _python -m tf2onnx.convert --input save_dir/default_name/frozen_default_name.pb --inputs ImageTensor:0 --outputs SemanticPredictions:0 --output model.onnx --opset 13 --foldconst

error: AssertionError: SemanticPredictions is not in graph

Gyx-One commented 3 years ago

Hello! @mzgong1 Sorry to response so late. Issue Reason: The reason that you could not successfully convert the .pb file to the .onnx file is due to that you probably have passed the wrong name of inputs and outputs nodes to the tf2onnx.convert. Solution: Use the export_pb.py of the newest hyperpose version, and it will convert the .npz model weight into the output .pb file and output the input node and output node names of the .pb file at the same time, then you can pass the corret name of the input node and output node names to the tf2onnx.convert to get the onnx model. :)