ValueError:提供了输出名称:logits/BiasAdd,但Tensorflow图不包含具有此名称的张量

2024-09-30 03:24:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我在做一个检测眼睛区域的项目,我有一个冻结的推理模型。 我正在尝试将此模型转换为.mlmodel(使用tfcoreml),但出现以下错误:

ValueError: output name: logits/BiasAdd was provided, but the Tensorflow graph does not contain a tensor with this name.

但是张量存在于图上,这是: graph of the model

+这是输入张量(input to float):

Input tensor

+这是输出张量(logits/BiasAdd):

output tensor

这是我用来转换的代码:


import tfcoreml as tf_converter
tf_converter.convert(tf_model_path='C:\\Users\\User\\cnn-facial-landmark\\irismodel\\freeze2\\frozen_inf_model_iris.pb',
                     mlmodel_path='irismodelios.mlmodel',
                     output_feature_names=['logits/BiasAdd'],
                     input_name_shape_dict={'input_to_float': [1, 112, 112, 3]})

如何解决此错误?你知道吗


Tags: topathnameinputoutputmodeltf错误
1条回答
网友
1楼 · 发布于 2024-09-30 03:24:13

我可以这样说,我解决了我的问题:How to use a retrained "tensorflow for poets" graph on iOS?

优化冻结图之后,我得到占位符而不是OneShotterator、IteratorGetNext和cast。 转换前:(优化图)

,但我不确定,因为我怀疑输入\u到\u float应该有[1112112,3]而不是[311212]:

命令日志:

Core ML input(s):
[name: "input_to_float__0"
type {
multiArrayType {
shape: 3
shape: 112
shape: 112
dataType: DOUBLE
}
}
]
Core ML output(s):
[name: "logits__BiasAdd__0"
type {
multiArrayType {
shape: 80
dataType: DOUBLE
}
}
]

enter image description here

转换(.mlmodel文件)后

enter image description here

相关问题 更多 >

    热门问题