DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Path Perception
Note
SW Release Applicability: This tutorial is applicable to modules in NVIDIA DRIVE Software releases.

About This Module

The Path perception module detects drive-able paths from camera images. The NVIDIA proprietary DNN named PathNet returns the coordinates of the edges and center of each drive-able path. For each input image, this module employs PathNet to infer paths in image coordinates. Paths are distinguished from lanes where paths are either explicitly marked on the road (for example marked lanes), or implied by road geometry and traffic patterns (for example, implied lanes on a two way street with no markings). With proper initialization of camera intrinsic and extrinsic parameters, paths can be viewed in top-view vehicle coordinate system.

Path Detector Module Initialization

Path detector module initialization takes either PathNet module handle or user customized path detection network module handle as an input. To initialize NVIDIA PathNet module:

dwStatus dwPathNet_initialize(dwPathNetHandle_t *pathNetHandle,
const dwPathNetParams *pathNetParams,
dwContextHandle_t ctx);

With the initialized PathNet module handle, path detection module can be initialized by:

dwStatus dwPathDetector_initializeFromPathNet(dwPathDetectorHandle_t *obj,
dwPathNetHandle_t pathnet,
uint32_t frameWidth,
uint32_t frameHeight,
cudaStream_t stream,
dwContextHandle_t ctx);

To initialize PathNet module with calibrated camera for computing paths in top-down vehicle coordinate system:

dwStatus dwPathDetector_initializeFromPathNet(dwPathDetectorHandle_t *obj,
dwPathNetHandle_t pathnet,
uint32_t frameWidth,
uint32_t frameHeight,
dwCameraModelHandle_t cam,
dwTransformation3f cam2rig,
cudaStream_t stream,
dwContextHandle_t ctx);

Detector Parameter Setup (Optional)

Path detector allows user to set detection Region of Interest (ROI) and how much each detected path is being temporally smoothed.

To set detection ROI in input image coordinates:

dwPathDetector_setDetectionROI(const dwRect* roi,
dwPathDetectorHandle_t obj);

To temporally smooth each detected path:

dwPathDetector_setTemporalSmoothingFactor(float32_t factor,
dwPathDetectorHandle_t obj);

Output predictions are sensitive to detection threshold. To set detection threshold:

dwStatus dwPathDetector_setDetectionThreshold(float32_t threshold,
dwPathDetectorHandle_t obj);

To set detection threshold for the opposite traffic path attribute:

dwStatus dwPathDetector_setOppositeTrafficDetectionThreshold(float32_t threshold,
dwPathDetectorHandle_t obj);

The center rail of the ego path in world view is used for driving. We can calculate that either by: 1) Computing the center rail in image view from the path edged and projecting that to world view 2) Projecting the path edges to world view and then computing the center. To switch between these options, use:

dwStatus dwPathDetector_setComputeCenterRailFrom3D(bool computeCenterRailFrom3D,
dwPathDetectorHandle_t obj);

For more details, please refer to API header documentation.

Path Detection Execution

After module initialization and detector parameter setup, the sequential API calls to compute paths from an input image are as follows. To perform network inference on GPU:

dwPathDetector_processDeviceAsync(const dwImageCUDA* frame,
dwPathDetectorHandle_t obj);

To interpret the network inferred results into image coordinates and path labels:

dwPathDetector_interpretHost(dwPathDetectorHandle_t obj);

To get the per frame interpreted results in the format of dwPathDetection:

dwPathDetector_getPathDetections(dwPathDetection *paths,
dwPathDetectorHandle_t obj);

Path Detector Module Release

To release the path detector module, the module itself needs to be released first by:

dwPathDetector_release(dwPathDetectorHandle_t *obj);

then the PathNet module:

dwPathNet_release(dwPathNetHandle_t *obj);

Relevant Tutorials

APIs