Ways to Create a Dataset (Vision)
There are three different API calls you can use to create a dataset. The first two APIs create a dataset from a .zip file.
See Create a Dataset and Upload Images Asynchronously From a Zip File.
This call creates a dataset, labels, and examples from a .zip file in a single asynchronous operation.
- This API call returns a response in which the
available
value isfalse
and thestatusMsg
value isUPLOADING
. - After you make the call, use the call to Get a Dataset and check the
available
andstatusMsg
values. - When
available
istrue
andstatusMsg
isSUCCEEDED
, all the data has been uploaded from the .zip file, and you can train the dataset to create a model.
Use this call when you have a .zip file that’s 10 MB or larger. If your .zip file is more than 20 MB, for better performance, we recommend that you upload it to a cloud location that doesn't require authentication and pass in the URL.
See Create a Dataset and Upload Images Synchronously From a Zip File.
This call creates a dataset, labels, and examples from a .zip file in a single synchronous operation.
- The response is returned only after the call completes.
- The
available
andstatusMsg
fields in the response indicate whether the call was successful. Ifavailable
istrue
andstatusMsg
isSUCCEEDED
, all the data has been uploaded from the .zip file, and you can train the dataset to create a model.
Use this call when you have a .zip file that’s less than 10 MB.
How Datasets are Created From a Zip File
When you create an image or multi-label dataset from a .zip file, the API uses the structure of the .zip file.
- The dataset name is the name of the .zip file minus the file extension.
- A label is created for each directory that contains images, and the label name is the same as the directory name.
- An example is created for each image, and the example name is the same as the file name.
The .zip file can be on a local drive or accessible from a cloud location that doesn’t require authentication. You can add images to a dataset created from a .zip file only by using the Create Examples From a Zip File call.
This call creates an empty dataset and labels. To create examples in a dataset that you create using this call, you must use the Create an Example call to add the images individually. You can create only an image or multi-label dataset using this call.
After you create this type of dataset, you can only add images individually, you can’t add examples to the dataset from a .zip file. Therefore, we recommend that you create a dataset from a .zip file using either the asynchronous or synchronous call, depending on the amount of data.