Getting Started

Manage your Projects and data with Python


You can use our Python API Wrapper to easily access and manage your Projects, Datasets, Images and labeled data from your own Python projects or Jupyter Notebooks. This documentation will guide you through the installation process and provides you with some common use cases.

Latest Release: v0.2 on April 6, 2020.

Upgrade your datagym package with pip install --upgrade datagym


Python Version: Ensure you have one of the following Python versions installed - Python 3.6, 3.7, 3.8

DataGym Account: If you haven't got a DataGym account yet, please Sign Up

Initial Project: Setup your first Project and/or label some images in your Dummy Project

API Token: In order to access your Dummy Project via our Python API you need to create an API Token

After finishing the initial preparations as described above, we have our first Dummy Project and some labeled images to work with in this tutorial. Feel free to mix in some of your own Projects and labeled data if you already used DataGym.

Step 1: Package Installation

The DataGym Python API can easily be installed from the Python Package Index (PyPI) via pip. Therefore, you only have to execute the following command on your machine:

user@machine:~$ pip install datagym

Step 2: Create a Client

In order to connect to your Projects you have to import and initialize the API Client from the datagym package. Just put in your API Key into the Client and you're good to go!

from datagym import Client
client = Client(api_key="<YOUR_API_KEY>")

The Client object is the gateway to the data from your DataGym account. You can use the Client to get your Projects, Datasets, Images, and labeled data.

Step 3: Fetch your Projects

You can fetch all your Projects including their connected Datasets in a single line.

projects = client.get_projects()

This may raise an API Exception with the Message: ´Forbidden.´. If you see see this error, please sign into your DataGym account and check if your API Token is valid.

Use-Case: If you want to inspect your Projects you can simply write a little script to print a report.

for project in projects:
print(f'{"Project:":<15} {}')
print(f'{"Description:":<15} {project.short_description}')
print(f'{"Datasets:":<15} {len(project.datasets)}')
for dataset in project.datasets:
print(f'{"Dataset:":<15} {}')
print(f'{"Description:":<15} {dataset.short_description}')
print(f'{"Images:":<15} {len(dataset.images)}')

Your output could look like this:

Project: Cats
Description: Labeling Cats Task
Datasets: 1
Dataset: Cats from Pixabay
Description: Just too many cats
Images: 2330
Project: Dummy_Project
Description: A project that helps to track cars from an arial drone
Datasets: 1
Dataset: Dummy_Dataset_One
Description: None
Images: 10

That's it, now you are connected to your DataGym account. You can use the Client to easily access your labeled data, Projects, Datasets, and images. Follow the next pages of this documentation to explore the possibilities of DataGym's Python API!

Visit and copy our Jupyter Notebooks to get a comprehensive overview of the functionality.