I'm running this out-of-the-box turi python code:

import turicreate as tc
# Load the data
data =  tc.SFrame('annotations.sframe')

# Make a train-test split
train_data, test_data = data.random_split(0.8)

# Create a model
model = tc.object_detector.create(train_data, model="darknet-yolo", max_iterations=1, verbose=True)

# Save predictions to an SArray
predictions = model.predict(test_data)

# Evaluate the model and save the results into a dictionary
metrics = model.evaluate(test_data)

# Save the model for later use in Turi Create
model.save('mymodel.model')

# Export for use in Core ML
model.export_coreml('MyCustomObjectDetector.mlmodel')

But on the last line I'm getting the error: model.export_coreml('MyCustomObjectDetector.mlmodel')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/amir/anaconda/envs/CowsVision/lib/python2.7/site-packages/turicreate/toolkits/object_detector/object_detector.py", line 1477, in export_coreml
    mlmodel = coremltools.models.MLModel(model)
  File "/Users/amir/anaconda/envs/CowsVision/lib/python2.7/site-packages/coremltools/models/model.py", line 209, in __init__
    self.__proxy__ = _get_proxy_from_spec(filename)
  File "/Users/amir/anaconda/envs/CowsVision/lib/python2.7/site-packages/coremltools/models/model.py", line 103, in _get_proxy_from_spec
    return _MLModelProxy(filename)
RuntimeError: Error compiling model: "Error reading protobuf spec. validator error: The .mlmodel supplied is of version 3, intended for a newer version of Xcode. This version of Xcode supports model version 2 or earlier.".
>>> 

In the console.

Does that mean that my local installed xcode version needs upgrade? Where is the .mlmodel version being determined? What's "this version of Xcode"?

1

There are 1 best solutions below

0
On

Per the comments above, I've downgraded to turicreate 4.0 version and the problem was solved for me. It looks like the most recent beta version (5.1) isn't working well.