Annotations

Upload annotations

Upload files

POST /api/dataset/1/upload/?annotation_set_id=3

payload {
    "files": binary data,
    "annotation_task": "Object detection,
    "folder_id": 2
}

Optional parameters: 
    annotation_set_id, annotation_task - without this parameters user simply uploads files
    folder_id - allow to add files in particular folder
POST /api/dataset/1/upload/?folder_id=2&annotation_set_id=3

payload {
    "local_files": ['/home/ubuntu/dataset/D1'],
    "annotation_task": "Object detection,
    "urls": ['http://...']
}

Optional parameters: 
    annotation_set_id, annotation_task - without this parameters user simply uploads files
    folder_id - allow to add files in particular folder
    local_files - list of pathes to local files/folders
    urls - list of links to archive/image/annotation files

Tags

Add tag to the image in paticular annotation set

POST /api/v1/ui/annotation-sets/32/images/562892/tags/

payload {“name”:“cat”}

Response: {
    "id":49,
    "name":"cat",
    "annotation_set":32,
    "image":562892
}

Remove tag from the image

DELETE /api/v1/ui/annotation-sets/32/images/562892/tags/48/

Classes

Create new class

Creates new class in common class list.

POST /api/common-class/

payload: {name: "New class name"}

Response: {
    "id":961,
    "name":"New class name"
}

Annotation set

Annotation sets can be one of this type: 1 - Object detection 2 - Instance segmentation 3 - Image classification

Create new annotation set

Creates new annotation set for given annotation task, dataset, and list of classes.

POST /api/v1/ui/annotation-sets/

payload: {
    "annotation_task": "Object detection",
    "classes":["Dog", "Cat", "Cow"],
    "dataset_id":"4",
    "name":"New annotation set name",
}

Response: {
    "id": 88,
    "name": "New annotation set name",
    "task": "Object detection",
    "dataset_id": 4,
    "classes":[
        {"id": 335, "name": "Cat"}, {"id": 1, "name": "Dog"}, {"id": 185, "name": "Cow"}
    ]
}


@deprecated
POST /api/annotation-set/

payload: {
    "task":3,
    "classes":[
        {"id":961,"name":"New class name"}
    ],
    "dataset":"4",
    "name":"New annotation set name",
    "type":"image"
}

Response: {
    "id":154,
    "name":"New annotation set name",
    "released_at":null,
    "updated_at":"2019-12-26T05:34:48.531184Z",
    "task":3,
    "dataset":4,
    "last_annotated_date":null,
    "classes":[
        {"id":961,"name":"New class name"}
    ],
    "is_last_modified":false,
    "type":"image",
    "is_public":false
}

Rename annotation set

PUT /api/v1/ui/annotation-sets/42/

payload: {"name": "New name"}

Response: {
    "id": 42,
    "name": "New name"
}

Add new class to annotation set

POST  /api/v1/ui/annotation-sets/1/classes/

payload: {"name": "new class name"}

Response: {
    "id": 123,
    "name": "New class name"
}

Rename class in annotation set

Renames existing class with id:2, to class with name 'Dog'

PUT /api/v1/ui/annotation-sets/1/classes/2/

payload: {"name": "Dog"}

Response: {"id":15, "name":"Dog"}

Delete class from annotation set

DELETE /api/v1/ui/annotation-sets/1/classes/2/

List tags in annotation set

GET /api/v1/ui/annotation-sets/1/tags/

Response: {
    "count":7,
    "next":null,
    "previous":null,
    "results":[
        {"id":4, "name":"food"},
        {"id":13, "name":"zero"},
        {"id":6, "name":"outside"},
        {"id":1, "name":"test"},
        {"id":2, "name":"cat"},
        {"id":8, "name":"one"},
        {"id":5, "name":"inhouse"}
    ]
}

Rename tag in annotation set

Renames existing tag with id:2, to tag with name 'Dog'

PUT /api/v1/ui/annotation-sets/1/tags/2/

payload: {"name": "Dog"}

Response: {"id":15, "name":"Dog"}

Delete tag from annotation set

DELETE /api/v1/ui/annotation-sets/1/tags/2/

Export annotations

Exports annotations in giving format

GET /api/v1/ui/annotation-sets/1/export/?annotation_format='json'&full_path='true'&export_coordinates='percent'

Parameters:
    annotation_format: can be one of ['json', 'coco', 'csv'], default='json'
    full_path: can be one of ['true', 'false'], default='false'
    export_coordinates: can be one of ['pixel', 'percent'], default='pixel'

List annotation sets

GET /api/v1/ui/datasets/4/annotation-sets/?limit=10

Response: { 
    "count":2,
    "next":null,
    "previous":null,
    "results":[ 
        { 
            "id":36,
            "name":"segmentation",
            "released_at":null,
            "updated_at":"2019-12-16T13:25:44.765252Z",
            "task":{ 
                "id":2, "name":"Instance segmentation", "type":"instance_segmentation"
            },
            "total_images":21,
            "last_annotated_date":"2019-12-16T13:25:44.765127Z",
            "is_public":false,
            "is_completed":false,
            "statistics":{ 
                "annotated_images_count":1,
                "top3_classes":[ 
                    {"name":"dog","count":2},
                    {"name":"Pizza","count":1}
                ],
                "total_classes":2,
                "total_annotation_objects":8
            }
        },
        { 
            "id":51,
            "name":"Andrea TEST",
            "released_at":null,
            "updated_at":"2019-12-17T14:36:37.687804Z",
            "task":{ 
                "id":1, "name":"Object detection", "type":"object_detection"
            },
            "total_images":21,
            "last_annotated_date":"2019-12-17T14:36:37.687692Z",
            "is_public":false,
            "is_completed":false,
            "statistics":{ 
                "annotated_images_count":1,
                "top3_classes":[ 
                    {"name":"long_class_name_very_longssss","count":5},
                    {"name":"dog","count":4}
                ],
                "total_classes":2,
                "total_annotation_objects":21
            }
        }
    ]
}

