TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
SampleFasterRCNN Class Reference

The SampleFasterRCNN class implements the FasterRCNN sample. More...

Collaboration diagram for SampleFasterRCNN:

Public Member Functions

 SampleFasterRCNN (const SampleFasterRCNNParams &params)
 
bool build ()
 Function builds the network engine. More...
 
bool infer ()
 Runs the TensorRT inference engine for this sample. More...
 
bool teardown ()
 Cleans up any state created in the sample class. More...
 

Private Types

template<typename T >
using SampleUniquePtr = std::unique_ptr< T, samplesCommon::InferDeleter >
 

Private Member Functions

void constructNetwork (SampleUniquePtr< nvcaffeparser1::ICaffeParser > &parser, SampleUniquePtr< nvinfer1::IBuilder > &builder, SampleUniquePtr< nvinfer1::INetworkDefinition > &network, SampleUniquePtr< nvinfer1::IBuilderConfig > &config)
 Parses a Caffe model for FasterRCNN and creates a TensorRT network. More...
 
bool processInput (const samplesCommon::BufferManager &buffers)
 Reads the input and mean data, preprocesses, and stores the result in a managed buffer. More...
 
bool verifyOutput (const samplesCommon::BufferManager &buffers)
 Filters output detections, handles post-processing of bounding boxes and verify results. More...
 
void bboxTransformInvAndClip (const float *rois, const float *deltas, float *predBBoxes, const float *imInfo, const int N, const int nmsMaxOut, const int numCls)
 Performs inverse bounding box transform and clipping. More...
 
std::vector< intnonMaximumSuppression (std::vector< std::pair< float, int >> &scoreIndex, float *bbox, const int classNum, const int numClasses, const float nmsThreshold)
 Performs non maximum suppression on final bounding boxes. More...
 

Private Attributes

SampleFasterRCNNParams mParams
 The parameters for the sample. More...
 
nvinfer1::Dims mInputDims
 The dimensions of the input to the network. More...
 
std::vector< samplesCommon::PPM< kIMG_CHANNELS, kIMG_H, kIMG_W > > mPPMs
 PPMs of test images. More...
 
std::shared_ptr< nvinfer1::ICudaEnginemEngine
 The TensorRT engine used to run the network. More...
 

Static Private Attributes

static const int kIMG_CHANNELS = 3
 
static const int kIMG_H = 375
 
static const int kIMG_W = 500
 

Detailed Description

The SampleFasterRCNN class implements the FasterRCNN sample.

It creates the network using a caffe model

Member Typedef Documentation

◆ SampleUniquePtr

template<typename T >
using SampleFasterRCNN::SampleUniquePtr = std::unique_ptr<T, samplesCommon::InferDeleter>
private

Constructor & Destructor Documentation

◆ SampleFasterRCNN()

SampleFasterRCNN::SampleFasterRCNN ( const SampleFasterRCNNParams params)
inline

Member Function Documentation

◆ build()

bool SampleFasterRCNN::build ( )

Function builds the network engine.

Creates the network, configures the builder and creates the network engine.

This function creates the FasterRCNN network by parsing the caffe model and builds the engine that will be used to run FasterRCNN (mEngine)

Returns
Returns true if the engine was created successfully and false otherwise
Here is the call graph for this function:

◆ infer()

bool SampleFasterRCNN::infer ( )

Runs the TensorRT inference engine for this sample.

This function is the main execution function of the sample. It allocates the buffer, sets inputs and executes the engine.

Here is the call graph for this function:

◆ teardown()

bool SampleFasterRCNN::teardown ( )

Cleans up any state created in the sample class.

Clean up the libprotobuf files as the parsing is complete

Note
It is not safe to use any other part of the protocol buffers library after ShutdownProtobufLibrary() has been called.
Here is the call graph for this function:

◆ constructNetwork()

void SampleFasterRCNN::constructNetwork ( SampleUniquePtr< nvcaffeparser1::ICaffeParser > &  parser,
SampleUniquePtr< nvinfer1::IBuilder > &  builder,
SampleUniquePtr< nvinfer1::INetworkDefinition > &  network,
SampleUniquePtr< nvinfer1::IBuilderConfig > &  config 
)
private

Parses a Caffe model for FasterRCNN and creates a TensorRT network.

Uses a caffe parser to create the FasterRCNN network and marks the output layers.

Parameters
networkPointer to the network that will be populated with the FasterRCNN network
builderPointer to the engine builder
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processInput()

bool SampleFasterRCNN::processInput ( const samplesCommon::BufferManager buffers)
private

Reads the input and mean data, preprocesses, and stores the result in a managed buffer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyOutput()

bool SampleFasterRCNN::verifyOutput ( const samplesCommon::BufferManager buffers)
private

Filters output detections, handles post-processing of bounding boxes and verify results.

Filters output detections and handles post-processing of bounding boxes, verify result.

Returns
whether the detection output matches expectations
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bboxTransformInvAndClip()

void SampleFasterRCNN::bboxTransformInvAndClip ( const float *  rois,
const float *  deltas,
float *  predBBoxes,
const float *  imInfo,
const int  N,
const int  nmsMaxOut,
const int  numCls 
)
private

Performs inverse bounding box transform and clipping.

Performs inverse bounding box transform.

Here is the caller graph for this function:

◆ nonMaximumSuppression()

std::vector< int > SampleFasterRCNN::nonMaximumSuppression ( std::vector< std::pair< float, int >> &  scoreIndex,
float *  bbox,
const int  classNum,
const int  numClasses,
const float  nmsThreshold 
)
private

Performs non maximum suppression on final bounding boxes.

Here is the caller graph for this function:

Member Data Documentation

◆ mParams

SampleFasterRCNNParams SampleFasterRCNN::mParams
private

The parameters for the sample.

◆ mInputDims

nvinfer1::Dims SampleFasterRCNN::mInputDims
private

The dimensions of the input to the network.

◆ kIMG_CHANNELS

const int SampleFasterRCNN::kIMG_CHANNELS = 3
staticprivate

◆ kIMG_H

const int SampleFasterRCNN::kIMG_H = 375
staticprivate

◆ kIMG_W

const int SampleFasterRCNN::kIMG_W = 500
staticprivate

◆ mPPMs

std::vector<samplesCommon::PPM<kIMG_CHANNELS, kIMG_H, kIMG_W> > SampleFasterRCNN::mPPMs
private

PPMs of test images.

◆ mEngine

std::shared_ptr<nvinfer1::ICudaEngine> SampleFasterRCNN::mEngine
private

The TensorRT engine used to run the network.


The documentation for this class was generated from the following file: