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:
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.
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:
or even the meta data which contains preprocessing configuration of the network:
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)