Images

Cache image

Caches image on backend, needed for deep zooming on annotation tool for high resolution images.

GET /api/v1/ui/images/1095611/cache/

Downsample image

Crop image starting from position (source_x, source_y) with width=source_width and height=source_height and downscale it by factor downscale=0.7

GET /api/v1/ui/images/1095614/downsample/?source_x=1000&source_y=2600&source_width=1100&source_height=1100&downscale=0.7

Response: image fragment

Datasets

List datasets

GET /api/v1/ui/datasets/?is_public=false&is_archived=false&limit=10
Parameters:
[optional]  is_public       (true | false)      - filters public/private datasets
[optional]  is_archived     (true | false)      - filters archived/active datasets
[optional]  limit           (positive integer)  - limits results number of datasets

Response: {
    "count":6,
    "next":null,
    "previous":null,
    "results":[
        {
            "id":3,
            "name":"Open Images V5",
            "owner":"Remo Admin",
            "is_archived":false,
            "image_thumbnails":[
                "http://image-url",
            ],
            "quantity":21619,
            "size_in_bytes":6714851753,
            "created_at":"2019-05-26T20:18:13.721502Z",
            "updated_at":"2019-12-27T07:14:14.596622Z",
            "license":null,
            "is_public":true,
            "is_readonly":false
        },
        ...
    ]
}

List dataset contents (folders and images)

GET /api/v1/ui/datasets/4/contents/?limit=25
Parameters:
[optional]  limit           (positive integer)  - limits results number

Response: {
    "count":15,
    "next":null,
    "previous":null,
    "results":[
        {
            "record_type":"folder",
            "image":null,
            "folder":{
                "id":5,
                "name":"Animal",
                "dataset_id":4,
                "updated_at":"2019-07-08T12:34:42.194147Z",
                "created_at":"2019-06-12T16:42:26.523835Z",
                "preview":null,
                "total_images":0,
                "top3_classes":[

                ],
                "total_classes":0
            }
        },
        ...
        {
            "record_type":"image",
            "image":{
                "id":541818,
                "preview":"http://image-url",
                "name":"00075905539074f2.jpg",
                "annotations":{
                    "coordinates":[
                        [
                            {"x":53.484314245188955, "y":97.74775543613383},
                            {"x":121.98408476261328,"y":179.40449686125507}
                        ],
                        [
                            {"x":53.484314245188955, "y":97.74775543613383},
                            {"x":121.98408476261328, "y":179.40449686125507}
                        ]
                    ],
                    "classes":[]
                },
                "dimensions":[1024, 914],
                "size_in_bytes":302326,
                "created_at":"2019-07-05T11:42:08.762268Z"
            },
            "folder":null
        },
        ...
    ]
}

List dataset contents in particular folder (folders and images)

GET /api/v1/ui/datasets/4/contents/6/?limit=25
Parameters:
[optional]  limit           (positive integer)  - limits results number

Response: {
    "count":2,
    "next":null,
    "previous":null,
    "results":[
        {
            "record_type":"image",
            "image":{
                "id":22901,
                "preview":"http://image-url",
                "name":"pinguin.jpg",
                "annotations":{
                    "coordinates":[
                        [
                            {"x":114.99758911132812, "y":59.9200325012207},
                            {"x":135.74884033203125, "y":77.88980865478516}
                        ],
                        [
                            {"x":114.99758911132812, "y":59.9200325012207},
                            {"x":135.74884033203125, "y":77.88980865478516}
                        ]
                    ],
                    "classes":[]
                },
                "dimensions":[299, 199],
                "size_in_bytes":15500,
                "created_at":"2019-06-17T11:25:57.568112Z"
            },
            "folder":null
        },
        {
            "record_type":"image",
            "image":{
                "id":22908,
                "preview":"http://image-url",
                "name":"kisspng-kowalski.png",
                "annotations":{
                    "coordinates":[
                        [
                            {"x":125.6457471472072,"y":211.28039022130292},
                            {"x":342.1559107022023, "y":382.2946010799859}
                        ],
                        [
                            {"x":125.6457471472072,"y":211.28039022130292},
                            {"x":342.1559107022023, "y":382.2946010799859}
                        ]
                    ],
                    "classes":[]
                },
                "dimensions":[1600, 1051],
                "size_in_bytes":1567852,
                "created_at":"2019-06-17T11:25:57.568112Z"
            },
            "folder":null
        }
    ]
}

TODO

GET /api/v1/ui/datasets/{}/images/
GET /api/v1/ui/datasets/{}/images/{}/annotations/
GET /api/user-dataset/{}/contents/{}/
GET /api/v1/ui/search/
GET /api/dataset/