|
|
DriveWorks SDK Reference| 0.6.67 Release |
Defines ObjectDetector module for object detection.
Data Structures | |
| struct | dwObjectDetectorDNNParams |
| struct | dwObjectDetectorParams |
Macros | |
| #define | DW_OBJECT_DETECTOR_MAX_IMAGES 16 |
| Maximum number of images to run detector on. More... | |
Typedefs | |
| typedef struct dwObjectDetectorObject * | dwObjectDetectorHandle_t |
| Handle to an object detector. More... | |
Functions | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_getCoverageThreshold (float32_t *covThreshold, uint32_t classIdx, 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_getDetectedObjects (dwObject *objectList, size_t *numObjects, uint32_t imageIdx, uint32_t classIdx, dwObjectDetectorHandle_t obj) |
| Returns detected objects for one of the images given to dwObjectDetector_inferDeviceAsync. More... | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_getROI (dwRect *ROI, dwTransformation2D *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_inferDeviceAsync (const dwImageCUDA *const *imageArray, uint32_t numImages, dwObjectDetectorHandle_t obj) |
| Runs inference using the provided DNN model. More... | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_initDefaultParams (dwObjectDetectorDNNParams *dnnParams, dwObjectDetectorParams *detectorParams) |
| Initializes ObjectDetector parameters with default values. More... | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_initialize (dwObjectDetectorHandle_t *obj, dwContextHandle_t ctx, dwDNNHandle_t dnn, const dwObjectDetectorDNNParams *dnnParams, const dwObjectDetectorParams *detectorParams) |
| Initializes ObjectDetector module with a preloaded DNN inference module. More... | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_initializeFromDriveNet (dwObjectDetectorHandle_t *obj, dwContextHandle_t ctx, dwDriveNetHandle_t drivenet, const dwObjectDetectorParams *detectorParams) |
| Initializes ObjectDetector module with a DriveNet module. More... | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_interpretHost (uint32_t numImages, dwObjectDetectorHandle_t obj) |
| Output of the inference (dwObjectDetector_inferDeviceAsync) is interpreted to get the list of object proposals. More... | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_isFuseObjectsEnabled (dwBool *enabled, dwObjectDetectorHandle_t obj) |
| Returns a boolean indicating whether object fusing is enabled. 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_setCoverageThreshold (float32_t covThreshold, uint32_t classIdx, 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 (dwBool enable, dwObjectDetectorHandle_t obj) |
| Enables or disables objectFusing. More... | |
| DW_API_PUBLIC dwStatus | dwObjectDetector_setROI (uint32_t imageIdx, const dwRect *ROI, const dwTransformation2D *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 dwObjectDetectorDNNParams |
| Data Fields | ||
|---|---|---|
| const char * | bottomVisBlobName | Name of the bottom visibility layer. Default is empty string. |
| const char * | boundingBoxBlobName | Name of the bounding box layer. Default is empty string. |
| float32_t | boxScaleX1 |
Scale coefficient for X coordinate of upper-left corner of the RAW bounding box from DNN output. Default is 1.0. |
| float32_t | boxScaleX2 |
Scale coefficient for X coordinate of lower-right corner of the RAW bounding box from DNN output. Default is 1.0. |
| float32_t | boxScaleY1 |
Scale coefficient for Y coordinates of upper-left corner of the RAW bounding box from DNN output. Default is 1.0 |
| float32_t | boxScaleY2 |
Scale coefficient for Y coordinates of lower-right corner of the RAW bounding box from DNN output. Default is 1.0. |
| const char * | coverageBlobName | Name of the coverage layer. Default is empty string. |
| float32_t | coverageThreshold[DW_OBJECT_MAX_CLASSES] | Threshold for coverage for each class. Default is 0.5f for all classes. |
| dwDataConditionerParams | dataConditionerParams | DataConditioner parameters. |
| dwBool | enable2_5D | Whether the network can predict object orientation. |
| const char * | horizontalVisBlobName | Name of the horizontal visibility layer. Default is empty string. |
| uint32_t | maxProposalsPerClass | Maximum number of RAW detections directly obtained from DNN. Default is 100. |
| const char * | orientationYawBlobName | Name of the orientation yaw layer. Default is empty string. |
| struct dwObjectDetectorParams |
| Data Fields | ||
|---|---|---|
| dwBool | enableBoundingBoxClipping |
If enableBoundingBoxClipping is set to DW_TRUE, the bounding boxes are clipped to the image edges. Default is DW_TRUE since it has been used during training. |
| dwBool | enableFuseObjects |
If enableFuseObjects is set to DW_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 DW_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. |
| dwTransformation2D | 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 16 |
Maximum number of images to run detector on.
Definition at line 61 of file Detector.h.
| typedef struct dwObjectDetectorObject* dwObjectDetectorHandle_t |
Handle to an object detector.
Definition at line 67 of file Detector.h.
| DW_API_PUBLIC dwStatus dwObjectDetector_getCoverageThreshold | ( | float32_t * | covThreshold, |
| uint32_t | classIdx, | ||
| dwObjectDetectorHandle_t | obj | ||
| ) |
Get coverage threshold for a given class.
| [out] | covThreshold | Coverage threshold in [0.0, 1.0] |
| [in] | classIdx | Index of 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_getDetectedObjects | ( | dwObject * | objectList, |
| size_t * | numObjects, | ||
| uint32_t | imageIdx, | ||
| uint32_t | classIdx, | ||
| dwObjectDetectorHandle_t | obj | ||
| ) |
Returns detected objects for one of the images given to dwObjectDetector_inferDeviceAsync.
| [out] | objectList | Object list where the detected objects are copied into. |
| [out] | numObjects | Number of objects that are detected for this image and class. |
| [in] | imageIdx | Index of the image the array as given to dwObjectDetector_inferDeviceAsync. |
| [in] | classIdx | Class index. |
| [in] | obj | Specifies the ObjectDetector handle. |
| DW_API_PUBLIC dwStatus dwObjectDetector_getROI | ( | dwRect * | ROI, |
| dwTransformation2D * | 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_inferDeviceAsync | ( | const dwImageCUDA *const * | imageArray, |
| uint32_t | numImages, | ||
| dwObjectDetectorHandle_t | obj | ||
| ) |
Runs inference using the provided DNN model.
The inference pipeline is as follows:
| [in] | imageArray | Array storing pointers to images where the detector is to be applied. |
| [in] | numImages | 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_initDefaultParams | ( | dwObjectDetectorDNNParams * | dnnParams, |
| dwObjectDetectorParams * | detectorParams | ||
| ) |
Initializes ObjectDetector parameters with default values.
| [out] | dnnParams | ObjectDetector DNN parameters. |
| [out] | detectorParams | ObjectDetector parameters. |
| DW_API_PUBLIC dwStatus dwObjectDetector_initialize | ( | dwObjectDetectorHandle_t * | obj, |
| dwContextHandle_t | ctx, | ||
| dwDNNHandle_t | dnn, | ||
| const dwObjectDetectorDNNParams * | dnnParams, | ||
| const dwObjectDetectorParams * | detectorParams | ||
| ) |
Initializes ObjectDetector module with a preloaded DNN inference module.
| [out] | obj | A pointer to ObjectDetector handle that is initialized from parameters. |
| [in] | ctx | Specifies the handle to the context. |
| [in] | dnn | Specifies the handle to the dnn module which is initialized with detector network. |
| [in] | dnnParams | A pointer to ObjectDetectorDNN parameters. |
| [in] | detectorParams | A pointer to ObjectDetector parameters. |
coverage and a blob for bounding box.The number of channels in the coverage blob is equal to the number of classes that the network detects.
The number of channels in the bounding box blob is equal to the 4 times number of classes that the network detects.
For example, for detecting cars and pedestrians, the first channel of the coverage blob refers to the coverage of cars, and the first four channels of the bounding box blob refers to the top left and bottom right corners of car bounding boxes. The second channel of the coverage blob refers to the coverage of pedestrians, and the second four channels of the bounding box blob refers to the top left and bottom right corners of pedestrian bounding boxes.
Since it is unknown to the model which channel refers to which class, they are assigned class IDs instead, where class ID refers to the channel index of the network output. In the above example, the class ID of the car objects is 0, whereas the class ID of pedestrian objects is 1.
| DW_API_PUBLIC dwStatus dwObjectDetector_initializeFromDriveNet | ( | dwObjectDetectorHandle_t * | obj, |
| dwContextHandle_t | ctx, | ||
| dwDriveNetHandle_t | drivenet, | ||
| const dwObjectDetectorParams * | detectorParams | ||
| ) |
Initializes ObjectDetector module with a DriveNet module.
| [out] | obj | A pointer to ObjectDetector handle that is initialized from parameters. |
| [in] | ctx | Specifies the handle to the context. |
| [in] | drivenet | Specifies the handle to the DriveNet module. |
| [in] | detectorParams | A pointer to ObjectDetector parameters. |
| DW_API_PUBLIC dwStatus dwObjectDetector_interpretHost | ( | uint32_t | numImages, |
| dwObjectDetectorHandle_t | obj | ||
| ) |
Output of the inference (dwObjectDetector_inferDeviceAsync) is interpreted to get the list of object proposals.
If fusing is activated, proposals coming from different images is filled into a single list.
| [in] | numImages | Number of images provided in the array in dwObjectDetector_inferDeviceAsync call. |
| [in] | obj | Specifies the ObjectDetector handle. |
| DW_API_PUBLIC dwStatus dwObjectDetector_isFuseObjectsEnabled | ( | dwBool * | 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_release | ( | dwObjectDetectorHandle_t * | obj | ) |
Releases the ObjectDetector module.
| [in] | obj | A pointer to 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_setCoverageThreshold | ( | float32_t | covThreshold, |
| uint32_t | classIdx, | ||
| dwObjectDetectorHandle_t | obj | ||
| ) |
Set coverage threshold for a given class.
| [in] | covThreshold | Coverage threshold in [0.0, 1.0] |
| [in] | classIdx | Index of 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 | ( | dwBool | 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_setROI | ( | uint32_t | imageIdx, |
| const dwRect * | ROI, | ||
| const dwTransformation2D * | 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. |