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

samples/python/tensorflow_object_detection_api/build_engine.py fails for models with dynamic axes #4363

Open
fdarvas opened this issue Feb 21, 2025 · 0 comments

Comments

@fdarvas
Copy link

fdarvas commented Feb 21, 2025

I tried to use the model conversion script samples/python/tensorflow_object_detection_api/build_engine.py to build and engine from an onnx model. I have confirmed that the onnx model can be used by trtexec, which correctly recognized the dynamic axes, but the python script fails with

python3 build_engine.py --onnx myModel.onnx --engine myModel.engine --precision fp32

INFO:EngineBuilder:Network Description
INFO:EngineBuilder:Input 'images' with shape (-1, 3, 640, 640) and dtype DataType.FLOAT
INFO:EngineBuilder:Input 'orig_target_sizes' with shape (-1, 2) and dtype DataType.INT64
INFO:EngineBuilder:Output 'classes_int64' with shape (-1, 300) and dtype DataType.INT64
INFO:EngineBuilder:Output 'boxes' with shape (-1, 300, 4) and dtype DataType.FLOAT
INFO:EngineBuilder:Output 'scores' with shape (-1, 300) and dtype DataType.FLOAT
INFO:EngineBuilder:Output 'classes' with shape (-1, 300) and dtype DataType.FLOAT
Traceback (most recent call last):
  File "/mnt/e/data/teknoir/TensorRT/samples/python/tensorflow_object_detection_api/build_engine.py", line 334, in <module>
    main(args)
  File "/mnt/e/data/teknoir/TensorRT/samples/python/tensorflow_object_detection_api/build_engine.py", line 269, in main
    builder.create_network(args.onnx)
  File "/mnt/e/data/teknoir/TensorRT/samples/python/tensorflow_object_detection_api/build_engine.py", line 182, in create_network
    assert self.batch_size > 0
AssertionError

This is obviously a built-in feature, but there are many models out there with dynamic axes - for trtexec I can speficy a min, opt and max range - but there are no such options for this example?

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

1 participant