Datasets
Manage your DataGym.ai Datasets and their images with our Python API
Last updated
Was this helpful?
Manage your DataGym.ai Datasets and their images with our Python API
Last updated
Was this helpful?
The Dataset object in our Python API Wrapper is a representation of the Datasets you already know from DataGym. This object includes the Images that belongs to your DataGym Datasets. Datasets can be accessed through the Client object introduced in the page.
Before we look at the Dataset object in our Python API Wrapper, we first have to learn how to get the data from DataGym.ai. There are multiple ways to fetch Datasets from DataGym's backend.
get_datasets
returns all Datasets in a list.
get_dataset_by_name
returns a specific Dataset by its unique name
To create a new Dataset on DataGym.ai, you can use the create_dataset
method of the Client class. Therefore, you have to specify a Dataset name and an optional short description. In this example we use the owner ID of our Dummy Project.
create_dataset
returns the newly created Dataset
The create_images_from_urls
method of the Client class helps you to add Images to your Datasets. The methods requires a List of image URLs and a Dataset ID.
create_images_from_urls
returns a list of errors that may have occurred during the Image upload.
add_dataset
returns True
if connecting the Dataset was successful
The remove_dataset
method of the Client class allows you to remove a Dataset from a DataGym.ai Project. This method requires a Dataset ID and Project ID. Therefore, the example below fetches these objects before it executes the remove_dataset
method:
remove_dataset
returns True
if removing the Dataset was successful
Datasets in the Python API are modeled after DataGym's Datasets and, therefore, inherit the same attributes you already know from your DataGym.ai Datasets.
A Dataset can hold any number of images. To simplify the access to the respective Image objects, the Dataset object provides a variety of helper methods.
In some use-cases you might only be interested in a specific set of images. The get_images_by_name
method can reduce the effort of searching for these images.
get_images_by_name
returns a list of Images that match the search term
You can also use regular expressions to start a broader search and return only images that fit into a specific naming pattern. For example, let's get all satellite images from your project:
The add_dataset
method of the Client class enables you to . This method requires a respective Dataset ID and Project ID. Therefore, the example below fetches these objects before it executes the add_dataset
method:
As you can see, a Dataset object also contains a list of its images, which are represented as objects.