Upload images via a text file

Import file format

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

In order to import images using a text file, those images need to be reachable via a public URL. If this is not the case, you need to find ways to upload images to a remote server or you can use Deepomatic command line interface.

If 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.

File structure

The text file contains a set of JSON objects:

  • the first object is a header allowing you to define the tree structure of the views composing your project

  • the other objects correspond to all the images you wish to import, one per image.

This structure allows the upload of very large quantities of data by streaming.

The header is a JSON object that allows you to define your views and the concepts attached to each of them. It is also in the header that you indicate the tree structure of your views, and how the child and parent views are linked together.

Header json
{
"name": "Bulk items",
"splits": [
"train",
"val"
],
"views": [
{
"concepts": [
{
"name": "With Item"
},
{
"name": "Without Item"
}
],
"type": "classification",
"name": "Item or not",
"conditions": []
},
{
"concepts": [
{
"name": "Item"
}
],
"type": "detection",
"name": "Item Detector",
"conditions": [
[
{
"name": "With Item"
}
]
]
},
{
"concepts": [
{
"name": "Glass"
},
{
"name": "Metal"
},
{
"name": "Wood"
}
],
"type": "classification",
"name": "Item material",
"conditions": [
[
{
"name": "Item"
}
]
]
}
]
}

Here are the fields you need to specify:

  • name : the name of your project

  • splits : a list which only supports train and val for now.

  • views : each entry in the views list defines a view and contains the following fields:

    • name : the name of your view

    • type : the type of your view among classification, tagging or detection (see the creation of views to know more)

    • concepts : each entry in the concepts list defines a concept and contains the following field:

      • name: the name of your concept.

    • conditions : a list of lists of concepts to specify AND and OR conditions. A list of concepts specifies a AND condition and the list of lists specifies OR conditions.

Concepts must be unique within a project. It is not possible to have several concepts with the same name in separate views.

The header in your file should be on a single line and will allow the platform to build all the views and all the concepts that you have specified, based on the conditions you have indicated.

Images

Each image you want to add to your project is a JSON object that must be written on a single line of your file.

Image
{
"id": null,
"data": [
{
"url": "https://storage.googleapis.com/dp-vesta-pre-prod/10-thibaut/3029/7a2681e4-15b7-48b2-98c7-6feada1eb3e5.jpg?Expires=1609523433&GoogleAccessId=vesta-pre-prod%40deepomatic-160015.iam.gserviceaccount.com&Signature=mBk6X9xyTLCqOYtb0uvC6r316kV5MpWEGV9c9xiOBK4y3zic3WIrpY5W13US3UCdfm5%2B%2FHFRlslueF7OaSlTv3JqqoAkIlH%2FIcRmAqudcHb4ydr2fGL%2FJkHbophvEBCMYPbCVFCRH5uFKmbWdet1K8qXDP8gtoc1spJ9RuKen3g%2FYJrAsOpGWiPVN3SM1cONxIDgjOQBsuKluYg2l0KLr2dLdnQftUwYrUoLQe0%2B1FUXBHLaI5Onm1B%2FcAMGAKBo6z7i2A4LEluH7luJhLu%2BtWMdKziN9OfPWrqy0dpq8f7ozHnhR9xf4ovqsT8HFSEEFOSNs%2FjsUft%2BmTIaytjPCw%3D%3D"
}
],
"metadata": "{}",
"annotations": [
{
"concepts": [
{
"name": "Glass",
"bool": true
},
{
"name": "Item",
"bool": true
}
],
"region": {
"bbox": {
"xmin": 0.14237532448083068,
"ymin": 0.2097216707202064,
"xmax": 0.7449424670527156,
"ymax": 0.9198461929815852
}
}
},
{
"concepts": [
{
"name": "With Item",
"bool": true
}
],
"region": {
"bbox": {
"xmin": 0.0,
"ymin": 0.0,
"xmax": 1.0,
"ymax": 1.0
}
}
}
],
"splits": [
"train"
]
}

Here are the fields you need to specify:

  • id : null

  • data : each entry in the data list is an object that contains the field url that you need to specify. You should for now add only one image per line of your text file.

  • metadata : a string of characters via which you can add metadata to your image as a dictionary. The metadata are displayed in the information popup on Studio.

Some data are automatically added to the platform: File name, Created, Creator and Last annotator are set automatically.

  • annotations: each entry in the annotations list corresponds to a region, with all the information attached to it:

    • concepts: the list of concepts attached to the region. You should not create an annotation for each view, but instead you need to combine the concepts from all the views required in a single annotation.

    • region: the actual region, described as a bounding box bbox, and the coordinates of this bounding box, xmin, ymin, xmax and ymax.

  • splits: a list of splits to which the image belongs. You should choose between train and val for now.

The difference between classification and tagging views is that for classification views, the annotation can only have one of the concept with bool field at True.

Upload & Progress Report

After dropping your text file and after it has been uploaded to the platform, a spinning wheel is displayed and you can see the number of images that has been added to the platform, giving you the progress of your upload.

After clicking on Start upload, you need to wait for the spinning wheel to start to leave or reload the page.