Skip to main content

Create annotations

Tator is designed to manage large numbers of annotations. For dense tracking algorithms, this can equate to multiple localizations per frame, and tens of thousands of localizations per video. Tator-py includes utilities for chunked creation of large numbers of annotations. First we must create a list of dictionaries conforming to the schema specified for LocalizationSpec or StateSpec, then we use the chunked_create utility:

import tator
api = tator.get_api('', TOKEN)
spec = [{
'media_id': MEDIA_ID,
'frame': FRAME_NUMBER,
'x': 0.0,
'y': 0.0,
'width': 0.5,
'height': 0.5,
# Add user-defined attributes here
# Insert many more localizations here
created_ids = []
for response in tator.util.chunked_create(api.create_localization_list, PROJECT_ID,
created_ids +=
print(f"Created {len(created_ids)} localizations!")

The utility will do multiple requests, creating localizations in batches of 500, the maximum number of localizations that can be created in a single request. For states, the call to chunked_create is only slightly different. Starting from a list of state specs:

created_ids = []
for response in tator.util.chunked_create(api.create_state_list, PROJECT_ID,
created_ids +=
print(f"Created {len(created_ids)} states!")