Initialize DNN using driveworks


I currently incur in the following error when initializing the network with DriveWorks:

DefaultLogger: [23-02-2023 17:43:31] DefaultLogger: Driveworks exception thrown: DW_INVALID_HANDLE: Cannot cast to C++ handle, given instance is a nullptr, type=P15dwContextObject
terminate called after throwing an instance of ‘std::runtime_error’
what(): [2023-02-23 17:43:31] DW Error DW_INVALID_HANDLE executing DW function:
dwDNN_initializeTensorRTFromFile(&dnn, “/mnt/persistent/mfddFP16.bin”, nullptr, DW_PROCESSOR_TYPE_GPU, contextHandle)
at /usr/local/driveworks/samples/src/dnn/sample_object_detector_tracker/main.cpp:987

The line of code which fails is:

CHECK_DW_ERROR(dwDNN_initializeTensorRTFromFile(&dnn, "/mnt/persistent/mfddFP16.bin", nullptr, DW_PROCESSOR_TYPE_GPU, contextHandle));

The engine was generated using ./usr/local/driveworks/tools/dnn/tensorRT_optimization starting from an onnx file.

Could you help in solving this issue?

Thank you

Dear @Leonardo-MAI,
Could you share DRIVE OS release, DW details?

Dear Siva

1- Drive OS version 6.0.5
2- DW version 5.8

If there is something else you should know please let me know how to get the information.

Thank you


could you help on this regard? Let me know in case you need anything else.


Dear @Leonardo-MAI,
Could you confirm if you are using same object detector sample code and just replaced the model file path?

No, in the first place I just tried to load the engine, removing the rest of the code.
But now I tried with the original code by changing the model - generated with tensorRT_optimization - and I am getting a different error, as in the attachment.
error.txt (5.4 KB)

Thank you

Dear @Leonardo-MAI,
As per recent error log, the input video path is wrong. Please double check the input video path. Did you try with absolute path?(DriveWorks SDK Reference: Basic Object Detector and Tracker Sample). Please share the complete used command and log.

in the first place I just tried to load the engine, removing the rest of the code

Does that include removal dwInitialize()? As the error indicates passed parameter is null.

Is this still an issue to support? Any result can be shared? Thanks