Skip to main content

Create a project with python

This tutorial will show you how to create a new project using tator-py. The project metadata will be configured for video object detection, and our bounding boxes will only have one attribute: a string indicating the classification label. This project will be suitable for following most of the media management, custom metadata, and annotation tutorials.

First make sure you have installed tator-py:

pip install tator

Create an organization, then create a project under that organization:

import tator
api = tator.get_api(host='https://cloud.tator.io', token=MY_TOKEN)

# Create the organization.
organization = {'name': 'My Company'}
response = api.create_organization(organization_spec=organization)
print(response.message)
organization_id = response.id

# Create the project.
project = {'name': 'Demo Project',
'summary': 'A project created with tator-py.',
'organization': response.id}
response = api.create_project(project_spec=project)
print(response.message)
project_id = response.id

Now we will create a video type. This will allow us to upload videos to the project:

media_type = {'name': 'Demo Videos',
'description': 'A video type created with tator-py.',
'dtype': 'video'}
response = api.create_media_type(project_id, media_type_spec=media_type)
print(response.message)
media_type_id = response.id

Finally we will create a box type. This will allow us to draw boxes in the annotation view and set classification labels.

localization_type = {'name': 'Demo Boxes',
'description': 'A box type created with tator-py.',
'dtype': 'box',
'media_types': [media_type_id],
'attribute_types': [
{
'name': 'Label',
'dtype': 'string',
'order': 0,
}
]}
response = api.create_localization_type(project_id, localization_type_spec=localization_type)
print(response.message)
localization_type_id = response.id

Now if you log in to the web interface you will see the project you just created.