To convert our model from Keras or TensorFlow, another tool is needed—tf-coreml (https://github.com/tf-coreml/tf-coreml).
At the time of writing, tf-coreml is not compatible with TensorFlow 2. We have provided a modified version while the library's developers are updating it. Refer to the chapter's notebook for the latest installation instructions.
We can then convert our model to .mlmodel:
import tfcoreml as tf_converter
tf_converter.convert('frozen_model.pb',
'mobilenet.mlmodel',
class_labels=EMOTIONS,
image_input_names=['input_0:0'],
output_feature_names=[output_node_name + ':0'],
red_bias=-1,
green_bias=-1,
blue_bias=-1,
image_scale=1/127.5,
is_bgr=False)
A few arguments are important:
- class_labels: The list...