DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

perception/landmarks/camera/mapnet/docs/mapnet_usecase1.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page mapnet_usecase1 MapNet Workflow
4 
5 @note SW Release Applicability: This tutorial is applicable to modules in **NVIDIA DRIVE Software** releases.
6 
7 ## Initialization
8 
9 MapNet module creates a MapNet handle ( `::dwMapNetHandle_t` ) that is owned by
10 the application and must be released by the application when it's not needed
11 anymore.
12 
13 `dwMapNetParams` records the specs of the MapNet model to be loaded and
14 initialized. These parameters determine which precision, optimized processor,
15 and type of MapNet to be loaded and can affect the speed of the inference
16 greatly.
17 `dwMapNetType` defines which type of network to use segmentation based, regressor based or end-to-end network.
18 To initialize MapNet parameters with default values:
19 
20 ```{.cpp}
21 dwStatus dwMapNet_initDefaultParams(dwMapNetParams* params, dwMapNetType mapnetType, dwContextHandle_t ctx);
22 ```
23 
24 To initialize a pointer to MapNet handle with the designated values of
25 `dwMapNetParams` call:
26 
27 ```{.cpp}
28 dwStatus dwMapNet_initialize(dwMapNetHandle_t* mapNetHandle,
29  const dwMapNetParams* mapNetParams,
30  dwContextHandle_t ctx);
31 ```
32 
33 An example code snippet to initialize a MapNet module with a customized FP32
34 MapNet model that is optimized to perform inference on GPU:
35 ```{.cpp}
36 dwMapNetHandle_t mapNet;
37 dwMapNetParams mapNetParams{};
38 dwMapNet_initDefaultParams(&mapNetParams, DW_MAPNET_TYPE_SEGMENTATION, context);
39 mapNetParams.networkModel = DW_MAPNET_MODEL_FRONT_MULTI_CLASS;
40 CHECK_DW_ERROR(dwMapNet_initialize(&mapNet, &mapNetParams, context));
41 ```
42 Note that `dwMapNet_initDefaultParams()` set `mapNetParams.networkPrecision`
43 and `mapNetParams.processorType` to the default values of `::DW_PRECISION_FP32`
44 and `::DW_PROCESSOR_TYPE_GPU`, respectively.
45 
46 The available choices for network model depend on `::dwMapNetType`.
47 If the MapNet type is `::DW_MAPNET_TYPE_E2E`, the supported model is `::DW_MAPNET_MODEL_FRONT_E2E`.
48 If the MapNet type is `::DW_MAPNET_TYPE_REGRESSOR`, the supported model is `::DW_MAPNET_MODEL_FRONT_REGRESSOR`.
49 If the MapNet type is `::DW_MAPNET_TYPE_SEGMENTATION`,
50 the supported models are `::DW_MAPNET_MODEL_FRONT_MULTI_CLASS` and `::DW_MAPNET_MODEL_FRONT_SINGLE_CLASS`.
51 
52 ## Query Network Specs
53 
54 With the provided APIs, you can get the input blob dimension that the
55 initialized MapNet expects:
56 
57 ```{.cpp}
58 dwStatus dwMapNet_getInputBlobsize(dwBlobSize* inputBlobsize, dwMapNetHandle_t obj);
59 
60 ```
61 
62 or retrieve the pointer to the label of the provided class index:
63 ```{.cpp}
64 dwStatus dwMapNet_getClassLabel(const char** classLabel, uint32_t classIdx, dwMapNetHandle_t obj);
65 
66 ```
67 
68 or even the meta data which contains preprocessing configuration for the network:
69 ```{.cpp}
70 dwStatus dwMapNet_getDNNMetaData(dwDNNMetaData* metaData, dwMapNetHandle_t obj);
71 
72 ```
73 
74 ## Release
75 
76 Finally, to release the MapNet module at the end of the application:
77 ```{.cpp}
78 dwStatus dwMapNet_release(dwMapNetHandle_t obj);
79 
80 ```