2

This week Apple announced support for trained ML models.

How can one convert a trained Tensorflow model (Google Cloud Machine Learning Engine model in SavedModel format) into an Apple Core ML model (.mlmodel format)?

Chuck Finley
  • 250
  • 1
  • 10

2 Answers2

3

It depends what your TensorFlow model contains. The coremltools do not support TensorFlow so you'll have to write your own converter. But this will only work if your model only contains things that are supported by the mlmodel format. You can download the spec for this format from the coremltools web page. Since it's possible to build compute graphs of arbitrary complexity in TensorFlow, it's not surprising that coremltools currently does not support it (since mlmodel itself only supports a limited number of model types).

Matthijs Hollemans
  • 7,706
  • 2
  • 16
  • 23
  • 1
    Thank you for answering. Apple appears to support InceptionV3, so if one has merely retrained InceptionV3 (as per https://github.com/GoogleCloudPlatform/cloudml-samples/tree/master/flowers), you think a converter can be written, correct? – Chuck Finley Jun 11 '17 at 18:07
  • I'm sure it's possible to write a converter for (a retrained) Inception-v3, but it's hard to say how Apple converted their Inception -- did they use the coremltools or using some custom script? Who knows... – Matthijs Hollemans Jun 12 '17 at 08:43
  • @ChuckFinley did you make some progress? – gbhall Jul 15 '17 at 14:35
  • No, because of other priorities. The answer is to hire @MatthijsHollemans to write a converter. – Chuck Finley Jul 15 '17 at 21:10
0

You should use coremltools (python package).

Check out the WWDC Session 710 Video "Core ML In Depth"

Alex Brown
  • 41,819
  • 10
  • 94
  • 108