Skip to content

Comments

Feat/stage 2 node unification#274

Open
PetrNovota wants to merge 11 commits intofeat/stage-2-nodefrom
feat/stage-2-node-unification
Open

Feat/stage 2 node unification#274
PetrNovota wants to merge 11 commits intofeat/stage-2-nodefrom
feat/stage-2-node-unification

Conversation

@PetrNovota
Copy link
Contributor

@PetrNovota PetrNovota commented Jan 16, 2026

Purpose

  • Added BaseThreadedHostNode
  • Both BaseThreadedHostNode` and BaseHostNodehave the same instance variables,_platform, _pipelineand_logger`.
  • Added CoordinatesMapper node. Replaces the DetectionsMapper. It is a more general implementation of remapping massage coordinates into different frame of reference.
  • ExtendedNeuralNetwork implements with_tiling and with_detections_filter builder methods to split the initialisation more cleanly.
  • Refactored Stage2NeuralNetwork so that it follows high level node architecture. It just builds and connects nodes, doesn't have any own logic.
  • Refactored the remap_message function. Proposing to use from_transformation and to_transformation to make it a little bit more clear from where to where the coordinates are mapped.

Specification

None / not applicable

Dependencies & Potential Impact

None / not applicable

Deployment Plan

None / not applicable

Testing & Validation

Tested with the updated focused vision app

@PetrNovota PetrNovota added the wip work in progress label Jan 16, 2026
@PetrNovota PetrNovota marked this pull request as draft January 16, 2026 16:16
@github-actions github-actions bot added the enhancement New feature or request label Jan 16, 2026
@PetrNovota PetrNovota removed the wip work in progress label Jan 19, 2026
@PetrNovota PetrNovota marked this pull request as ready for review January 19, 2026 16:45
@klemen1999
Copy link
Collaborator

Is this replacement for #249 and should that one be closed?

@PetrNovota
Copy link
Contributor Author

Is this replacement for #249 and should that one be closed?

that one can be closed. the #274 is built on top of #249 . This PR is an update for the #274 . Once this PR is ready for merge, the #274 can be then merged immediately. I wanted to make it a separate PR as there are quite a few updates. Hopefuly this is not too confusing

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.

Went through and left some comments, didn't yet test anything.
Since this is adding a bit more complex nodes could we also add some MREs to the PR so we could more easily test these nodes and functionalities (see actual usage)?

for nn_msg in nn_msgs
]
merged_detections = merge_messages(remapped_messages)
if len(remapped_messages) == 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we do this check before remaping on len(nn_msgs)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, done

gather_node_data_input = nn_output

if remap_detections:
script = self._pipeline.create(dai.node.Script)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this script node if remap is already performed by CoordinatesMapper node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, thank you. I missed this. We don't need it.

def setPadding(self, padding: float) -> None:
self.detection_cropper.setPadding(padding)

@property
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick on the function order: I would match the ordering as we have it elsewhere so essentially:

  • init
  • properties
  • setters & getters
  • build, ran, process functions
  • other private functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. order fixed.

@@ -0,0 +1,277 @@
from typing import Optional, Sequence, Tuple, Union, overload
Copy link
Collaborator

Choose a reason for hiding this comment

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

General note for all the new nodes:
We should document them as well in the README under depthai_nodes/node/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@PetrNovota PetrNovota requested a review from klemen1999 January 29, 2026 13:26
@PetrNovota
Copy link
Contributor Author

@klemen1999 all suggestions integrated, MREs added, just wasn't sure where to put them. let me know if you think another place is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants