-
Notifications
You must be signed in to change notification settings - Fork 159
Add host implementation of Detection parser #1513
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
Conversation
moratom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if tests pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds host-side implementation for the Detection parser to handle parsing of Segmentation head outputs on RVC2 devices where on-device processing is computationally expensive. The implementation introduces utilities for tensor data access and YOLO decoding algorithms (v3, v5, v6, v8, etc.) that can run on the host instead of the device.
Key changes:
- Added
NNDataViewerutility class for safe tensor data access across different storage orders and data types - Implemented multiple YOLO decoding families (R1AF, v3AB, v5AB, TLBR) with support for segmentation and keypoint decoding
- Extended
DetectionParsernode to support host-side execution viasetRunOnHost()API
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/CMakeLists.txt | Expanded test labels to include ondevice and platform-specific tags |
| src/pipeline/utilities/NNDataViewer.hpp | New utility class for accessing tensor data with different storage orders and data types |
| src/pipeline/utilities/DetectionParser/DetectionParserUtils.hpp | Header declaring detection parsing utility functions for various YOLO families |
| src/pipeline/utilities/DetectionParser/DetectionParserUtils.cpp | Implementation of YOLO decoding algorithms, NMS, and segmentation/keypoint processing |
| src/pipeline/node/DetectionParser.cpp | Added host-side run loop and decoder dispatch logic |
| src/pipeline/datatype/ImgDetectionsT.cpp | Added type validation for segmentation mask input |
| include/depthai/pipeline/node/DetectionParser.hpp | Extended node interface to support host execution mode |
| include/depthai/pipeline/datatype/ImgDetectionsT.hpp | Updated documentation for setCvSegmentationMask |
| examples/python/DetectionNetwork/detection_and_segmentation.py | Updated example to conditionally enable host parsing on RVC2 |
| examples/python/DetectionNetwork/detection_and_keypoints.py | Updated model references and camera settings |
| examples/cpp/DetectionNetwork/detection_and_segmentation.cpp | Updated C++ example with RVC2 detection and model selection |
| examples/cpp/DetectionNetwork/detection_and_keypoints.cpp | Updated model reference to nano variant |
| examples/cpp/DetectionNetwork/CMakeLists.txt | Fixed example file paths |
| cmake/Depthai/DepthaiDeviceSideConfig.cmake | Updated device-side binary commit hash |
| bindings/python/src/pipeline/node/DetectionParserBindings.cpp | Added Python bindings for setRunOnHost/runOnHost methods |
| CMakeLists.txt | Added DetectionParserUtils.cpp to build sources |
Comments suppressed due to low confidence (1)
src/pipeline/node/DetectionParser.cpp:1
- Variable
imgSizesSetshould be of typeboolinstead ofuint32_tsince it stores a boolean state. The current type is misleading.
#include "depthai/pipeline/node/DetectionParser.hpp"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Purpose
This PR adds host side implementation of the updated Detection parser. This is necessary for parsing Segmentation head outputs when using RVC2 due to high computational cost.
Specification
None / not applicable
Dependencies & Potential Impact
None / not applicable
Deployment Plan
None / not applicable
Testing & Validation
The detection_parser_test label expanded with
onhostlabel. Tests passed.