|
NVIDIA DeepStream SDK API Reference
|
7.1 Release
|
Go to the documentation of this file.
13 #ifndef __NVDSPREPROCESS_IMPL_H__
14 #define __NVDSPREPROCESS_IMPL_H__
17 #include <condition_variable>
24 #include <cuda_runtime_api.h>
26 #include "nvdspreprocess_interface.h"
33 #define _MAX_CHANNELS 4
36 #define DISABLE_CLASS_COPY(NoCopyClass) \
37 NoCopyClass(const NoCopyClass &) = delete; \
38 void operator=(const NoCopyClass &) = delete
41 #define SIMPLE_MOVE_COPY(Cls) \
42 Cls &operator=(Cls &&o) \
44 move_copy(std::move(o)); \
47 Cls(Cls &&o) { move_copy(std::move(o)); }
50 inline const char *
safeStr(
const std::string &str)
59 return (access(path, F_OK) != -1);
88 float pixel_normalization_factor = 1.0;
100 explicit CudaStream(uint flag = cudaStreamDefault,
int priority = 0);
112 m_Stream = o.m_Stream;
113 o.m_Stream =
nullptr;
130 template <
typename T>
182 bool setScaleOffsets(
float scale,
const std::vector<float>& offsets = {});
207 float m_Scale = 1.0f;
208 std::vector<float> m_ChannelMeans;
209 std::string m_MeanFile;
211 std::unique_ptr<CudaStream> m_PreProcessStream;
212 std::unique_ptr<CudaDeviceBuffer> m_MeanDataBuffer;
222 std::unique_ptr<NvDsPreProcessTensorImpl> & m_Preprocessor,
int unique_id);
~CudaDeviceBuffer()
destructor
T * ptr()
template to return cuda buffer
CudaBuffer(size_t s)
helper move copy functionality
void * m_Buf
pointer to cuda buffer
Custom parameters for normalization and mean subtractions.
@ NvDsPreProcessFormat_RGB
Specifies 24-bit interleaved R-G-B format.
Holds information about the model network.
bool setMeanFile(const std::string &file)
method to set mean file
Holds information about the batch of frames to be inferred.
NvDsPreProcessStatus allocateResource()
allocate resources for tensor preparation
bool file_accessible(const char *path)
helper check if file accessible in C
bool setInputOrder(const NvDsPreProcessNetworkInputOrder order)
method to set network input order
#define SIMPLE_MOVE_COPY(Cls)
helper move function
NvDsPreProcessStatus
Enum for the status codes returned by NvDsPreProcessImpl.
std::vector< float > offsets
Holds the per-channel offsets for mean subtraction.
Provides pre-processing functionality like mean subtraction and normalization.
Helper class for managing Cuda Streams.
std::string labelsFilePath
Holds the pathname of the labels file containing strings for the class labels.
NvDsPreProcessTensorImpl(const NvDsPreProcessNetworkSize &size, NvDsPreProcessFormat format, int id=0)
constructor for tensor preparation implementation
Helper base class for managing Cuda allocated buffers.
NvDsPreProcessStatus syncStream()
synchronize cuda stream
Tensor params passed to custom library for tensor preparation.
void move_copy(CudaBuffer &&o)
move_copy cuda buffer
virtual ~CudaBuffer()=default
virtual ~NvDsPreProcessTensorImpl()=default
const char * safeStr(const std::string &str)
helper check safe string in C
Holds model parameters for tensor preparation.
bool setScaleOffsets(float scale, const std::vector< float > &offsets={})
method to set offsets values
size_t bytes() const
size of cuda buffer in bytes
std::string meanImageFilePath
Holds the pathname of the mean image file (PPM format).
NvDsPreProcessNetworkInputOrder
Enum for the network input order according to which network shape will be provided to prepare raw ten...
NvDsPreProcessNetworkSize networkSize
width, height, channels size of Network
CudaDeviceBuffer(size_t size)
constructor
@ NvDsPreProcessNetworkInputOrder_kNCHW
Specifies NCHW network input order.
DISABLE_CLASS_COPY(CudaBuffer)
disable class copy
void * ptr()
pointer to cuda buffer
NvDsPreProcessStatus prepare_tensor(NvDsPreProcessBatch *batch, CustomTensorParams &tensorParam, void *&devBuf)
method to prepare tensor using cuda kernels
NvDsPreProcessFormat
Defines model color formats.
NvDsPreProcessStatus normalization_mean_subtraction_impl_initialize(CustomMeanSubandNormParams *custom_params, NvDsPreProcessTensorParams *tensor_params, std::unique_ptr< NvDsPreProcessTensorImpl > &m_Preprocessor, int unique_id)
Initialize for pixel normalization and mean subtraction.
cudaStream_t & ptr()
pointer to cuda stream
CudaStream(uint flag=cudaStreamDefault, int priority=0)