23 #ifndef __SEGMENTATION_NET_H__ 24 #define __SEGMENTATION_NET_H__ 34 #define SEGNET_DEFAULT_INPUT "data" 40 #define SEGNET_DEFAULT_OUTPUT "score_fr_21classes" 106 static segNet*
Create(
const char* prototxt_path,
const char* model_path,
107 const char* class_labels,
const char* class_colors=NULL,
133 bool Process(
float* input, uint32_t width, uint32_t height,
const char* ignore_class=
"void" );
139 bool Mask( uint8_t* output, uint32_t width, uint32_t height );
181 void SetClassColor( uint32_t classIndex,
float r,
float g,
float b,
float a=255.0f );
219 bool classify(
const char* ignore_class );
221 bool overlayPoint(
float* input, uint32_t in_width, uint32_t in_height,
float* output, uint32_t out_width, uint32_t out_height,
bool mask_only );
222 bool overlayLinear(
float* input, uint32_t in_width, uint32_t in_height,
float* output, uint32_t out_width, uint32_t out_height,
bool mask_only );
FilterMode
Enumeration of mask/overlay filtering modes.
Definition: segNet.h:70
precisionType
Enumeration for indicating the desired precision that the network should run in, if available in hard...
Definition: tensorNet.h:79
bool overlayPoint(float *input, uint32_t in_width, uint32_t in_height, float *output, uint32_t out_width, uint32_t out_height, bool mask_only)
static FilterMode FilterModeFromStr(const char *str, FilterMode default_value=FILTER_LINEAR)
Parse a string from one of the FilterMode values.
GPU (if multiple GPUs are present, a specific GPU can be selected with cudaSetDevice() ...
Definition: tensorNet.h:108
#define DIMS_W(x)
Definition: tensorNet.h:52
std::vector< std::string > mClassLabels
Definition: segNet.h:227
NetworkType mNetworkType
Pretrained built-in model type enumeration.
Definition: segNet.h:237
const char * GetClassLabel(uint32_t id) const
Retrieve the description of a particular class.
Definition: segNet.h:171
FCN-Alexnet trained on SYNTHIA SEQS summer datasets.
Definition: segNet.h:58
FCN-Alexnet trained on SYNTHIA SEQS summer datasets.
Definition: segNet.h:57
FCN-Alexnet trained on Pascal VOC dataset.
Definition: segNet.h:55
void SetGlobalAlpha(float alpha, bool explicit_exempt=true)
Set a global alpha value for all classes (between 0-255), (optionally except for those that have been...
FCN-Alexnet trained on Cityscapes dataset with 21 classes.
Definition: segNet.h:59
static NetworkType NetworkTypeFromStr(const char *model_name)
Parse a string from one of the built-in pretrained models.
std::vector< outputLayer > mOutputs
Definition: tensorNet.h:551
bool overlayLinear(float *input, uint32_t in_width, uint32_t in_height, float *output, uint32_t out_width, uint32_t out_height, bool mask_only)
deviceType
Enumeration for indicating the desired device that the network should run on, if available in hardwar...
Definition: tensorNet.h:106
#define DIMS_C(x)
Definition: tensorNet.h:50
uint32_t GetNumClasses() const
Retrieve the number of object classes supported in the detector.
Definition: segNet.h:166
const char * GetNetworkName() const
Retrieve a string describing the network name.
Definition: segNet.h:214
The fastest detected precision should be use (i.e.
Definition: tensorNet.h:82
FCN-Alexnet trained on SYNTHIA CVPR16 dataset.
Definition: segNet.h:56
bool loadClassLabels(const char *filename)
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.
#define SEGNET_DEFAULT_INPUT
Name of default input blob for segmentation model.
Definition: segNet.h:34
int FindClassID(const char *label_name)
Find the ID of a particular class (by label name).
FCN-Alexnet trained on aerial first-person view of the horizon line for drones, 1280x720 and 21 outpu...
Definition: segNet.h:61
uint32_t mLastInputWidth
width in pixels of last input image to be processed
Definition: segNet.h:234
const char * GetClassPath() const
Retrieve the path to the file containing the class label descriptions.
Definition: segNet.h:192
virtual ~segNet()
Destroy.
float * mClassColors[2]
array of overlay colors in shared CPU/GPU memory
Definition: segNet.h:230
uint8_t * mClassMap[2]
runtime buffer for the argmax-classified class index of each tile
Definition: segNet.h:231
Bilinear filtering.
Definition: segNet.h:73
Nearest point sampling.
Definition: segNet.h:72
std::string mClassPath
Definition: segNet.h:228
float * mLastInputImg
last input image to be processed, stored for overlay
Definition: segNet.h:233
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 th...
bool classify(const char *ignore_class)
FCN-Alexnet trained on Cityscapes dataset with 21 classes.
Definition: segNet.h:60
Image segmentation with FCN-Alexnet or custom models, using TensorRT.
Definition: segNet.h:47
uint32_t GetGridWidth() const
Retrieve the number of columns in the classification grid.
Definition: segNet.h:198
#define DEFAULT_MAX_BATCH_SIZE
Default maximum batch size.
Definition: tensorNet.h:65
Abstract class for loading a tensor network with TensorRT.
Definition: tensorNet.h:188
#define SEGNET_DEFAULT_OUTPUT
Name of default output blob for segmentation model.
Definition: segNet.h:40
NetworkType GetNetworkType() const
Retrieve the network type (alexnet or googlenet)
Definition: segNet.h:209
bool loadClassColors(const char *filename)
float * GetClassColor(uint32_t id) const
Retrieve the class synset category of a particular class.
Definition: segNet.h:176
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.
uint32_t mLastInputHeight
height in pixels of last input image to be processed
Definition: segNet.h:235
bool Process(float *input, uint32_t width, uint32_t height, const char *ignore_class="void")
Perform the initial inferencing processing portion of the segmentation.
NetworkType
Enumeration of pretrained/built-in network models.
Definition: segNet.h:53
static segNet * Create(NetworkType networkType=FCN_ALEXNET_CITYSCAPES_SD, uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true)
Load a new network instance.
uint32_t GetGridHeight() const
Retrieve the number of rows in the classification grid.
Definition: segNet.h:204
#define DIMS_H(x)
Definition: tensorNet.h:51