DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

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

Initialization

LightNet module creates an LightNet handle ( dwLightNetHandle_t ) that is owned by the application and must be released by the application when it's not needed anymore.

dwLightNetParams documents the specs of the LightNet model to be loaded and initialized. These parameters determine which precision, optimized processor, and type of LightNet to be loaded and can affect the speed of the inference significantly. To initialize LightNet parameters with default values:

To initialize a pointer to LightNet handle with the designated values of dwLightNetParams call:

An example code snippet to initialize an LightNet module with a customized FP32 LightNet model that is optimized to perform inference on GPU:

dwLightNetParams lightNetParams{};
lightNetParams.networkModel = DW_LIGHTNET_MODEL_CUSTOM;
lightNetParams.networkCustomData = "my_lightnet_model";
lightNetParams.batchSize = DW_LIGHTNET_BATCH_SIZE_1;
CHECK_DW_ERROR(dwLightNet_initialize(&lightNet, &lightNetParams, context));

Note that dwLightNet_initDefaultParams() set lightNetParams.networkPrecision, lightNetParams.batchSize and lightNetParams.processorType to their default values of DW_PRECISION_FP32, DW_LIGHTNET_BATCH_SIZE_1 and DW_PROCESSOR_TYPE_GPU, respectively. It is assuming that "my_lightnet_model" file exists in data/resources sub-directory.

Query Network Specs

With the provided APIs, you can query the input blob dimension that the initialized LightNet expects:

or get the pointer to the label of the provided class index:

dwStatus dwLightNet_getTypeLabel(const char** classLabel, uint32_t classIdx, dwLightNetHandle_t obj);

or even the meta data which contains preprocessing configuration of the network:

Release

Finally, to release the LightNet module at the end of the application:

Wait Conditions Classification Workflow for Traffic Lights shows in more details how to employ LightNet with ObjectClassifier after initialization. For more concrete usage please refer to Traffic Light Classification Sample (LightNet)