DetectionNetwork.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
7 
8 // standard
9 #include <fstream>
10 
11 // shared
13 
14 namespace dai {
15 namespace node {
16 
20 class DetectionNetwork : public NodeCRTP<NeuralNetwork, DetectionNetwork, DetectionNetworkProperties> {
21  public:
22  constexpr static const char* NAME = "DetectionNetwork";
23 
24  protected:
25  DetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
26  DetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId, std::unique_ptr<Properties> props);
27 
28  public:
33  Output out{*this, "out", Output::Type::MSender, {{DatatypeEnum::ImgDetections, false}}};
34 
38  Output outNetwork{*this, "outNetwork", Output::Type::MSender, {{DatatypeEnum::NNData, false}}};
39 
44  void setConfidenceThreshold(float thresh);
45 
50  float getConfidenceThreshold() const;
51 };
52 
56 class MobileNetDetectionNetwork : public NodeCRTP<DetectionNetwork, MobileNetDetectionNetwork, DetectionNetworkProperties> {
57  public:
58  MobileNetDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
59  MobileNetDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId, std::unique_ptr<Properties> props);
60 };
61 
65 class YoloDetectionNetwork : public NodeCRTP<DetectionNetwork, YoloDetectionNetwork, DetectionNetworkProperties> {
66  public:
67  YoloDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
68  YoloDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId, std::unique_ptr<Properties> props);
69 
71  void setNumClasses(int numClasses);
73  void setCoordinateSize(int coordinates);
75  void setAnchors(std::vector<float> anchors);
77  void setAnchorMasks(std::map<std::string, std::vector<int>> anchorMasks);
79  void setIouThreshold(float thresh);
80 
82  int getNumClasses() const;
84  int getCoordinateSize() const;
86  std::vector<float> getAnchors() const;
88  std::map<std::string, std::vector<int>> getAnchorMasks() const;
90  float getIouThreshold() const;
91 };
92 
93 } // namespace node
94 } // namespace dai
dai::node::DetectionNetwork::out
Output out
Definition: DetectionNetwork.hpp:33
dai::utility::map
static std::unordered_map< std::string, std::string > map
Definition: Environment.cpp:16
dai::node::DetectionNetwork::outNetwork
Output outNetwork
Definition: DetectionNetwork.hpp:38
dai::NodeCRTP
Definition: Node.hpp:342
dai::node::YoloDetectionNetwork::setAnchors
void setAnchors(std::vector< float > anchors)
Set anchors.
Definition: DetectionNetwork.cpp:61
dai::node::YoloDetectionNetwork::setNumClasses
void setNumClasses(int numClasses)
Set num classes.
Definition: DetectionNetwork.cpp:53
dai::node::YoloDetectionNetwork
YoloDetectionNetwork node. Parses Yolo results.
Definition: DetectionNetwork.hpp:65
NeuralNetwork.hpp
dai::node::YoloDetectionNetwork::getAnchors
std::vector< float > getAnchors() const
Get anchors.
Definition: DetectionNetwork.cpp:84
dai::node::YoloDetectionNetwork::setIouThreshold
void setIouThreshold(float thresh)
Set Iou threshold.
Definition: DetectionNetwork.cpp:69
dai::node::YoloDetectionNetwork::YoloDetectionNetwork
YoloDetectionNetwork(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
Definition: DetectionNetwork.cpp:45
DetectionNetworkProperties.hpp
dai::node::YoloDetectionNetwork::setCoordinateSize
void setCoordinateSize(int coordinates)
Set coordianate size.
Definition: DetectionNetwork.cpp:57
dai::node::DetectionNetwork::setConfidenceThreshold
void setConfidenceThreshold(float thresh)
Definition: DetectionNetwork.cpp:24
dai::node::DetectionNetwork::DetectionNetwork
DetectionNetwork(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
Definition: DetectionNetwork.cpp:14
dai::node::YoloDetectionNetwork::getNumClasses
int getNumClasses() const
Get num classes.
Definition: DetectionNetwork.cpp:74
dai::node::DetectionNetwork
DetectionNetwork, base for different network specializations.
Definition: DetectionNetwork.hpp:20
dai::node::YoloDetectionNetwork::getIouThreshold
float getIouThreshold() const
Get Iou threshold.
Definition: DetectionNetwork.cpp:94
dai::node::MobileNetDetectionNetwork::MobileNetDetectionNetwork
MobileNetDetectionNetwork(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
Definition: DetectionNetwork.cpp:35
dai::node::DetectionNetwork::getConfidenceThreshold
float getConfidenceThreshold() const
Definition: DetectionNetwork.cpp:28
dai::node::YoloDetectionNetwork::getCoordinateSize
int getCoordinateSize() const
Get coordianate size.
Definition: DetectionNetwork.cpp:79
dai::node::YoloDetectionNetwork::setAnchorMasks
void setAnchorMasks(std::map< std::string, std::vector< int >> anchorMasks)
Set anchor masks.
Definition: DetectionNetwork.cpp:65
OpenVINO.hpp
dai::DatatypeEnum::NNData
@ NNData
dai::DatatypeEnum::ImgDetections
@ ImgDetections
dai::node::YoloDetectionNetwork::getAnchorMasks
std::map< std::string, std::vector< int > > getAnchorMasks() const
Get anchor masks.
Definition: DetectionNetwork.cpp:89
dai::node::DetectionNetwork::NAME
constexpr static const char * NAME
Definition: DetectionNetwork.hpp:22
dai::node::MobileNetDetectionNetwork
MobileNetDetectionNetwork node. Parses MobileNet results.
Definition: DetectionNetwork.hpp:56
dai
Definition: CameraExposureOffset.hpp:6
Node.hpp


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19