Skip to content

TensorRT: write image_size to onnx.yaml; fix demo output dir and intrinsics#37

Open
kvnptl wants to merge 1 commit intoNVlabs:masterfrom
kvnptl:fix/tensorrt-onnx-yaml-demo
Open

TensorRT: write image_size to onnx.yaml; fix demo output dir and intrinsics#37
kvnptl wants to merge 1 commit intoNVlabs:masterfrom
kvnptl:fix/tensorrt-onnx-yaml-demo

Conversation

@kvnptl
Copy link

@kvnptl kvnptl commented Mar 23, 2026

What

  • make_onnx.py: When exporting, write image_size: [height, width] into onnx.yaml using existing --height / --width, so the TensorRT demo knows the engine resolution without guessing.
  • run_demo_tensorrt.py: Only rm -rf out_dir when it is not the same as onnx_dir and onnx_dir is not under out_dir — avoids deleting .engine files when both point at e.g. output/. Always os.makedirs(out_dir, exist_ok=True).
  • run_demo_tensorrt.py: Scale intrinsics after resize with K[:2] *= …[:, np.newaxis] so NumPy broadcasts correctly after fx / fy.

Why

  • Missing image_size in onnx.yaml caused wrong resize vs engine shape and reshape errors.
  • Unconditional rm -rf out_dir deleted engine artifacts when out_dir and onnx_dir overlapped.
  • K[:2] *= [fx, fy] failed with a broadcast error for (2,3) vs (2,).

How to verify

  1. Run make_onnx.py with --height / --width; confirm onnx.yaml contains image_size.
  2. Run run_demo_tensorrt.py with --onnx_dir output/ and --out_dir output/ — engines should remain; run should complete through point cloud.

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

Successfully merging this pull request may close these issues.

1 participant