SegmentationParser
Supported on:RVC4
How to place it
Python
Python
1pipeline = dai.Pipeline()
2segmentation = pipeline.create(dai.node.SegmentationParser)Inputs and Outputs
Usage
Python
Python
1model = dai.NNModelDescription("luxonis/deeplab-v3-plus:512x512")
2pipeline = dai.Pipeline()
3camera = pipeline.create(dai.node.Camera).build()
4nn = pipeline.create(dai.node.NeuralNetwork).build(camera, model)
5parser = pipeline.create(dai.node.SegmentationParser).build(nn.out, model )Examples of functionality
- Semantic segmentation (Python) - Run a DeepLabv3+ segmentation model and display the segmentation masks on a video stream.
- Segmentation examples (C++) - Browse the C++ segmentation examples in
depthai-core.
Reference
class
dai::node::SegmentationParser
variable
std::shared_ptr< SegmentationParserConfig > initialConfig
Initial config to use when parsing segmentation masks.
variable
Input input
Input NN results with segmentation data to parser
variable
Input inputConfig
variable
Output out
Outputs segmentation mask
function
~SegmentationParser()function
SegmentationParser()inline function
SegmentationParser(std::unique_ptr< Properties > props)function
std::shared_ptr< SegmentationParser > build(Node::Output & nnInput, const Model & model)function
std::shared_ptr< SegmentationParser > build(Node::Output & nnInput, const dai::nn_archive::v1::Head & head)function
void setLabels(const std::vector< std::string > & labels)Sets the class labels associated with the segmentation mask. The label at index $i$ in the
Parameters
- labels: Vector of class labels
function
std::vector< std::string > getLabels()Returns the class labels associated with the segmentation mask.
function
void setBackgroundClass(bool backgroundClass)Sets whether the first class (index 0) is considered the background class. If true, the pixels classified as index 0 will be treated as background.
Parameters
- backgroundClass: Boolean indicating if the first class is the background class
Parameters
Only applicable if the number of classes is greater than 1 and the output classes are not in a single layer (eg. classesInOneLayer = false).
function
bool getBackgroundClass()Gets whether the first class (index 0) is considered the background class.
function
void setRunOnHost(bool runOnHost)Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()Check if the node is set to run on host
function
void run()function
void buildInternal()inline function
DeviceNodeCRTP()inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)enum
std::variant< NNModelDescription, NNArchive, std::string > Model
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.