Back to Jetson Inference

Jetson Inference: segNet

docs/html/group__segNet.html

latest63.4 KB
Original Source

| | Jetson Inference

DNN Vision Library |

Classes | Macros

segNet DNN Vision Library (jetson-inference)

Semantic segmentation DNN (FCN or Fully-Convolutional Networks) More...

|

Classes

| | class | segNet | | | Image segmentation with FCN-Alexnet or custom models, using TensorRT. More...
| | |

|

Macros

| | #define | SEGNET_DEFAULT_INPUT "input_0" | | | Name of default input blob for segmentation model. More...
| | | | #define | SEGNET_DEFAULT_OUTPUT "output_0" | | | Name of default output blob for segmentation model. More...
| | | | #define | SEGNET_DEFAULT_ALPHA 150 | | | Default alpha blending value used during overlay. More...
| | | | #define | SEGNET_MODEL_TYPE "segmentation" | | | The model type for segNet in data/networks/models.json. More...
| | | | #define | SEGNET_USAGE_STRING | | | Standard command-line options able to be passed to segNet::Create()More...
| | |

Detailed Description

Semantic segmentation DNN (FCN or Fully-Convolutional Networks)


Class Documentation

segNet

| class segNet |

Image segmentation with FCN-Alexnet or custom models, using TensorRT.

Inheritance diagram for segNet:

|

Public Types

| | enum | FilterMode { FILTER_POINT = 0, FILTER_LINEAR } | | | Enumeration of mask/overlay filtering modes. More...
| | | | enum | VisualizationFlags { VISUALIZE_OVERLAY = (1 << 0), VISUALIZE_MASK = (1 << 1) } | | | Visualization flags. More...
| | | |

Public Member Functions

