Hi, I meet a problme.
I have trained a model using tensorflow using ‘last_channel, NHWC’ and this is the model.summary():
________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) (None, 300, 300, 3) 0
_________________________________________________________________
identity_layer (Lambda) (None, 300, 300, 3) 0
_________________________________________________________________
input_mean_normalization (La (None, 300, 300, 3) 0
_________________________________________________________________
input_stddev_normalization ( (None, 300, 300, 3) 0
_________________________________________________________________
bbn_stage1_block1_pad (ZeroP (None, 301, 301, 3) 0
_________________________________________________________________
bbn_stage1_block1_conv (Conv (None, 150, 150, 32) 864
_________________________________________________________________
bbn_stage1_block1_bn (BatchN (None, 150, 150, 32) 128
_________________________________________________________________
bbn_stage1_block1_relu (Acti (None, 150, 150, 32) 0
=================================================================
Total params: 992
Trainable params: 928
Non-trainable params: 64
I created a model.uff file from this model.h5 file as follow:
UFF Version 0.6.7
=== Automatically deduced input nodes ===
[name: "input_1"
op: "Placeholder"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "shape"
value {
shape {
dim {
size: -1
}
dim {
size: 300
}
dim {
size: 300
}
dim {
size: 3
}
}
}
}
]
=========================================
=== Automatically deduced output nodes ===
[name: "bbn_stage1_block1_relu/Relu6"
op: "Relu6"
input: "bbn_stage1_block1_bn/batchnorm/add_1"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
]
==========================================
Using output node bbn_stage1_block1_relu/Relu6
Converting to UFF graph
DEBUG [/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py:96] Marking ['bbn_stage1_block1_relu/Relu6'] as outputs
No. nodes: 23
UFF Output written to /home/model.uff
Then I want to create model.engine but when I type this command:
parser.register_input("input_1", (300,300,3),trt.UffInputOrder.NHWC)
It would show this:
[TensorRT] ERROR: UffParser: Parser error: input_mean_normalization/sub: Invalid scale mode, nbWeights: 3
But when I change this command
parser.register_input("input_1", (3,300,300),trt.UffInputOrder.NCHW)
It would be passed.
What does it mean?
My platform is Jetson Nano Ubuntu18 Jetpack4.4 TensorRT 7 cuda10.2 cudnn8
Here is about input_mean_normalization code:
subtract_mean=[123, 117, 104]
def input_mean_normalization(tensor):
return tensor - np.array(subtract_mean)
x1 = Lambda(input_mean_normalization, output_shape=(img_height, img_width, img_channels),
name='input_mean_normalization')(x1)
<tf.Operation 'input_mean_normalization/sub' type=Sub>