Label-studio: How to import predictions ?

Created on 9 Apr 2021  路  2Comments  路  Source: heartexlabs/label-studio

I have thousands of JPEG images in the Azure cloud. I linked them to Label Studio as a Source Storage, I turned the option "Treat every bucket object as a source file" for that. I can see all my images in Label Studio.

Here is the source for task 80960 when I click on "show task source" :

{
  "id": 80960,
  "data": {
    "image": "https://xxx.blob.core.windows.net/container/folder/im-1.jpg?se=2021-04-07T09%3A45%3A08Z&sp=rt&sv=2020-06-12&sr=b&sig=L56aMlD21DwfSFxBYFdmvz%2DqBMdUHX2%2BYoMjeHio%2BzI%3D"
  },
  "annotations": [],
  "predictions": []
}

Now I want to upload predictions (stored locally) but I don't know what to put in the "data" field.

My question is : how should I import my predictions ? Should I upload a JSON in the Basic Label Studio JSON format with the data field matching exactly this URL ? That's what I tried to do :

curl -X GET http://xxx.com/api/projects/1/tasks/

To get all the URLs of the image field in data.
It returns a list of these objects

{
  "id": 80960,
  "data": {
    "image": "azure-blob://container/folder/im-1.jpg"
  },
  "meta": {},
  "created_at": "2021-04-08T18:10:57.993767Z",
  "updated_at": "2021-04-08T18:10:57.993795Z",
  "is_labeled": false,
  "overlap": 1,
  "project": 1,
  "file_upload": null,
  "annotations": []
}

I tried to upload a JSON with azure-blob://container/dir/im-1.jpg as the URL like this :

[
  {
    "data": {
      "image": "azure-blob://container/dir/im-1.jpg"
    },
    "predictions": [
      {
        "result": [
          {"from_name": "...",}
        ]
      }
    ]
  }
]

but it doesn't work. It creates a new task with the raw azure-blob:// URL that can't connect to the cloud :

Cannot load image (azure-blob://container/dir/im-1.jpg). Check console/network panel for more info.
Image Preannotations bug

All 2 comments

We have implemented predictions import from storages recently and it isn't included into release 1.0.1 yet. So, you have 2 tracks to solve it:

  1. Patch tasks via api
  2. Use branch with the prediction import:
    https://github.com/heartexlabs/label-studio/pull/767

For (2) you need to save json files into your storage using the LS common format.

Thanks, #767 worked perfectly !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kgeis picture kgeis  路  4Comments

andreaferretti picture andreaferretti  路  6Comments

vkovac2 picture vkovac2  路  6Comments

fakyras picture fakyras  路  3Comments

p-sodmann picture p-sodmann  路  3Comments