Yolov3 with leakyRELU

My system is as follow :
TensorRT 5.1.5-1+cuda10.0
CUDA : V10.0.130
cuDNN ; 7.5.0.56-1+cuda10.0
GPU : RTX2080Ti
Driver : 418.67

I have register the leakyRELU with plugin and can convert pb to uff

Converting to UFF graph
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional74/Activation as custom op: LeakyRelu
W0627 15:34:02.000798 139929572443968 deprecation_wrapper.py:119] From /usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py:179: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional73/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional72/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional71/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional70/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional69/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional26/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional25/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional10/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional5/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional2/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional1/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional4/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional3/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional7/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional6/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional9/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional8/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional12/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional11/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional14/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional13/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional16/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional15/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional18/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional17/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional20/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional19/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional22/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional21/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional24/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional23/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: ResizeNearestNeighbor yet.
Converting yolov3-aoi/upsample2 as custom op: ResizeNearestNeighbor
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional68/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional65/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional64/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional63/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional62/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional61/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional43/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional42/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional27/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional29/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional28/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional31/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional30/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional33/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional32/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional35/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional34/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional37/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional36/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional39/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional38/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional41/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional40/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: ResizeNearestNeighbor yet.
Converting yolov3-aoi/upsample1 as custom op: ResizeNearestNeighbor
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional60/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional57/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional56/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional55/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional54/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional53/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional44/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional46/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional45/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional48/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional47/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional50/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional49/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional52/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional51/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional66/Activation as custom op: LeakyRelu
Warning: No conversion function registered for layer: LeakyRelu yet.
Converting yolov3-aoi/convolutional58/Activation as custom op: LeakyRelu
No. nodes: 624
UFF Output written to yolov3.uff
UFF Text Output written to yolov3.pbtxt
Successfully transfer to UFF model

When i try convert it to engine, i still have

[TensorRT] ERROR: UffParser: Validator error: yolov3-aoi/convolutional66/Activation: Unsupported operation _LeakyRelu

I check support martrix here :https://docs.nvidia.com/deeplearning/sdk/tensorrt-support-matrix/index.html
The TensorRT layers :

IActivationLayer
tensorrt.ActivationType
The type of activation to perform.

Members:

<b>LEAKY_RELU : Leaky Relu activation: f(x) = x if x >= 0, f(x) = alpha * x if x < 0</b>

CLIP : Clip activation: f(x) = max(alpha, min(beta, x))

SIGMOID : Sigmoid activation

HARD_SIGMOID : Hard sigmoid activation: f(x) = max(0, min(1, alpha * x + beta))

THRESHOLDED_RELU : Thresholded Relu activation: f(x) = x if x > alpha, f(x) = 0 if x <= alpha

SCALED_TANH : Scaled Tanh activation: f(x) = alpha * tanh(beta * x)

ELU : Elu activation: f(x) = x if x >= 0, f(x) = alpha * (exp(x) - 1) if x < 0

SELU : Selu activation: f(x) = beta * x if x > 0, f(x) = beta * (alpha * exp(x) - alpha) if x <= 0

SOFTSIGN : Softsign activation: f(x) = x / (1 + |x|)

RELU : Rectified Linear activation

TANH : Hyperbolic Tangent activation

SOFTPLUS : Softplus activation: f(x) = alpha * log(exp(beta * x) + 1)

Tensorflow layers :

TensorFlow
These are the operations that are supported in a TensorFlow framework:
Add, Sub, Mul, Div, Minimum and Maximum
ArgMax
ArgMin
AvgPool
BiasAdd
Clip
ConcatV2
Const
Conv2D
ConvTranspose2D
DepthwiseConv2dNative
Elu
ExpandDims
FusedBatchNorm
Identity
<b>LeakyReLU</b>
MaxPool
Mean
Negative, Abs, Sqrt, Recip, Rsqrt, Pow, Exp and Log
Pad is supported if followed by one of these TensorFlow layers: Conv2D, DepthwiseConv2dNative, MaxPool, and AvgPool.
Placeholder
ReLU, TanH, and Sigmoid
Relu6
Reshape
Sin, Cos, Tan, Asin, Acos, Atan, Sinh, Cosh, Asinh, Acosh, Atanh, Ceil and Floor
Selu
Slice
SoftMax
Note: If the input to a TensorFlow SoftMax op is not NHWC, TensorFlow will automatically insert a transpose layer with a non-constant permutation, causing the UFF converter to fail. It is therefore advisable to manually transpose SoftMax inputs to NHWC using a constant permutation.
Softplus
Softsign
Transpose

