[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相匹配。