Annotation Classes#

SAClient.create_annotation_class(project, name, color, attribute_groups=None, class_type='object')#

Create annotation class in project

Parameters:
  • project (str) – project name

  • name (str) – name for the class

  • color (str) – RGB hex color value, e.g., “#F9E0FA”

  • attribute_groups (list of dicts) –

    list of attribute group dicts. The values for the “group_type” key are

    * radio
    * checklist
    * checklist
    * text
    * numeric
    * ocr
    

    ocr and group_type keys are only available for Vector projects. Mandatory keys for each attribute group are:

    - "name"
    

  • class_type (str) – class type. Should be either “object” or “tag”. Document project type can also have “relationship” type of classes.

Returns:

new class metadata

Return type:

dict

Request Example:

attributes_list = [
    {
        "group_type": "radio",
        "name": "Vehicle",
        "attributes": [
           {
               "name": "Car"
           },
           {
               "name": "Track"
           },
           {
               "name": "Bus"
           }
       ],
       "default_value": "Car"
   },
   {
       "group_type": "checklist",
       "name": "Color",
       "attributes": [
           {
               "name": "Yellow"
           },
           {
               "name": "Black"
           },
           {
               "name": "White"
           }
       ],
       "default_value": ["Yellow", "White"]
   },
   {
       "group_type": "text",
       "name": "Timestamp"
   },
   {
       "group_type": "numeric",
       "name": "Description"
   }
]
client.create_annotation_class(
   project="Image Project",
   name="Example Class",
   color="#F9E0FA",
   attribute_groups=attributes_list
)
SAClient.create_annotation_classes_from_classes_json(project, classes_json, from_s3_bucket=False)#

Creates annotation classes in project from a SuperAnnotate format annotation classes.json.

Parameters:
  • project (str) – project name

  • classes_json (list or Path-like (str or Path)) – JSON itself or path to the JSON file

  • from_s3_bucket (str) – AWS S3 bucket to use. If None then classes_json is in local filesystem

Returns:

list of created annotation class metadatas

Return type:

list of dicts

SAClient.search_annotation_classes(project, name_contains=None)#

Searches annotation classes by name_prefix (case-insensitive)

Parameters:
  • project (str) – project name

  • name_contains (str) – search string. Returns those classes, where the given string is found anywhere within its name. If None, all annotation classes will be returned.

Returns:

annotation classes of the project

Return type:

list of dicts

SAClient.download_annotation_classes_json(project, folder)#

Downloads project classes.json to folder

Parameters:
  • project (str) – project name

  • folder (Path-like (str or Path)) – folder to download to

Returns:

path of the download file

Return type:

str

SAClient.delete_annotation_class(project, annotation_class)#

Deletes annotation class from project

Parameters:
  • project (str) – project name

  • annotation_class (str or dict) – annotation class name or metadata