Can you please point out where i can set it wrong ? or TensorRT still cannot support leakyRELU ?
Thank you,

hi hiro.nguyen

i want to get uff file from yolo_v3 pb file,but it fail.
this is code.

import tensorflow as tf
import uff
uff.from_tensorflow_frozen_model(
    "/media/lw/OS/yolo_v3.pb",
    "outputboxes,outputscores,outputclasses".split(',')
)

i got some errors

NOTE: UFF has been tested with TensorFlow 1.12.0. Other versions are not guaranteed to work
UFF Version 0.6.3
=== Automatically deduced input nodes ===
[name: “Placeholder”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_INT32
}
}
attr {
key: “shape”
value {
shape {
dim {
size: 2
}
}
}
}
, name: “input_image”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_FLOAT
}
}
attr {
key: “shape”
value {
shape {
dim {
size: -1
}
dim {
size: 416
}
dim {
size: 416
}
dim {
size: 3
}
}
}
}
]

Using output node outputboxes
Using output node outputscores
Using output node outputclasses
Converting to UFF graph
Warning: No conversion function registered for layer: Fill yet.
Converting ones_like_2 as custom op: Fill
Warning: No conversion function registered for layer: NonMaxSuppressionV3 yet.
Converting non_max_suppression_2/NonMaxSuppressionV3 as custom op: NonMaxSuppressionV3
Warning: No conversion function registered for layer: Where yet.
Converting boolean_mask_5/Where as custom op: Where
Warning: No conversion function registered for layer: GreaterEqual yet.
Converting GreaterEqual as custom op: GreaterEqual
Traceback (most recent call last):
File “/home/lw/PycharmProjects/lenet/get_node_op.py”, line 19, in
“outputboxes,outputscores,outputclasses”.split(’,’)
File “/home/lw/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/conversion_helpers.py”, line 233, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File “/home/lw/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/conversion_helpers.py”, line 181, in from_tensorflow
debug_mode=debug_mode)
File “/home/lw/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/converter.py”, line 94, in convert_tf2uff_graph
uff_graph, input_replacements, debug_mode=debug_mode)
File “/home/lw/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/converter.py”, line 79, in convert_tf2uff_node
op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes, debug_mode=debug_mode)
File “/home/lw/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/converter.py”, line 47, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File “/home/lw/anaconda3/lib/python3.6/site-packages/uff/converters/tensorflow/converter_functions.py”, line 580, in convert_strided_slice
raise ValueError(“ellipsis_mask not supported”)
ValueError: ellipsis_mask not supported

could you tell me what to do?
thanks

Hi 351048599
I think it is because “ellipsis_mask” is an unsupported layer. Is your pb a frozen pb ? Which yolov3 darknet cfg you used to convert ? You should convert the testing cfg, they will remove all training related layers.

For my problem, in the end i cannot make it work nor NVIDIA provide any answer so i changed to use Yolov3 onnx.

thank for your reply, pb file is frozen, and i test the bp file sucessfully using tensorflow c++ api.

I don’t know how to do it now.

hi hiro.nguyen

I want to know if you solved the problem?

Hi I used the Tensorflow-TensorRT (TF-RT) It allows you to convert partial model. Like when some layers are not supported, they will fall back running on Tensorflow, if it can run on TensorRT they will run on TensorRT. You can give it a try.

Thank you for the information, I’m just very confused that Leakyrelu and ResizeNearestNeighbor are supported according to https://docs.nvidia.com/deeplearning/sdk/tensorrt-support-matrix/index.html, but actually it’s not or something wrong with my code. Seems that I must wait for the next version.