TensorRT deserializeCudaEngine 推理结果错误

使用deserializeCudaEngine得到的模型进行目标检测,检测结果异常,详细情况如下,请大家帮忙分析分析,感谢。详细log请见附件。
问题复现步骤:
1、使用/usr/src/tensorrt/samples/sampleSSD工程进行测试,运行平台为xavier NX,输入图像为data/ssd/dog.ppm。
2、sampleSSD.cpp中增加saveEngine和loadEngine的代码:使用宏LOAD_ENGINE切换模式
#define LOAD_ENGINE 1
#if LOAD_ENGINE
printf(“BEGIN: load engine\n”);
ICudaEngine *p_engine = sample::loadEngine("/home/username/models/ssd/cuda_engine.bin3", mParams.dlaCore, std::cout);
printf(“END : load engine\n”);
mEngine = std::shared_ptrnvinfer1::ICudaEngine(p_engine, samplesCommon::InferDeleter());
return true;
#else
mEngine = std::shared_ptrnvinfer1::ICudaEngine(
builder->buildEngineWithConfig(*network, *config), samplesCommon::InferDeleter());
if (!mEngine)
{
return false;
}
// save engine
printf(“BEGIN: save engine\n”);
sample::saveEngine(*mEngine.get(), “/home/username/models/ssd/cuda_engine.bin3”, std::cout);
printf(“END: save engine\n”);
return true;
#endif
3、LOAD_ENGINE设置为0,编译、运行、saveEngine、推理结果正确,log如下:
[09/01/2020-23:48:43] [I] Label: dog, confidence: 99.7308 xmin: 80.0972 ymin: 22.7761 xmax: 295.669 ymax: 295.394
saveEngine运行正常,结果如下:
-rw-rw-r-- 1 username username 179994805 Sep 1 23:48 /home/username/models/ssd/cude_engine.bin3
4、LOAD_ENGINE设置为1,编译、运行、loadEngine、推理结果异常,多了很多目标,log如下。
[09/01/2020-23:56:09] [I] Label: dog, confidence: 99.7308 xmin: 18 ymin: 18 xmax: 282 ymax: 282
[09/01/2020-23:56:09] [I] Label: dog, confidence: 99.1606 xmin: 131.434 ymin: 131.434 xmax: 300 ymax: 300
[09/01/2020-23:56:09] [I] Label: dog, confidence: 91.3579 xmin: 30 ymin: 30 xmax: 60 ymax: 60
[09/01/2020-23:56:09] [I] Label: dog, confidence: 77.5392 xmin: 177.006 ymin: 55.5534 xmax: 232.275 ymax: 58.0759
bad
log.txt (4.8 KB)