Class for inference context CUDA processing.
Handles preprocessing, post-processing, extra input processing and LSTM related processing.
Definition at line 44 of file infer_cuda_context.h.


Public Member Functions | |
| InferCudaContext () | |
| Constructor. More... | |
| ~InferCudaContext () override | |
| Destructor. More... | |
| SharedSysMem | acquireTensorHostBuf (const std::string &name, size_t bytes) |
| Allocator. More... | |
| SharedCuEvent | acquireTensorHostEvent () |
| Acquire a CUDA event from the events pool. More... | |
| NvDsInferStatus | initialize (const std::string &prototxt, InferLoggingFunc logFunc) final |
| NvDsInferStatus | run (SharedIBatchArray input, InferOutputCb outputCb) final |
Protected Member Functions | |
| NvDsInferStatus | fixateInferenceInfo (const ic::InferenceConfig &config, BaseBackend &backend) override |
| Check the tensor order, media format, and datatype for the input tensor. More... | |
| NvDsInferStatus | createPreprocessor (const ic::PreProcessParams ¶ms, std::vector< UniqPreprocessor > &processors) override |
| Create the surface converter and network preprocessor. More... | |
| NvDsInferStatus | createPostprocessor (const ic::PostProcessParams ¶ms, UniqPostprocessor &processor) override |
| Create the post-processor as per the network output type. More... | |
| NvDsInferStatus | allocateResource (const ic::InferenceConfig &config) override |
| Allocate resources for the preprocessors and post-processor. More... | |
| NvDsInferStatus | preInference (SharedBatchArray &inputs, const ic::InferenceConfig &config) override |
| Initialize non-image input layers if the custom library has implemented the interface. More... | |
| NvDsInferStatus | extraOutputTensorCheck (SharedBatchArray &outputs, SharedOptions inOptions) override |
| Post inference steps for the custom processor and LSTM controller. More... | |
| void | notifyError (NvDsInferStatus status) override |
| In case of error, notify the waiting threads. More... | |
| NvDsInferStatus | deinit () override |
| Release the host tensor pool buffers, extra input buffers, LSTM controller, extra input processor. More... | |
| void | getNetworkInputInfo (NvDsInferNetworkInfo &networkInfo) override |
| Get the network input layer information. More... | |
| int | tensorPoolSize () const |
| Get the size of the tensor pool. More... | |
| virtual void | backendConsumedInputs (SharedBatchArray inputs) |
| virtual SharedCuStream & | mainStream ()=0 |
| const ic::InferenceConfig & | config () const |
| int | maxBatchSize () const |
| int | uniqueId () const |
| BaseBackend * | backend () |
| const SharedDllHandle & | customLib () const |
| bool | needCopyInputToHost () const |
| void | print (NvDsInferLogLevel l, const char *msg) |
| bool | needPreprocess () const |
Protected Attributes | |
| NvDsInferNetworkInfo | m_NetworkImageInfo {0, 0, 0} |
| Network input height, width, channels for preprocessing. More... | |
| InferMediaFormat | m_NetworkImageFormat = InferMediaFormat::kRGB |
| The input layer media format. More... | |
| std::string | m_NetworkImageName |
| The input layer name. More... | |
| InferTensorOrder | m_InputTensorOrder = InferTensorOrder::kNone |
| The input layer tensor order. More... | |
| InferDataType | m_InputDataType = InferDataType::kFp32 |
| The input layer datatype. More... | |
| std::vector< SharedCudaTensorBuf > | m_ExtraInputs |
| Array of buffers of the additional inputs. More... | |
| MapBufferPool< std::string, UniqSysMem > | m_HostTensorPool |
| Map of pools for the output tensors. More... | |
| SharedBufPool< std::unique_ptr< CudaEventInPool > > | m_HostTensorEvents |
| Pool of CUDA events for host tensor copy. More... | |
| UniqLstmController | m_LstmController |
| LSTM controller. More... | |
| UniqStreamManager | m_MultiStreamManager |
| stream-id based management. More... | |
| UniqInferExtraProcessor | m_ExtraProcessor |
| Extra and custom processing pre/post inference. More... | |
| nvdsinferserver::InferCudaContext::InferCudaContext | ( | ) |
Constructor.
Instantiate the host tensor pool.
|
override |
Destructor.
Clear the extra input list and host tensor pool.
| SharedSysMem nvdsinferserver::InferCudaContext::acquireTensorHostBuf | ( | const std::string & | name, |
| size_t | bytes | ||
| ) |
Allocator.
Acquire a host buffer for the inference output.
| [in] | name | Name of the output layer. |
| [in] | bytes | Size of the buffer. |
| SharedCuEvent nvdsinferserver::InferCudaContext::acquireTensorHostEvent | ( | ) |
Acquire a CUDA event from the events pool.
|
overrideprotectedvirtual |
Allocate resources for the preprocessors and post-processor.
Allocate the host tensor pool buffers.
| [in] | config | The inference configuration settings. |
Implements nvdsinferserver::InferBaseContext.
|
inlineprotectedinherited |
Definition at line 101 of file infer_base_context.h.
|
inlineprotectedvirtualinherited |
Definition at line 93 of file infer_base_context.h.
|
inlineprotectedinherited |
Definition at line 98 of file infer_base_context.h.
|
overrideprotectedvirtual |
Create the post-processor as per the network output type.
| [in] | params | The post processing configuration parameters. |
| [out] | processor | The handle to the created post processor. |
Implements nvdsinferserver::InferBaseContext.
|
overrideprotectedvirtual |
Create the surface converter and network preprocessor.
| params | The preprocessor configuration. |
| processors | List of the created preprocessor handles. |
Implements nvdsinferserver::InferBaseContext.
|
inlineprotectedinherited |
Definition at line 102 of file infer_base_context.h.
|
overrideprotected |
Release the host tensor pool buffers, extra input buffers, LSTM controller, extra input processor.
De-initialize the context.
|
overrideprotectedvirtual |
Post inference steps for the custom processor and LSTM controller.
| [in,out] | outputs | The output batch buffers array. |
| [in] | inOptions | The configuration options for the buffers. |
Reimplemented from nvdsinferserver::InferBaseContext.
|
overrideprotectedvirtual |
Check the tensor order, media format, and datatype for the input tensor.
Initiate the extra processor and lstm controller if configured.
| [in] | config | The inference configuration protobuf message. |
| [in] | backend | The inference backend instance. |
Implements nvdsinferserver::InferBaseContext.
|
inlineoverrideprotected |
Get the network input layer information.
Definition at line 132 of file infer_cuda_context.h.
References m_NetworkImageInfo.
|
finalinherited |
|
protectedpure virtualinherited |
Implemented in nvdsinferserver::InferGrpcContext, and nvdsinferserver::InferTrtISContext.
|
inlineprotectedinherited |
Definition at line 99 of file infer_base_context.h.
|
protectedinherited |
|
protectedinherited |
|
overrideprotectedvirtual |
In case of error, notify the waiting threads.
Implements nvdsinferserver::InferBaseContext.
|
overrideprotectedvirtual |
Initialize non-image input layers if the custom library has implemented the interface.
| [in,out] | inputs | Array of the input batch buffers. |
| [in] | config | The inference configuration settings. |
Reimplemented from nvdsinferserver::InferBaseContext.
|
protectedinherited |
|
finalinherited |
|
protected |
Get the size of the tensor pool.
|
inlineprotectedinherited |
Definition at line 100 of file infer_base_context.h.
|
protected |
Array of buffers of the additional inputs.
Definition at line 213 of file infer_cuda_context.h.
|
protected |
Extra and custom processing pre/post inference.
Definition at line 228 of file infer_cuda_context.h.
|
protected |
Definition at line 234 of file infer_cuda_context.h.
|
protected |
Pool of CUDA events for host tensor copy.
Definition at line 221 of file infer_cuda_context.h.
|
protected |
Map of pools for the output tensors.
Definition at line 217 of file infer_cuda_context.h.
|
protected |
The input layer datatype.
Definition at line 208 of file infer_cuda_context.h.
|
protected |
The input layer tensor order.
Definition at line 204 of file infer_cuda_context.h.
|
protected |
LSTM controller.
Definition at line 224 of file infer_cuda_context.h.
|
protected |
stream-id based management.
Definition at line 226 of file infer_cuda_context.h.
|
protected |
The input layer media format.
Definition at line 196 of file infer_cuda_context.h.
|
protected |
Network input height, width, channels for preprocessing.
Definition at line 192 of file infer_cuda_context.h.
Referenced by getNetworkInputInfo().
|
protected |
The input layer name.
Definition at line 200 of file infer_cuda_context.h.
|
protected |
Definition at line 233 of file infer_cuda_context.h.
|
protected |
Preprocessor and post-processor handles.
Definition at line 232 of file infer_cuda_context.h.