SegmentationNetwork class
Segmentation neural network process object.
Contents
- Reference
This class is a convenience class for a neural network which performs segmentation by having 1 input image, and outputs 1 segmentation image. Internally it uses TensorToSegmentation. If you need multi-input or multi-output support, use NeuralNetwork with TensorToSegmentation instead.
Base classes
- class NeuralNetwork
- Neural network process object.
Public functions
- auto create(std::string modelFilename, float scaleFactor, bool heatmapOutput, float threshold, bool hasBackgroundClass, float meanIntensity, float standardDeviationIntensity, bool resizeBackToOrigianlSize, std::vector<NeuralNetworkNode> inputNodes, std::vector<NeuralNetworkNode> outputNodes, std::string inferenceEngine, std::vector<std::string> customPlugins) -> std::shared_ptr<SegmentationNetwork>
- Create instance.
- auto create(std::string modelFilename, std::vector<NeuralNetworkNode> inputNodes, std::vector<NeuralNetworkNode> outputNodes, std::string inferenceEngine, std::vector<std::string> customPlugins) -> std::shared_ptr<SegmentationNetwork>
- Create instance C++ friendly create with parameters that must be set before loading.
- void setHeatmapOutput()
- void setSegmentationOutput()
- void setThreshold(float threshold)
- auto getThreshold() const -> float
- void setBackgroundClass(bool hasBackgroundClass)
- void loadAttributes() virtual
- void setResizeBackToOriginalSize(bool resize)
- void setChannelsToIgnore(std::vector<int> channels)
- Specify list of output channels to ignore.
Private functions
- void execute() virtual
Function documentation
std::shared_ptr<SegmentationNetwork> fast:: SegmentationNetwork:: create(std::string modelFilename,
float scaleFactor,
bool heatmapOutput,
float threshold,
bool hasBackgroundClass,
float meanIntensity,
float standardDeviationIntensity,
bool resizeBackToOrigianlSize,
std::vector<NeuralNetworkNode> inputNodes,
std::vector<NeuralNetworkNode> outputNodes,
std::string inferenceEngine,
std::vector<std::string> customPlugins)
Create instance.
| Parameters | |
|---|---|
| modelFilename | path to model to load |
| scaleFactor | A value which is multiplied with each pixel of input image before it is sent to the neural network. Use this to scale your pixels values. Default: 1.0 |
| heatmapOutput | If set to true, the output of this object will be a Tensor instead of a segmentation Image. Default: false |
| threshold | The minimum value of the class confidence value to be accepted. Default: 0.5 |
| hasBackgroundClass | Whether the neural network has a channel 0 which represents the "background". |
| meanIntensity | Mean intensity to subtract from each pixel of the input image |
| standardDeviationIntensity | Standard deviation to divide each pixel of the input image by |
| resizeBackToOrigianlSize | |
| inputNodes | Specify names, and potentially shapes, of input nodes. Not necessary unless you only want to use certain inputs or specify the input shape manually. |
| outputNodes | Specify names, and potentially shapes, of output nodes to use. Not necessary unless you only want to use certain outputs or specify the output shape manually. |
| inferenceEngine | Specify which inference engine to use (TensorFlow, TensorRT, OpenVINO). By default, FAST will select the best inference engine available on your system. |
| customPlugins | Specify path to any custom plugins/operators to load |
| Returns | instance |
std::shared_ptr<SegmentationNetwork> fast:: SegmentationNetwork:: create(std::string modelFilename,
std::vector<NeuralNetworkNode> inputNodes,
std::vector<NeuralNetworkNode> outputNodes,
std::string inferenceEngine,
std::vector<std::string> customPlugins)
Create instance C++ friendly create with parameters that must be set before loading.
| Parameters | |
|---|---|
| modelFilename | Path to model to load |
| inputNodes | Specify names, and potentially shapes, of input nodes. Not necessary unless you only want to use certain inputs or specify the input shape manually. |
| outputNodes | Specify names, and potentially shapes, of output nodes to use. Not necessary unless you only want to use certain outputs or specify the output shape manually. |
| inferenceEngine | Specify which inference engine to use (TensorFlow, TensorRT, OpenVINO). By default, FAST will select the best inference engine available on your system. |
| customPlugins | Specify path to any custom plugins/operators to load |
| Returns | instance |
void fast:: SegmentationNetwork:: setThreshold(float threshold)
| Parameters | |
|---|---|
| threshold | |
Threshold to accept a channel X as being class X.
void fast:: SegmentationNetwork:: setBackgroundClass(bool hasBackgroundClass)
| Parameters | |
|---|---|
| hasBackgroundClass | |
Set whether channel 0 of segmentation tensor is the "background" class, thereby getting the label 0 in the resulting Segmentation.
void fast:: SegmentationNetwork:: setChannelsToIgnore(std::vector<int> channels)
Specify list of output channels to ignore.
| Parameters | |
|---|---|
| channels | |