SpatialDetectionNetwork.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 SpatialDetectionNetwork : public NodeCRTP<DetectionNetwork, SpatialDetectionNetwork, SpatialDetectionNetworkProperties> {
21  public:
22  constexpr static const char* NAME = "SpatialDetectionNetwork";
23 
24  protected:
25  SpatialDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
26  SpatialDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId, std::unique_ptr<Properties> props);
27 
28  public:
33  Input input{*this, "in", Input::Type::SReceiver, true, 5, true, {{DatatypeEnum::ImgFrame, false}}};
34 
39  Input inputDepth{*this, "inputDepth", Input::Type::SReceiver, false, 4, true, {{DatatypeEnum::ImgFrame, false}}};
40 
44  Output out{*this, "out", Output::Type::MSender, {{DatatypeEnum::SpatialImgDetections, false}}};
45 
51  Output boundingBoxMapping{*this, "boundingBoxMapping", Output::Type::MSender, {{DatatypeEnum::SpatialLocationCalculatorConfig, false}}};
52 
58  Output passthrough{*this, "passthrough", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}};
59 
65  Output passthroughDepth{*this, "passthroughDepth", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}};
66 
72  *this, "spatialLocationCalculatorOutput", Output::Type::MSender, {{DatatypeEnum::SpatialLocationCalculatorData, false}}};
73 
78  void setBoundingBoxScaleFactor(float scaleFactor);
79 
84  void setDepthLowerThreshold(uint32_t lowerThreshold);
85 
90  void setDepthUpperThreshold(uint32_t upperThreshold);
91 
97 
104 };
105 
109 class MobileNetSpatialDetectionNetwork : public NodeCRTP<SpatialDetectionNetwork, MobileNetSpatialDetectionNetwork, SpatialDetectionNetworkProperties> {
110  public:
111  MobileNetSpatialDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
112 };
113 
117 class YoloSpatialDetectionNetwork : public NodeCRTP<SpatialDetectionNetwork, YoloSpatialDetectionNetwork, SpatialDetectionNetworkProperties> {
118  public:
119  YoloSpatialDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
120 
122  void setNumClasses(const int numClasses);
124  void setCoordinateSize(const int coordinates);
126  void setAnchors(std::vector<float> anchors);
128  void setAnchorMasks(std::map<std::string, std::vector<int>> anchorMasks);
130  void setIouThreshold(float thresh);
131 
133  int getNumClasses() const;
135  int getCoordinateSize() const;
137  std::vector<float> getAnchors() const;
139  std::map<std::string, std::vector<int>> getAnchorMasks() const;
141  float getIouThreshold() const;
142 };
143 
144 } // namespace node
145 } // namespace dai
dai::node::SpatialDetectionNetwork::spatialLocationCalculatorOutput
Output spatialLocationCalculatorOutput
Definition: SpatialDetectionNetwork.hpp:71
dai::node::SpatialDetectionNetwork::inputDepth
Input inputDepth
Definition: SpatialDetectionNetwork.hpp:39
dai::node::SpatialDetectionNetwork::SpatialDetectionNetwork
SpatialDetectionNetwork(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
Definition: SpatialDetectionNetwork.cpp:14
dai::DatatypeEnum::SpatialLocationCalculatorConfig
@ SpatialLocationCalculatorConfig
dai::utility::map
static std::unordered_map< std::string, std::string > map
Definition: Environment.cpp:16
dai::node::MobileNetSpatialDetectionNetwork::MobileNetSpatialDetectionNetwork
MobileNetSpatialDetectionNetwork(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
Definition: SpatialDetectionNetwork.cpp:45
dai::node::YoloSpatialDetectionNetwork::getAnchorMasks
std::map< std::string, std::vector< int > > getAnchorMasks() const
Get anchor masks.
Definition: SpatialDetectionNetwork.cpp:94
dai::node::SpatialDetectionNetwork
SpatialDetectionNetwork node. Runs a neural inference on input image and calculates spatial location ...
Definition: SpatialDetectionNetwork.hpp:20
dai::node::SpatialDetectionNetwork::setDepthUpperThreshold
void setDepthUpperThreshold(uint32_t upperThreshold)
Definition: SpatialDetectionNetwork.cpp:30
dai::DatatypeEnum::SpatialLocationCalculatorData
@ SpatialLocationCalculatorData
dai::node::YoloSpatialDetectionNetwork::setAnchorMasks
void setAnchorMasks(std::map< std::string, std::vector< int >> anchorMasks)
Set anchor masks.
Definition: SpatialDetectionNetwork.cpp:70
dai::NodeCRTP
Definition: Node.hpp:342
dai::node::SpatialDetectionNetwork::input
Input input
Definition: SpatialDetectionNetwork.hpp:33
dai::node::SpatialDetectionNetwork::NAME
constexpr static const char * NAME
Definition: SpatialDetectionNetwork.hpp:22
dai::node::SpatialDetectionNetwork::setDepthLowerThreshold
void setDepthLowerThreshold(uint32_t lowerThreshold)
Definition: SpatialDetectionNetwork.cpp:26
dai::node::YoloSpatialDetectionNetwork
Definition: SpatialDetectionNetwork.hpp:117
dai::node::YoloSpatialDetectionNetwork::YoloSpatialDetectionNetwork
YoloSpatialDetectionNetwork(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
Definition: SpatialDetectionNetwork.cpp:53
dai::node::SpatialDetectionNetwork::passthrough
Output passthrough
Definition: SpatialDetectionNetwork.hpp:58
dai::node::YoloSpatialDetectionNetwork::setIouThreshold
void setIouThreshold(float thresh)
Set Iou threshold.
Definition: SpatialDetectionNetwork.cpp:74
dai::node::SpatialDetectionNetwork::setBoundingBoxScaleFactor
void setBoundingBoxScaleFactor(float scaleFactor)
Definition: SpatialDetectionNetwork.cpp:22
SpatialDetectionNetworkProperties.hpp
DetectionNetwork.hpp
dai::node::SpatialDetectionNetwork::setSpatialCalculationAlgorithm
void setSpatialCalculationAlgorithm(dai::SpatialLocationCalculatorAlgorithm calculationAlgorithm)
Definition: SpatialDetectionNetwork.cpp:34
dai::node::YoloSpatialDetectionNetwork::getIouThreshold
float getIouThreshold() const
Get Iou threshold.
Definition: SpatialDetectionNetwork.cpp:99
dai::node::MobileNetSpatialDetectionNetwork
Definition: SpatialDetectionNetwork.hpp:109
dai::node::YoloSpatialDetectionNetwork::setAnchors
void setAnchors(std::vector< float > anchors)
Set anchors.
Definition: SpatialDetectionNetwork.cpp:66
OpenVINO.hpp
stepSize
static constexpr float stepSize
Definition: mono_camera_control.cpp:16
dai::node::SpatialDetectionNetwork::setSpatialCalculationStepSize
void setSpatialCalculationStepSize(int stepSize)
Definition: SpatialDetectionNetwork.cpp:38
dai::node::YoloSpatialDetectionNetwork::getCoordinateSize
int getCoordinateSize() const
Get coordianate size.
Definition: SpatialDetectionNetwork.cpp:84
dai::node::SpatialDetectionNetwork::out
Output out
Definition: SpatialDetectionNetwork.hpp:44
dai::node::YoloSpatialDetectionNetwork::setCoordinateSize
void setCoordinateSize(const int coordinates)
Set coordianate size.
Definition: SpatialDetectionNetwork.cpp:62
dai::node::SpatialDetectionNetwork::passthroughDepth
Output passthroughDepth
Definition: SpatialDetectionNetwork.hpp:65
dai::node::YoloSpatialDetectionNetwork::getNumClasses
int getNumClasses() const
Get num classes.
Definition: SpatialDetectionNetwork.cpp:79
dai::SpatialLocationCalculatorAlgorithm
SpatialLocationCalculatorAlgorithm
Definition: RawSpatialLocationCalculatorConfig.hpp:36
dai::DatatypeEnum::ImgFrame
@ ImgFrame
dai::node::SpatialDetectionNetwork::boundingBoxMapping
Output boundingBoxMapping
Definition: SpatialDetectionNetwork.hpp:51
dai
Definition: CameraExposureOffset.hpp:6
Node.hpp
dai::DatatypeEnum::SpatialImgDetections
@ SpatialImgDetections
dai::node::YoloSpatialDetectionNetwork::getAnchors
std::vector< float > getAnchors() const
Get anchors.
Definition: SpatialDetectionNetwork.cpp:89
dai::node::YoloSpatialDetectionNetwork::setNumClasses
void setNumClasses(const int numClasses)
Set num classes.
Definition: SpatialDetectionNetwork.cpp:58


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