how to convert json polygon annotation to yolov8 format

385 Views Asked by At

How can I convert the annotations of a solar panel dataset, which are currently in a JSON format, to be compatible with the YOLO model for use in my deep learning projects? The dataset includes both images and their corresponding annotations.

Here is an example of the JSON file annotations:

Please note that in this case, the ID refers to the name of the corresponding image.

[{
  "@type": "SurfaceResult",
  "id": "NDXQX3EBUEZNO",
  "polygons": [
    {
      "@type": "Polygon",
      "points": [
        {
          "@type": "Point",
          "x": 163,
          "y": 186
        },
        {
          "@type": "Point",
          "x": 162,
          "y": 193
        },
        {
          "@type": "Point",
          "x": 222,
          "y": 212
        },
        {
          "@type": "Point",
          "x": 227,
          "y": 209
        },
        {
          "@type": "Point",
          "x": 227,
          "y": 205
        },
        {
          "@type": "Point",
          "x": 166,
          "y": 184
        }
      ],
      "score": 3.5525435073627842,
      "area": 601.5
    }
  ]
},{
  "@type": "SurfaceResult",
  "id": "OSIBG1RDEDJ",
  "polygons": [
    {
      "@type": "Polygon",
      "points": [
        {
          "@type": "Point",
          "x": 294,
          "y": 112```



Is there a script available that can assist in converting the annotation into the *YOLOv8* format?
0

There are 0 best solutions below