3d Keras Optimize on Tensor Rt


I have a keras 3d convolutional model that I would like to optimize on Tensor RT. I have successfully converted the .h5 into a .pb, and the .pb into a onnx file. I am trying to optimize this onnx model with tensor rt with this script:

However this returns a plugin error for max pooling 3d. I am not sure why I am receiving this error because I have tensor rt 7 and I thought it provides support for 3d convolution and pooling, How do I solve this?


There are some limitation in the 3D pooling.
Would you mind to check if your model is supported by both TensorRT API and onnx2trt first?

TensorRT: https://docs.nvidia.com/deeplearning/tensorrt/support-matrix/index.html#layers-matrix
ONNX2TRT: https://github.com/onnx/onnx-tensorrt/blob/master/operators.md


From what I’ve read, it shows support for 2d and 3d for pooling. However, I am unsure on max pooling because Onnx2TRT simply says yes for max pooling. https://docs.nvidia.com/deeplearning/tensorrt/release-notes/tensorrt-6.html shows support for pooling.
Here is my onnx file in case you want to try it out:

Any follow ups?


Sorry for the late update.

It looks like ONNX2TRT only support MaxPool and no MaxPool3D operation support.

Here are two possible workarounds for your reference.

  1. Add the MaxPool3D support into ONNX2TRT.
  2. Update the operation into MaxPool when generating the onnx model from your .pb file.