Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
115c3d1
Move example
aljazkonec1 Nov 4, 2025
bb3204e
Add host parsing option
aljazkonec1 Nov 4, 2025
1392154
Merge remote-tracking branch 'origin/develop' into dev/update_rvc2_de…
aljazkonec1 Nov 4, 2025
96a92f5
Add host side implementation
aljazkonec1 Nov 5, 2025
a0dd29a
bump device
aljazkonec1 Nov 5, 2025
d0d07bf
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 5, 2025
33752f1
bump rvc4
aljazkonec1 Nov 5, 2025
7a25242
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 10, 2025
3f53b11
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 10, 2025
d50cb15
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 11, 2025
16a147e
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 11, 2025
8cd5d7b
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 11, 2025
bf0307c
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 11, 2025
1bfe31a
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 11, 2025
255a882
update parser
aljazkonec1 Nov 11, 2025
831232c
update example
aljazkonec1 Nov 11, 2025
ad653f5
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 11, 2025
39fcbd0
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 12, 2025
3f4d628
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 12, 2025
cc2f5a6
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 12, 2025
2f073d9
Merge branch 'dev_update_detection_parser' into dev/update_rvc2_detec…
aljazkonec1 Nov 14, 2025
1203e29
Move parsing logic to host
aljazkonec1 Nov 17, 2025
d43af05
Merge branch 'develop' into dev/update_rvc2_detection_parser
aljazkonec1 Nov 17, 2025
36770bc
update utils and node params
aljazkonec1 Nov 17, 2025
9dbda0b
add logger
aljazkonec1 Nov 17, 2025
8f30141
Remove unused functions
aljazkonec1 Nov 17, 2025
6509bfc
remove unwanted import
aljazkonec1 Nov 17, 2025
85fdbd1
Add storage order checker
aljazkonec1 Nov 17, 2025
2e51cca
Fix formating
aljazkonec1 Nov 17, 2025
6c2214a
bump fw
aljazkonec1 Nov 17, 2025
109020c
remove rvc2 test label
aljazkonec1 Nov 18, 2025
063adc8
Merge branch 'develop' into dev/update_rvc2_detection_parser
aljazkonec1 Nov 18, 2025
ab5f693
Implement suggestions
aljazkonec1 Nov 19, 2025
4072796
Merge remote-tracking branch 'origin/develop' into dev/update_rvc2_de…
aljazkonec1 Nov 19, 2025
eeecbf9
merge develop
aljazkonec1 Nov 19, 2025
3943a06
fix rvc2 build failure
aljazkonec1 Nov 19, 2025
07ae4c6
bump fw
aljazkonec1 Nov 19, 2025
6143b93
Merge remote-tracking branch 'origin/develop' into dev/update_rvc2_de…
aljazkonec1 Nov 21, 2025
93a3f27
Throw if anchor dimension is != 2
aljazkonec1 Nov 21, 2025
c7dda6f
Bump fw
aljazkonec1 Nov 21, 2025
cf0b4c8
bump fw
aljazkonec1 Nov 21, 2025
f5a149f
fix formatting
aljazkonec1 Nov 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ set(TARGET_CORE_SOURCES
src/pipeline/node/ImageAlign.cpp
src/pipeline/node/ToF.cpp
src/pipeline/node/DetectionParser.cpp
src/pipeline/utilities/DetectionParser/DetectionParserUtils.cpp
src/pipeline/node/test/MyProducer.cpp
src/pipeline/node/test/MyConsumer.cpp
src/pipeline/node/UVC.cpp
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/src/pipeline/node/DetectionParserBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void bind_detectionparser(pybind11::module& m, void* pCallstack) {
DOC(dai, node, DetectionParser, setAnchors, 2))
.def("setAnchorMasks", &DetectionParser::setAnchorMasks, py::arg("anchorMasks"), DOC(dai, node, DetectionParser, setAnchorMasks))
.def("setIouThreshold", &DetectionParser::setIouThreshold, py::arg("thresh"), DOC(dai, node, DetectionParser, setIouThreshold))
.def("setRunOnHost", &DetectionParser::setRunOnHost, py::arg("runOnHost"), DOC(dai, node, DetectionParser, setRunOnHost))
.def("setSubtype", &DetectionParser::setSubtype, py::arg("subtype"), DOC(dai, node, DetectionParser, setSubtype))
.def("setDecodeKeypoints", &DetectionParser::setDecodeKeypoints, py::arg("decode"), DOC(dai, node, DetectionParser, setDecodeKeypoints))
.def("setDecodeSegmentation", &DetectionParser::setDecodeSegmentation, py::arg("decode"), DOC(dai, node, DetectionParser, setDecodeSegmentation))
Expand All @@ -78,6 +79,7 @@ void bind_detectionparser(pybind11::module& m, void* pCallstack) {
.def("getAnchors", &DetectionParser::getAnchors, DOC(dai, node, DetectionParser, getAnchors))
.def("getAnchorMasks", &DetectionParser::getAnchorMasks, DOC(dai, node, DetectionParser, getAnchorMasks))
.def("getIouThreshold", &DetectionParser::getIouThreshold, DOC(dai, node, DetectionParser, getIouThreshold))
.def("runOnHost", &DetectionParser::runOnHost, DOC(dai, node, DetectionParser, runOnHost))
.def("getSubtype", &DetectionParser::getSubtype, DOC(dai, node, DetectionParser, getSubtype))
.def("getNkeypoints", &DetectionParser::getNKeypoints, DOC(dai, node, DetectionParser, getNKeypoints))
.def("getDecodeKeypoints", &DetectionParser::getDecodeKeypoints, DOC(dai, node, DetectionParser, getDecodeKeypoints))
Expand Down
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceRVC4Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set(DEPTHAI_DEVICE_RVC4_MATURITY "snapshot")

# "version if applicable"
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+ccb59dd506392110b0c85abee0d82e28c7d91f9e")
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+098f664d24dc72bce0589a9f81f18ceb285b0f8f")
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "0f9a7793654b8f2fbed64759c162425eab2c8541")
set(DEPTHAI_DEVICE_SIDE_COMMIT "621e48a2a0375f4594f7f8875661c50d3d5950c9")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
8 changes: 4 additions & 4 deletions examples/cpp/DetectionNetwork/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ dai_set_example_test_labels(detection_network ondevice rvc2_all rvc4 rvc4rgb ci)
dai_add_example(detection_network_remap detection_network_remap.cpp ON OFF)
dai_set_example_test_labels(detection_network_remap ondevice rvc2_all rvc4 ci)

dai_add_example(detection_and_segmentation RVC4/detection_and_segmentation.cpp ON OFF)
dai_set_example_test_labels(detection_and_segmentation rvc4)
dai_add_example(detection_and_segmentation detection_and_segmentation.cpp ON OFF)
dai_set_example_test_labels(detection_and_segmentation rvc2_all rvc4 ci)

dai_add_example(detection_and_keypoints RVC4/detection_and_keypoints.cpp ON OFF)
dai_set_example_test_labels(detection_and_keypoints rvc4)
dai_add_example(detection_and_keypoints detection_and_keypoints.cpp ON OFF)
dai_set_example_test_labels(detection_and_keypoints rvc2_all rvc4 ci)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main() {
auto detectionNetwork = pipeline.create<dai::node::DetectionNetwork>();

dai::NNModelDescription modelDescription;
modelDescription.model = "luxonis/yolov8-large-pose-estimation:coco-640x352:1868e39";
modelDescription.model = "luxonis/yolov8-nano-pose-estimation:coco-512x288";
detectionNetwork->build(cameraNode, modelDescription);

// Create output queues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstdio>
#include <iostream>
#include <map>
#include <memory>
#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>

Expand All @@ -17,8 +18,16 @@ cv::Rect frameNorm(const cv::Mat& frame, const dai::Point2f& topLeft, const dai:
}

int main() {
std::string modelName = "luxonis/yolov8-instance-segmentation-large:coco-640x352";
bool setRunOnHost = false;
auto device = std::make_shared<dai::Device>();

if(device->getPlatform() == dai::Platform::RVC2) {
modelName = "luxonis/yolov8-instance-segmentation-nano:coco-512x288";
setRunOnHost = true;
}
// Create pipeline
dai::Pipeline pipeline;
dai::Pipeline pipeline{device};

// Create and configure camera node
auto cameraNode = pipeline.create<dai::node::Camera>();
Expand All @@ -28,8 +37,10 @@ int main() {
auto detectionNetwork = pipeline.create<dai::node::DetectionNetwork>();

dai::NNModelDescription modelDescription;
modelDescription.model = "luxonis/yolov8-instance-segmentation-large:coco-640x480";

modelDescription.model = modelName;
detectionNetwork->build(cameraNode, modelDescription);
detectionNetwork->detectionParser->setRunOnHost(setRunOnHost);

// Create output queues
auto qRgb = detectionNetwork->passthrough.createOutputQueue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

# Create pipeline
with dai.Pipeline() as pipeline:
cameraNode = pipeline.create(dai.node.Camera).build()
detectionNetwork = pipeline.create(dai.node.DetectionNetwork).build(cameraNode, dai.NNModelDescription("luxonis/yolov8-large-pose-estimation:coco-640x352:1868e39"))
cameraNode = pipeline.create(dai.node.Camera).build(sensorFps=12)
detectionNetwork = pipeline.create(dai.node.DetectionNetwork).build(cameraNode, dai.NNModelDescription("luxonis/yolov8-nano-pose-estimation:coco-512x288"))
labelMap = detectionNetwork.getClasses()

qRgb = detectionNetwork.passthrough.createOutputQueue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
import numpy as np
import time

model_name = "luxonis/yolov8-instance-segmentation-large:coco-640x480"
setRunOnHost = False
device = dai.Device()
if device.getPlatform() == dai.Platform.RVC2:
model_name = "luxonis/yolov8-instance-segmentation-nano:coco-512x288"
setRunOnHost = True

# Create pipeline
with dai.Pipeline() as pipeline:
with dai.Pipeline(device) as pipeline:
cameraNode = pipeline.create(dai.node.Camera).build()
detectionNetwork = pipeline.create(dai.node.DetectionNetwork).build(cameraNode, dai.NNModelDescription("luxonis/yolov8-instance-segmentation-large:coco-640x480"))

detectionNetwork = pipeline.create(dai.node.DetectionNetwork).build(cameraNode, dai.NNModelDescription(model_name))
detectionNetwork.detectionParser.setRunOnHost(setRunOnHost)
labelMap = detectionNetwork.getClasses()
assert labelMap is not None
qRgb = detectionNetwork.passthrough.createOutputQueue()
Expand Down
1 change: 1 addition & 0 deletions include/depthai/pipeline/datatype/ImgDetectionsT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class ImgDetectionsT : public Buffer {
* Copies cv::Mat data to Segmentation Mask buffer
*
* @param frame Input cv::Mat frame from which to copy the data
* @note Throws if mask is not a single channel INT8 type.
*/
void setCvSegmentationMask(cv::Mat mask);

Expand Down
29 changes: 28 additions & 1 deletion include/depthai/pipeline/node/DetectionParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <string>

#include "depthai/common/YoloDecodingFamily.hpp"
#include "depthai/pipeline/datatype/ImgDetections.hpp"
#include "depthai/pipeline/datatype/NNData.hpp"

namespace dai {
namespace node {
Expand All @@ -20,7 +22,7 @@ namespace node {
* @brief DetectionParser node. Parses detection results from different neural networks and is being used internally by MobileNetDetectionNetwork and
* YoloDetectionNetwork.
*/
class DetectionParser : public DeviceNodeCRTP<DeviceNode, DetectionParser, DetectionParserProperties> {
class DetectionParser : public DeviceNodeCRTP<DeviceNode, DetectionParser, DetectionParserProperties>, public HostRunnable {
public:
constexpr static const char* NAME = "DetectionParser";
using DeviceNodeCRTP::DeviceNodeCRTP;
Expand Down Expand Up @@ -268,14 +270,39 @@ class DetectionParser : public DeviceNodeCRTP<DeviceNode, DetectionParser, Detec
*/
const NNArchiveVersionedConfig& getNNArchiveVersionedConfig() const;

/**
* Specify whether to run on host or device
* By default, the node will run on device.
*/
void setRunOnHost(bool runOnHost);

/**
* Check if the node is set to run on host
*/
bool runOnHost() const override;

void run() override;

void decodeMobilenet(dai::NNData& nnData, dai::ImgDetections& outDetections, float confidenceThr);

private:
bool runOnHostVar = false;
void setNNArchiveBlob(const NNArchive& nnArchive);
void setNNArchiveSuperblob(const NNArchive& nnArchive, int numShaves);
void setNNArchiveOther(const NNArchive& nnArchive);
void setConfig(const dai::NNArchiveVersionedConfig& config);
YoloDecodingFamily yoloDecodingFamilyResolver(const std::string& subtype);
bool decodeSegmentationResolver(const std::vector<std::string>& outputs);

// host runnable requirements
void buildStage1() override;
void decodeYolo(dai::NNData& nnData, dai::ImgDetections& outDetections);
std::vector<dai::TensorInfo> inTensorInfo;
uint32_t imgWidth;
uint32_t imgHeight;
uint32_t imgSizesSet = false;
//

std::optional<NNArchive> mArchive;

std::optional<NNArchiveVersionedConfig> archiveConfig;
Expand Down
3 changes: 3 additions & 0 deletions src/pipeline/datatype/ImgDetectionsT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ std::optional<dai::ImgFrame> ImgDetectionsT<DetectionT>::getSegmentationMask() c

template <class DetectionT>
void ImgDetectionsT<DetectionT>::setCvSegmentationMask(cv::Mat mask) {
if(mask.type() != CV_8UC1) {
throw std::runtime_error("SetCvSegmentationMask: Mask must be of INT8 type, got opencv type " + cv::typeToString(mask.type()) + ".");
}
std::vector<std::uint8_t> dataVec;
if(!mask.isContinuous()) {
for(int i = 0; i < mask.rows; i++) {
Expand Down
Loading
Loading