将tensorflow .pb模型转换为.mlmodel时出错

问题描述 投票:1回答:1

我正在尝试将张量图(。pb文件)转换为。mlmodel

import tfcoreml
coreml_model = tfcoreml.convert(tf_model_path='optimized_model.pb', mlmodel_path='FaceImages.mlmodel', output_feature_names=['final_result'], input_name_shape_dict={'ResizeBilinear': {'images': None, 'size': {None, None}}}, minimum_ios_deployment_target='13')

但是我遇到以下错误:

/ usr / local / lib / python3.6 / dist-packages / coremltools / converters / nnssa / frontend / tensorflow / graphdef_to_ssa.py在load_tf_graph(graph_file)

 21     with tf.io.gfile.GFile(graph_file, "rb") as f:
 22         graph_def = tf.compat.v1.GraphDef()

[---> 23 graph_def.ParseFromString(f.read())] >>

 24 
 25     # Then, we import the graph_def into a new Graph and returns it

DecodeError:错误分析消息

有人可以帮忙吗?

这里是colab项目

,我在其中附加了tensorflow模型和相关的转换代码

https://colab.research.google.com/drive/1S7nf7pnX15UuswFZaTih5pHhfDFwG5Xa

我正在尝试将张量流图(.pb文件)转换为.mlmodel导入tfcoreml coreml_model = tfcoreml.convert(tf_model_path ='optimized_model.pb',mlmodel_path ='FaceImages.mlmodel',...

python tensorflow coreml mlmodel
1个回答
0
投票

您是否已检查所使用的Tensorflow版本与这些库兼容?这只是一个猜测,但您可以尝试运行

!pip install tensorflow --upgrade

© www.soinside.com 2019 - 2024. All rights reserved.