NVIDIA DeepStream SDK API Reference

9.1 Release
sources/libs/nvdsinferserver/infer_extra_processor.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
25 #ifndef __NVDSINFERSERVER_EXTRA_PROCESSOR_H__
26 #define __NVDSINFERSERVER_EXTRA_PROCESSOR_H__
27 
28 #include "infer_base_backend.h"
29 #include "infer_common.h"
30 #include "infer_custom_process.h"
31 #include "infer_datatypes.h"
32 #include "infer_utils.h"
33 
34 namespace nvdsinferserver {
35 
36 using TensorMapPool = MapBufferPool<std::string, UniqCudaTensorBuf>;
37 using TensorMapPoolPtr = std::unique_ptr<TensorMapPool>;
38 
43 public:
46 
47  /*
48  * @brief Load custom processor from custom library.
49  */
51  SharedDllHandle dlHandle, const std::string& funcName, const std::string& config);
52 
53  /*
54  * @brief Allocate extra input resources including both CPU/GPU buffers.
55  */
57  BaseBackend& backend, const std::set<std::string>& excludes, int32_t poolSize, int gpuId);
58 
59  /*
60  * @brief Process extra input tensors per batched input.
61  */
63 
64  /*
65  * @brief Notify errors.
66  */
67  void notifyError(NvDsInferStatus status);
68 
69  /*
70  * @brief Inference done callback outputs.
71  */
73 
74  /*
75  * @brief Destroy all resources including custom processors.
76  */
78 
79 private:
80  bool requireLoop() const { return m_RequireInferLoop; }
81 
82  /*
83  * @brief Stores all input layers except primary input.
84  */
85  LayerDescriptionList m_ExtraInputLayers;
86  /*
87  * @brief Stores all input layers.
88  */
89  LayerDescriptionList m_FullInputLayers;
90  /*
91  * @brief Max batch size, 0 indicates no batching.
92  */
93  uint32_t m_maxBatch = 0;
94  /*
95  * @brief Flag indicating first dimension is dynamic size batch.
96  * Only valid if m_maxBatch == 0
97  */
98  bool m_firstDimDynamicBatch = false;
99 
100  bool m_RequireInferLoop = false;
101  UniqStreamManager m_StreamManager;
102  InferCustomProcessorPtr m_CustomProcessor;
103  TensorMapPoolPtr m_ExtInputHostPool;
104  TensorMapPoolPtr m_ExtInputGpuPool;
105  SharedCuStream m_Host2GpuStream;
106 };
107 
108 } // namespace nvdsinferserver
109 
110 #endif
nvdsinferserver
This is a header file for pre-processing cuda kernels with normalization and mean subtraction require...
Definition: sources/gst-plugins/gst-nvinferserver/gstnvinferserver_impl.h:69
nvdsinferserver::InferExtraProcessor::processExtraInputs
NvDsInferStatus processExtraInputs(SharedBatchArray &inputs)
nvdsinferserver::SharedDllHandle
std::shared_ptr< DlLibHandle > SharedDllHandle
Definition: sources/libs/nvdsinferserver/infer_common.h:116
nvdsinferserver::TensorMapPoolPtr
std::unique_ptr< TensorMapPool > TensorMapPoolPtr
Definition: sources/libs/nvdsinferserver/infer_extra_processor.h:37
nvdsinferserver::SharedBatchArray
std::shared_ptr< BaseBatchArray > SharedBatchArray
Definition: sources/libs/nvdsinferserver/infer_common.h:80
nvdsinferserver::InferExtraProcessor::InferExtraProcessor
InferExtraProcessor()
nvdsinferserver::InferCustomProcessorPtr
std::shared_ptr< IInferCustomProcessor > InferCustomProcessorPtr
Definition: sources/libs/nvdsinferserver/infer_common.h:146
nvdsinferserver::InferExtraProcessor::checkInferOutputs
NvDsInferStatus checkInferOutputs(SharedBatchArray &outputs, SharedOptions inOptions)
infer_common.h
Header file of the common declarations for the nvinferserver library.
nvdsinferserver::SharedCuStream
std::shared_ptr< CudaStream > SharedCuStream
Cuda based pointers.
Definition: sources/libs/nvdsinferserver/infer_common.h:89
nvdsinferserver::UniqStreamManager
std::unique_ptr< StreamManager > UniqStreamManager
Definition: sources/libs/nvdsinferserver/infer_common.h:136
nvdsinferserver::TensorMapPool
MapBufferPool< std::string, UniqCudaTensorBuf > TensorMapPool
Definition: sources/libs/nvdsinferserver/infer_extra_processor.h:36
nvdsinferserver::SharedOptions
std::shared_ptr< IOptions > SharedOptions
Definition: sources/libs/nvdsinferserver/infer_common.h:78
nvdsinferserver::InferExtraProcessor::~InferExtraProcessor
~InferExtraProcessor()
nvdsinferserver::InferExtraProcessor
: Extra processing pre/post inference.
Definition: sources/libs/nvdsinferserver/infer_extra_processor.h:42
nvdsinferserver::LayerDescriptionList
std::vector< LayerDescription > LayerDescriptionList
Definition: sources/libs/nvdsinferserver/infer_ibackend.h:63
infer_utils.h
Header file containing utility functions and classes used by the nvinferserver low level library.
nvdsinferserver::InferExtraProcessor::destroy
NvDsInferStatus destroy()
nvdsinferserver::InferExtraProcessor::notifyError
void notifyError(NvDsInferStatus status)
nvdsinferserver::BaseBackend
Base class of inference backend processing.
Definition: sources/libs/nvdsinferserver/infer_base_backend.h:45
infer_base_backend.h
Header file for inference processing backend base class.
nvdsinferserver::InferExtraProcessor::allocateExtraInputs
NvDsInferStatus allocateExtraInputs(BaseBackend &backend, const std::set< std::string > &excludes, int32_t poolSize, int gpuId)
nvdsinferserver::InferExtraProcessor::initCustomProcessor
NvDsInferStatus initCustomProcessor(SharedDllHandle dlHandle, const std::string &funcName, const std::string &config)
NvDsInferStatus
NvDsInferStatus
Enum for the status codes returned by NvDsInferContext.
Definition: sources/includes/nvdsinfer.h:231