Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 1.11 KB

Usage.md

File metadata and controls

21 lines (16 loc) · 1.11 KB

Usage

To convert models trained/saved via TensorFlow 1, first export them into the frozen graph def format, which is a protobuf file format with .pb as the extension. Frozen .pb files can be obtained by using TensorFlow's tensorflow.python.tools.freeze_graph utility.

This Jupyter notebook shows how to freeze a graph to produce a .pb file.

There are several other Jupyter notebook examples for conversion here.

import tfcoreml

tfcoreml.convert(tf_model_path='my_model.pb',
                 mlmodel_path='my_model.mlmodel',
                 output_feature_names=['softmax:0'],  # name of the output tensor (appended by ":0")
                 input_name_shape_dict={'input:0': [1, 227, 227, 3]},  # map from input tensor name (placeholder op in the graph) to shape
                 minimum_ios_deployment_target='12') # one of ['12', '11.2']