NMS (Non-Maximum Suppression)#
Compatibility: Requires PVA SDK 2.6.0 and later.
Functions#
- NVCVStatus pvaNmsCreate(NVCVOperatorHandle *handle, NVCVTensorRequirements *tensorRequirements, int32_t nmsSize, const NVCVBorderType borderMode, int32_t borderValue)
Constructs an instance of the Non-Maximum Suppression (NMS) operator.
- NVCVStatus pvaNmsSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out)
Submits the NMS operator to a CUDA stream.
- NVCVStatus pvaNmsSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out)
Submits the NMS operator to a cuPVA stream.
Functions#
- NVCVStatus pvaNmsCreate(
- NVCVOperatorHandle *handle,
- NVCVTensorRequirements *tensorRequirements,
- int32_t nmsSize,
- const NVCVBorderType borderMode,
- int32_t borderValue,
Constructs an instance of the Non-Maximum Suppression (NMS) operator.
For each pixel an nmsSize x nmsSize window centered on that pixel is searched. If the pixel is the maximum of the window it is copied to the output, otherwise the output pixel is set to zero. Ties are resolved by position: among equal maxima within the window, the pixel that appears last in raster order (left to right, top to bottom) wins, that is, the one with the largest row index and, if those are equal, the largest column index. A rectangular plateau of equal values therefore leaves exactly one surviving pixel, at its bottom-right corner, rather than keeping all of them.
Limitations:
nmsSize must be 3 or 5.
Only NVCV_BORDER_CONSTANT and NVCV_BORDER_REPLICATE are supported.
The suppression decision is exact only where the center pixel differs from every other pixel of its window by more than 4 for a 3x3 window or 12 for a 5x5 window; see Accuracy below.
Input: Data Layout: [kHWC] Channels: [1]
Data Type
Allowed
8bit Unsigned
No
8bit Signed
No
16bit Unsigned
No
16bit Signed
No
32bit Unsigned
No
32bit Signed
Yes
32bit Float
No
64bit Float
No
Output: Data Layout: [kHWC] Channels: [1]
Data Type
Allowed
8bit Unsigned
No
8bit Signed
No
16bit Unsigned
No
16bit Signed
No
32bit Unsigned
No
32bit Signed
Yes
32bit Float
No
64bit Float
No
Input/Output Dependency:
Property
Input == Output
Data Layout
Yes
Data Type
Yes
Number
Yes
Channels
Yes
Width
Yes
Height
Yes
Parameters
Accuracy:Data Type = NVCV_DATA_TYPE_S32 only nmsSize = 3 or 5 (window is nmsSize x nmsSize) borderMode = NVCV_BORDER_CONSTANT or NVCV_BORDER_REPLICATE
The window maximum is computed with a position-dependent bias added to each tap, which implements the bottom-right tie-break. Because the bias is added to the pixel value, the decision is exact only where the center pixel differs from every other pixel of its window by more than B = (nmsSize * nmsSize - 1) / 2, i.e. 4 for a 3x3 window and 12 for a 5x5 window. Within that margin the result can err in either direction: a lower neighbor can suppress the center pixel, or a higher one can fail to suppress it.
- Parameters:
handle – [out] Where the operator instance handle will be written to.
Must not be NULL.
tensorRequirements – [in] Pointer to the NVCVTensorRequirements structure which contains Tensor rank, shape, layout and data type information.
Must not be NULL.
nmsSize – [in] Suppression window size. Must be 3 or 5.
borderMode – [in] Border mode to be used when accessing elements outside input image.
borderValue – [in] Constant border value to be used when borderMode is NVCV_BORDER_CONSTANT. Ignored otherwise.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Handle is null.
NVCV_ERROR_OUT_OF_MEMORY – Not enough memory to create the operator.
NVCV_SUCCESS – Operation executed successfully.
- NVCVStatus pvaNmsSubmit(
- NVCVOperatorHandle handle,
- cudaStream_t stream,
- NVCVTensorHandle in,
- NVCVTensorHandle out,
Submits the NMS operator to a CUDA stream.
Note
CUDA stream support requirements:
PVA SDK 2.7.0 or later
Jetpack 7 or later
DriveOS 7 or later
x86 Emulator is not supported
- Parameters:
handle – [in] Handle to the operator.
stream – [in] Handle to a valid CUDA stream.
in – [in] Input tensor handle.
out – [out] Output tensor handle.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.
NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.
NVCV_SUCCESS – Operation executed successfully.
- NVCVStatus pvaNmsSubmit(
- NVCVOperatorHandle handle,
- cupvaStream_t stream,
- NVCVTensorHandle in,
- NVCVTensorHandle out,
Submits the NMS operator to a cuPVA stream.
- Parameters:
handle – [in] Handle to the operator.
Must not be NULL.
stream – [in] Handle to a valid cuPVA stream.
in – [in] Input tensor handle.
out – [out] Output tensor handle.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.
NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.
NVCV_SUCCESS – Operation executed successfully.