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

Host nodes: DepthMerger. #163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Host nodes: DepthMerger. #163

wants to merge 1 commit into from

Conversation

kkeroo
Copy link
Collaborator

@kkeroo kkeroo commented Jan 24, 2025

This PR adds first host node called DepthMerger. The node merges normal ImgDetections or ImgDetectionsExtended with depth information into SpatialImgDetections. The node is taken from experiments host-nodes folder and slightly adjusted so it works with ImgDetectionsExtended. We also introduce parameter shrinking_factor that is responsible for optionally shrinking the ROI for calculating depth values. This is useful because sometimes bounding-box also includes background and so the mean depth value is affected. E.g. In bouding-box of a human the shrinking factor will shrink the ROI into the human torso.

I am not sure about the folder hierarchy. I was thinking of placing it in the helpers folder under specific subfolders. Maybe there is something better?

The proposed node works with rewritten experiments: Human-Machine safety and social distancing.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 110 lines in your changes missing coverage. Please review.

Project coverage is 34.94%. Comparing base (b013402) to head (b04f1bd).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
depthai_nodes/ml/helpers/depth/depth_merger.py 0.00% 59 Missing ⚠️
...pthai_nodes/ml/helpers/depth/host_spatials_calc.py 0.00% 51 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #163      +/-   ##
==========================================
- Coverage   35.88%   34.94%   -0.95%     
==========================================
  Files          70       72       +2     
  Lines        4013     4124     +111     
==========================================
+ Hits         1440     1441       +1     
- Misses       2573     2683     +110     

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

Copy link
Contributor

@dominik737 dominik737 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. I would have a nodes folder along (same level as) the ml folder. Since many of the nodes are actually not related to ml. Then if there are too many nodes, we can group then in the nodes folder into subfolders.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would add from .depth_merger import DepthMerger.

@dominik737
Copy link
Contributor

@klemen1999 Also I just remembered we were talking about tests. Should they be implemented now in those PRs that add nodes?

Copy link
Collaborator

@klemen1999 klemen1999 left a comment

Choose a reason for hiding this comment

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

Generally LGTM

Agree on moving nodes into separate folder (same level as ml) and not nesting them into subfolders at least for now, we can do that later on if needed.

@klemen1999 Also I just remembered we were talking about tests. Should they be implemented now in those PRs that add nodes?

Good catch, we should make tests for every new node as potentially many different experiments will rely on their specifics. We can sync offline what/how to test.

]
)

self.shrinking_factor = 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make this also configurable through init

@@ -0,0 +1,171 @@
# HostSpatialsCalc implementation taken from here:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment can be removed

self.depth_alignment_socket = depth_alignment_socket

# Values
self.DELTA = 5 # Take 10x10 depth pixels around point for depth averaging
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make this 3 values also configurable through init with default values

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.

4 participants