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(shape_estimation): add ml shape estimation #7860

Conversation

kaancolak
Copy link
Contributor

@kaancolak kaancolak commented Jul 5, 2024

Description

Pointnet-based vehicle shape estimation module.

Choosing the estimation method is optional in the config file.

Related links

ONNX model file: https://drive.google.com/drive/folders/1xj95FShWo3_lL-1wtXMBB7T2OR8oFxB8

Parent Issue:
#7106

How was this PR tested?

Notes for reviewers

Test using the given ONNX file, no need to any other change

Interface changes

None.

Effects on system behavior

None.

@kaancolak kaancolak requested a review from miursh July 5, 2024 01:28
@kaancolak kaancolak self-assigned this Jul 5, 2024
Copy link

github-actions bot commented Jul 5, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Jul 5, 2024
@kaancolak kaancolak linked an issue Jul 5, 2024 that may be closed by this pull request
3 tasks
@yukkysaito
Copy link
Contributor

@kaancolak This is really amazing! Could you please describe the mechanism and node parameters in the README? If there is a learning method, please also include the user's learning procedure.

@kaancolak
Copy link
Contributor Author

Thank you @yukkysaito -san, I will prepare documentation about model details and also how to train the model/convert to ONNX.

@kaancolak kaancolak marked this pull request as draft July 5, 2024 23:36
@github-actions github-actions bot added the type:documentation Creating or refining documentation. (auto-assigned) label Jul 12, 2024
@kaancolak kaancolak force-pushed the feat/add-deep-learning-based-shape-estimator branch 3 times, most recently from fd59254 to 460fb6e Compare July 16, 2024 04:47
@kaancolak
Copy link
Contributor Author

kaancolak commented Jul 16, 2024

@yukkysaito @YoshiRi @miursh

I updated the readme file that added retraining/deploying guidelines. Please check it out and feel free to share your thoughts.

This is the training repository, maybe we can move it under Autoware foundation :
https://github.com/kaancolak/bbox_estimator

@kaancolak kaancolak marked this pull request as ready for review July 16, 2024 06:03
@kaancolak kaancolak force-pushed the feat/add-deep-learning-based-shape-estimator branch from b31afb7 to a13a441 Compare July 16, 2024 06:39
@kaancolak
Copy link
Contributor Author

@yukkysaito @YoshiRi @miursh

Could you review or assign a proper reviewer?

@YoshiRi
Copy link
Contributor

YoshiRi commented Jul 19, 2024

Hi. @kaancolak
Thanks for your PR.

Test with sample rosbag

I built and checked your ml based shape estimation with sample rosbag and confirmed it works.

  • how to test
    • Let detection_by_tracker_node to published cluster with class label (need slight source code change)
    • use that output to check ml based shape estimation

sample objects after fitting is like following:

title figure
normal vehicle Screenshot from 2024-07-19 15-08-46
trucks with I-shaped cluster(Not L-shape) Screenshot from 2024-07-19 15-09-02
trailer with L-shape cluster Screenshot from 2024-07-19 15-09-09

Discussion

I have several opinion and question.

  • Based on the current CMakeLists setup, it seems that the build process requires a CUDA environment. However, there are situations where we might want to build and run without a CUDA environment. To accommodate this, we should either use #ifdef to conditionally compile or separate the node that uses ML.
  • The shape_estimator is also called in other places, such as detection_by_tracker, so we should aim to unify the interface for both ML and non-ML shape_estimator calls as much as possible. It might be better for the non-ML side to accept a list of objects as input instead of individual objects. However, for this PR, it might be acceptable to ignore this issue for now.
  • Just a pure question, the ML estimator is designed for vehicle classes, but what kind of output does it produce if the input belongs to other classes?

perception/shape_estimation/CMakeLists.txt Outdated Show resolved Hide resolved

~TrtShapeEstimator();

bool inference(const DetectedObjectsWithFeature & input, DetectedObjectsWithFeature & output);
Copy link
Contributor

