1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page dwx_path_perception_sample Path Perception Sample (PathNet)
6 @note SW Release Applicability: This sample is available in **NVIDIA DRIVE Software** releases.
8 @section dwx_path_perception_sample_description Description
10 The Path Perception sample demonstrates how to use the NVIDIA<sup>®</sup> proprietary deep neural network
11 to perform path perception on the road. It detects the path you are in (ego-path), as well
12 as the left and right adjacent paths when they are present. PathNet has been trained with RCB
13 images and its performance is invariant to RGB encoded H.264 videos.
15 This sample streams an H.264 or RAW video, computing paths for each frame. The network
16 directly computes the path vertices and a confidence value for each path.
17 A user assigned threshold value sets the minimum confidence for each path to be considered valid.
18 The sample can also be operated with cameras.
22 The image datasets used to train Pathnet have been captured by a View Sekonix Camera Module (SS3323) with
23 AR0231 RCCB sensor with a 60 degree field of view. The camera is mounted high up at the rear view mirror position.
24 Demo videos are captured at 2.3 MP and down-sampled to 960 x 604.
26 To achieve the best path perception performance, NVIDIA<sup>®</sup> recommends to adopt a similar camera setup and align
27 the video center vertically with the horizon before recording new videos. Also, the detection will perform best
28 with a 60 degree field of view camera.
30 @section dwx_path_perception_sample_running Running the Sample
32 The Path Perception sample, sample_path_perception, accepts the following optional parameters. If none are specified, it will perform path perception on pre-recorded video.
35 ./sample_path_perception
36 --camera-group=[a|b|c|d]
37 --camera-index=[0|1|2|3]
38 --camera-type=[camera]
39 --input-type=[video|camera]
42 --debugView=[true|false]
43 --detectionThreshold=<floating-point number in (0, 1)>
44 --enableFovea=[true|false]
45 --enableFoveaInTopView=[true|false]
46 --fps=<integer in (1, 120)>
47 --horizonHeight=<integer in (0, image_height)>
48 --precision=[int8|fp16|fp32]
50 --roi.height=<integer in (0, image_height)>
51 --roi.width=<integer in (0, image_width)>
52 --roi.x=<integer in (0, image_width)>
53 --roi.y=<integer in (0, image_height)>
54 --showForks=[true|false]
55 --temporalSmoothingFactor=<floating-point value in (0, 1)>
57 --video=[path/to/video]
58 --windowWidth=<integer window width in pixels>
59 --customModelPath=[path/to/custom/model]
61 where the first five options are only valid on the Drive platform:
63 --camera-group=[a|b|c|d]
64 Is the group where the camera is connected to.
65 Only applicable if --input-type=camera.
68 --camera-index=[0|1|2|3]
69 Indicates the camera index on the given port.
72 --camera-type=[camera]
73 Is a supported AR0231 `RCCB` sensor.
74 Only applicable if --input-type=camera.
75 Default value: ar0231-rccb-bae-sf3324
77 --input-type=[video|camera]
78 Defines if the input is from live camera or from a recorded video.
79 Live camera is only supported on NVIDIA<sup>®</sup> DRIVE platform.
83 Setting this parameter to 1 when running the sample on Xavier B allows to access a camera that
84 is being used on Xavier A. Only applicable if --input-type=camera.
87 and the remaining options are valid for all platforms:
89 --debugView=[true|false]
90 Whether to show the default view or the debug view, which includes fishbone lines connecting the predicted points of the network.
93 --detectionThreshold=<floating-point number in (0, 1)>
94 The detection threshold parameter is used to determine the validity of a path generated
95 by the network. If there is no path with a confidence above this value, then no paths will be displayed.
96 By default, the value is 0.5, which provides the best accuracy based on the NVIDIA<sup>®</sup> test data set.
97 Decrease the threshold value if path polylines flicker or cover shorter distance.
100 --enableFovea=[true|false]
101 Enable interleaved fovea-based path prediction mode.
104 --enableFoveaInTopView=[true|false]
105 In fovea mode (--enableFovea=true), render fovea paths in top view instead full resolution paths.
108 --fps=<integer number in (1, 120)>
109 Frames per second that the video is played at.
112 --horizonHeight=<int in 0, image height>
113 y coordinate of the flat world horizon.
116 --precision=[int8|fp16|fp32]
117 Specifies the precision for the PathNet model.
121 Rig file containing all information about vehicle sensors and calibration.
122 Default value: path/to/samples/pathDetection/rig.json
124 --roi.height=<integer in [0, image_height]>
125 The height of our ROI.
126 By default, the value is set to 800, which provides the best accuracy based on the NVIDIA<sup>®</sup> test data set.
128 --roi.width=<integer in [0, image_width]>
129 The width of our ROI.
130 By default, the value is set to 1920, which provides the best accuracy based on the NVIDIA<sup>®</sup> test data set.
132 --roi.x=<integer number in [0, image_width)>
133 The top left x image coordinate in the input frame that is to be cropped and passed into the network.
134 By default, the value is set to 0, which provides the best accuracy based on the NVIDIA<sup>®</sup> test data set.
136 --roi.y=<integer number in [0, image_height)>
137 The top left y image coordinate in the input frame that is to be cropped and passed into the network.
138 By default, the value is set to 400, which provides the best accuracy based on the NVIDIA<sup>®</sup> test data set.
140 --showForks=[true|false]
141 Choose to render and display the forking paths.
144 --temporalSmoothingFactor=<floating-point number in (0, 1)>
145 The temporal smoothing factor is used to take a weighted average of the model predictions from the current
146 frame and the immediately preceding frame. The average is computed as
147 x'(t) = (1 - temporalSmoothingFactor) * x(t) + temporalSmoothingFactor * x(t-1). This means that the higher
148 the factor, the less the impact of the current prediction on the final output. A factor of 1 would never update
149 the output and a factor of 0 would never consider the past input.
150 By default, the value is 0.1, which provides the best accuracy based on the NVIDIA<sup>®</sup> test data set.
151 Increase the factor value if path polylines flicker.
154 Setting this parameter to 1 runs PathNet DNN inference by CUDAGraph if the hardware supports.
157 --video=[path/to/video]
158 Specifies the absolute or relative path of recording.
159 Only applicable if --input-type=video
160 Default value: path/to/samples/pathDetection/video_paths.h264
162 --windowWidth=<integer window width in pixels>
163 Width in pixels of rendered output window.
166 --customModelPath=[path/to/custom/model]
167 Folder should contain pathnet.dnn, pathnet_metadata.json and tensorrt_metadata.json.
168 Default value: <empty string>
170 @subsection dwx_path_perception_sample_examples Examples
172 #### To run the sample on Linux
174 ./sample_path_perception --video=<video file.h264> --detectionThreshold=<floating-point number in (0,1)>
177 ./sample_path_perception --video=<video file.raw> --detectionThreshold=<floating-point number in (0,1)>
179 #### To run the sample on an NVIDIA DRIVE platform with cameras:
181 ./sample_path_perception --input-type=camera --camera-type=<camera_type> --camera-group=<camera_group> --detectionThreshold=<floating-point number in (0,1)>
183 where `<camera type>` is a supported `RCCB` sensor.
184 See @ref supported_sensors for the list of supported cameras for each platform.
186 @note Path perception sample directly resizes video frames to the network
187 input resolution. Therefore, to get the best performance, it is suggested to
188 use videos with similar aspect ratio to the demo video. Or you can set Region
189 of Interest (ROI) to perform inference on a sub-window of the full frame.
191 @section dwx_path_perception_sample_output Output
193 PathNet creates a window, displays a video, and overlays a collection of polylines for each detected path.
194 The path center line is displayed as a thick polyline, with its lateral extent shown as thin polylines.
196 The colors of the polylines represent the path marking position types and the path attribute that
197 it detects, as follows:
199 - DarkRed: Ego path, alternate color : Red
200 - Blue: Left adjacent path, alternate color: LightBlue
201 - Green: Right adjacent path, alternate color: LightGreen
202 - Dark Red: Ego path fork-left
203 - Purple: Ego path fork-right
204 - Dark Green: Right adjacent path fork-right
205 - Dark Blue: Left adjacent path fork-left
206 - White: Opposite traffic direction
208 Note that the alternate colors are not used. In cases, where we need to render multiple overlapping
209 paths, we can use the alternate color set for constrast.
211 
212 
214 @section dwx_path_perception_sample_more Additional Information
216 For more details see @ref pathperception_mainsection_pathdetector.