| | virtual | ~segNet () | | | Destroy. More...
| | | | template<typename T > | | bool | Process (T *input, uint32_t width, uint32_t height, const char *ignore_class="void") | | | Perform the initial inferencing processing portion of the segmentation. More...
| | | | bool | Process (void *input, uint32_t width, uint32_t height, imageFormat format, const char *ignore_class="void") | | | Perform the initial inferencing processing portion of the segmentation. More...
| | | | bool | Process (float *input, uint32_t width, uint32_t height, const char *ignore_class="void") | | | Perform the initial inferencing processing portion of the segmentation. More...
| | | | template<typename T > | | bool | Mask (T *output, uint32_t width, uint32_t height, FilterMode filter=FILTER_LINEAR) | | | Produce a colorized segmentation mask. More...
| | | | bool | Mask (void *output, uint32_t width, uint32_t height, imageFormat format, FilterMode filter=FILTER_LINEAR) | | | Produce a colorized segmentation mask. More...
| | | | bool | Mask (float *output, uint32_t width, uint32_t height, FilterMode filter=FILTER_LINEAR) | | | Produce a colorized RGBA segmentation mask. More...
| | | | bool | Mask (uint8_t *output, uint32_t width, uint32_t height) | | | Produce a grayscale binary segmentation mask, where the pixel values correspond to the class ID of the corresponding class type. More...
| | | | template<typename T > | | bool | Overlay (T *output, uint32_t width, uint32_t height, FilterMode filter=FILTER_LINEAR) | | | Produce the segmentation overlay alpha blended on top of the original image. More...
| | | | bool | Overlay (void *output, uint32_t width, uint32_t height, imageFormat format, FilterMode filter=FILTER_LINEAR) | | | Produce the segmentation overlay alpha blended on top of the original image. More...
| | | | bool | Overlay (float *output, uint32_t width, uint32_t height, FilterMode filter=FILTER_LINEAR) | | | Produce the segmentation overlay alpha blended on top of the original image. More...
| | | | int | FindClassID (const char *label_name) | | | Find the ID of a particular class (by label name). More...
| | | | uint32_t | GetNumClasses () const | | | Retrieve the number of object classes supported in the detector. More...
| | | | const char * | GetClassLabel (uint32_t id) const | | | Retrieve the description of a particular class. More...
| | | | const char * | GetClassDesc (uint32_t id) const | | | Retrieve the description of a particular class. More...
| | | | float4 | GetClassColor (uint32_t id) const | | | Retrieve the RGBA visualization color a particular class. More...
| | | | void | SetClassColor (uint32_t classIndex, const float4 &color) | | | Set the visualization color of a particular class of object. More...
| | | | void | SetClassColor (uint32_t classIndex, float r, float g, float b, float a=255.0f) | | | Set the visualization color of a particular class of object. More...
| | | | float | GetOverlayAlpha () const | | | Retrieve the overlay alpha blending value for classes that don't have it explicitly set. More...
| | | | void | SetOverlayAlpha (float alpha, bool explicit_exempt=true) | | | Set overlay alpha blending value for all classes (between 0-255), (optionally except for those that have been explicitly set). More...
| | | | const char * | GetClassPath () const | | | Retrieve the path to the file containing the class label descriptions. More...
| | | | uint32_t | GetGridWidth () const | | | Retrieve the number of columns in the classification grid. More...
| | | | uint32_t | GetGridHeight () const | | | Retrieve the number of rows in the classification grid. More...
| | | | Public Member Functions inherited from tensorNet | | virtual | ~tensorNet () | | | Destory. More...
| | | | bool | LoadNetwork (const char *prototxt, const char *model, const char *mean=NULL, const char *input_blob="data", const char *output_blob="prob", uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true, nvinfer1::IInt8Calibrator *calibrator=NULL, cudaStream_t stream=NULL) | | | Load a new network instance. More...
| | | | bool | LoadNetwork (const char *prototxt, const char *model, const char *mean, const char *input_blob, const std::vector< std::string > &output_blobs, uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true, nvinfer1::IInt8Calibrator *calibrator=NULL, cudaStream_t stream=NULL) | | | Load a new network instance with multiple output layers. More...
| | | | bool | LoadNetwork (const char *prototxt, const char *model, const char *mean, const std::vector< std::string > &input_blobs, const std::vector< std::string > &output_blobs, uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true, nvinfer1::IInt8Calibrator *calibrator=NULL, cudaStream_t stream=NULL) | | | Load a new network instance with multiple input layers. More...
| | | | bool | LoadNetwork (const char *prototxt, const char *model, const char *mean, const char *input_blob, const Dims3 &input_dims, const std::vector< std::string > &output_blobs, uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true, nvinfer1::IInt8Calibrator *calibrator=NULL, cudaStream_t stream=NULL) | | | Load a new network instance (this variant is used for UFF models) More...
| | | | bool | LoadNetwork (const char *prototxt, const char *model, const char *mean, const std::vector< std::string > &input_blobs, const std::vector< Dims3 > &input_dims, const std::vector< std::string > &output_blobs, uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true, nvinfer1::IInt8Calibrator *calibrator=NULL, cudaStream_t stream=NULL) | | | Load a new network instance with multiple input layers (used for UFF models) More...
| | | | bool | LoadEngine (const char *engine_filename, const std::vector< std::string > &input_blobs, const std::vector< std::string > &output_blobs, nvinfer1::IPluginFactory *pluginFactory=NULL, deviceType device=DEVICE_GPU, cudaStream_t stream=NULL) | | | Load a network instance from a serialized engine plan file. More...
| | | | bool | LoadEngine (char *engine_stream, size_t engine_size, const std::vector< std::string > &input_blobs, const std::vector< std::string > &output_blobs, nvinfer1::IPluginFactory *pluginFactory=NULL, deviceType device=DEVICE_GPU, cudaStream_t stream=NULL) | | | Load a network instance from a serialized engine plan file. More...
| | | | bool | LoadEngine (nvinfer1::ICudaEngine *engine, const std::vector< std::string > &input_blobs, const std::vector< std::string > &output_blobs, deviceType device=DEVICE_GPU, cudaStream_t stream=NULL) | | | Load network resources from an existing TensorRT engine instance. More...
| | | | bool | LoadEngine (const char *filename, char **stream, size_t *size) | | | Load a serialized engine plan file into memory. More...
| | | | void | EnableLayerProfiler () | | | Manually enable layer profiling times. More...
| | | | void | EnableDebug () | | | Manually enable debug messages and synchronization. More...
| | | | bool | AllowGPUFallback () const | | | Return true if GPU fallback is enabled. More...
| | | | deviceType | GetDevice () const | | | Retrieve the device being used for execution. More...
| | | | precisionType | GetPrecision () const | | | Retrieve the type of precision being used. More...
| | | | bool | IsPrecision (precisionType type) const | | | Check if a particular precision is being used. More...
| | | | cudaStream_t | GetStream () const | | | Retrieve the stream that the device is operating on. More...
| | | | cudaStream_t | CreateStream (bool nonBlocking=true) | | | Create and use a new stream for execution. More...
| | | | void | SetStream (cudaStream_t stream) | | | Set the stream that the device is operating on. More...
| | | | const char * | GetPrototxtPath () const | | | Retrieve the path to the network prototxt file. More...
| | | | const char * | GetModelPath () const | | | Retrieve the full path to model file, including the filename. More...
| | | | const char * | GetModelFilename () const | | | Retrieve the filename of the file, excluding the directory. More...
| | | | modelType | GetModelType () const | | | Retrieve the format of the network model. More...
| | | | bool | IsModelType (modelType type) const | | | Return true if the model is of the specified format. More...
| | | | uint32_t | GetInputLayers () const | | | Retrieve the number of input layers to the network. More...
| | | | uint32_t | GetOutputLayers () const | | | Retrieve the number of output layers to the network. More...
| | | | Dims3 | GetInputDims (uint32_t layer=0) const | | | Retrieve the dimensions of network input layer. More...
| | | | uint32_t | GetInputWidth (uint32_t layer=0) const | | | Retrieve the width of network input layer. More...
| | | | uint32_t | GetInputHeight (uint32_t layer=0) const | | | Retrieve the height of network input layer. More...
| | | | uint32_t | GetInputSize (uint32_t layer=0) const | | | Retrieve the size (in bytes) of network input layer. More...
| | | | float * | GetInputPtr (uint32_t layer=0) const | | | Get the CUDA pointer to the input layer's memory. More...
| | | | Dims3 | GetOutputDims (uint32_t layer=0) const | | | Retrieve the dimensions of network output layer. More...
| | | | uint32_t | GetOutputWidth (uint32_t layer=0) const | | | Retrieve the width of network output layer. More...
| | | | uint32_t | GetOutputHeight (uint32_t layer=0) const | | | Retrieve the height of network output layer. More...
| | | | uint32_t | GetOutputSize (uint32_t layer=0) const | | | Retrieve the size (in bytes) of network output layer. More...
| | | | float * | GetOutputPtr (uint32_t layer=0) const | | | Get the CUDA pointer to the output memory. More...
| | | | float | GetNetworkFPS () | | | Retrieve the network frames per second (FPS). More...
| | | | float | GetNetworkTime () | | | Retrieve the network runtime (in milliseconds). More...
| | | | const char * | GetNetworkName () const | | | Retrieve the network name (it's filename). More...
| | | | float2 | GetProfilerTime (profilerQuery query) | | | Retrieve the profiler runtime (in milliseconds). More...
| | | | float | GetProfilerTime (profilerQuery query, profilerDevice device) | | | Retrieve the profiler runtime (in milliseconds). More...
| | | | void | PrintProfilerTimes () | | | Print the profiler times (in millseconds). More...
| | | |

Static Public Member Functions

| | static uint32_t | VisualizationFlagsFromStr (const char *str, uint32_t default_value=VISUALIZE_OVERLAY) | | | Parse a string of one of more VisualizationMode values. More...
| | | | static FilterMode | FilterModeFromStr (const char *str, FilterMode default_value=FILTER_LINEAR) | | | Parse a string from one of the FilterMode values. More...
| | | | static segNet * | Create (const char *network="fcn-resnet18-voc", uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true) | | | Load a pre-trained model. More...
| | | | static segNet * | Create (const char *prototxt_path, const char *model_path, const char *class_labels, const char *class_colors=NULL, const char *input=SEGNET_DEFAULT_INPUT, const char *output=SEGNET_DEFAULT_OUTPUT, uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true) | | | Load a new network instance. More...
| | | | static segNet * | Create (int argc, char **argv) | | | Load a new network instance by parsing the command line. More...
| | | | static segNet * | Create (const commandLine &cmdLine) | | | Load a new network instance by parsing the command line. More...
| | | | static const char * | Usage () | | | Usage string for command line arguments to Create()More...
| | | | Static Public Member Functions inherited from tensorNet | | static bool | LoadClassLabels (const char *filename, std::vector< std::string > &descriptions, int expectedClasses=-1) | | | Load class descriptions from a label file. More...
| | | | static bool | LoadClassLabels (const char *filename, std::vector< std::string > &descriptions, std::vector< std::string > &synsets, int expectedClasses=-1) | | | Load class descriptions and synset strings from a label file. More...
| | | | static bool | LoadClassColors (const char *filename, float4 *colors, int expectedClasses, float defaultAlpha=255.0f) | | | Load class colors from a text file. More...
| | | | static bool | LoadClassColors (const char *filename, float4 **colors, int expectedClasses, float defaultAlpha=255.0f) | | | Load class colors from a text file. More...
| | | | static float4 | GenerateColor (uint32_t classID, float alpha=255.0f) | | | Procedurally generate a color for a given class index with the specified alpha value. More...
| | | | static precisionType | SelectPrecision (precisionType precision, deviceType device=DEVICE_GPU, bool allowInt8=true) | | | Resolve a desired precision to a specific one that's available. More...
| | | | static precisionType | FindFastestPrecision (deviceType device=DEVICE_GPU, bool allowInt8=true) | | | Determine the fastest native precision on a device. More...
| | | | static std::vector< precisionType > | DetectNativePrecisions (deviceType device=DEVICE_GPU) | | | Detect the precisions supported natively on a device. More...
| | | | static bool | DetectNativePrecision (const std::vector< precisionType > &nativeTypes, precisionType type) | | | Detect if a particular precision is supported natively. More...
| | | | static bool | DetectNativePrecision (precisionType precision, deviceType device=DEVICE_GPU) | | | Detect if a particular precision is supported natively. More...
| | | |

Protected Member Functions

| | | segNet () | | | | bool | classify (const char *ignore_class) | | | | bool | overlayPoint (void *input, uint32_t in_width, uint32_t in_height, imageFormat in_format, void *output, uint32_t out_width, uint32_t out_height, imageFormat out_format, bool mask_only) | | | | bool | overlayLinear (void *input, uint32_t in_width, uint32_t in_height, imageFormat in_format, void *output, uint32_t out_width, uint32_t out_height, imageFormat out_format, bool mask_only) | | | | bool | loadClassColors (const char *filename) | | | | bool | loadClassLabels (const char *filename) | | | | bool | saveClassLegend (const char *filename) | | | | Protected Member Functions inherited from tensorNet | | | tensorNet () | | | Constructor. More...
| | | | bool | ProcessNetwork (bool sync=true) | | | Execute processing of the network. More...
| | | | bool | ProfileModel (const std::string &deployFile, const std::string &modelFile, const std::vector< std::string > &inputs, const std::vector< Dims3 > &inputDims, const std::vector< std::string > &outputs, uint32_t maxBatchSize, precisionType precision, deviceType device, bool allowGPUFallback, nvinfer1::IInt8Calibrator *calibrator, char **engineStream, size_t *engineSize) | | | Create and output an optimized network model. More...
| | | | bool | ConfigureBuilder (nvinfer1::IBuilder *builder, uint32_t maxBatchSize, uint32_t workspaceSize, precisionType precision, deviceType device, bool allowGPUFallback, nvinfer1::IInt8Calibrator *calibrator) | | | Configure builder options. More...
| | | | bool | ValidateEngine (const char *model_path, const char *cache_path, const char *checksum_path) | | | Validate that the model already has a built TensorRT engine that exists and doesn't need updating. More...
| | | | void | PROFILER_BEGIN (profilerQuery query) | | | Begin a profiling query, before network is run. More...
| | | | void | PROFILER_END (profilerQuery query) | | | End a profiling query, after the network is run. More...
| | | | bool | PROFILER_QUERY (profilerQuery query) | | | Query the CUDA part of a profiler query. More...
| | | |

Protected Attributes

| | std::vector< std::string > | mClassLabels | | | | std::string | mClassPath | | | | bool * | mColorsAlphaSet | | | true if class color had been explicitly set from file or user More...
| | | | float4 * | mClassColors | | | array of overlay colors in shared CPU/GPU memory More...
| | | | uint8_t * | mClassMap | | | runtime buffer for the argmax-classified class index of each tile More...
| | | | void * | mLastInputImg | | | last input image to be processed, stored for overlay More...
| | | | uint32_t | mLastInputWidth | | | width in pixels of last input image to be processed More...
| | | | uint32_t | mLastInputHeight | | | height in pixels of last input image to be processed More...
| | | | imageFormat | mLastInputFormat | | | pixel format of last input image More...
| | | | Protected Attributes inherited from tensorNet | | tensorNet::Logger | gLogger | | | | tensorNet::Profiler | gProfiler | | | | std::string | mPrototxtPath | | | | std::string | mModelPath | | | | std::string | mModelFile | | | | std::string | mMeanPath | | | | std::string | mCacheEnginePath | | | | std::string | mCacheCalibrationPath | | | | std::string | mChecksumPath | | | | deviceType | mDevice | | | | precisionType | mPrecision | | | | modelType | mModelType | | | | cudaStream_t | mStream | | | | cudaEvent_t | mEventsGPU [PROFILER_TOTAL *2] | | | | timespec | mEventsCPU [PROFILER_TOTAL *2] | | | | nvinfer1::IRuntime * | mInfer | | | | nvinfer1::ICudaEngine * | mEngine | | | | nvinfer1::IExecutionContext * | mContext | | | | float2 | mProfilerTimes [PROFILER_TOTAL+1] | | | | uint32_t | mProfilerQueriesUsed | | | | uint32_t | mProfilerQueriesDone | | | | uint32_t | mWorkspaceSize | | | | uint32_t | mMaxBatchSize | | | | bool | mEnableProfiler | | | | bool | mEnableDebug | | | | bool | mAllowGPUFallback | | | | void ** | mBindings | | | | std::vector< layerInfo > | mInputs | | | | std::vector< layerInfo > | mOutputs | | |

Member Enumeration Documentation

FilterMode

| enum segNet::FilterMode |

Enumeration of mask/overlay filtering modes.

Enumerator
FILTER_POINT

Nearest point sampling.

| | FILTER_LINEAR |

Bilinear filtering.

|

VisualizationFlags

| enum segNet::VisualizationFlags |

Visualization flags.

Enumerator
VISUALIZE_OVERLAY

Overlay the segmentation class colors with alpha blending.

| | VISUALIZE_MASK |

View just the colorized segmentation class mask.

|

Constructor & Destructor Documentation

~segNet()

|

| virtual segNet::~segNet | ( | | ) | |

| virtual |

Destroy.

segNet()

|

| segNet::segNet | ( | | ) | |

| protected |

Member Function Documentation

classify()

|

| bool segNet::classify | ( | const char * | ignore_class | ) | |

| protected |

Create() [1/4]

|

| static segNet* segNet::Create | ( | const char * | network = "fcn-resnet18-voc", | | | | uint32_t | maxBatchSize = DEFAULT_MAX_BATCH_SIZE, | | | | precisionType | precision = TYPE_FASTEST, | | | | deviceType | device = DEVICE_GPU, | | | | bool | allowGPUFallback = true | | | ) | | |

| static |

Load a pre-trained model.

See alsoSEGNET_USAGE_STRING for the models available.

Create() [2/4]

|

| static segNet* segNet::Create | ( | const char * | prototxt_path, | | | | const char * | model_path, | | | | const char * | class_labels, | | | | const char * | class_colors = NULL, | | | | const char * | input = SEGNET_DEFAULT_INPUT, | | | | const char * | output = SEGNET_DEFAULT_OUTPUT, | | | | uint32_t | maxBatchSize = DEFAULT_MAX_BATCH_SIZE, | | | | precisionType | precision = TYPE_FASTEST, | | | | deviceType | device = DEVICE_GPU, | | | | bool | allowGPUFallback = true | | | ) | | |

| static |

Load a new network instance.

Parameters

| prototxt_path | File path to the deployable network prototxt | | model_path | File path to the caffemodel | | class_labels | File path to list of class name labels | | class_colors | File path to list of class colors | | input | Name of the input layer blob. |

See alsoSEGNET_DEFAULT_INPUT Parameters

| output | Name of the output layer blob. |

See alsoSEGNET_DEFAULT_OUTPUT Parameters

| maxBatchSize | The maximum batch size that the network will support and be optimized for. |

Create() [3/4]

|

| static segNet* segNet::Create | ( | const commandLine & | cmdLine | ) | |

| static |

Load a new network instance by parsing the command line.

Create() [4/4]

|

| static segNet* segNet::Create | ( | int | argc, | | | | char ** | argv | | | ) | | |

| static |

Load a new network instance by parsing the command line.

FilterModeFromStr()

|

| static FilterMode segNet::FilterModeFromStr | ( | const char * | str, | | | | FilterMode | default_value = FILTER_LINEAR | | | ) | | |

| static |

Parse a string from one of the FilterMode values.

Valid strings are "point", and "linear"

Returnsone of the segNet::FilterMode enums, or default segNet::FILTER_LINEAR on an error.

FindClassID()

| int segNet::FindClassID | ( | const char * | label_name | ) | |

Find the ID of a particular class (by label name).

GetClassColor()

|

| float4 segNet::GetClassColor | ( | uint32_t | id | ) | const |

| inline |

Retrieve the RGBA visualization color a particular class.

GetClassDesc()

|

| const char* segNet::GetClassDesc | ( | uint32_t | id | ) | const |

| inline |

Retrieve the description of a particular class.

GetClassLabel()

|

| const char* segNet::GetClassLabel | ( | uint32_t | id | ) | const |

| inline |

Retrieve the description of a particular class.

GetClassPath()

|

| const char* segNet::GetClassPath | ( | | ) | const |

| inline |

Retrieve the path to the file containing the class label descriptions.

GetGridHeight()

|

| uint32_t segNet::GetGridHeight | ( | | ) | const |

| inline |

Retrieve the number of rows in the classification grid.

This indicates the resolution of the raw segmentation output.

GetGridWidth()

|

| uint32_t segNet::GetGridWidth | ( | | ) | const |

| inline |

Retrieve the number of columns in the classification grid.

This indicates the resolution of the raw segmentation output.

GetNumClasses()

|

| uint32_t segNet::GetNumClasses | ( | | ) | const |

| inline |

Retrieve the number of object classes supported in the detector.

GetOverlayAlpha()

| float segNet::GetOverlayAlpha | ( | | ) | const |

Retrieve the overlay alpha blending value for classes that don't have it explicitly set.

loadClassColors()

|

| bool segNet::loadClassColors | ( | const char * | filename | ) | |

| protected |

loadClassLabels()

|

| bool segNet::loadClassLabels | ( | const char * | filename | ) | |

| protected |

Mask() [1/4]

| bool segNet::Mask | ( | float * | output, | | | | uint32_t | width, | | | | uint32_t | height, | | | | FilterMode | filter = FILTER_LINEAR | | | ) | | |

Produce a colorized RGBA segmentation mask.

**Deprecated:**this overload is for legacy compatibility. It expects float4 RGBA image.

Mask() [2/4]

template<typename T >

|

| bool segNet::Mask | ( | T * | output, | | | | uint32_t | width, | | | | uint32_t | height, | | | | FilterMode | filter = FILTER_LINEAR | | | ) | | |

| inline |

Produce a colorized segmentation mask.

Mask() [3/4]

| bool segNet::Mask | ( | uint8_t * | output, | | | | uint32_t | width, | | | | uint32_t | height | | | ) | | |

Produce a grayscale binary segmentation mask, where the pixel values correspond to the class ID of the corresponding class type.

Mask() [4/4]

| bool segNet::Mask | ( | void * | output, | | | | uint32_t | width, | | | | uint32_t | height, | | | | imageFormat | format, | | | | FilterMode | filter = FILTER_LINEAR | | | ) | | |

Produce a colorized segmentation mask.

Overlay() [1/3]

| bool segNet::Overlay | ( | float * | output, | | | | uint32_t | width, | | | | uint32_t | height, | | | | FilterMode | filter = FILTER_LINEAR | | | ) | | |

Produce the segmentation overlay alpha blended on top of the original image.

**Deprecated:**this overload is for legacy compatibility. It expects float4 RGBA image. Parameters

| input | float4 input image in CUDA device memory, RGBA colorspace with values 0-255. | | output | float4 output image in CUDA device memory, RGBA colorspace with values 0-255. | | width | width of the input image in pixels. | | height | height of the input image in pixels. | | ignore_class | label name of class to ignore in the classification (or NULL to process all). | | type | overlay visualization options |

Returnstrue on success, false on error.

Overlay() [2/3]

template<typename T >

|

| bool segNet::Overlay | ( | T * | output, | | | | uint32_t | width, | | | | uint32_t | height, | | | | FilterMode | filter = FILTER_LINEAR | | | ) | | |

| inline |

Produce the segmentation overlay alpha blended on top of the original image.

Parameters

| output | output image in CUDA device memory, RGB/RGBA colorspace with values 0-255. | | width | width of the input image in pixels. | | height | height of the input image in pixels. | | ignore_class | label name of class to ignore in the classification (or NULL to process all). | | type | overlay visualization options |

Returnstrue on success, false on error.

Overlay() [3/3]

| bool segNet::Overlay | ( | void * | output, | | | | uint32_t | width, | | | | uint32_t | height, | | | | imageFormat | format, | | | | FilterMode | filter = FILTER_LINEAR | | | ) | | |

Produce the segmentation overlay alpha blended on top of the original image.

Parameters

| output | output image in CUDA device memory, RGB/RGBA colorspace with values 0-255. | | width | width of the input image in pixels. | | height | height of the input image in pixels. | | ignore_class | label name of class to ignore in the classification (or NULL to process all). | | type | overlay visualization options |

Returnstrue on success, false on error.

overlayLinear()

|

| bool segNet::overlayLinear | ( | void * | input, | | | | uint32_t | in_width, | | | | uint32_t | in_height, | | | | imageFormat | in_format, | | | | void * | output, | | | | uint32_t | out_width, | | | | uint32_t | out_height, | | | | imageFormat | out_format, | | | | bool | mask_only | | | ) | | |

| protected |

overlayPoint()

|

| bool segNet::overlayPoint | ( | void * | input, | | | | uint32_t | in_width, | | | | uint32_t | in_height, | | | | imageFormat | in_format, | | | | void * | output, | | | | uint32_t | out_width, | | | | uint32_t | out_height, | | | | imageFormat | out_format, | | | | bool | mask_only | | | ) | | |

| protected |

Process() [1/3]

| bool segNet::Process | ( | float * | input, | | | | uint32_t | width, | | | | uint32_t | height, | | | | const char * | ignore_class = "void" | | | ) | | |

Perform the initial inferencing processing portion of the segmentation.

The results can then be visualized using the Overlay() and Mask() functions.

**Deprecated:**this overload is for legacy compatibility. It expects float4 RGBA image. Parameters

| input | float4 input image in CUDA device memory, RGBA colorspace with values 0-255. | | width | width of the input image in pixels. | | height | height of the input image in pixels. | | ignore_class | label name of class to ignore in the classification (or NULL to process all). |

Process() [2/3]

template<typename T >

|

| bool segNet::Process | ( | T * | input, | | | | uint32_t | width, | | | | uint32_t | height, | | | | const char * | ignore_class = "void" | | | ) | | |

| inline |

Perform the initial inferencing processing portion of the segmentation.

The results can then be visualized using the Overlay() and Mask() functions.

Parameters

| input | the input image in CUDA device memory, with pixel values 0-255. | | width | width of the input image in pixels. | | height | height of the input image in pixels. | | ignore_class | label name of class to ignore in the classification (or NULL to process all). |

Process() [3/3]

| bool segNet::Process | ( | void * | input, | | | | uint32_t | width, | | | | uint32_t | height, | | | | imageFormat | format, | | | | const char * | ignore_class = "void" | | | ) | | |

Perform the initial inferencing processing portion of the segmentation.

The results can then be visualized using the Overlay() and Mask() functions.

Parameters

| input | the input image in CUDA device memory, with pixel values 0-255. | | width | width of the input image in pixels. | | height | height of the input image in pixels. | | ignore_class | label name of class to ignore in the classification (or NULL to process all). |

saveClassLegend()

|

| bool segNet::saveClassLegend | ( | const char * | filename | ) | |

| protected |

SetClassColor() [1/2]

| void segNet::SetClassColor | ( | uint32_t | classIndex, | | | | const float4 & | color | | | ) | | |

Set the visualization color of a particular class of object.

SetClassColor() [2/2]

| void segNet::SetClassColor | ( | uint32_t | classIndex, | | | | float | r, | | | | float | g, | | | | float | b, | | | | float | a = 255.0f | | | ) | | |

Set the visualization color of a particular class of object.

SetOverlayAlpha()

| void segNet::SetOverlayAlpha | ( | float | alpha, | | | | bool | explicit_exempt = true | | | ) | | |

Set overlay alpha blending value for all classes (between 0-255), (optionally except for those that have been explicitly set).

Usage()

|

| static const char* segNet::Usage | ( | | ) | |

| inlinestatic |

Usage string for command line arguments to Create()

VisualizationFlagsFromStr()

|

| static uint32_t segNet::VisualizationFlagsFromStr | ( | const char * | str, | | | | uint32_t | default_value = VISUALIZE_OVERLAY | | | ) | | |

| static |

Parse a string of one of more VisualizationMode values.

Valid strings are "overlay" "mask" "overlay|mask" "overlay,mask" ect.

Member Data Documentation

mClassColors

|

| float4* segNet::mClassColors |

| protected |

array of overlay colors in shared CPU/GPU memory

mClassLabels

|

| std::vector<std::string> segNet::mClassLabels |

| protected |

mClassMap

|

| uint8_t* segNet::mClassMap |

| protected |

runtime buffer for the argmax-classified class index of each tile

mClassPath

|

| std::string segNet::mClassPath |

| protected |

mColorsAlphaSet

|

| bool* segNet::mColorsAlphaSet |

| protected |

true if class color had been explicitly set from file or user

mLastInputFormat

|

| imageFormat segNet::mLastInputFormat |

| protected |

pixel format of last input image

mLastInputHeight

|

| uint32_t segNet::mLastInputHeight |

| protected |

height in pixels of last input image to be processed

mLastInputImg

|

| void* segNet::mLastInputImg |

| protected |

last input image to be processed, stored for overlay

mLastInputWidth

|

| uint32_t segNet::mLastInputWidth |

| protected |

width in pixels of last input image to be processed

Macro Definition Documentation

SEGNET_DEFAULT_ALPHA

| #define SEGNET_DEFAULT_ALPHA 150 |

Default alpha blending value used during overlay.

SEGNET_DEFAULT_INPUT

| #define SEGNET_DEFAULT_INPUT "input_0" |

Name of default input blob for segmentation model.

SEGNET_DEFAULT_OUTPUT

| #define SEGNET_DEFAULT_OUTPUT "output_0" |

Name of default output blob for segmentation model.

SEGNET_MODEL_TYPE

| #define SEGNET_MODEL_TYPE "segmentation" |

The model type for segNet in data/networks/models.json.

SEGNET_USAGE_STRING

| #define SEGNET_USAGE_STRING |

Value:

"segNet arguments: \n" \

" --network=NETWORK pre-trained model to load, one of the following:\n" \

" * fcn-resnet18-cityscapes-512x256\n" \

" * fcn-resnet18-cityscapes-1024x512\n" \

" * fcn-resnet18-cityscapes-2048x1024\n" \

" * fcn-resnet18-deepscene-576x320\n" \

" * fcn-resnet18-deepscene-864x480\n" \

" * fcn-resnet18-mhp-512x320\n" \

" * fcn-resnet18-mhp-640x360\n" \

" * fcn-resnet18-voc-320x320 (default)\n" \

" * fcn-resnet18-voc-512x320\n" \

" * fcn-resnet18-sun-512x400\n" \

" * fcn-resnet18-sun-640x512\n" \

" --model=MODEL path to custom model to load (caffemodel, uff, or onnx)\n" \

" --prototxt=PROTOTXT path to custom prototxt to load (for .caffemodel only)\n" \

" --labels=LABELS path to text file containing the labels for each class\n" \

" --colors=COLORS path to text file containing the colors for each class\n" \

" --input-blob=INPUT name of the input layer (default: '" SEGNET_DEFAULT_INPUT "')\n" \

" --output-blob=OUTPUT name of the output layer (default: '" SEGNET_DEFAULT_OUTPUT "')\n" \

" --alpha=ALPHA overlay alpha blending value, range 0-255 (default: 150)\n" \

" --visualize=VISUAL visualization flags (e.g. --visualize=overlay,mask)\n" \

" valid combinations are: 'overlay', 'mask'\n" \

" --profile enable layer profiling in TensorRT\n\n"

Standard command-line options able to be passed to segNet::Create()

SEGNET_DEFAULT_INPUT

#define SEGNET_DEFAULT_INPUT

Name of default input blob for segmentation model.

Definition: segNet.h:34

SEGNET_DEFAULT_OUTPUT

#define SEGNET_DEFAULT_OUTPUT

Name of default output blob for segmentation model.

Definition: segNet.h:40

  • Generated on Tue Mar 28 2023 14:27:58 for Jetson Inference by 1.8.17