Importing Video Pre-Annotations

What is the format for video preannotations? I have frames labelled locally, how can I compile this to import as video annotations into label studios?

To import video preannotations into Label Studio, you need to format your data in the Label Studio JSON format. Here’s how you can compile your locally labeled frames into the required format:

  1. Labeling Configuration:
    Ensure your labeling configuration in Label Studio is set up for video annotation. For example:
   <View>
     <Video name="video" value="$video" framerate="25.0"/>
     <VideoRectangle name="box" toName="video" />
     <Labels name="videoLabels" toName="video" allowEmpty="true">
       <Label value="Object1" background="blue"/>
       <Label value="Object2" background="red"/>
     </Labels>
   </View>
  1. JSON Format for Preannotations:
    Your JSON file should include the video URL and the preannotations. Here’s an example structure:
{
 "data": {
   "video": "https://example.com/path/to/your/video.mp4"
 },
 "predictions": [
    {
     "model_version": "v1",
     "result": [
       {
          "id": "N-9HJ5jjVS",
          "type": "videorectangle",
          "value": {
            "labels": [
              "Man"
            ],
            "duration": 61.391021,
            "sequence": [
              {
                "x": 15.449804432855279,
                "y": 36.324786324786324,
                "time": 0.04,
                "frame": 1,
                "width": 13.820078226857888,
                "height": 19.23801245835144,
                "enabled": true,
                "rotation": 0
              },
              {
                "x": 27.70534550195567,
                "y": 33.77517021584817,
                "time": 0.48,
                "frame": 12,
                "width": 13.820078226857884,
                "height": 19.238012458351434,
                "enabled": true,
                "rotation": 0
              }
            ],
            "framesCount": 1535
          },
          "origin": "manual",
          "to_name": "video",
          "from_name": "box"
        }
      ]
    }
  ]
}
  1. Key Elements:
    • data: Contains the video URL.
    • predictions: An array of prediction objects.
    • result: An array of regions, there is only one region (bbox) that contains a sequence of frames.
    • value: Contains the label name of the bbox.
    • sequence: Contains the coordinates, dimensions, time and frame number for each frame.
  2. Importing Preannotations:
    • Go to your Label Studio project.
    • Navigate to the Data Manager and select Import.
    • Upload your JSON file.

For more details, you can refer to the Label Studio documentation on preannotations. If you have any specific questions or need further assistance, feel free to ask!