- Note
- SW Release Applicability: This tutorial is applicable to modules in NVIDIA DRIVE Software releases.
The following code snippet shows the general structure of a program that uses waitconditions detector to detect intersections, traffic lights and traffic signs.
Initialize WaitNet default parameters, WaitNet, detector parameters and then the detector.
dwWaitConditionsDetectorParams wcDetectorParams;
dwWaitConditionsDetector_initDefaultParams(&wcDetectorParams);
dwWaitConditionsDetector_initializeFromWaitNetNew(&wcDetectorHandle, waitnetHandle,
&wcDetectorParams, cam2Rig, calibratedCamObj, motionObj, context);
Then bind output and set cuda stream:
dwWaitConditionsDetectorOutput detectorOutput{};
dwIntersectionDetection detectedIntersections[DW_WAIT_CONDITIONS_DETECTOR_MAX_INTERSECTIONS];
intersectionsBuffer.buffer = detectedIntersections;
intersectionsBuffer.size = 0;
intersectionsBuffer.maxSize = DW_WAIT_CONDITIONS_DETECTOR_MAX_INTERSECTIONS;
detectorOutput.intersections = &intersectionsBuffer;
dwWaitConditionsDetector_bindOutput(&detectorOutput, wcDetectorHandle);
dwWaitConditionsDetector_setCUDAStream(cudaStream, wcDetectorHandle);
Detect intersections, traffic lights and traffic signs:
dwWaitConditionsDetector_inferDeviceAsync(&imageIn, imageNum, wcDetectorHandle);
dwWaitConditionsDetector_interpret(imageNum, wcDetectorHandle);
When finished, release the module handles:
dwWaitConditionsDetector_release(wcDetectorHandle);
For more detailed workflow, please refer to the intersection detector sample: Intersection Detection Sample (WaitNet)