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

onnx problem #50

Open
jxncyym opened this issue Jun 22, 2021 · 5 comments
Open

onnx problem #50

jxncyym opened this issue Jun 22, 2021 · 5 comments

Comments

@jxncyym
Copy link

jxncyym commented Jun 22, 2021

how to convert to onnx, I meet the problem,
assert target.dim() == 4 and target_weight.dim() == 3
AttributeError: 'NoneType' object has no attribute 'dim'

code:
model = build_posenet(cfg.model)
load_checkpoint(model, args.checkpoint, map_location='cpu')
model = model.eval()

x = torch.randn((1,3,384,288))
target = torch.randn((1,4,384,288))
target_weight = torch.randn((1,4,1))
output_path = "onnx/lite_HRNet_960_1280.onnx"
torch.onnx.export(model,               # model being run
                x,                         # model input (or a tuple for multiple inputs)
                output_path,   # where to save the model (can be a file or file-like object)
                export_params=True,        # store the trained parameter weights inside the model file
                opset_version=11,          # the ONNX version to export the model to
                do_constant_folding=True,  # whether to execute constant folding for optimization
                input_names = ['inputx'],   # the model's input names
                output_names = ['outputy'], # the model's output names
                verbose=True,
                )

the error can refer:
https://github.com/HRNet/Lite-HRNet/issues/23
@ycszen

@jxncyym
Copy link
Author

jxncyym commented Jun 23, 2021

another problem: RuntimeError: Only tuples, lists and Variables supported as JIT inputs/outputs. Dictionaries and strings are also accepted but their usage is not recommended. But got unsupported type float

@AlexMinhao
Copy link

Hi,

Have you solved this problem?

@so0c
Copy link

so0c commented Jan 20, 2022

Hi, i faced same problem. have you solved this problem?

@AnasArram
Copy link

same issue here, any thoughts?

@viet-hoang-99
Copy link

I have a repo that implement another way of Lite Hrnet (not dependent on mmpose apis) and i can convert model to onnx format. See my repo: https://github.com/viet-hoang-99/Lite_HRnet_vh

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

5 participants