NVIDIA-AI-IOT / CUDA-PointPillars

A project demonstrating how to use CUDA-PointPillars to deal with cloud points data from lidar.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not export onnx.

Domwis-IR opened this issue · comments

I tried export.py but could not do it because it didn't get the right input.
2022-10-28 04:02:25,943 INFO ==> Loading parameters from checkpoint ./pointpillar_7728.pth to CPU

Traceback (most recent call last):
  File "exporter.py", line 150, in <module>
    main()
  File "exporter.py", line 134, in main
    output_names = ['cls_preds', 'box_preds', 'dir_cls_preds'], # the model's output names
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/onnx/__init__.py", line 365, in export
    export_modules_as_functions,
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 178, in export
    export_modules_as_functions=export_modules_as_functions,
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 1097, in _export
    dynamic_axes=dynamic_axes,
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 737, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 611, in _create_jit_graph
    graph, torch_out = _trace_and_get_graph_from_model(model, args)
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/onnx/utils.py", line 527, in _trace_and_get_graph_from_model
    model, args, strict=False, _force_outplace=False, _return_inputs_states=True
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/jit/_trace.py", line 1179, in _get_trace_graph
    outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/jit/_trace.py", line 134, in forward
    self._force_outplace,
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/jit/_trace.py", line 120, in wrapper
    outs.append(self.inner(*trace_inputs))
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/rjh1016/anaconda3/envs/openpcdet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1118, in _slow_forward
    result = self.forward(*input, **kwargs)
**TypeError: forward() missing 1 required positional argument: 'batch_dict'**

I guess the model architecture is still same with the OpenPCDet. But I don't know what to do first to export onnx from this file.
My torch version is 1.12.1+cu102, cuda version is 11.3 and onnx version is 1.12.0

@Domwis-IR I am working on the same issue. Did you solve it?

@Domwis-IR this was due to using the wrong version of PCDet. To solve this I created a docker container with torch 1.8.1 and PCDet at the HEAD reference by the submodule

Thank you so much with your reply. I will try too!

@rjwb1 could you share your Dockerfile?

@jrb-cobot find here, I had to modify it slightly as I have a customised workflow but hope this helps

4bcb924

#77

@Domwis-IR this was due to using the wrong version of PCDet. To solve this I created a docker container with torch 1.8.1 and PCDet at the HEAD reference by the submodule
@rjwb1 I built the image using the dockerfile you provided, and used the container created from the image . But the command "python exporter.py --ckpt pointpillar_7728.pth"could not do it.Could you provide some help?

@Domwis-IR this was due to using the wrong version of PCDet. To solve this I created a docker container with torch 1.8.1 and PCDet at the HEAD reference by the submodule
@rjwb1 I built the image using the dockerfile you provided, and used the container created from the image . But the command "python exporter.py --ckpt pointpillar_7728.pth"could not do it.Could you provide some help?

Could you provide more information about the issue? Perhaps the traceback

@rjwb1 Thanks for your replytation! I uesd your dockerfile for builting container and then solved problem.Thanks!

@Domwis-IR this was due to using the wrong version of PCDet. To solve this I created a docker container with torch 1.8.1 and PCDet at the HEAD reference by the submodule
@rjwb1 I built the image using the dockerfile you provided, and used the container created from the image . But the command "python exporter.py --ckpt pointpillar_7728.pth"could not do it.Could you provide some help?

Could you provide more information about the issue? Perhaps the traceback

May I ask what environment your docker is in? x86 or Xavier/Orin?

@Domwis-IR this was due to using the wrong version of PCDet. To solve this I created a docker container with torch 1.8.1 and PCDet at the HEAD reference by the submodule
@rjwb1 I built the image using the dockerfile you provided, and used the container created from the image . But the command "python exporter.py --ckpt pointpillar_7728.pth"could not do it.Could you provide some help?

Could you provide more information about the issue? Perhaps the traceback

image
the wrong message

This docker file is for x86. Please check the README.md inside the docker directory for usage

@Domwis-IR this was due to using the wrong version of PCDet. To solve this I created a docker container with torch 1.8.1 and PCDet at the HEAD reference by the submodule
@rjwb1 I built the image using the dockerfile you provided, and used the container created from the image . But the command "python exporter.py --ckpt pointpillar_7728.pth"could not do it.Could you provide some help?

Could you provide more information about the issue? Perhaps the traceback

image the wrong message

You can modify the last two lines in your Dockerfile(add "-c"),like this:
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["/bin/bash", "-c"]

I'm still working on this issue. I'd like to keep to the current version of OpenPCDet so that I can use the latest models and features. If anyone has made progress using version 0.6.0+, please let me know.

commented

I'm still working on this issue. I'd like to keep to the current version of OpenPCDet so that I can use the latest models and features. If anyone has made progress using version 0.6.0+, please let me know.

Do you have any progress? I can't find the difference that led to the problem between v0.5 and v0.6. I'm looking forward to your reply. Thank you very much!

I'm still working on this issue. I'd like to keep to the current version of OpenPCDet so that I can use the latest models and features. If anyone has made progress using version 0.6.0+, please let me know.

Do you have any progress? I can't find the difference that led to the problem between v0.5 and v0.6. I'm looking forward to your reply. Thank you very much!

I can't find the difference that led to the problem between v0.5 and v0.6. I'm looking forward to your reply, too.