从 Keras 构建 TensoRRT 引擎时出错

Posted

技术标签:

【中文标题】从 Keras 构建 TensoRRT 引擎时出错【英文标题】:Error while building TensoRT engine from Keras 【发布时间】:2020-05-14 15:55:15 【问题描述】:

我正在将 Keras 模型转换为张量 RT。

首先我将 Keras 模型转换为 TensorFlow 冻结图 (.pb)。

然后将冻结图转换为 UFF 文件终端输出如下:-

    UFF Version 0.6.5
=== Automatically deduced input nodes ===
[name: "input"
op: "Placeholder"
attr 
  key: "dtype"
  value 
    type: DT_FLOAT
  

attr 
  key: "shape"
  value 
    shape 
      dim 
        size: -1
      
      dim 
        size: -1
      
      dim 
        size: -1
      
      dim 
        size: 3
      
    
  

]
=========================================

=== Automatically deduced output nodes ===
[name: "concatenate_1/concat"
op: "ConcatV2"
input: "conv2d_25/truediv"
input: "conv2d_26/BiasAdd"
input: "concatenate_1/concat/axis"
attr 
  key: "N"
  value 
    i: 2
  

attr 
  key: "T"
  value 
    type: DT_FLOAT
  

attr 
  key: "Tidx"
  value 
    type: DT_INT32
  

]
==========================================

Using output node concatenate_1/concat
Converting to UFF graph
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_16/cond/Merge as custom op: Merge
WARNING:tensorflow:From ../../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: Switch yet.
Converting batch_normalization_16/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: PlaceholderWithDefault yet.
Converting batch_normalization_1/keras_learning_phase as custom op: PlaceholderWithDefault
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_11/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_11/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_6/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_6/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_3/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_3/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_2/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_2/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_1/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_1/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_1/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_1/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_1/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_1/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_1/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_2/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_2/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_2/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_2/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_2/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_3/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_3/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_3/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_3/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_3/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_5/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_5/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_4/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_4/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_4/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_4/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_4/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_4/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_4/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_5/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_5/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_5/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_5/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_5/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_6/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_6/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_6/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_6/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_6/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_8/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_8/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_7/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_7/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_7/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_7/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_7/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_7/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_7/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_8/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_8/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_8/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_8/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_8/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_10/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_10/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_9/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_9/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_9/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_9/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_9/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_9/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_9/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_10/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_10/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_10/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_10/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_10/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_11/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_11/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_11/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_11/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_11/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_13/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_13/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_12/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_12/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_12/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_12/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_12/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_12/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_12/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_13/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_13/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_13/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_13/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_13/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_15/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_15/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_14/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_14/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_14/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_14/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_14/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_14/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_14/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_15/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_15/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_15/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_15/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_15/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_16/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_16/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_16/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_16/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_16/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_18/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_18/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_17/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_17/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_17/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_17/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_17/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_17/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_17/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_18/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_18/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_18/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_18/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_18/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_20/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_20/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_19/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_19/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_19/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_19/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_19/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_19/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_19/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_20/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_20/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_20/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_20/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_20/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_22/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_22/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_21/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_21/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_21/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_21/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_21/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_21/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_21/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_22/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_22/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_22/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_22/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_22/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_24/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_24/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Merge yet.
Converting batch_normalization_23/cond/Merge as custom op: Merge
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_23/cond/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_23/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_23/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_23/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_23/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_23/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_24/cond/FusedBatchNorm/Switch_4 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_24/cond/FusedBatchNorm/Switch_3 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_24/cond/FusedBatchNorm/Switch_2 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_24/cond/FusedBatchNorm/Switch_1 as custom op: Switch
Warning: No conversion function registered for layer: Switch yet.
Converting batch_normalization_24/cond/FusedBatchNorm/Switch as custom op: Switch
Warning: keepdims is ignored by the UFF Parser and defaults to True
Warning: keepdims is ignored by the UFF Parser and defaults to True
DEBUG [../../uff/converters/tensorflow/converter.py:96] Marking ['concatenate_1/concat'] as outputs
No. nodes: 511
UFF Output written to /home/kingashar/tensorRT/Models/wpod/tf_model.uff

如您所见,UFF 转换器已将输出节点设置为 ['concatenate_1/concat']。

现在当我运行代码来构建一个 trt 引擎时,我得到了这些错误。

    [TensorRT] ERROR: UffParser: Validator error: batch_normalization_24/cond/Merge: Unsupported operation _Merge
Building TensorRT engine, this may take a few minutes...
[TensorRT] ERROR: Network must have at least one output
None
Traceback (most recent call last):
  File "buildTRTengine.py", line 32, in <module>
    buf = trt_engine.serialize()
AttributeError: 'NoneType' object has no attribute 'serialize'

由于 TRT 无法检测到输出层,因此无法序列化引擎。 关于如何解决这个问题的任何想法?

另外,我的图表中有多个合并层,这些层不受 TRT 支持。 我应该用什么替换它才能成功构建引擎?

【问题讨论】:

【参考方案1】:

这是对您正在使用的图层的支持问题。我对 Keras 并不精通,但似乎 Merge 就像一个 concat?

TF 层支持的运算符列表可以在support matrix 中找到,也可以查看图片:

正如您所见,Merge 不存在,对于 TF 和 TF2,我发现在进行转换时存在多个问题,因为缺少层支持。尝试将其转换为.onnx。我用它来转换多个网络,层支持更广泛。

或者您可以编写自己的层转换,但这需要相当大的努力。

您还可以发布层架构吗?也许我混淆了您尝试使用的图层。

【讨论】:

以上是关于从 Keras 构建 TensoRRT 引擎时出错的主要内容,如果未能解决你的问题,请参考以下文章

TensorRT模型部署实战,英伟达平台,C++ 和python对比(包含源码)

TensorRT模型部署实战,英伟达平台,C++ 和python对比(包含源码)

Yolov3 到 Tensorrt:tf-keras Lambda 层的自定义插件

一个简单的tensorRT mnist推理案例,模型采用代码构建

导入 Keras 层时出错

TensorRT maskrcnn windows下使用自己的数据集(二)