HumanSignal / label-studio-sdk

Label Studio SDK
https://api.labelstud.io
Apache License 2.0
89 stars 58 forks source link

[BUG] Issue getting annotations with the sdk #195

Open efcy opened 6 months ago

efcy commented 6 months ago

Running

dict_task = my_project.get_task(123)
print(dict_task)

gives me the following dict. Notice that the value of annotations_results is a string. It should be a list of dicts. I cant easily convert it because the keys inside the dict there don't have quotes. I think something is wrong on the sdk end. If I am doing something wrong here please give me a hint on how to proceed.

{
   "id":123,
   "predictions":[

   ],
   "annotations":[
      {
         "id":23,
         "created_username":" email, 1",
         "created_ago":"50\\xa0minutes",
         "completed_by":{
            "id":1,
            "first_name":"",
            "last_name":"",
            "avatar":"None",
            "email":"email",
            "initials":"st"
         },
         "result":[
            {
               "id":"Xm01aKoKq_",
               "type":"rectanglelabels",
               "value":{
                  "x":24.429657794676807,
                  "y":26.61596958174905,
                  "width":14.068441064638783,
                  "height":17.49049429657795,
                  "rotation":0,
                  "rectanglelabels":[
                     "ball"
                  ]
               },
               "origin":"manual",
               "to_name":"image",
               "from_name":"label",
               "image_rotation":0,
               "original_width":640,
               "original_height":480
            }
         ],
         "was_cancelled":false,
         "ground_truth":false,
         "created_at":"2024-03-12T19:46:33.835626Z",
         "updated_at":"2024-03-12T19:46:33.835636Z",
         "draft_created_at":"None",
         "lead_time":5.427,
         "import_id":"None",
         "last_action":"None",
         "task":1490,
         "project":21,
         "updated_by":1,
         "parent_prediction":"None",
         "parent_annotation":"None",
         "last_created_by":"None"
      }
   ],
   "drafts":[

   ],
   "annotators":[
      1
   ],
   "inner_id":2,
   "cancelled_annotations":0,
   "total_annotations":1,
   "total_predictions":0,
   "completed_at":"2024-03-12T19:46:33.835626Z",
   "annotations_results":"[{id:Xm01aKoKq_, type:rectanglelabels, value:{x:24.43, y:26.62, width:14.07, height:17.49, rotation:0, rectanglelabels:[ball]}, origin:manual, to_name:image, from_name:label, image_rotation:0, original_width:640, original_height:480}]",
   "predictions_results":"",
   "predictions_score":"None",
   "file_upload":"None",
   "storage_filename":"0005584.png",
   "annotations_ids":"23",
   "predictions_model_versions":"",
   "avg_lead_time":5.427,
   "draft_exists":false,
   "updated_by":[
      {
         "user_id":1
      }
   ],
   "data":{
      "image":"<myurl>/tasks/123/presign/?fileuri=czM6Ly9kZ3Bzd2dhemdkandhbXNsdGZhdXp1LzAwMDU1ODQucG5n"
   },
   "meta":{

   },
   "created_at":"2024-03-12T19:46:04.287715Z",
   "updated_at":"2024-03-12T19:46:33.927086Z",
   "is_labeled":true,
   "overlap":1,
   "comment_count":0,
   "unresolved_comment_count":0,
   "last_comment_updated_at":"None",
   "project":21,
   "comment_authors":[

   ]
}