Error reading serialized TensorRT engine


I have an ocrnet.engine file which works fine in a separate inference application built using the nvocdr library . But when I integrate the library and .engine file into my main code base which is a C++ qt application to detect vehicle, then license plate. After that the ocrnet.engine file is suppose to perform ocr on the license plate. Without the ocrnet there are 3 separate models being loaded and performing inference. But the ocrnet is showing this error message: Error reading serialized TensorRT engine:( some symbols). Sometimes the error message is:

Error reading serialized TensorRT engine: _ZN55_INTERNAL_ac9bc2a4_24_syscall_device_shared_cu_9f7172a518ctaUnlockExclusiveEv

To solve the problem I have rebuilt the model. I checked if there is any TensorRT version mismatch between my qt import and the version I have used to parse the model. I have checked the cuda version. Everything seems alright to me. What can be the cause of the error? Also I am using threads.


TensorRT Version: 8.6.1
GPU Type: RTX 2070
Nvidia Driver Version: 525.125.06
CUDA Version: 12.1
CUDNN Version: 8.9.5
Operating System + Version: Linux

I have found out why the error is occurring. For some reason my path can’t be read by the compiler inside nvocdr library

std::string e_path=“/home/sigmind/ocrnet_files/bdlpocrnet.fp16.engine”;
std::string d_path= “/home/sigmind/ocrnet_files/characters_list”;
nvOCDRParam param;
param.input_data_format = NHWC;
param.ocrnet_trt_engine_path =strdup(e_path.c_str());
param.ocrnet_dict_file = strdup(d_path.c_str());
param.ocrnet_infer_input_shape[0] = 1;
param.ocrnet_infer_input_shape[1] = 64;
param.ocrnet_infer_input_shape[2] = 200;
param.ocrnet_decode = Attention;


Error reading serialized TensorRT engine: 0��d7V

But haven’t found out yet why.