0

我正在运行这个开箱即用的 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”?

4

1 回答 1

0

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

于 2018-06-20T02:29:54.390 回答