Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to ONNX #7

Open
mehdiae opened this issue Mar 31, 2021 · 2 comments
Open

Convert to ONNX #7

mehdiae opened this issue Mar 31, 2021 · 2 comments

Comments

@mehdiae
Copy link

mehdiae commented Mar 31, 2021

Hi,

This project is very interesting and I want to use it with DeepStream. I need to convert this model weights to ONNX file using this script in trt_pose. But it seems that the model is different and I get this error:

File "export_for_isaac.py", line 182, in <module> main(args) File "export_for_isaac.py", line 119, in main model.load_state_dict(torch.load(args.input_checkpoint)) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1223, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Sequential: Missing key(s) in state_dict: "1.cmap_conv.0.0.weight", "1.cmap_conv.0.0.bias", "1.cmap_conv.0.1.weight", "1.cmap_conv.0.1.bias", "1.cmap_conv.0.1.running_mean", "1.cmap_conv.0.1.running_var", "1.cmap_conv.0.3.weight", "1.cmap_conv.0.3.bias", "1.cmap_conv.0.4.weight", "1.cmap_conv.0.4.bias", "1.cmap_conv.0.4.running_mean", "1.cmap_conv.0.4.running_var", "1.cmap_conv.0.6.weight", "1.cmap_conv.0.6.bias", "1.cmap_conv.0.7.weight", "1.cmap_conv.0.7.bias", "1.cmap_conv.0.7.running_mean", "1.cmap_conv.0.7.running_var", "1.cmap_conv.1.weight", "1.cmap_conv.1.bias", "1.paf_conv.0.0.weight", "1.paf_conv.0.0.bias", "1.paf_conv.0.1.weight", "1.paf_conv.0.1.bias", "1.paf_conv.0.1.running_mean", "1.paf_conv.0.1.running_var", "1.paf_conv.0.3.weight", "1.paf_conv.0.3.bias", "1.paf_conv.0.4.weight", "1.paf_conv.0.4.bias", "1.paf_conv.0.4.running_mean", "1.paf_conv.0.4.running_var", "1.paf_conv.0.6.weight", "1.paf_conv.0.6.bias", "1.paf_conv.0.7.weight", "1.paf_conv.0.7.bias", "1.paf_conv.0.7.running_mean", "1.paf_conv.0.7.running_var", "1.paf_conv.1.weight", "1.paf_conv.1.bias". Unexpected key(s) in state_dict: "1.cmap_up.0.weight", "1.cmap_up.0.bias", "1.cmap_up.1.weight", "1.cmap_up.1.bias", "1.cmap_up.1.running_mean", "1.cmap_up.1.running_var", "1.cmap_up.1.num_batches_tracked", "1.cmap_up.3.weight", "1.cmap_up.3.bias", "1.cmap_up.4.weight", "1.cmap_up.4.bias", "1.cmap_up.4.running_mean", "1.cmap_up.4.running_var", "1.cmap_up.4.num_batches_tracked", "1.cmap_up.6.weight", "1.cmap_up.6.bias", "1.cmap_up.7.weight", "1.cmap_up.7.bias", "1.cmap_up.7.running_mean", "1.cmap_up.7.running_var", "1.cmap_up.7.num_batches_tracked", "1.paf_up.0.weight", "1.paf_up.0.bias", "1.paf_up.1.weight", "1.paf_up.1.bias", "1.paf_up.1.running_mean", "1.paf_up.1.running_var", "1.paf_up.1.num_batches_tracked", "1.paf_up.3.weight", "1.paf_up.3.bias", "1.paf_up.4.weight", "1.paf_up.4.bias", "1.paf_up.4.running_mean", "1.paf_up.4.running_var", "1.paf_up.4.num_batches_tracked", "1.paf_up.6.weight", "1.paf_up.6.bias", "1.paf_up.7.weight", "1.paf_up.7.bias", "1.paf_up.7.running_mean", "1.paf_up.7.running_var", "1.paf_up.7.num_batches_tracked", "1.cmap_att.weight", "1.cmap_att.bias", "1.paf_att.weight", "1.paf_att.bias", "1.cmap_conv.weight", "1.cmap_conv.bias", "1.paf_conv.weight", "1.paf_conv.bias".

Have you changed resnet18_baseline architecture?

@soerenbrockmann
Copy link

Hi @mehdiae, have you found a solution for it?

@soerenbrockmann
Copy link

I found a solution. The model name has to be in a specific format I guess. So I just renamed the hand pose model equal to the human pose model and converted the model with this command:

hand_pose_resnet18_att_244_244.pth >>>> resnet18_baseline_att_244x244_A_epoch_249.pth

python3 export_for_isaac.py --input_checkpoint resnet18_baseline_att_244x244_A_epoch_249.pth --input_topology hand_pose.json

Input model is not specified, using resnet18_baseline_att as a default.
Input width/height are not specified, using 244x244 as a default.
Output path is not specified, using resnet18_baseline_att_244x244_A_epoch_249.onnx as a default.
Successfully completed convertion of resnet18_baseline_att_244x244_A_epoch_249.pth to resnet18_baseline_att_244x244_A_epoch_249.onnx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants