NVIDIA-AI-IOT / CUDA-PointPillars

A project demonstrating how to use CUDA-PointPillars to deal with cloud points data from lidar.
Apache License 2.0
522 stars 152 forks source link

when I generate onnx by exporter.py, i got the error #18

Closed liveforday closed 1 year ago

liveforday commented 2 years ago

['Car', 'Pedestrian', 'Cyclist']
3
0 -39.68 -3 69.12 39.68 1
[0.16, 0.16, 4]
32
40000
4
64
0.78539
0.0
2
[3.9, 1.6, 1.56, 0.0, 3.9, 1.6, 1.56, 1.57, 0.8, 0.6, 1.73, 0.0, 0.8, 0.6, 1.73, 1.57, 1.76, 0.6, 1.73, 0.0, 1.76, 0.6, 1.73, 1.57]
[-1.78, -0.6, -0.6]
0.1
0.01
anchors:      const float anchors[num_anchors * len_per_anchor] = {
      3.9,1.6,1.56,0.0,
      3.9,1.6,1.56,1.57,
      0.8,0.6,1.73,0.0,
      0.8,0.6,1.73,1.57,
      1.76,0.6,1.73,0.0,
      1.76,0.6,1.73,1.57,
      };

anchors:      const float anchor_bottom_heights[num_classes] = {-1.78,-0.6,-0.6,};

########
2022-03-15 11:08:59,269   INFO  ------ Convert OpenPCDet model for TensorRT ------
2022-03-15 11:09:05,030   INFO  ==> Loading parameters from checkpoint ../../checkpoint_epoch_1.pth to CPU
2022-03-15 11:09:05,171   INFO  ==> Checkpoint trained from version: pcdet+0.3.0+0642cf0
2022-03-15 11:09:05,462   INFO  ==> Done (loaded 127/127)
/home/nvidia/project/pointpillar/CUDA-PointPillars-main/tool/pcdet/models/backbones_3d/vfe/pillar_vfe.py:45: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if inputs.shape[0] > self.part:
/home/nvidia/project/pointpillar/CUDA-PointPillars-main/tool/pcdet/models/backbones_2d/map_to_bev/pointpillar_scatter.py:31: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  batch_size = coords[:, 0].max().int().item() + 1
Traceback (most recent call last):
  File "exporter.py", line 150, in <module>
    main()
  File "exporter.py", line 135, in main
    output_names = ['cls_preds', 'box_preds', 'dir_cls_preds'], # the model's output names
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/onnx/__init__.py", line 208, in export
    custom_opsets, enable_onnx_checker, use_external_data_format)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 92, in export
    use_external_data_format=use_external_data_format)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 530, in _export
    fixed_batch_size=fixed_batch_size)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 366, in _model_to_graph
    graph, torch_out = _trace_and_get_graph_from_model(model, args)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/onnx/utils.py", line 319, in _trace_and_get_graph_from_model
    torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/jit/__init__.py", line 338, in _get_trace_graph
    outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/jit/__init__.py", line 426, in forward
    self._force_outplace,
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/jit/__init__.py", line 412, in wrapper
    outs.append(self.inner(*trace_inputs))
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 720, in _call_impl
    result = self._slow_forward(*input, **kwargs)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 704, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/home/nvidia/project/pointpillar/CUDA-PointPillars-main/tool/pcdet/models/detectors/pointpillar.py", line 31, in forward
    spatial_features_2d = self.module_list[2](spatial_features) #"BaseBEVBackbone"
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 720, in _call_impl
    result = self._slow_forward(*input, **kwargs)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 704, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/home/nvidia/project/pointpillar/CUDA-PointPillars-main/tool/pcdet/models/backbones_2d/base_bev_backbone.py", line 103, in forward
    stride = int(spatial_features.shape[2] / x.shape[2])
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.```

when I generate onnx by exporter.py, i got the error 。 How can i fix it?
liveforday commented 2 years ago

Can you provide the software version,such as torch, onnx and so on. I use torch==1.6.0 onnx==1.8.1

byte-deve commented 2 years ago

Try with torch=1.10.1+cu113? onnx version is the same.

PeterJaq commented 2 years ago

Try with torch=1.10.1+cu113? onnx version is the same.

how can I install high torch version of openpcdet. when I use, for example, torch 1.11.x + cuda113 the setup process error.

liveforday commented 1 year ago

I use Jetson xavier NX.with JetPack4.6. I fix this by install torch==1.8.0 after replace torch 1.8.1 the error became a warning