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

feat(tensorrt_yolox): add build only option for tensorrt engine #2982

Merged

Conversation

yukke42
Copy link
Contributor

@yukke42 yukke42 commented Mar 2, 2023

Description

  • the option to build tensorrt engine without inference is required for test on cloud
  • add depend package
  • fix documentation

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) component:perception Advanced sensor data processing and environment understanding. (auto-assigned) labels Mar 2, 2023
Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
@yukke42 yukke42 force-pushed the tensorrt-yolox-build-only-option branch from 7ac636d to 48e72dc Compare March 2, 2023 06:49
@codecov
Copy link

codecov bot commented Mar 2, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.05 ⚠️

Comparison is base (f9075cb) 12.81% compared to head (5ee5293) 12.76%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2982      +/-   ##
==========================================
- Coverage   12.81%   12.76%   -0.05%     
==========================================
  Files        1212     1216       +4     
  Lines       85613    85922     +309     
  Branches    24260    24260              
==========================================
  Hits        10968    10968              
- Misses      63282    63591     +309     
  Partials    11363    11363              
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 12.81% <ø> (ø) Carriedforward from 4536ca8

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
...ception/tensorrt_yolox/src/tensorrt_yolox_node.cpp 0.00% <0.00%> (ø)
...havior_path_planner/behavior_path_planner_node.hpp 0.00% <ø> (ø)
...th_planner/scene_module/scene_module_interface.hpp 0.00% <ø> (ø)
...or_path_planner/src/behavior_path_planner_node.cpp 0.15% <ø> (ø)
...rt_yolox/src/yolox_single_image_inference_node.cpp 0.00% <0.00%> (ø)
perception/tensorrt_yolox/src/tensorrt_yolox.cpp 0.00% <0.00%> (ø)
...rt_yolox/include/tensorrt_yolox/tensorrt_yolox.hpp 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
@yukke42 yukke42 marked this pull request as ready for review March 2, 2023 07:34
@yukke42 yukke42 requested review from wep21, manato and a team as code owners March 2, 2023 07:34
@wep21
Copy link
Contributor

wep21 commented Mar 2, 2023

@yukke42 Why don't you use trtexec?

Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
@yukke42
Copy link
Contributor Author

yukke42 commented Mar 2, 2023

@yukke42 Why don't you use trtexec?

@wep21
If the tensorrt_yolox package becomes more complicated in terms of cuda/tensorrt options, s.t. int8, calibration, ... etc,
trtexec can be used by develpers who knows both trtexec and this package. But, by this option, they don't need know them and just add the build_only arg to launch command.

@wep21
Copy link
Contributor

wep21 commented Mar 2, 2023

they don't need know them and just add the build_only arg to launch command.

@yukke42
But they do need to know launch options such as int8, calibrator defined in each package(not only this package but other packages which use tensorrt), right?
I think trtexec is a generalized tool which covers most use cases to build tensorrt engine file, so we don't have to add build only option in each package.

@yukke42
Copy link
Contributor Author

yukke42 commented Mar 2, 2023

But they do need to know launch options such as int8, calibrator defined in each package(not only this package but other packages which use tensorrt), right?
I think trtexec is a generalized tool which covers most use cases to build tensorrt engine file, so we don't have to add build only option in each package.

@wep21 Yes, we can do the same thing with this option and trtexec. But it's hard to guarantee that the same engine file is generated as we expected.
tensorrt_yolox uses optimizationProfile and I think it's --optShapes of trtexec. It requires the magic number like this and another scirpt to get values from onnx file to delete these magic numbers. And, traffic_light_classifier don't use optimizationProfile , the package don't need opt option.
If some contrbutes change the tensorrt option/implementation, we need to catch up all the chages and change trtexec options as well. This is for not only this package but also other packages which require tensorrt. And how do we support trtexec options for many autoware versions?

@wep21
Copy link
Contributor

wep21 commented Mar 2, 2023

It may be out of scope from this PR, but I think the problem is that each package has own implementation to build tensorrt engine, while they do almost the same process. I think it is better to use trtexec to build tensorrt engine in launch file like

<launch>
  <executable cmd="trtexec --onnx=$(var onnx) --saveEngine=$(var enigne) --optShapes=input:1x3x$(var input_h)x$(var input_w)" name="trt_build" output="screen" shell="true"/>

  <node pkg="yolo" exec="yolo" name="yolo">
    <param name="engine" value="$(var engine)" />
  </node>
<launch>

and then remove engine build function from each package. What do you think?
Anyway, I won't block this PR if you need this feature as soon as possible for cloud test.

@yukke42
Copy link
Contributor Author

yukke42 commented Mar 6, 2023

@wep21 I see, Let me make a new discussion topic about it.
I hope you allow this pr to merge and then I'll chnage it later.

Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>
@wep21 wep21 self-requested a review March 7, 2023 01:32
Copy link
Contributor

@wep21 wep21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yukke42 yukke42 enabled auto-merge (squash) March 7, 2023 03:23
@yukke42 yukke42 merged commit 6ab40ca into autowarefoundation:main Mar 7, 2023
@yukke42 yukke42 deleted the tensorrt-yolox-build-only-option branch March 7, 2023 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned) type:documentation Creating or refining documentation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants