DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

/dvs/git/dirty/gitlab-master_av/dw/sdk/samples/pathperception/camera/README.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
2 
3 @page dwx_path_perception_sample Path Perception Sample (PathNet)
4 @tableofcontents
5 
6 @note SW Release Applicability: This sample is available in **NVIDIA DRIVE Software** releases.
7 
8 @section dwx_path_perception_sample_description Description
9 
10 The Path Perception sample demonstrates how to use the NVIDIA<sup>&reg;</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.
14 
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.
19 
20 #### Sensor details
21 
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.
25 
26 To achieve the best path perception performance, NVIDIA<sup>&reg;</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.
29 
30 @section dwx_path_perception_sample_running Running the Sample
31 
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.
33 
34 
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]
40  --slave=[0|1]
41 
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]
49  --rig=[path/to/rig]
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)>
56  --useCudaGraph=[0|1]
57  --video=[path/to/video]
58  --windowWidth=&lt;integer window width in pixels>
59  --customModelPath=[path/to/custom/model]
60 
61 where the first five options are only valid on the Drive platform:
62 
63  --camera-group=[a|b|c|d]
64  Is the group where the camera is connected to.
65  Only applicable if --input-type=camera.
66  Default value: a
67 
68  --camera-index=[0|1|2|3]
69  Indicates the camera index on the given port.
70  Default value: 0
71 
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
76 
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>&reg;</sup> DRIVE platform.
80  Default value: video
81 
82  --slave=[0|1]
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.
85  Default value: 0
86 
87 and the remaining options are valid for all platforms:
88 
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.
91  Default value: true
92 
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>&reg;</sup> test data set.
97  Decrease the threshold value if path polylines flicker or cover shorter distance.
98  Default: 0.5
99 
100  --enableFovea=[true|false]
101  Enable interleaved fovea-based path prediction mode.
102  Default value: false
103 
104  --enableFoveaInTopView=[true|false]
105  In fovea mode (--enableFovea=true), render fovea paths in top view instead full resolution paths.
106  Default value: false
107 
108  --fps=<integer number in (1, 120)>
109  Frames per second that the video is played at.
110  Default value: 30
111 
112  --horizonHeight=<int in 0, image height>
113  y coordinate of the flat world horizon.
114  Default value: 600
115 
116  --precision=[int8|fp16|fp32]
117  Specifies the precision for the PathNet model.
118  Default value: fp32
119 
120  --rig=[path/to/rig]
121  Rig file containing all information about vehicle sensors and calibration.
122  Default value: path/to/samples/pathDetection/rig.json
123 
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>&reg;</sup> test data set.
127 
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>&reg;</sup> test data set.
131 
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>&reg;</sup> test data set.
135 
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>&reg;</sup> test data set.
139 
140  --showForks=[true|false]
141  Choose to render and display the forking paths.
142  Default value: true
143 
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>&reg;</sup> test data set.
151  Increase the factor value if path polylines flicker.
152 
153  --useCudaGraph=[0|1]
154  Setting this parameter to 1 runs PathNet DNN inference by CUDAGraph if the hardware supports.
155  Default value: 0
156 
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
161 
162  --windowWidth=<integer window width in pixels>
163  Width in pixels of rendered output window.
164  Default value: 1600
165 
166  --customModelPath=[path/to/custom/model]
167  Folder should contain pathnet.dnn, pathnet_metadata.json and tensorrt_metadata.json.
168  Default value: <empty string>
169 
170 @subsection dwx_path_perception_sample_examples Examples
171 
172 #### To run the sample on Linux
173 
174  ./sample_path_perception --video=<video file.h264> --detectionThreshold=<floating-point number in (0,1)>
175 or
176 
177  ./sample_path_perception --video=<video file.raw> --detectionThreshold=<floating-point number in (0,1)>
178 
179 #### To run the sample on an NVIDIA DRIVE platform with cameras:
180 
181  ./sample_path_perception --input-type=camera --camera-type=<camera_type> --camera-group=<camera_group> --detectionThreshold=<floating-point number in (0,1)>
182 
183 where `<camera type>` is a supported `RCCB` sensor.
184 See @ref supported_sensors for the list of supported cameras for each platform.
185 
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.
190 
191 @section dwx_path_perception_sample_output Output
192 
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.
195 
196 The colors of the polylines represent the path marking position types and the path attribute that
197 it detects, as follows:
198 
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
207 
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.
210 
211 ![Path Detection Sample](doc/images/sample_path_detection.png)
212 ![Path Detection With Opposite Traffic Sample](doc/images/sample_path_detection_with_opposite_traffic.png)
213 
214 @section dwx_path_perception_sample_more Additional Information
215 
216 For more details see @ref pathperception_mainsection_pathdetector.