Lite-HRNet
Lite-HRNet copied to clipboard
onnx problem
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
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
Hi,
Have you solved this problem?
Hi, i faced same problem. have you solved this problem?
same issue here, any thoughts?
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