TF to UFF issue

Hello,

I have a tf pb file, and I have found many convert issues, and remove ‘_ResizeBilinear’, ‘_BatchToSpaceND’ and ‘_SpaceToBatchND’, but got below issue:

xhz@xhz-omen:tf_to_trt_image_classification$ python scripts/convert_plan.py /home/xhz/Projects/models/xw_model/new/LsGan_model_test.pb /home/xhz/Projects/models/xw_model/LsGan_model.pb.plan input_img 360 640 sigmoid_logits 1 0 float
Using output node sigmoid_logits
Converting to UFF graph
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
WARNING: The UFF converter currently only supports 2D dilated convolutions
No. nodes: 570
UFF Output written to data/tmp.uff
UFFParser: parsing input_img
UFFParser: parsing res_aspp_g/decoder/resnet/conv1/weights
UFFParser: parsing res_aspp_g/decoder/resnet/conv1/conv1
UFFParser: Convolution: add Padding Layer to support asymmetric padding
UFFParser: Convolution: Left: 2
UFFParser: Convolution: Right: 3
UFFParser: Convolution: Top: 2
UFFParser: Convolution: Bottom: 3
UFFParser: parsing res_aspp_g/decoder/resnet/bn_conv1/BatchNorm/Const
UFFParser: parsing res_aspp_g/decoder/resnet/bn_conv1/BatchNorm/beta
UFFParser: parsing res_aspp_g/decoder/resnet/bn_conv1/BatchNorm/Const_1
UFFParser: parsing res_aspp_g/decoder/resnet/bn_conv1/BatchNorm/Const_2
UFFParser: parsing res_aspp_g/decoder/resnet/bn_conv1/BatchNorm/FusedBatchNorm
Parameter check failed at: Utils.cpp::reshapeWeights::71, condition: input.values != nullptr
UFFParser: Parser error: res_aspp_g/decoder/resnet/bn_conv1/BatchNorm/FusedBatchNorm: reshape weights failed!
Failed to parse UFF

so i remove layer ‘FusedBatchNorm’, so got below issue:

UFFParser: parsing res_aspp_g/decoder/resnet/res4b3_branch2a/weights
UFFParser: parsing res_aspp_g/decoder/resnet/res4b3_branch2a/Conv2D
res_aspp_g/decoder/resnet/res4b1_branch2b/convolution: at least three non-batch dimensions are required for input
UFFParser: parsing res_aspp_g/decoder/resnet/res4b3_branch2a/Relu
UFFParser: parsing res_aspp_g/decoder/resnet/res4b3_branch2b/weights
UFFParser: parsing res_aspp_g/decoder/resnet/res4b3_branch2b/convolution
UFFParser: parsing res_aspp_g/decoder/resnet/res4b3_branch2b/Relu
UFFParser: parsing res_aspp_g/decoder/resnet/conv/weights
UFFParser: parsing res_aspp_g/decoder/resnet/conv/Conv2D
res_aspp_g/decoder/resnet/res4b1_branch2b/Relu: at least one non-batch dimension is required for input
UFFParser: parsing res_aspp_g/decoder/resnet/conv/biases
UFFParser: parsing res_aspp_g/decoder/resnet/conv/BiasAdd
res_aspp_g/decoder/resnet/res4b1_branch2c/Conv2D: at least three non-batch dimensions are required for input
UFFParser: Parser error: res_aspp_g/decoder/resnet/conv/BiasAdd: The input to the Scale Layer is required to have a minimum of 3 dimensions.
Failed to parse UFF

I use the tool from https://github.com/NVIDIA-Jetson/tf_to_trt_image_classification, and the issue was post at convert issue · Issue #26 · NVIDIA-AI-IOT/tf_to_trt_image_classification · GitHub

Is TRT have some compatibility issue to tensorflow 1.8? Is someone have this issue?

My detail of computer:

OS: ubuntu 16.04 64bit(4.15.0-33-generic)
NVIDIA GTX1080TI
nvidia 384.130 + CUDA 9.0 + cudnn 7.1.2
TensorRT 4.0.1.6

Hello,

It looks like you are converting a pb file with many TRT unsupported operations (ex: ResizeBilinear). Simply removing unsupported operations may not result in a valid model. Which is what you are seeing here. The TRT converter is calling out this out.

@NVES I meet the error. In my model, I use slim.batch_norm, it means tensorrt does not support this type of FusedBatchNorm op? how should I fix it?

@NVES when I use tf.layer.batch_normalization instead of tf.slim.batch_norm, meanwhile not setting the training parameter(the default value is False), it works. But when I train a model with setting the training parameter to True, then I transfer the ckpt model to pb and uff file and then parse the uff file, it stills shows the above error:

[TensorRT] INFO: UFFParser: parsing model_0/resnet_v1_50/conv1/batch_normalization/FusedBatchNorm
[TensorRT] ERROR: Parameter check failed at: Utils.cpp::reshapeWeights::71, condition: input.values != nullptr
[TensorRT] ERROR: UFFParser: Parser error: model_0/resnet_v1_50/conv1/batch_normalization/FusedBatchNorm: reshape weights failed!

it is weird issue, can you give some advises to fix it?

see NVES’s suggestion [url]https://devtalk.nvidia.com/default/topic/1044545/tensorrt/-tf-slim-batch_norm-or-tf-layer-batch_normalization-/[/url]