Choose a reason for hiding this comment

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

[just a comment]
I think it's better to share interface between ml and non-ml shape estimation in the future update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I completely agree with that. It will make the package better as a design.

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>
@kaancolak kaancolak force-pushed the feat/add-deep-learning-based-shape-estimator branch from a13a441 to d1213d9 Compare July 27, 2024 08:47
@kaancolak
Copy link
Contributor Author

@YoshiRi -san, thank you for your review. Sorry, I haven't been looked for last week.

Like your comment, I separated the cuda and non-cuda parts of the code that are controlled by cuda and cuda library founding flags.

Just a pure question, the ML estimator is designed for vehicle classes, but what kind of output does it produce if the input belongs to other classes?

The model takes one hot vector and point cloud as input. Yet if we feed different objects than vehicle labels, it will probably return the closest vehicle shape to the fed point cloud. The model could be easily extended for other classes according to the training readme file.

Copy link
Contributor

@YoshiRi YoshiRi left a comment

Choose a reason for hiding this comment

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

LGTM and worked with my local environment.

lib/corrector/utils.cpp
lib/corrector/no_corrector.cpp
set(${PROJECT_NAME}_SOURCES
lib/shape_estimator.cpp
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor comment]
Do you have any intention to add these indent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you warning, I fixed the indent

- object size classification result
- object size residuals

### Training ML Based Shape Estimation Model
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor comment]
It may better to separate training document with README for future.

kaancolak and others added 3 commits July 29, 2024 19:49
Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>
Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>
@kaancolak kaancolak enabled auto-merge (squash) August 1, 2024 10:39
}

int iter_count = static_cast<int>(input_pc_size) / point_size_of_cloud;
int remainer_count = static_cast<int>(input_pc_size) % point_size_of_cloud;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
int remainer_count = static_cast<int>(input_pc_size) % point_size_of_cloud;
int remainder_count = static_cast<int>(input_pc_size) % point_size_of_cloud;

Spell check failed, so can you change remainer to another word? I think reminder is better.
https://github.com/autowarefoundation/autoware.universe/actions/runs/10196767728/job/28208175986?pr=7860

@YoshiRi YoshiRi added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Aug 2, 2024
@YoshiRi
Copy link
Contributor

YoshiRi commented Aug 2, 2024

Rerun CI to check builds. Please wait for a while.

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 5.50%. Comparing base (3d849e9) to head (16a98d9).
Report is 973 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #7860       +/-   ##
==========================================
- Coverage   15.09%   5.50%    -9.59%     
==========================================
  Files        1967     109     -1858     
  Lines      135941    4558   -131383     
  Branches    42122     567    -41555     
==========================================
- Hits        20520     251    -20269     
+ Misses      92700    4256    -88444     
+ Partials    22721      51    -22670     
Flag Coverage Δ
differential 5.50% <ø> (?)
total ?

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kaancolak kaancolak merged commit 04a00ef into autowarefoundation:main Aug 2, 2024
37 of 39 checks passed
kyoichi-sugahara pushed a commit to kyoichi-sugahara/autoware.universe that referenced this pull request Aug 5, 2024
)

* feat(shape_estimation): add ml shape estimation

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>

* style(pre-commit): autofix

* feat(shape_estimation): fix exceed objects

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>

* style(pre-commit): autofix

* feat(shape_estimation): fix indent

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>

---------

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
esteve pushed a commit to esteve/autoware.universe that referenced this pull request Aug 13, 2024
)

* feat(shape_estimation): add ml shape estimation

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>

* style(pre-commit): autofix

* feat(shape_estimation): fix exceed objects

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>

* style(pre-commit): autofix

* feat(shape_estimation): fix indent

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>

---------

Signed-off-by: Kaan Çolak <kaancolak95@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:documentation Creating or refining documentation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add deep learning based 3D bouding box shape estimation algorithm
4 participants