# YoloDetectionNetwork

Yolo detection network extends [NeuralNetwork](https://docs.luxonis.com/software/depthai-components/nodes/neural_network.md) 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](https://docs.luxonis.com/software/depthai-components/messages/nn_data.md) (a byte array) but a
[ImgDetections](https://docs.luxonis.com/software/depthai-components/messages/img_detections.md) that can easily be used in your
code.

## How to place it

#### Python

```python
pipeline = dai.Pipeline()
yoloDet = pipeline.create(dai.node.YoloDetectionNetwork)
```

#### C++

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

## Inputs and Outputs

## Usage

#### Python

```python
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)
```

#### C++

```cpp
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

 * [RGB & Tiny YOLO](https://docs.luxonis.com/software/depthai/examples/tiny_yolo.md)
 * [RGB & YOLOv8 Nano](https://docs.luxonis.com/software/depthai/examples/yolov8_nano.md)

## Reference

### depthai.node.YoloDetectionNetwork(depthai.node.DetectionNetwork)

Kind: Class

YoloDetectionNetwork node. Parses Yolo results

#### getAnchorMasks(self) -> dict[str, list[int]]: dict[str, list[int]]

Kind: Method

Get anchor masks

#### getAnchors(self) -> list[float]: list[float]

Kind: Method

Get anchors

#### getCoordinateSize(self) -> int: int

Kind: Method

Get coordianate size

#### getIouThreshold(self) -> float: float

Kind: Method

Get Iou threshold

#### getNumClasses(self) -> int: int

Kind: Method

Get num classes

#### setAnchorMasks(self, anchorMasks: collections.abc.Mapping [ str , collections.abc.Sequence [ typing.SupportsInt ] ])

Kind: Method

Set anchor masks

#### setAnchors(self, anchors: collections.abc.Sequence [ typing.SupportsFloat ])

Kind: Method

Set anchors

#### setCoordinateSize(self, coordinates: typing.SupportsInt)

Kind: Method

Set coordianate size

#### setIouThreshold(self, thresh: typing.SupportsFloat)

Kind: Method

Set Iou threshold

#### setNumClasses(self, numClasses: typing.SupportsInt)

Kind: Method

Set num classes

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
