1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page waitcondition_mainsection Wait Conditions Detection and Classification
5 @note SW Release Applicability: This module is available in **NVIDIA DRIVE Software** releases.
9 Wait Conditions detector module detects intersections, traffic lights and traffic signs from camera images. NVIDIA proprietary DNN named WaitNet will return the detected bounding box of intersections, traffic signs and traffic lights.
11 Wait Conditions classifier module classifies detected traffic signs and traffic lights from camera images. NVIDIA proprietary DNN named LightNet will return the state (color(s) and shape(s)) of a detected traffic light. NVIDIA proprietary DNN named SignNet will return the class of a detected traffic sign.
13 ### Wait Conditions Intersection Detector Module Initialization
14 Wait Conditions detector module can create default parameters:
17 dwStatus dwWaitConditionsDetector_initDefaultParams(dwWaitConditionsDetectorParams* detectorParams);
20 With the generated default parameters, Wait Conditions detector module can be initialized by:
23 dwStatus dwWaitConditionsDetector_initializeFromWaitNetNew(dwWaitConditionsDetectorHandle_t* obj,
24 dwWaitNetHandle_t waitnet,
25 const dwWaitConditionsDetectorParams* detectorParams,
26 const dwTransformation3f* cam2Rig,
27 dwCameraModelHandle_t calibratedCamObj,
28 dwEgomotionConstHandle_t motionObj,
29 dwContextHandle_t ctx);
32 where dwWaitNetHandle_t specifies the handle to the WaitNet module, dwWaitConditionsDetectorParams is pointer to WaitConditionsDetector parameters, dwTransformation3f is camera extrinsic transformation, dwCameraModelHandle_t is camera intrinsic transformation, dwEgomotionConstHandle_t is egomotion module handle and dwContextHandle_t specifies the handle to the drivework context. The camera extrinsic can be set by:
35 dwStatus dwWaitConditionsDetector_setCameraExtrinsics(uint32_t cameraID, const dwTransformation3f* cam2Rig, dwWaitConditionsDetectorHandle_t obj);
38 The output of the module need to be created by the application and bind to the detector module by:
41 dwStatus dwWaitConditionsDetector_bindOutput(const dwWaitConditionsDetectorOutput* output,
42 dwWaitConditionsDetectorHandle_t obj);
45 where dwWaitConditionsDetectorOutput holds the output.
47 CUDA stream can be set and get by:
50 dwStatus dwWaitConditionsDetector_setCUDAStream(cudaStream_t stream, dwWaitConditionsDetectorHandle_t obj);
54 dwStatus dwWaitConditionsDetector_getCUDAStream(cudaStream_t* stream, dwWaitConditionsDetectorHandle_t obj);
57 ### Wait Conditions Intersection Detector Module Execution
59 After module initialization, the network to detect the intersection, traffic light and traffic sign can be inferred by:
62 dwStatus dwWaitConditionsDetector_inferDeviceAsync(const dwImageCUDA* const* imageArray,
63 uint32_t numImages, dwWaitConditionsDetectorHandle_t obj);
66 where imageArray stores pointers to images where the detector is to be applied. The inferred result can be interpreted by:
69 dwStatus dwWaitConditionsDetector_interpret(uint32_t numImages, dwWaitConditionsDetectorHandle_t obj);
72 After the interpretation, the detection result can be accessed in the output bound to the detector.
74 ### Wait Conditions Intersection Detector Module Release
76 The module can be released by:
79 dwStatus dwWaitConditionsDetector_release(dwWaitConditionsDetectorHandle_t obj);
82 ### Wait Conditions Traffic Light/Sign Classifier Module Initialization
83 Wait Conditions classifier module initialization takes either a user customized sign detection network module handle or a user customized light detection network module handle as an input. To initialize NVIDIA Traffic Light/Sign Classifier module:
85 With the initialized LightNet module handle, Wait Conditions classifier module can be initialized by:
88 dwTrafficLightSignClassifier_initializeFromLightNet(dwTrafficLightSignClassifierHandle_t* obj,
89 dwLightNetHandle_t dnn,
90 dwContextHandle_t ctx);
93 With the initialized SignNet module handle, Wait Conditions classifier module can be initialized by:
96 dwTrafficLightSignClassifier_initializeFromSignNet(dwTrafficLightSignClassifierHandle_t* obj,
97 dwSignNetHandle_t dnn,
98 dwContextHandle_t ctx);
101 ### Wait Conditions Classification Execution
102 After module initialization, the sequential API calls to classify detected input traffic signs and traffic lights are as follows.
103 To perform network inference on GPU:
105 dwTrafficLightSignClassifier_inferDeviceAsync(const dwImageCUDA* const* imageArray,
106 dwObject* objectList,
109 dwTrafficLightSignClassifierHandle_t obj);
112 To interpret the network inferred results into traffic light states or traffic sign classes:
114 dwTrafficLightSignClassifier_interpretHost(uint32_t numObjects,
116 dwTrafficLightSignClassifierHandle_t obj);
119 To get the per frame interpreted results in the format of `subClassId` field on each traffic sign or traffic light dwObject:
121 dwTrafficLightSignClassifier_getClassifiedObjects(dwObject* objectList,
123 dwTrafficLightSignClassifierHandle_t obj);
126 ### Wait Conditions Traffic Light/Sign Classifier Module Release
127 To release the Wait Conditions classifier module, the module itself needs to be released first by:
129 dwTrafficLightSignClassifier_release(dwTrafficLightSignClassifierHandle_t obj);
132 then the SignNet module:
134 dwSignNet_release(dwSignNetHandle_t obj);
138 or the LightNet module:
140 dwLightNet_release(dwLightNetHandle_t obj);
144 ## Relevant Tutorials
146 - @ref waitcondition_usecase1
147 - @ref waitcondition_usecase2
148 - @ref waitcondition_usecase3
149 - @ref waitcondition_usecase4