Class DetectionParser

Inheritance Relationships

Base Type

Class Documentation

class DetectionParser : public dai::DeviceNodeCRTP<DeviceNode, DetectionParser, DetectionParserProperties>

DetectionParser node. Parses detection results from different neural networks and is being used internally by MobileNetDetectionNetwork and YoloDetectionNetwork.

Public Functions

~DetectionParser() override
std::shared_ptr<DetectionParser> build(Node::Output &nnInput, const NNArchive &nnArchive)

Build DetectionParser node. Connect output to this node’s input. Also call setNNArchive() with provided NNArchive.

Parameters:
  • nnInput – Output to link

  • nnArchive – Neural network archive

void setNumFramesPool(int numFramesPool)

Specify number of frames in pool.

Parameters:

numFramesPool – How many frames should the pool have

int getNumFramesPool()

Returns number of frames in pool

void setNNArchive(const NNArchive &nnArchive)

Set NNArchive for this Node. If the archive’s type is SUPERBLOB, use default number of shaves.

Parameters:

nnArchiveNNArchive to set

void setModelPath(const std::filesystem::path &modelPath)

Load network xml and bin files into assets.

Parameters:

xmlModelPath – Path to the neural network model file.

void setBlobPath(const std::filesystem::path &path)

Load network blob into assets and use once pipeline is started.

Throws:

Error – if file doesn’t exist or isn’t a valid network blob.

Parameters:

path – Path to network blob

void setBlob(OpenVINO::Blob blob)

Retrieves some input tensor information from the blob

Parameters:

blobOpenVINO blob to retrieve the information from

void setBlob(const std::filesystem::path &path)

Same functionality as the setBlobPath(). Load network blob into assets and use once pipeline is started.

Throws:

Error – if file doesn’t exist or isn’t a valid network blob.

Parameters:

path – Path to network blob

void setInputImageSize(int width, int height)

Set input image size

This should only be used instead of setBlob, not besides it

void setInputImageSize(std::tuple<int, int> size)
void setNNFamily(DetectionNetworkType type)

Sets NN Family to parse

DetectionNetworkType getNNFamily()

Gets NN Family to parse

void setConfidenceThreshold(float thresh)

Specifies confidence threshold at which to filter the rest of the detections.

Parameters:

thresh – Detection confidence must be greater than specified threshold to be added to the list

float getConfidenceThreshold() const

Retrieves threshold at which to filter the rest of the detections.

Returns:

Detection confidence

void setNumClasses(int numClasses)

Set num classes.

void setClasses(const std::vector<std::string> &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 setAnchors(const std::vector<std::vector<std::vector<float>>> &anchors)

Set anchors with masks.

void setIouThreshold(float thresh)

Set Iou threshold.

int getNumClasses() const

Get num classes.

std::optional<std::vector<std::string>> getClasses() const
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.

const NNArchiveVersionedConfig &getNNArchiveVersionedConfig() const
inline DeviceNodeCRTP()
inline DeviceNodeCRTP(const std::shared_ptr<Device> &device)
inline DeviceNodeCRTP(std::unique_ptr<Properties> props)
inline DeviceNodeCRTP(std::unique_ptr<Properties> props, bool confMode)
inline DeviceNodeCRTP(const std::shared_ptr<Device> &device, std::unique_ptr<Properties> props, bool confMode)

Public Members

Input input = {*this, {"in", DEFAULT_GROUP, true, 5, {{{DatatypeEnum::NNData, true}}}, true}}

Input NN results with detection data to parse Default queue is blocking with size 5

Output out = {*this, {"out", DEFAULT_GROUP, {{{DatatypeEnum::ImgDetections, false}}}}}

Outputs image frame with detected edges

Public Static Attributes

static constexpr const char *NAME = "DetectionParser"