Failed to convert .pb model to .trt model on nx by following the steps provided in samples/python/uff_ssd


My .pb model has FusedBatchNorm layer. I have successfuly converted the .pb model to .uff model, but I failed to convert to .trt model. I got the following error messages when I tried to build_cuda_engine():

[TensorRT] ERROR: cr/bn0/Const: constant weights has count 0 but 1 was expected
[TensorRT] ERROR: UffParser: Parser error: cr/bn0/FusedBatchNorm: Invalid Batchnorm inputs for layer cr/bn0/FusedBatchNorm

So I took a look at the batchnorm layer of my .pb model and .uff model. I noticed both of the mean and variance have a size of 0 as shown in the images attached.

It seems the UffParser needs the mean and variance of the batchnorm layer have a size of 1 (for example, mean = [0], variance = [1]). Could anyone help me resolve this? Thanks in advance.


You can attach one when you converts the .pb file into .uff.


dummy_const = gs.create_node(name="dummy_const", op="Const", dtype=tf.float32, value=np.array([1, 1], dtype=np.float32))

def preprocess(dynamic_graph):