Loading a caffe model with layer that's not supported.

Hello everyone. I’ve been trying to run trt inference with caffe pretrained models. Everything seems to be working great except for densenets. I get the following:

[TensorRT] INFO: Detecting Framework
[TensorRT] INFO: Parsing Model from caffe
[libprotobuf ERROR google/protobuf/text_format.cc:298] Error parsing text-format ditcaffe.NetParameter: 
    54:14: Message type "ditcaffe.PoolingParameter" has no field named "ceil_mode".
[TensorRT] ERROR: CaffeParser: Could not parse deploy file
[TensorRT] INFO: Parsing caffe model deploy.prototxt, densenet_121.caffemodel
[TensorRT] ERROR: Failed to parse caffe model

Apparently ceil_mode is not supported. I figured since this model is made and saved in caffe, then the problem lies in tensorrt or cudnn not being able to parse this layer. Can anyone help me with fixing that? I see some people here: https://github.com/BVLC/caffe/pull/3057/files tried to solve a similar problem, but since I have no access to caffe code, only the .caffemodel file along with .prototxt, I need to find a different workaround. I’ll be grateful for any help.

There’s no way you’ll get into the TensorRT Caffe parser to be able to support ceil_mode, which is not even part of mainline Caffe. Here are a few possible options for you

  • consider modifying your prototxt to not use ceil_mode. what it’s doing (according to your github link) is giving a policy on how to round pooling windows. for certain configurations, when things evenly divide, ceil and floor give the same result. Otherwise, either TensorRT might be giving the one you want anyway, or the result might be close enough for your use case.
  • if you really need to use that given rounding policy, you could implement a Plugin layer (which I wouldn’t really recommend)

Good luck,