Defines the DataConditioner module for performing common transformations on input images for DNN.
|
| DW_API_PUBLIC dwStatus | dwDataConditioner_getCUDAStream (cudaStream_t *stream, dwDataConditionerHandle_t obj) |
| | Gets the CUDA stream used by the data conditioner. More...
|
| |
| DW_API_PUBLIC dwStatus | dwDataConditioner_getOutputSize (dwBlobSize *outputBlobSize, dwDataConditionerHandle_t 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 *obj, const dwBlobSize *networkInputBlobSize, const dwDataConditionerParams *dataConditionerParams, cudaStream_t stream, dwContextHandle_t ctx) |
| | Initializes a DataConditioner module. More...
|
| |
| DW_API_PUBLIC dwStatus | dwDataConditioner_initParams (dwDataConditionerParams *dataConditionerParams) |
| | Initializes DataConditioner parameters with default values. More...
|
| |
| DW_API_PUBLIC dwStatus | dwDataConditioner_outputPositionToInput (float32_t *outputX, float32_t *outputY, float32_t inputX, float32_t inputY, const dwRect *roi, dwDataConditionerHandle_t obj) |
| | Computes the position of a point from the interpreted DNN output on the input image. More...
|
| |
| DW_API_PUBLIC dwStatus | dwDataConditioner_prepareData (float32_t *d_outputImage, const dwImageCUDA *const *inputImages, uint32_t numImages, const dwRect *roi, cudaTextureAddressMode addressMode, dwDataConditionerHandle_t obj) |
| | Runs the configured transformations on an image. More...
|
| |
| DW_API_PUBLIC dwStatus | dwDataConditioner_release (dwDataConditionerHandle_t *obj) |
| | Releases the DataConditioner module. More...
|
| |
| DW_API_PUBLIC dwStatus | dwDataConditioner_reset (dwDataConditionerHandle_t obj) |
| | Resets the DataConditioner module. More...
|
| |
| DW_API_PUBLIC dwStatus | dwDataConditioner_setCUDAStream (cudaStream_t stream, dwDataConditionerHandle_t obj) |
| | Sets the CUDA stream for CUDA related operations. More...
|
| |
◆ dwDataConditionerParams
| struct dwDataConditionerParams |
| Data Fields |
|
dwBool |
doPerPlaneMeanNormalization |
Boolean indicating whether to perform per-plane mean normalization. Default false. |
|
dwBool |
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.
|
|
float32_t |
meanValue[DW_MAX_IMAGE_PLANES] |
Mean value to be subtracted. Default is 0. |
|
float32_t |
scaleCoefficient |
Scale pixel intensities. Default is 1.0. |
|
dwBool |
splitPlanes |
Boolean indicating whether planes should be split. Default is true. |
◆ dwDataConditionerHandle_t
◆ dwDataConditioner_getCUDAStream()
Gets the CUDA stream used by the data conditioner.
- Parameters
-
| [out] | stream | The CUDA stream currently used by the data conditioner. |
| [in] | obj | A handle to the data conditioner module. |
- Returns
- DW_INVALID_ARGUMENT if the given dataconditioner handle or stream are NUll.
DW_SUCCESS otherwise.
◆ dwDataConditioner_getOutputSize()
Computes the output size based on the input size and the operations that have been added.
- Parameters
-
| [out] | outputBlobSize | Size of the output blob after the transformations have been applied. |
| [in] | obj | Specifies the DataConditioner handle. |
- Returns
- DW_INVALID_ARGUMENT if outputBlobSize or dataconditioner handle are NULL.
DW_SUCCESS otherwise.
◆ dwDataConditioner_initialize()
Initializes a DataConditioner module.
- Parameters
-
| [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. |
- Note
- DataConditioner parameters must be initialized using dwDataConditioner_initDefaultParams before modifying.
- Returns
- DW_INVALID_ARGUMENT if dataconditioner handle is NULL or dataConditionerParams is invalid.
DW_SUCCESS
◆ dwDataConditioner_initParams()
Initializes DataConditioner parameters with default values.
- Parameters
-
| [out] | dataConditionerParams | DataConditioner parameters. |
- Returns
- DW_INVALID_ARGUMENT if parameters are NULL.
DW_SUCCESS
◆ dwDataConditioner_outputPositionToInput()
Computes the position of a point from the interpreted DNN output on the input image.
- Parameters
-
| [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. |
- Returns
- DW_INVALID_ARGUMENT if outputX, outputY, roi or dataconditioner handle are NULL.
DW_SUCCESS
◆ dwDataConditioner_prepareData()
Runs the configured transformations on an image.
- Parameters
-
| [out] | d_outputImage | 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. |
- Note
- Supported image types: R, RGB, RGBA, RCB and RCC.
-
If the type of inputImage is RGBA, alpha channel is dropped during the operations; therefore, outputImage has three channels instead of four.
-
If the type of inputImage is RGB, the channels may not be interleaved. Use RGBA if that is intended.
-
All the images in the list are required to have the same dimensions as the one given during initialization.
-
The ROI is scaled to match the network input size. If ignoreAspectRatio is false, scaling is performed by maintaining the original ROI aspect ratio. Since after scaling there might be an empty part in the scaled ROI, this will be filled according to addressMode.
-
numImages cannot exceed the batchsize set at initialization time. If numImages is higher than 1, the resultant output image is batched, and it can then be given to the corresponding DNN.
- Returns
- DW_INVALID_ARGUMENT if outputImage or dataconditioner handle are NULL, or inputImage is null or invalid.
DW_CUDA_ERROR in case of an underlying cuda failure.
DW_SUCCESS otherwise.
◆ dwDataConditioner_release()
Releases the DataConditioner module.
- Parameters
-
| [in] | obj | A pointer to the object handle to release. |
- Returns
- DW_INVALID_ARGUMENT if dataconditioner handle is NULL.
DW_SUCCESS otherwise.
- Note
- This method renders the handle unusable.
◆ dwDataConditioner_reset()
Resets the DataConditioner module.
- Parameters
-
| [in] | obj | Specifies the DataConditioner handle to reset. |
- Returns
- DW_INVALID_ARGUMENT if dataconditioner handle is NULL.
DW_SUCCESS otherwise.
◆ dwDataConditioner_setCUDAStream()
Sets the CUDA stream for CUDA related operations.
- Note
- The ownership of the stream remains by the callee.
- Parameters
-
| [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. |
- Returns
- DW_INVALID_ARGUMENT if the given dataconditioner handle is NULL.
DW_SUCCESS otherwise.