Pytorch _for DeeplabV3 resize Error

Description

pytorch → onnx → tensorrt

Environment

TensorRT Version : tensorrt 7.0.0.11
GPU Type : RTX 2080ti
Nvidia Driver Version : 440.64
CUDA Version : 10.2
CUDNN Version : i don’t know
Operating System + Version : ubuntu 18.04
Python Version (if applicable) : 3.6x
TensorFlow Version (if applicable) : X
PyTorch Version (if applicable) : 1.4.0
Baremetal or Container (if container which image + tag) : Ok ( _tensorrt git(url:GitHub - NVIDIA/TensorRT: TensorRT is a C++ library for high performance inference on NVIDIA GPUs and deep learning accelerators.))

Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

class Res_Deeplab(nn.Module):
    def __init__(self):
        super(Res_Deeplab, self).__init__()
        self.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=2, padding=1, bias=False)
        self.bn1 = nn.BatchNorm2d(64)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1, ceil_mode=True)
        self.relu = nn.ReLU(inplace=False)
        self.avgpool = nn.AvgPool2d((129,257))
        self.conv2 = nn.Conv2d(64, 64, kernel_size=1, padding=0, dilation=1, bias=False)
        self.conv3 = nn.Conv2d(64, 64, kernel_size=1, padding=0, dilation=1, bias=False)
        self.conv4 = nn.Conv2d(64, 64, kernel_size=3, padding=12, dilation=12, bias=False)
        self.conv5 = nn.Conv2d(64, 64, kernel_size=3, padding=24, dilation=24, bias=False)
        self.conv6 = nn.Conv2d(64, 64, kernel_size=3, padding=36, dilation=36, bias=False)
    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        x = self.relu(x)
        x = self.maxpool(x)
        x = self.maxpool(x)
        x1 = self.avgpool(x)
        x1 = self.conv2(x1)
        feat1 = F.interpolate(x1, size=(129, 257), mode='bilinear', align_corners=True)
        feat2 = self.conv3(x)
        feat3 = self.conv4(x)
        feat4 = self.conv5(x)
        feat5 = self.conv6(x)
        #out = torch.cat((feat1, feat2, feat3, feat4, feat5), 1)

        return feat1

Steps To Reproduce

./trtexec --onnx=output_deeplabv3.onnx --explicitBatch --verbose=True --workspace=9000 --shapes=input:1x3x1024x2048

  • code error :
[04/19/2020-19:34:19] [V] [TRT] /workspace/TensorRT/parsers/onnx/ModelImporter.cpp:181:  [Concat] outputs: [31 -> (4)],
[04/19/2020-19:34:19] [V] [TRT] /workspace/TensorRT/parsers/onnx/ModelImporter.cpp:107: Parsing node:  [Resize]
[04/19/2020-19:34:19] [V] [TRT] /workspace/TensorRT/parsers/onnx/ModelImporter.cpp:123: Searching for input: 22
[04/19/2020-19:34:19] [V] [TRT] /workspace/TensorRT/parsers/onnx/ModelImporter.cpp:123: Searching for input: 24
[04/19/2020-19:34:19] [V] [TRT] /workspace/TensorRT/parsers/onnx/ModelImporter.cpp:123: Searching for input: 24
[04/19/2020-19:34:19] [V] [TRT] /workspace/TensorRT/parsers/onnx/ModelImporter.cpp:123: Searching for input: 31
[04/19/2020-19:34:19] [V] [TRT] /workspace/TensorRT/parsers/onnx/ModelImporter.cpp:129:  [Resize] inputs: [22 -> (1, 64, 1, 1)], [24 -> ()], [24 -> ()], [31 -> (4)],
While parsing node number 16 [Resize -> "32"]:
--- Begin node ---
input: "22"
input: "24"
input: "24"
input: "31"
output: "32"
op_type: "Resize"
attribute {
  name: "coordinate_transformation_mode"
  s: "align_corners"
  type: STRING
}
attribute {
  name: "cubic_coeff_a"
  f: -0.75
  type: FLOAT
}
attribute {
  name: "mode"
  s: "linear"
  type: STRING
}
attribute {
  name: "nearest_mode"
  s: "floor"
  type: STRING
}

--- End node ---
ERROR: /workspace/TensorRT/parsers/onnx/builtin_op_importers.cpp:2453 In function importResize:
[8] Assertion failed: (transformationMode == "asymmetric") && "This version of TensorRT only supports asymmetric resize!"
[04/19/2020-19:34:19] [E] Failed to parse onnx file
[04/19/2020-19:34:19] [E] Parsing model failed
[04/19/2020-19:34:19] [E] Engine creation failed
[04/19/2020-19:34:19] [E] Engine set up failed

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered

Hi,

Please refer to below link, in case it helps:
https://github.com/NVIDIA/TensorRT/issues/273#issuecomment-605283145
https://github.com/onnx/onnx-tensorrt/pull/418/files

Thanks

thank you for the reply.

The following comments were accepted.
https://github.com/onnx/onnx-tensorrt/pull/418

However, the problem was caused by changing the (path: TensorRT/parsers/onnx/builtin_op_importers.cpp)

 cd $TRT_SOURCE
 mkdir -p build && cd build
 cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR=`pwd`/out
 make -j$(nproc)

Briefly, can you explain?

thanks x 10000

Hi,

Please refer below link:
https://github.com/NVIDIA/TensorRT/issues/273#issuecomment-616899833

Thanks