When I use trained keras model in tensorRT 5.1, I got the problem:

[TensorRT] ERROR: (Unnamed Layer* 605) [Deconvolution]: kernel weights has count 5242880 but 32768 was expected

here is my trt code:

import numpy as np
import pycuda.driver as cuda
# This import causes pycuda to automatically manage CUDA context creation and cleanup.
import pycuda.autoinit
import tensorrt as trt
import sys, os
sys.path.insert(1, os.path.join(sys.path[0], ".."))
import common
import random
from PIL import Image
import matplotlib.pyplot as plt

# You can set the logger severity higher to suppress messages (or lower to display more messages).
TRT_LOGGER = trt.Logger(trt.Logger.WARNING)

class ModelData(object):
    MODEL_FILE = "exp14-Unet-efficientnetb0-2out-c-[2].uff"
    INPUT_NAME = "input_1_1"   
    INPUT_SHAPE = (3, 512, 512)
    OUTPUT_NAME_1 = 'c_2_1/Softmax'
    OUTPUT_NAME_2 = "seg_1/Sigmoid"

def GiB(val):
    return val * 1 << 30

def build_engine(model_file):
    # For more information on TRT basics, refer to the introductory samples.
    with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.UffParser() as parser:
        builder.max_workspace_size = GiB(1)
        # Parse the Uff Network
        parser.register_input(ModelData.INPUT_NAME, ModelData.INPUT_SHAPE)
        parser.parse(model_file, network)
        # Build and return an engine.
        return builder.build_cuda_engine(network)

# Loads a test case into the provided pagelocked_buffer.
def load_normalized_test_case(data_path, pagelocked_buffer, case_num=random.randint(0, 9)):
    # test_case_path = os.path.join(data_path, str(case_num) + ".pgm")
    # Flatten the image into a 1D array, normalize, and copy to pagelocked memory.
    img = Image.open(data_path)
    img = img.resize((512, 512))
    img = np.array(img)
    img = np.moveaxis(img, -1, 0)
    img = img.ravel()
    np.copyto(pagelocked_buffer, img / 255.0)
    return case_num

def main():
    # data_path, _ = common.find_sample_data(description="Runs an MNIST network using a UFF model file", subfolder="mnist")
    data_path = 'data/3.png'
    # model_path is current "models/"
    model_path = os.environ.get("MODEL_PATH") or os.path.join(os.path.dirname(__file__), "models")
    model_file = os.path.join(model_path, ModelData.MODEL_FILE)

    with build_engine(model_file) as engine:
        # Build an engine, allocate buffers and create a stream.
        # For more information on buffer allocation, refer to the introductory samples.
        inputs, outputs, bindings, stream = common.allocate_buffers(engine)
        with engine.create_execution_context() as context:
            case_num = load_normalized_test_case(data_path, pagelocked_buffer=inputs[0].host)
            # For more information on performing inference, refer to the introductory samples.
            # The common.do_inference function will return a list of outputs - we only have one in this case.
            output = common.do_inference(context, bindings=bindings, inputs=inputs, outputs=outputs, stream=stream)
            # out_img = output[1].reshape((512, 512))
            # print('trt output is:', out_img[0:5, 0:5])  # output
            # print('trt output is:', output[2])

if __name__ == '__main__':

full error is, anyone can help me?

[TensorRT] ERROR: (Unnamed Layer* 605) [Deconvolution]: kernel weights has count 5242880 but 32768 was expected
[TensorRT] ERROR: (Unnamed Layer* 605) [Deconvolution]: kernel weights has count 5242880 but 32768 was expected
python: uff/UffParser.cpp:1070: std::shared_ptr UffParser::parseConvTranspose(const uff::Node&, const Fields&, NodesMap&): Assertion `(outSpatial[0] == layer->getOutput(0)->getDimensions().d[1] && outSpatial[1] == layer->getOutput(0)->getDimensions().d[2]) && “Uff parser gets incorrect outSpacial”’ failed.