1

I am trying to convert a tensorflow graph (.pb file) into a .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')

but I am getting following error:

/usr/local/lib/python3.6/dist-packages/coremltools/converters/nnssa/frontend/tensorflow/graphdef_to_ssa.py in 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: Error parsing message

Could anybody help with this pls?

Here is the colab project where I have attached the tensorflow model and the associated code for conversion

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

SandeepAggarwal
  • 1,273
  • 3
  • 14
  • 38

1 Answers1

0

Have you checked that the version of Tensorflow your are using is compatible with those libraries? This is just a guess, but you could try running

!pip install tensorflow --upgrade

at the top of the notebook to see if it resolves the issue.

Matt L.
  • 3,431
  • 1
  • 15
  • 28