Skip to content

Latest commit

 

History

History
119 lines (86 loc) · 3.71 KB

yolo_spatial_detection_network.rst

File metadata and controls

119 lines (86 loc) · 3.71 KB

YoloSpatialDetectionNetwork

Spatial detection for the Yolo NN. It is similar to a combination of the YoloDetectionNetwork and SpatialLocationCalculator.

How to place it

py

pipeline = dai.Pipeline() yoloSpatial = pipeline.create(dai.node.YoloSpatialDetectionNetwork)

c++

dai::Pipeline pipeline; auto yoloSpatial = pipeline.create<dai::node::YoloSpatialDetectionNetwork>();

Inputs and Outputs

┌───────────────────┐

input │ │ passthrough ──────────────►│-------------------├─────────────────► │ Yolo │ out │ Spatial ├─────────────────► │ Detection │boundingBoxMapping │ Network ├─────────────────► inputDepth │ │ passthroughDepth ──────────────►│-------------------├─────────────────► └───────────────────┘

Message types

  • input - ImgFrame
  • inputDepth - ImgFrame
  • passthrough - ImgFrame
  • out - SpatialImgDetections
  • boundingBoxMapping - SpatialLocationCalculatorConfig
  • passthroughDepth - ImgFrame

Usage

py

pipeline = dai.Pipeline() yoloSpatial = pipeline.create(dai.node.YoloSpatialDetectionNetwork) yoloSpatial.setBlobPath(nnBlobPath)

# Spatial detection specific parameters yoloSpatial.setConfidenceThreshold(0.5) yoloSpatial.input.setBlocking(False) yoloSpatial.setBoundingBoxScaleFactor(0.5) yoloSpatial.setDepthLowerThreshold(100) # Min 10 centimeters yoloSpatial.setDepthUpperThreshold(5000) # Max 5 meters

# Yolo specific parameters yoloSpatial.setNumClasses(80) yoloSpatial.setCoordinateSize(4) yoloSpatial.setAnchors([10,14, 23,27, 37,58, 81,82, 135,169, 344,319]) yoloSpatial.setAnchorMasks({ "side26": [1,2,3], "side13": [3,4,5] }) yoloSpatial.setIouThreshold(0.5)

c++

dai::Pipeline pipeline; auto yoloSpatial = pipeline.create<dai::node::YoloSpatialDetectionNetwork>(); yoloSpatial->setBlobPath(nnBlobPath);

// Spatial detection specific parameters yoloSpatial->setConfidenceThreshold(0.5f); yoloSpatial->input.setBlocking(false); yoloSpatial->setBoundingBoxScaleFactor(0.5); yoloSpatial->setDepthLowerThreshold(100); // Min 10 centimeters yoloSpatial->setDepthUpperThreshold(5000); // Max 5 meters

// yolo specific parameters yoloSpatial->setNumClasses(80); yoloSpatial->setCoordinateSize(4); yoloSpatial->setAnchors({10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319}); yoloSpatial->setAnchorMasks({{"side13", {3, 4, 5}}, {"side26", {1, 2, 3}}}); yoloSpatial->setIouThreshold(0.5f);

Examples of functionality

  • RGB & TinyYolo with spatial data

Reference

Python

depthai.node.YoloSpatialDetectionNetwork

C++

dai::node::YoloSpatialDetectionNetwork