Upload images

Programatically upload images to datasets using the SDK

With a dataset created, images can be uploaded to it using the push() method. push() uses a list of paths to upload files:

dataset.push(["/path/to/1.jpg", "/path/to/2.jpg"])

To upload an entire folder of images, simply specify the path of the folder itself, and push() will find all files at all depths within this directory to be uploaded:

dataset.push(["/path/to/folder/1", "/path/to/folder/2"])

Additionally, if you want to preserve the local structure of your data, you can do so by adding the preserve_folders argument, which by default is False:

dataset.push(["/path/to/folder/1", "/path/to/folder/2"], preserve_folders=True)

If you're sorting images into separate folders within your dataset, this can be done by setting path to the name of the folder within the dataset.

dataset.push(["/path/to/1.jpg", "/path/to/2.jpg"], path="myfolder")

📘

Functionality of push()

The above functionality also applies to video files.