错误阅读protobuf规范。验证器错误:。提供的mlmodel版本为3,适用于较新版本的xcode

时间:2018-06-16 13:36:12

标签: python xcode coreml turi

我正在运行这个开箱即用的turi python代码:

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')

但是在最后一行我得到了错误: 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.".
>>> 

在控制台中。

这是否意味着我本地安装的xcode版本需要升级? .mlmodel版本在哪里确定?什么是“这个版本的Xcode”?

1 个答案:

答案 0 :(得分:0)

根据以上评论,我已降级为turicreate 4.0版本,该问题已为我解决。看来最新的Beta版本(5.1)运行不正常。