YoloDetectionNetwork

Yolo detection network extends NeuralNetwork node by also adding YOLO NN result decoding, which happens on the OAK device. This means that Out of this node is not a NNData (a byte array) but a ImgDetections that can easily be used in your code.

How to place it

pipeline = dai.Pipeline()
yoloDet = pipeline.create(dai.node.YoloDetectionNetwork)
dai::Pipeline pipeline;
auto yoloDet = pipeline.create<dai::node::YoloDetectionNetwork>();

Inputs and Outputs

            ┌───────────────────┐
            │                   │       out
            │                   ├───────────►
            │     Yolo          │
            │     Detection     │
input       │     Network       │ passthrough
───────────►│-------------------├───────────►
            │                   │
            └───────────────────┘

Message types

Usage

pipeline = dai.Pipeline()
yoloDet = pipeline.create(dai.node.YoloDetectionNetwork)
yoloDet.setBlobPath(nnBlobPath)

# Yolo specific parameters
yoloDet.setConfidenceThreshold(0.5)
yoloDet.setNumClasses(80)
yoloDet.setCoordinateSize(4)
yoloDet.setAnchors([10,14, 23,27, 37,58, 81,82, 135,169, 344,319])
yoloDet.setAnchorMasks({"side26": [1, 2, 3], "side13": [3, 4, 5]})
yoloDet.setIouThreshold(0.5)
dai::Pipeline pipeline;
auto yoloDet = pipeline.create<dai::node::YoloDetectionNetwork>();
yoloDet->setBlobPath(nnBlobPath);

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

Examples of functionality

Reference

class depthai.node.YoloDetectionNetwork
class Id

Node identificator. Unique for every node on a single Pipeline

getAnchorMasks(self: depthai.node.YoloDetectionNetwork) → Dict[str, List[int]]
getAnchors(self: depthai.node.YoloDetectionNetwork) → List[float]
getAssetManager(*args, **kwargs)

Overloaded function.

  1. getAssetManager(self: depthai.Node) -> depthai.AssetManager

  2. getAssetManager(self: depthai.Node) -> depthai.AssetManager

getConfidenceThreshold(self: depthai.node.DetectionNetwork)float
getCoordinateSize(self: depthai.node.YoloDetectionNetwork)int
getInputRefs(*args, **kwargs)

Overloaded function.

  1. getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]

  2. getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]

getInputs(self: depthai.Node) → List[depthai.Node.Input]
getIouThreshold(self: depthai.node.YoloDetectionNetwork)float
getName(self: depthai.Node)str
getNumClasses(self: depthai.node.YoloDetectionNetwork)int
getNumInferenceThreads(self: depthai.node.NeuralNetwork)int
getOutputRefs(*args, **kwargs)

Overloaded function.

  1. getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]

  2. getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]

getOutputs(self: depthai.Node) → List[depthai.Node.Output]
getParentPipeline(*args, **kwargs)

Overloaded function.

  1. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

  2. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

setAnchorMasks(self: depthai.node.YoloDetectionNetwork, anchorMasks: Dict[str, List[int]])None
setAnchors(self: depthai.node.YoloDetectionNetwork, anchors: List[float])None
setBlob(*args, **kwargs)

Overloaded function.

  1. setBlob(self: depthai.node.NeuralNetwork, blob: depthai.OpenVINO.Blob) -> None

  2. setBlob(self: depthai.node.NeuralNetwork, path: Path) -> None

setBlobPath(self: depthai.node.NeuralNetwork, path: Path)None
setConfidenceThreshold(self: depthai.node.DetectionNetwork, thresh: float)None
setCoordinateSize(self: depthai.node.YoloDetectionNetwork, coordinates: int)None
setIouThreshold(self: depthai.node.YoloDetectionNetwork, thresh: float)None
setNumClasses(self: depthai.node.YoloDetectionNetwork, numClasses: int)None
setNumInferenceThreads(self: depthai.node.NeuralNetwork, numThreads: int)None
setNumNCEPerInferenceThread(self: depthai.node.NeuralNetwork, numNCEPerThread: int)None
setNumPoolFrames(self: depthai.node.NeuralNetwork, numFrames: int)None
class dai::node::YoloDetectionNetwork : public dai::NodeCRTP<DetectionNetwork, YoloDetectionNetwork, DetectionNetworkProperties>

YoloDetectionNetwork node. Parses Yolo results.

Public Functions

YoloDetectionNetwork(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)
YoloDetectionNetwork(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId, std::unique_ptr<Properties> props)
void setNumClasses(int numClasses)

Set num classes.

void setCoordinateSize(int coordinates)

Set coordianate size.

void setAnchors(std::vector<float> anchors)

Set anchors.

void setAnchorMasks(std::map<std::string, std::vector<int>> anchorMasks)

Set anchor masks.

void setIouThreshold(float thresh)

Set Iou threshold.

int getNumClasses() const

Get num classes.

int getCoordinateSize() const

Get coordianate size.

std::vector<float> getAnchors() const

Get anchors.

std::map<std::string, std::vector<int>> getAnchorMasks() const

Get anchor masks.

float getIouThreshold() const

Get Iou threshold.

Got questions?

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