3

I am trying to create an SFrame containing images and bounding boxes' coordinates, in order to perform object detection using TuriCreate. I have created my own dataset by IBM Cloud Annotations, exported as CreateML format. When I run:

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

I get:

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

Which is not the format requested. It is confirmed running the code below:

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)

`I get:

ToolkitError: No "feature" column specified and no column with expected type "image" is found. "datasets" consists of columns with types: list, str.

I would like to know:

  1. Is it correct export data in CreateML format?
  2. Can I use SFrame.read_json() for reading this kind of data?
Simone
  • 4,800
  • 12
  • 30
  • 46

1 Answers1

2

You need to create an SFrame from your images folder and then join it to your annotations SFrame like:

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

Just make sure that your annotations each have a path that exactly matches the path in your imagesSFrame. Below is my csv format:

path, annotation,
imagesFolder/image1.png,[{'label': 'dog', 'coordinates': {'height': 118, 'width': 240, 'x': 155, 'y': 129}}]

print(imagesSFrame) will allow you to inspect what the path is inside your imagesSFrame

ryboo
  • 41
  • 3