Defines ObjectDetector module for object detection.
Data Structures | |
struct | dwObjectDetectorParams |
Object detector configuration parameters. More... | |
Macros | |
#define | DW_OBJECT_DETECTOR_MAX_IMAGES 4 |
Maximum number of images the detector can process at a time. More... | |
Typedefs | |
typedef struct dwObjectDetectorObject * | dwObjectDetectorHandle_t |
Handle to an object detector. More... | |
Enumerations | |
enum | dwObjectDetectorDLAStage { DW_OBJECT_DETECTOR_DLA_STAGE_GPU_ASYNC_PREPROCESSING = 0, DW_OBJECT_DETECTOR_DLA_STAGE_DLA_ASYNC_INFERENCE, DW_OBJECT_DETECTOR_DLA_STAGE_GPU_ASYNC_INTERPRET_DETECTIONS, DW_OBJECT_DETECTOR_DLA_STAGE_CPU_SYNC_POSTPROCESSING } |
The DLA process stages of the ObjectDetector. More... | |
enum | dwObjectDetectorOutputType { DW_OBJECT_DETECTOR_OUTPUT_TYPE_PROPOSAL, DW_OBJECT_DETECTOR_OUTPUT_TYPE_DETECTION } |
The type of the detector output. More... | |
enum | dwObjectDetectorStage { DW_OBJECT_DETECTOR_STAGE_GPU_ASYNC_PREPROCESSING = 0, DW_OBJECT_DETECTOR_STAGE_GPU_ASYNC_INFERENCE, DW_OBJECT_DETECTOR_STAGE_GPU_ASYNC_INTERPRET_DETECTIONS, DW_OBJECT_DETECTOR_STAGE_CPU_SYNC_POSTPROCESSING } |
The GPU process stages of the ObjectDetector. More... | |
Functions | |
DW_API_PUBLIC dwStatus | dwObjectDetector_bindInput (const dwImageCUDA *const *images, uint32_t imageCount, dwObjectDetectorHandle_t obj) |
Binds the input to the detector as a list of images. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_bindOutput (dwObjectArray *objectArray, uint32_t imageIdx, dwObjectClass objectClass, dwObjectDetectorOutputType type, dwObjectDetectorHandle_t obj) |
Bind the ouput of the detector to array of objects. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_clearOutputMask (dwObjectClass objectClass, dwObjectDetectorHandle_t obj) |
Clears output mask. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_detectObjects (dwObjectArray *detections, const dwImageCUDA *image, dwObjectDetectorHandle_t obj) |
Detects objects from the given input image. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_getCoverageThreshold (float32_t *covThreshold, dwObjectClass objectClass, dwObjectDetectorHandle_t obj) |
Get coverage threshold for a given class. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_getCUDAStream (cudaStream_t *stream, dwObjectDetectorHandle_t obj) |
Gets the CUDA stream used. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_getOutputMaskDimensions (uint32_t *width, uint32_t *height, dwObjectDetectorHandle_t obj) |
Returns output mask dimensions. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_getROI (dwRect *ROI, dwTransformation2f *outputToObject, uint32_t imageIdx, dwObjectDetectorHandle_t obj) |
Returns the region of interest and the 2D transformation from the image coordinate system to object coordinate system at given index. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_initDefaultParams (dwObjectDetectorParams *detectorParams) |
Initializes ObjectDetector parameters with default values. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_initializeFromDriveNet (dwObjectDetectorHandle_t *obj, const dwObjectDetectorParams *detectorParams, dwDriveNetHandle_t drivenet, dwContextHandle_t ctx) |
Initializes ObjectDetector module with a DriveNet module. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_isDistanceEnabled (bool *enabled, dwObjectDetectorHandle_t obj) |
Returns a boolean indicating whether DNN distance output is enabled. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_isFuseObjectsEnabled (bool *enabled, dwObjectDetectorHandle_t obj) |
Returns a boolean indicating whether object fusing is enabled. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_isObjectDepthEnabled (bool *enabled, dwObjectDetectorHandle_t obj) |
Returns a boolean indicating whether object depth output is enabled. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_isObjectUrgencyEnabled (bool *enabled, dwObjectDetectorHandle_t obj) |
Returns a boolean indicating whether DNN urgency output is enabled. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_process (dwObjectDetectorStage stage, dwObjectDetectorHandle_t obj) |
Perform object detection GPU stages. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_processDLA (dwObjectDetectorDLAStage stage, dwObjectDetectorHandle_t obj) |
Perform object detection DLA stages. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_release (dwObjectDetectorHandle_t obj) |
Releases the ObjectDetector module. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_reset (dwObjectDetectorHandle_t obj) |
Resets ObjectDetector. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_setActiveImageIndices (const uint32_t *imageMap, uint32_t numImages, dwObjectDetectorHandle_t obj) |
Set active images to infer (DW_OBJECT_DETECTOR_STAGE_GPU_ASYNC_INFERENCE) or interpret (DW_OBJECT_DETECTOR_STAGE_GPU_ASYNC_INTERPRET_DETECTIONS).The detector can hold multiple images but only need to process a subset of them. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_setCoverageThreshold (float32_t covThreshold, dwObjectClass objectClass, dwObjectDetectorHandle_t obj) |
Set coverage threshold for a given class. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_setCUDAStream (cudaStream_t stream, dwObjectDetectorHandle_t obj) |
Sets the CUDA stream used. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_setEnableFuseObjects (bool enable, dwObjectDetectorHandle_t obj) |
Enables or disables objectFusing. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_setOutputMask (const uint8_t *mask, uint32_t maskWidth, uint32_t maskHeight, dwObjectClass objectClass, dwObjectDetectorHandle_t obj) |
Set output mask. More... | |
DW_API_PUBLIC dwStatus | dwObjectDetector_setROI (uint32_t imageIdx, const dwRect *ROI, const dwTransformation2f *outputToObject, dwObjectDetectorHandle_t obj) |
Sets the region of interest for an image at given index, and the 2D transformation from the image coordinate system to object coordinate system. More... | |
struct dwObjectDetectorParams |
Data Fields | ||
---|---|---|
bool | enableBoundingBoxClipping |
If enableBoundingBoxClipping is set to true, the bounding boxes are clipped to the image edges. Default is true since it has been used during training. |
bool | enableFuseObjects |
If enableFuseObjects is set to true, all the objects proposals coming from all the images are treated as a single list of proposals. Clustering is applied to this entire list, which results in a single list of objects. Default is false. |
uint32_t | maxNumImages | Maximum number of images (cannot be larger than DW_DETECTOR_MAX_IMAGES). Default is 1. |
dwRect | ROIs[DW_OBJECT_DETECTOR_MAX_IMAGES] |
Region of interest for each image at the corresponding index. The image is cropped at the given ROI. The cropped region is then be scaled while keeping the aspect ratio and is padded to have the right size for DNN. Default ROI is the whole image. |
uint32_t | sensorId | camera sensor id of the camera the detector runs on |
dwTransformation2f | transformations[DW_OBJECT_DETECTOR_MAX_IMAGES] |
List of transformations from each image coordinate system to object coordinate system at the corresponding image index. By default, the transformation matrices are identity. |
#define DW_OBJECT_DETECTOR_MAX_IMAGES 4 |
Maximum number of images the detector can process at a time.
Definition at line 64 of file ObjectDetector.h.
typedef struct dwObjectDetectorObject* dwObjectDetectorHandle_t |
Handle to an object detector.
Definition at line 70 of file ObjectDetector.h.
The DLA process stages of the ObjectDetector.
Definition at line 90 of file ObjectDetector_processpipeline.h.
The type of the detector output.
Enumerator | |
---|---|
DW_OBJECT_DETECTOR_OUTPUT_TYPE_PROPOSAL | |
DW_OBJECT_DETECTOR_OUTPUT_TYPE_DETECTION |
Definition at line 105 of file ObjectDetector.h.
The GPU process stages of the ObjectDetector.
Definition at line 59 of file ObjectDetector_processpipeline.h.
DW_API_PUBLIC dwStatus dwObjectDetector_bindInput | ( | const dwImageCUDA *const * | images, |
uint32_t | imageCount, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Binds the input to the detector as a list of images.
[in] | images | Array storing pointers to images where the detector is to be applied. |
[in] | imageCount | Number of images provided in the array. |
[in] | obj | Specifies the ObjectDetector handle. |
numImages
must be divisible by the batch size of the network. DW_API_PUBLIC dwStatus dwObjectDetector_bindOutput | ( | dwObjectArray * | objectArray, |
uint32_t | imageIdx, | ||
dwObjectClass | objectClass, | ||
dwObjectDetectorOutputType | type, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Bind the ouput of the detector to array of objects.
[in,out] | objectArray | Pointer to an object array structure. |
[in] | imageIdx | The image index for the list. |
[in] | objectClass | The class for the list. |
[in] | type | The type of the output |
[in] | obj | Specifies the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_clearOutputMask | ( | dwObjectClass | objectClass, |
dwObjectDetectorHandle_t | obj | ||
) |
Clears output mask.
[in] | objectClass | The class of the object |
[in] | obj | A pointer to the ObjectDetector handle that is updated |
DW_API_PUBLIC dwStatus dwObjectDetector_detectObjects | ( | dwObjectArray * | detections, |
const dwImageCUDA * | image, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Detects objects from the given input image.
The array for the output detections has to be allocated beforehand.
[out] | detections | Detections will be stored in this dwObjectArray. The array has to be previously initialized with the type DW_OBJECT_TYPE_CAMERA. The array will contain detections of all classes supported by the detector. |
[in] | image | Input image to detect objects from. |
[in] | obj | Specifies the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_getCoverageThreshold | ( | float32_t * | covThreshold, |
dwObjectClass | objectClass, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Get coverage threshold for a given class.
[out] | covThreshold | Coverage threshold in [0.0, 1.0] |
[in] | objectClass | The class for which the coverage threshold should be returned. |
[in] | obj | A pointer to the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_getCUDAStream | ( | cudaStream_t * | stream, |
dwObjectDetectorHandle_t | obj | ||
) |
Gets the CUDA stream used.
[out] | stream | The CUDA stream used. |
[in] | obj | A pointer to the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_getOutputMaskDimensions | ( | uint32_t * | width, |
uint32_t * | height, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Returns output mask dimensions.
[out] | width | Output mask width. |
[out] | height | Output mask height. |
[in] | obj | Specifies the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_getROI | ( | dwRect * | ROI, |
dwTransformation2f * | outputToObject, | ||
uint32_t | imageIdx, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Returns the region of interest and the 2D transformation from the image coordinate system to object coordinate system at given index.
[out] | ROI | Region of interest to be fed as input to network. |
[out] | outputToObject | 2D Transformation from output of the network to object coordinate system. |
[in] | imageIdx | Index of the image for which to set ROI and transformation. |
[in] | obj | Specifies the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_initDefaultParams | ( | dwObjectDetectorParams * | detectorParams | ) |
Initializes ObjectDetector parameters with default values.
[out] | detectorParams | ObjectDetector parameters. |
DW_API_PUBLIC dwStatus dwObjectDetector_initializeFromDriveNet | ( | dwObjectDetectorHandle_t * | obj, |
const dwObjectDetectorParams * | detectorParams, | ||
dwDriveNetHandle_t | drivenet, | ||
dwContextHandle_t | ctx | ||
) |
Initializes ObjectDetector module with a DriveNet module.
[out] | obj | A pointer to ObjectDetector handle that is initialized from parameters. |
[in] | detectorParams | A pointer to ObjectDetector parameters. |
[in] | drivenet | Specifies the handle to the DriveNet module. |
[in] | ctx | Specifies the handle to the context. |
DW_API_PUBLIC dwStatus dwObjectDetector_isDistanceEnabled | ( | bool * | enabled, |
dwObjectDetectorHandle_t | obj | ||
) |
Returns a boolean indicating whether DNN distance output is enabled.
[out] | enabled | Boolean indicating whether DNN distance output is enabled. |
[in] | obj | A pointer to the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_isFuseObjectsEnabled | ( | bool * | enabled, |
dwObjectDetectorHandle_t | obj | ||
) |
Returns a boolean indicating whether object fusing is enabled.
[out] | enabled | Boolean indicating whether object fusing is enabled. |
[in] | obj | A pointer to the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_isObjectDepthEnabled | ( | bool * | enabled, |
dwObjectDetectorHandle_t | obj | ||
) |
Returns a boolean indicating whether object depth output is enabled.
[out] | enabled | Boolean indicating whether object depth output is enabled. |
[in] | obj | A pointer to the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_isObjectUrgencyEnabled | ( | bool * | enabled, |
dwObjectDetectorHandle_t | obj | ||
) |
Returns a boolean indicating whether DNN urgency output is enabled.
[out] | enabled | Boolean indicating whether DNN urgency output is enabled. |
[in] | obj | A pointer to the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_process | ( | dwObjectDetectorStage | stage, |
dwObjectDetectorHandle_t | obj | ||
) |
Perform object detection GPU stages.
Inputs and outputs must be bound before this call.
[in] | stage | Processing stage to run. |
[in] | obj | Specifies the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_processDLA | ( | dwObjectDetectorDLAStage | stage, |
dwObjectDetectorHandle_t | obj | ||
) |
Perform object detection DLA stages.
Inputs and outputs must be bound before this call.
[in] | stage | Processing stage to run. |
[in] | obj | Specifies the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_release | ( | dwObjectDetectorHandle_t | obj | ) |
Releases the ObjectDetector module.
[in] | obj | The object handle to release. |
DW_API_PUBLIC dwStatus dwObjectDetector_reset | ( | dwObjectDetectorHandle_t | obj | ) |
Resets ObjectDetector.
[in] | obj | Handle to reset. |
DW_API_PUBLIC dwStatus dwObjectDetector_setActiveImageIndices | ( | const uint32_t * | imageMap, |
uint32_t | numImages, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Set active images to infer (DW_OBJECT_DETECTOR_STAGE_GPU_ASYNC_INFERENCE) or interpret (DW_OBJECT_DETECTOR_STAGE_GPU_ASYNC_INTERPRET_DETECTIONS).The detector can hold multiple images but only need to process a subset of them.
By default, all the images provided to infer API and interpret API will be used. This function is used to assign the images that needs to be processed when detector holds multiple images but want to skip (not process) some images when infer or interpret. The integer(s) of the iput imageMap are used to index to the internal list of ROIs and post-detection transformations.
[in] | imageMap | Specifies the images needed to process. |
[in] | numImages | Specifies the number of images needed to process. |
[in] | obj | Specifies the ObjectDetector handle. |
DW_API_PUBLIC dwStatus dwObjectDetector_setCoverageThreshold | ( | float32_t | covThreshold, |
dwObjectClass | objectClass, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Set coverage threshold for a given class.
[in] | covThreshold | Coverage threshold in [0.0, 1.0] |
[in] | objectClass | The class for which the coverage threshold should be set. |
[in] | obj | A pointer to the ObjectDetector handle that is updated |
DW_API_PUBLIC dwStatus dwObjectDetector_setCUDAStream | ( | cudaStream_t | stream, |
dwObjectDetectorHandle_t | obj | ||
) |
Sets the CUDA stream used.
[in] | stream | The CUDA stream used. |
[in] | obj | A pointer to the ObjectDetector handle that is updated. |
DW_API_PUBLIC dwStatus dwObjectDetector_setEnableFuseObjects | ( | bool | enable, |
dwObjectDetectorHandle_t | obj | ||
) |
Enables or disables objectFusing.
[in] | enable | Boolean indicating whether object fusing should be enabled. |
[in] | obj | A pointer to the ObjectDetector handle that is updated. |
DW_API_PUBLIC dwStatus dwObjectDetector_setOutputMask | ( | const uint8_t * | mask, |
uint32_t | maskWidth, | ||
uint32_t | maskHeight, | ||
dwObjectClass | objectClass, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Set output mask.
Areas where mask==0 will be ignored during detection. The size of the mask must be the same as the network output. The required mask dimensions can be obtained via dwObjectDetector_getOutputMaskDimensions.
[in] | mask | A CPU pointer to the mask data |
[in] | maskWidth | Mask width |
[in] | maskHeight | Mask height |
[in] | objectClass | Class of the object |
[in] | obj | A pointer to the ObjectDetector handle that is updated |
DW_API_PUBLIC dwStatus dwObjectDetector_setROI | ( | uint32_t | imageIdx, |
const dwRect * | ROI, | ||
const dwTransformation2f * | outputToObject, | ||
dwObjectDetectorHandle_t | obj | ||
) |
Sets the region of interest for an image at given index, and the 2D transformation from the image coordinate system to object coordinate system.
[in] | imageIdx | Index of the image for which to set ROI and transformation. |
[in] | ROI | Region of interest to be fed as input to network. |
[in] | outputToObject | 2D Transformation from output of the network to object coordinate system. |
[in] | obj | Specifies the ObjectDetector handle. |