# YoloDetectionNetwork

YoloDetectionNetwork 节点通过增加 YOLO NN 结果解码（在 OAK 设备上执行）来扩展
[NeuralNetwork](https://docs.luxonis.com/software/depthai-components/nodes/neural_network.md) 节点。
这意味着该节点的 Out 输出不再是 [NNData](https://docs.luxonis.com/software/depthai-components/messages/nn_data.md)（字节数组），而是
[ImgDetections](https://docs.luxonis.com/software/depthai-components/messages/img_detections.md)，可以在代码中轻松使用。

## 如何放置

#### Python

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

#### C++

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

## 输入与输出

## 使用方式

#### Python

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

# Yolo 特有参数
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 特有参数
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);
```

## 功能示例

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

## 参考

### 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

### 需要帮助？

请前往 [OAKChina 官网](https://www.oakchina.cn/) 获取技术支持或解答您的任何疑问。
