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
input
- ImgFrameout
- ImgDetectionspassthrough
- ImgFrame
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.
getAssetManager(self: depthai.Node) -> depthai.AssetManager
getAssetManager(self: depthai.Node) -> depthai.AssetManager
-
getConfidenceThreshold
(self: depthai.node.DetectionNetwork) → float
-
getCoordinateSize
(self: depthai.node.YoloDetectionNetwork) → int
-
getInputRefs
(*args, **kwargs) Overloaded function.
getInputRefs(self: depthai.Node) -> list[depthai.Node.Input]
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.
getOutputRefs(self: depthai.Node) -> list[depthai.Node.Output]
getOutputRefs(self: depthai.Node) -> list[depthai.Node.Output]
-
getOutputs
(self: depthai.Node) → list[depthai.Node.Output]
-
getParentPipeline
(*args, **kwargs) Overloaded function.
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
-
setAnchors
(self: depthai.node.YoloDetectionNetwork, anchors: list[float]) → None
-
setBlob
(*args, **kwargs) Overloaded function.
setBlob(self: depthai.node.NeuralNetwork, blob: depthai.OpenVINO.Blob) -> None
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
-
class
dai::node
::
YoloDetectionNetwork
: public dai::NodeCRTP<DetectionNetwork, YoloDetectionNetwork, DetectionNetworkProperties>¶ YoloDetectionNetwork node. Parses Yolo results.
Public Functions
-
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.
-
void