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

Force NCHW tensor order. #135

Merged
merged 4 commits into from
Nov 18, 2024
Merged

Force NCHW tensor order. #135

merged 4 commits into from
Nov 18, 2024

Conversation

kkeroo
Copy link
Collaborator

@kkeroo kkeroo commented Nov 18, 2024

This PR forces NCHW tensor output when calling getTensor(...) method instead of manually checking the shapes and transposing them inside parsers.

Affected Parsers:

  • MLSD parser
  • FastSAM parser
  • YOLOExtended parser
  • SuperAnimal parser: removed unnecessary check for shapes.

One yolo util function (reshape_seg_outputs) is removed - not needed anymore.

Additionally, ImgDetectionExtended's masks parameter now expects int16 and not int8 (introduced in some previous PR) + detection creator function converts masks to int16 instead of int8.

@github-actions github-actions bot added enhancement New feature or request messages Changes affecting ml.messages parsers Changes affecting ml.parsers labels Nov 18, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review.

Project coverage is 32.96%. Comparing base (37a2d92) to head (02db019).
Report is 7 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
depthai_nodes/ml/messages/creators/detection.py 0.00% 2 Missing ⚠️
depthai_nodes/ml/messages/img_detections.py 33.33% 2 Missing ⚠️
depthai_nodes/ml/parsers/mlsd.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #135      +/-   ##
==========================================
- Coverage   33.40%   32.96%   -0.45%     
==========================================
  Files          68       68              
  Lines        3739     3695      -44     
==========================================
- Hits         1249     1218      -31     
+ Misses       2490     2477      -13     

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

Copy link
Collaborator

@jkbmrz jkbmrz left a comment

Choose a reason for hiding this comment

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

Looks good but why are we not adding this feature to all parsers?

@kkeroo
Copy link
Collaborator Author

kkeroo commented Nov 18, 2024

Other parsers dont explicitly check for the tensor order - it doesnt matter. E.g.:

  • Classification parser: output is not NCHW and it doesnt make sense to be
  • Keypoints parser: automatically reshapes the output based on num_kpts

and similar for other not-affected parsers. I think forcing storageOrder=NCHW in every getTensor method is not needed and not ideal because DAI could fail transforming it if the shapes are weird

@kkeroo kkeroo merged commit cb2e704 into main Nov 18, 2024
10 checks passed
@kkeroo kkeroo deleted the feature/request_nchw branch November 18, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request messages Changes affecting ml.messages parsers Changes affecting ml.parsers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants