Defines the DataConditioner module for performing common transformations on input images for DNN.
Data Structures | |
| struct | dwDataConditionerParams |
Typedefs | |
| typedef struct dwDataConditionerObject * | dwDataConditionerHandle_t |
| Handle to a DataConditioner. More... | |
Functions | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_getCUDAStream (cudaStream_t *const stream, dwDataConditionerHandle_t const obj) |
| Gets the CUDA stream used by the data conditioner. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_getOutputSize (dwBlobSize *const outputBlobSize, dwDataConditionerHandle_t const obj) |
| Computes the output size based on the input size and the operations that have been added. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_initialize (dwDataConditionerHandle_t *const obj, dwBlobSize const *const networkInputBlobSize, dwDataConditionerParams const *const dataConditionerParams, cudaStream_t const stream, dwContextHandle_t const ctx) |
| Initializes a DataConditioner module. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_initializeFromTensorProperties (dwDataConditionerHandle_t *const obj, dwDNNTensorProperties const *const outputProperties, uint32_t const maxNumImages, dwDataConditionerParams const *const dataConditionerParams, cudaStream_t const stream, dwContextHandle_t const ctx) |
| Initializes a DataConditioner module. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_initializeNew (dwDataConditionerHandle_t *const obj, dwBlobSize const *const networkInputBlobSize, uint32_t const maxNumImages, dwDataConditionerParams const *const dataConditionerParams, cudaStream_t const stream, dwContextHandle_t const ctx) |
| Initializes a DataConditioner module. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_initParams (dwDataConditionerParams *const dataConditionerParams) |
| Initializes DataConditioner parameters with default values. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_outputPositionToInput (float32_t *const outputX, float32_t *const outputY, float32_t const inputX, float32_t const inputY, dwRect const *const roi, dwDataConditionerHandle_t const obj) |
| Computes the position of a point from the interpreted DNN output on the input image. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_prepareData (dwDNNTensorHandle_t const tensorOutput, dwImageHandle_t const *const inputImages, uint32_t const numImages, dwRect const *const roi, cudaTextureAddressMode const addressMode, dwDataConditionerHandle_t const obj) |
| Runs the configured transformations on an image. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_prepareDataRaw (float32_t *const dOutputImage, dwImageCUDA const *const *const inputImages, uint32_t const numImages, dwRect const *const roi, cudaTextureAddressMode const addressMode, dwDataConditionerHandle_t const obj) |
| Runs the configured transformations on an image. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_release (dwDataConditionerHandle_t const obj) |
| Releases the DataConditioner module. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_reset (dwDataConditionerHandle_t const obj) |
| Resets the DataConditioner module. More... | |
| DW_API_PUBLIC dwStatus | dwDataConditioner_setCUDAStream (cudaStream_t const stream, dwDataConditionerHandle_t const obj) |
| Sets the CUDA stream for CUDA related operations. More... | |
| struct dwDataConditionerParams |
| Data Fields | ||
|---|---|---|
| bool | doPerPlaneMeanNormalization | Boolean indicating whether to perform per-plane mean normalization. Default false. |
| bool | ignoreAspectRatio |
Boolean indicating whether the aspect ratio of the input image should be kept (false) or the image should be stretched to the roi specified (true). Default false |
| const dwImageCUDA * | meanImage |
Mean image to be subtracted. Default is nullptr. Mean image is expected to be float16 or float32. The pixel format is required to be R or RGBA with interleaved channels. The dimensions of the mean image must meet the dimensions of network input. Pixel range: [0, 255]. Default is nullptr. |
| float32_t | meanValue[DW_MAX_IMAGE_PLANES] | Mean value to be subtracted. Range [0, 255]. Default is 0. |
| float32_t | scaleCoefficient | Scale pixel intensities. Default is 1.0. |
| bool | splitPlanes | Boolean indicating whether planes should be split. Default is true. |
| float32_t | stdev[DW_MAX_IMAGE_PLANES] |
Standard deviation with range [0, 255]. Default is 1.0. The results are computed using the following formula, where R, G and B are from the input image and have range of [0, 255] meanImage is optional and is 0 if it is not set perPlaneMeanX is the mean per plane for that channel and is optional and 0 if it is not set R' = ((R - meanValue[0] - meanImage[pixelIndex] - perPlaneMeanR) / stdev[0]) * scaleCoefficient G' = ((G - meanValue[1] - meanImage[pixelIndex] - perPlaneMeanG) / stdev[1]) * scaleCoefficient B' = ((B - meanValue[2] - meanImage[pixelIndex] - perPlaneMeanB) / stdev[2]) * scaleCoefficient |
| typedef struct dwDataConditionerObject* dwDataConditionerHandle_t |
Handle to a DataConditioner.
Definition at line 90 of file DataConditioner.h.
| DW_API_PUBLIC dwStatus dwDataConditioner_getCUDAStream | ( | cudaStream_t *const | stream, |
| dwDataConditionerHandle_t const | obj | ||
| ) |
Gets the CUDA stream used by the data conditioner.
| [out] | stream | The CUDA stream currently used by the data conditioner. |
| [in] | obj | A handle to the data conditioner module. |
| DW_API_PUBLIC dwStatus dwDataConditioner_getOutputSize | ( | dwBlobSize *const | outputBlobSize, |
| dwDataConditionerHandle_t const | obj | ||
| ) |
Computes the output size based on the input size and the operations that have been added.
| [out] | outputBlobSize | Size of the output blob after the transformations have been applied. |
| [in] | obj | Specifies the DataConditioner handle. |
| DW_API_PUBLIC dwStatus dwDataConditioner_initialize | ( | dwDataConditionerHandle_t *const | obj, |
| dwBlobSize const *const | networkInputBlobSize, | ||
| dwDataConditionerParams const *const | dataConditionerParams, | ||
| cudaStream_t const | stream, | ||
| dwContextHandle_t const | ctx | ||
| ) |
Initializes a DataConditioner module.
| [out] | obj | A pointer to the DataConditioner handle for the created module. |
| [in] | networkInputBlobSize | A pointer to the size of the network input as a blob that the DataConditioner expects. |
| [in] | dataConditionerParams | DataConditioner parameters. |
| [in] | stream | Specifies the CUDA stream to use for operations. |
| [in] | ctx | Specifies the handler to the context under which the DataConditioner module is created. |
| DW_API_PUBLIC dwStatus dwDataConditioner_initializeFromTensorProperties | ( | dwDataConditionerHandle_t *const | obj, |
| dwDNNTensorProperties const *const | outputProperties, | ||
| uint32_t const | maxNumImages, | ||
| dwDataConditionerParams const *const | dataConditionerParams, | ||
| cudaStream_t const | stream, | ||
| dwContextHandle_t const | ctx | ||
| ) |
Initializes a DataConditioner module.
| [out] | obj | A pointer to the DataConditioner handle for the created module. |
| [in] | outputProperties | Tensor properties of the output. This can be obtained for dwDNN. |
| [in] | maxNumImages | Maximum number of images to run DataConditioner and combine into one Tensor |
| [in] | dataConditionerParams | DataConditioner parameters. |
| [in] | stream | Specifies the CUDA stream to use for operations. |
| [in] | ctx | Specifies the handler to the context under which the DataConditioner module is created. |
| DW_API_PUBLIC dwStatus dwDataConditioner_initializeNew | ( | dwDataConditionerHandle_t *const | obj, |
| dwBlobSize const *const | networkInputBlobSize, | ||
| uint32_t const | maxNumImages, | ||
| dwDataConditionerParams const *const | dataConditionerParams, | ||
| cudaStream_t const | stream, | ||
| dwContextHandle_t const | ctx | ||
| ) |
Initializes a DataConditioner module.
| [out] | obj | A pointer to the DataConditioner handle for the created module. |
| [in] | networkInputBlobSize | A pointer to the size of the network input as a blob that the DataConditioner expects. |
| [in] | maxNumImages | Maximum number of images that a single step can process. |
| [in] | dataConditionerParams | DataConditioner parameters. |
| [in] | stream | Specifies the CUDA stream to use for operations. |
| [in] | ctx | Specifies the handler to the context under which the DataConditioner module is created. |
| DW_API_PUBLIC dwStatus dwDataConditioner_initParams | ( | dwDataConditionerParams *const | dataConditionerParams | ) |
Initializes DataConditioner parameters with default values.
| [out] | dataConditionerParams | DataConditioner parameters. |
| DW_API_PUBLIC dwStatus dwDataConditioner_outputPositionToInput | ( | float32_t *const | outputX, |
| float32_t *const | outputY, | ||
| float32_t const | inputX, | ||
| float32_t const | inputY, | ||
| dwRect const *const | roi, | ||
| dwDataConditionerHandle_t const | obj | ||
| ) |
Computes the position of a point from the interpreted DNN output on the input image.
| [out] | outputX | Pointer to X coordinate on the input image. |
| [out] | outputY | Pointer to Y coordinate on the input image. |
| [in] | inputX | X coordinate from DNN output. |
| [in] | inputY | Y coordinate from DNN output. |
| [in] | roi | ROI extracted from the input image. |
| [in] | obj | Specifies the DataConditioner handle. |
| DW_API_PUBLIC dwStatus dwDataConditioner_prepareData | ( | dwDNNTensorHandle_t const | tensorOutput, |
| dwImageHandle_t const *const | inputImages, | ||
| uint32_t const | numImages, | ||
| dwRect const *const | roi, | ||
| cudaTextureAddressMode const | addressMode, | ||
| dwDataConditionerHandle_t const | obj | ||
| ) |
Runs the configured transformations on an image.
| [out] | tensorOutput | Tensor CUDA handle to store output. |
| [in] | inputImages | List of Image CUDA handles as input |
| [in] | numImages | Number of input images. |
| [in] | roi | ROI to extract from input images. |
| [in] | addressMode | cudaTextureAddressMode specifies how to fill the potentially empty part of the ROI. |
| [in] | obj | Specifies the DataConditioner handle. |
| DW_API_PUBLIC dwStatus dwDataConditioner_prepareDataRaw | ( | float32_t *const | dOutputImage, |
| dwImageCUDA const *const *const | inputImages, | ||
| uint32_t const | numImages, | ||
| dwRect const *const | roi, | ||
| cudaTextureAddressMode const | addressMode, | ||
| dwDataConditionerHandle_t const | obj | ||
| ) |
Runs the configured transformations on an image.
| [out] | dOutputImage | A pointer to the preallocated output blob in GPU memory. |
| [in] | inputImages | Pointer to a list of pitched images to batch. |
| [in] | numImages | Number of pitched images. |
| [in] | roi | ROI to extract from input images. |
| [in] | addressMode | cudaTextureAddressMode specifies how to fill the potentially empty part of the ROI. |
| [in] | obj | Specifies the DataConditioner handle. |
| DW_API_PUBLIC dwStatus dwDataConditioner_release | ( | dwDataConditionerHandle_t const | obj | ) |
Releases the DataConditioner module.
| [in] | obj | The object handle to release. |
| DW_API_PUBLIC dwStatus dwDataConditioner_reset | ( | dwDataConditionerHandle_t const | obj | ) |
Resets the DataConditioner module.
| [in] | obj | Specifies the DataConditioner handle to reset. |
| DW_API_PUBLIC dwStatus dwDataConditioner_setCUDAStream | ( | cudaStream_t const | stream, |
| dwDataConditionerHandle_t const | obj | ||
| ) |
Sets the CUDA stream for CUDA related operations.
| [in] | stream | The CUDA stream to be used. Default is the one passed during dwDataConditioner_initialize. |
| [in] | obj | A handle to the data conditioner module for which to set CUDA stream. |