Upload Annotations

This part assume that you have already created a dataset with your images and attached it to an empty project.

Picsell.ia format

You may have downloaded the annotations from a project once and then deleted this project. But now you have to put it back on the platform and you don't know how to do this. Let us explain.

First you need to initialize a project using the SDK

from picsellia import Client
api_token = "your_API_token"
clt = Client(api_token)
project_token = "your_project_token"
clt.checkout_project(project_token)

Now you can load the json file containing the annotations you downloaded from Picsell.ia earlier and send it.

The file name of your picture must be the same as those in the annotations JSON, if it's not we will never be able to match the annotations with the file you uploaded again on the platform.

with open('annotations.json') as file:
annotations = json.loads(file)
clt.upload_annotations(annotations)

The upload can take some time, depending on how heavy your annotation JSON is, but once it is uploaded, you will be able to see your annotations in your project's dashboard just like you never erased it !

Other format

If you have done some image annotation on another platform (LabelImg, CVAT, VGGIA...) and you want to switch to Picsell.ia (thank you by the way) it's also possible ! You will juste have to tune your annotations a bit so they can be processed by our platform.

COCO format

In order for anyone to be able to convert their annotations to a mainstream format, we decided to go with the COCO format which is an industry standard.

annotations = {
"images": [
{
"id": int,
"width": int,
"height": int,
"file_name": str
},
],
"categories": [
{
"id": int,
"name": str
},
],
"annotations": [
{
"id": int,
"image_id": int,
"category_id": int,
"segmentation": [polygon],
"bbox": [x,y,width,height]
},
]
}

As you may have understand, every key is referring to a list of objects (list of images, list of categories, list of annotations), however we might clarify some points :

An annotation is referring to either one (1) Bounding Box of one polygon, if there are several shapes for the same image, there will be as much list item in the "annotations" list.

Even if there are either no polygons or bounding-boxes in an image, the keys "segmentation" and "bbox" must remain present and their value must be an empty list [ ].

The id's of the images must be in ascending order in the list and there must be no discontinuities such as (1,2,3,5,6...), that's because we use those id's as indexes for the images in the list so they must be continuous so we can link the annotations with the right images.

Now that your annotations are in the good format as above, it's time to send it to the platform. The important part as opposed to the Picsell.ia format is that you must specify the 'format' argument in the function so your annotations get parsed correctly.

First you have to initalize your project like you would do for the Picsell.ia format then do :

clt.upload_annotations(annotations,format='custom')

And that's it ! You will now be able to see all your annotations available in your project on the platform.

Issues

Even though you did manage to upload your annotations correctly (then you will see those in the Review section of your project), it might happen that you can't see the shapes of your annotations when opening it.

One of the main reason for this is that there are typos between the labels defined in your project and those in your annotation file.

For exemple if in your annotations file the categories are the following :

"categories": [
{
"id": 1,
"name": "Right Hand"
},
{
"id": 2,
"name": "Left Hand"
},
]

And the labels you defined during the project creation are : "right-hand", "left-hand"

They will not be recognize as the same things and the shapes of your previous annotations will never appear. Every label declared in a project is transformed to lower case so you will need to rename them to : "right hand", "left hand". You can do that in the project's settings. We also lowercase the categories in your annotation JSON so now the labels should match !