ON THIS PAGE

  • YoloSpatialDetectionNetwork
  • How to place it
  • Inputs and Outputs
  • Usage
  • Examples of functionality
  • Spatial coordinate system
  • Reference

YoloSpatialDetectionNetwork

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

How to place it

Python
C++
Python
1pipeline = dai.Pipeline()
2yoloSpatial = pipeline.create(dai.node.YoloSpatialDetectionNetwork)

Inputs and Outputs

Command Line
1/
2                 ┌───────────────────┐
3  input          │                   │       passthrough
4  ──────────────►│-------------------├─────────────────►
5                 │     Yolo          │               out
6                 │     Spatial       ├─────────────────►
7                 │     Detection     │boundingBoxMapping
8                 │     Network       ├─────────────────►
9  inputDepth     │                   │  passthroughDepth
10  ──────────────►│-------------------├─────────────────►
11                 └───────────────────┘
Message types

Usage

Python
C++
Python
1pipeline = dai.Pipeline()
2yoloSpatial = pipeline.create(dai.node.YoloSpatialDetectionNetwork)
3yoloSpatial.setBlobPath(nnBlobPath)
4
5# Spatial detection specific parameters
6yoloSpatial.setConfidenceThreshold(0.5)
7yoloSpatial.input.setBlocking(False)
8yoloSpatial.setBoundingBoxScaleFactor(0.5)
9yoloSpatial.setDepthLowerThreshold(100) # Min 10 centimeters
10yoloSpatial.setDepthUpperThreshold(5000) # Max 5 meters
11
12# Yolo specific parameters
13yoloSpatial.setNumClasses(80)
14yoloSpatial.setCoordinateSize(4)
15yoloSpatial.setAnchors([10,14, 23,27, 37,58, 81,82, 135,169, 344,319])
16yoloSpatial.setAnchorMasks({ "side26": [1,2,3], "side13": [3,4,5] })
17yoloSpatial.setIouThreshold(0.5)

Examples of functionality

Spatial coordinate system

OAK camera uses left-handed (Cartesian) coordinate system for all spatial coordiantes.

Reference

class

depthai.node.YoloSpatialDetectionNetwork(depthai.node.SpatialDetectionNetwork)

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.