DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

perception/freespace/camera/openroadnet/docs/openroadnet_usecase1.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page openroadnet_usecase1 OpenRoadNet Workflow
4 
5 @note SW Release Applicability: This tutorial is applicable to modules in **NVIDIA DRIVE Software** releases.
6 
7 ## Initialization
8 
9 OpenRoadNet module creates an OpenRoadNet handle ( `dwOpenRoadNetHandle_t` ) that is owned by the application and must be released by the application when it's not needed anymore.
10 
11 `dwOpenRoadNetParams` documents the specs of the OpenRoadNet model to be loaded and initialized. These parameters determine which precision, optimized processor, and type of OpenRoadNet to be loaded and can affect the speed of the inference significantly. To initialize OpenRoadNet parameters with default values:
12 
13 ```{.cpp}
14 dwStatus dwOpenRoadNet_initDefaultParams(dwOpenRoadNetParams* params);
15 ```
16 
17 To initialize a pointer to OpenRoadNet handle with the designated values of `dwOpenRoadNetParams` call:
18 
19 ```{.cpp}
20 dwStatus dwOpenRoadNet_initialize(dwOpenRoadNetHandle_t* openRoadNetHandle,
21  dwContextHandle_t ctx,
22  const dwOpenRoadNetParams* openRoadNetParams);
23 ```
24 
25 An example code snippet to initialize an OpenRoadNet module with a customized FP32 OpenRoadNet model that is optimized to prefrom inference on GPU:
26 ```{.cpp}
27 dwOpenRoadNetHandle_t openRoadNet;
28 dwOpenRoadNetParams openRoadNetParams{};
29 dwOpenRoadNet_initDefaultParams(&openRoadNetParams);
30 openRoadNetParams.networkModel = DW_OPENROADNET_MODEL_CUSTOM;
31 openRoadNetParams.networkCustomData = "my_openroadnet_model";
32 CHECK_DW_ERROR(dwOpenRoadNet_initialize(&openRoadNet, &openRoadParams, context));
33 ```
34 Note that `dwOpenRoadNet_initDefaultParams()` set `openRoadNetParams.networkPrecision` and `openRoadNetParams.processorType` to their default values of `DW_PRECISION_FP32` and `DW_PROCESSOR_TYPE_GPU`, respectively. It is assuming that "my_openroadnet_model" file exists in data/resources sub-directory.
35 
36 
37 ## Query Network Specs
38 
39 With the provided APIs, you can query the input blob dimension that the initialized OpenRoadNet expects:
40 
41 ```{.cpp}
42 dwStatus dwOpenRoadNet_getInputBlobsize(dwBlobSize* inputBlobsize, dwOpenRoadNetHandle_t obj);
43 
44 ```
45 
46 or get the pointer to the label of the provided class index:
47 ```{.cpp}
48 dwStatus dwOpenRoadNet_getClassLabel(const char** classLabel, uint32_t classIdx, dwOpenRoadNetHandle_t obj);
49 
50 ```
51 
52 or even the meta data which contains preprocessing configuration of the network:
53 ```{.cpp}
54 dwStatus dwOpenRoadNet_getDNNMetaData(dwDNNMetaData* metaData, dwOpenRoadNetHandle_t obj);
55 
56 ```
57 
58 ## Release
59 
60 Finally, to release the OpenRoadNet module at the end of the application:
61 ```{.cpp}
62 dwStatus dwOpenRoadNet_release(dwOpenRoadNetHandle_t obj);
63 
64 ```
65 
66 @ref freespace_usecase1 shows in more details how to employ OpenRoadNet with FreespaceDetector after initialization. For more concrete usage please refer to @ref dwx_freespace_detection_sample.