JSON Upload

Uploading images with a JSON file is the recommended solution if you need to add a large number of images.

In order to use the JSON format, the images that you want to add to the platform need to be reachable via a public URL. If that is not the case, you will find ways to upload images to a remote server by following the link below.

Now that all the images are publicly reachable, we need to tell Deepomatic Studio where to find the images, as well as adding any useful information associated with images. In what follows, we will consider the following image coming from the Open Images dataset.

Simple JSON

If what you want to do is simply to add the image in the platform, you just need to list all the images location in the JSON, as seen in the example below.

Simple upload json
{
"images": [
{
"location": "https://storage.googleapis.com/your-bucket/openimages/detection/images/train/000018acd19b4ad3.jpg",
"data":
{
"filename": "my image",
"source": "openimage dataset"
}
}
]
}

Each entry in the images list corresponds to an image and contains the following fields:

  • location: image URL

  • data: (optional) a dictionary in which you can add as many fields as you want. It will typically contain useful meta-data, such as: date, camera ID, etc.

Of course you can add multiple images at the same time: images is a list, so you may input as many as you want.

Tagging/classification JSON

If you want your images to be annotated when you add them to the platform, you can provide these annotations using the JSON format. In addition to the location and optional data fields, you will need to add the following fields to the images entries of your JSON file:

  • stage: (optional) stage of the image, either train, val. If not provided, it is set train by default.

  • annotated_regions: (optional) the list of annotations, each containing the following fields:

    • tags: the list of tags present on this region

    • region_type: always put Whole in this field, because the annotation concerns the whole image.

The difference between classification and tagging is that the classification can have only one tag per image while the tagging can have several.

If you want to add images with their annotations, you will have to add an additional tags field to the JSON. This is to check errors in the tags. Simply put, tags is a list of all possible tags for the images.

{
"tags": ["Statue", "Bike", "Plane", "Crystal"],
"images": [
{
"location": "https://storage.googleapis.com/dp-missions/openimages/detection/images/train/000018acd19b4ad3.jpg",
"stage": "train",
"annotated_regions": [
{
"tags": ["Statue", "Crystal"],
"region_type": "Whole"
}
]
}
]
}

If a tag is present in the JSON tags field but not on Deepomatic Studio, it will be automatically created. This can be helpful when you have to manually create a lot of tags.

Detection JSON

Finally, you can also add annotations specific to a bounding box, meaning a certain region of the image (represented in the image below).

If you upload the JSON below to the Deepomatic Studio platform on a detection dataset then you will see that both boxes are annotated.

Detection upload json
{
"tags": ["Statue", "Bike", "Plane", "Crystal"],
"images": [
{
"location": "https://storage.googleapis.com/dp-missions/openimages/detection/images/train/000018acd19b4ad3.jpg",
"stage": "train",
"annotated_regions": [
{
"tags": ["Statue"],
"region_type": "Box",
"region": {
"xmin": 0.485351562,
"xmax": 0.805664062,
"ymin": 0.121522694,
"ymax": 0.609077599
}
},
{
"tags": ["Crystal"],
"region_type": "Box",
"region": {
"xmin": 0.231445312,
"xmax": 0.706054688,
"ymin": 0.273792094,
"ymax": 0.775988287
}
}
]
}
]
}

This time, note that we've added a new field region composed of xmin, xmax, ymin and ymaxcorresponding to the normalized bounding box coordinates.