[00/13/2020-21:46:09] [E] [TRT] (Unnamed Layer* 0) [Convolution]: at least 4 dimensions are required for input While parsing node number 1 [BatchNormalization]: ERROR: builtin_op_importers.cpp:695 In function importBatchNormalization: [6] Assertion failed: scale_weights.shape == weights_shape [00/13/2020-21:46:09] [E] Failed to parse onnx file [00/13/2020-21:46:09] [E] Parsing model failed [00/13/2020-21:46:09] [E] Engine could not be created
看网上给的方案比较麻烦:https://github.com/NVIDIA/TensorRT/issues/330
我这里的解决方案如下:
第一步:更换createNetworkV2(1U)为createNetwork()
完成第一步编译运行,如果还是没有结果,执行第二步:
第二步:更换exeContexts[contextIndex]->enqueueV2(cur.data...)....为exeContexts[contextIndex]->enqueue(1, cur.data(), streams[contextIndex]->get(), nullptr);
完成第二步应该就可以正常运行了,如果还有错,更改cmake中的算力,与你使用的GPU相匹配。