如何创建与TuriCreate兼容的SFrame以进行对象检测任务

问题描述

我试图创建一个包含图像和边界框坐标的app_controllers: resource: ../../../src/Controller/HomeController.PHP type: annotation host: '{domain}' defaults: domain: '%domain%' requirements: domain: '%domain%|www.%domain%' ,以便使用SFrame执行对象检测。 我已经通过IBM Cloud Annotations创建了自己的数据集,并以TuriCreate格式导出。当我跑步时:

CreateML

我得到:

[{'label':'xyz'... | 8be1172e-44bb-4084-917f-db ....

这不是要求的格式。确认正在运行以下代码

usage_data = tc.SFrame.read_json("annotations.json")

我明白了:

data = tc.SFrame.read_json("annotations.json")

train_data,test_data = data.random_split(0.75)

model = tc.object_detector.create(train_data)

predictions = model.predict(test_data)

我想知道:

  1. 是否以ToolkitError: No "feature" column specified and no column with expected type "image" is found. "datasets" consists of columns with types: list,str. 格式正确导出数据?
  2. 我可以使用CreateML来读取此类数据吗?

解决方法

您需要从images文件夹创建一个SFrame,然后将其加入到注释SFrame中,例如:

index

只需确保每个注释的路径都与imagesSFrame中的路径完全匹配。下面是我的csv格式:

imagesSFrame = turicreate.image_analysis.load_images('imagesFolder/')
combinedSFrame = images.join(annotationsSFrame)

path,annotation,imagesFolder/image1.png,[{'label': 'dog','coordinates': {'height': 118,'width': 240,'x': 155,'y': 129}}] 将允许您检查imagesSFrame内部的路径