Hi, I have solved my problems, I release my solution here now.
Firstly, the warning problems mentioned above:
Warning: No conversion function registered for layer: Merge yet.
Warning: No conversion function registered for layer: Switch yet.
Warning: No conversion function registered for layer: Equal yet.
Warning: No conversion function registered for layer: RefSwitch yet.
Warning: No conversion function registered for layer: AssignSub yet.
was because of the utilization of tensorflow function tf.cond() and tf.equal().
tf.equal() caused Warning: No conversion function registered for layer: Equal yet.
tf.cond() caused all others.
Due to the function of tf.cond() and tf.equal() is not essential for my net, I removed them by some way.
For tf.cond(), it was used for switch batch_normalization between training and test, because it was not supported by tensorrt4.0, I have to give up to use it. Temporarily, I removed batch_normalization layers due to the unavailability of tf.cond() until I found some way to use batch_normalization under the absent of tf.cond().
Secondly, two problems below:
lanenet_loss/inference/encode/conv1_1/conv/Conv2D: kernel weights has count 1728 but 147456 was expected
UFFParser: Parser error: lanenet_loss/inference/encode/conv1_1/bn/FusedBatchNorm: The input to the Scale Layer is required to have a minimum of 3 dimensions.
The Parser error can be removed by removing batch_normalization.
And the error:“lanenet_loss/inference/encode/conv1_1/conv/Conv2D: kernel weights has count 1728 but 147456 was expected”
was caused by NHWC and NCHW problems.
My input shape is (1, 256, 512, 3) in NHWC format, and corresponding weight shape is (3, 3, 3, 64)
You can see that 3X3X3X64 = 1728, so the error information indicates that something wrong with weight shape.
Because 147456 = 3X3X256X64, so the wrong shape of weight was (3, 3, 256, 64), now you can know that tensorrt regard 256 as the C channel mistakenly, it is also to say, tensorrt processed my input shape (1, 256, 512, 3) with the wrong format NCHW.
So, the solution is that input “–uffInput” parameter explicitly when using trtexec, although “–uffInput” is an optional parameter. I suggest that make the “–uffInput” parameter as the essential parameter for trtexec, because NHWC format is usually used for tensorflow.