CVAT coco annotation json - iscrowd option

Viewed 1406

when outputting coco annotation json from CVAT, it is found that there is an attribute call 'iscrowd', but I cant seem to figure out how it is adjusted or annotated on CVAT to change the value to 1, under the scenario where the object is literally crowded. Can any one shed some lights?

{
  "annotations": [
    {
      "bbox": [
        762.703125,
        176.583984375,
        425.27301025390625,
        413.6938171386719
      ],
      "id": 1,
      "area": 175932.81493799202,
      "iscrowd": 0,
      "segmentation": [
        [
          762.703125,
          176.583984375,
          1187.9761352539062,
          176.583984375,
          1187.9761352539062,
          590.2778015136719,
          762.703125,
          590.2778015136719
        ]
      ],
      "category_id": 1,
      "image_id": 0
    }
  ],
  "licenses": [
    {
      "name": "",
      "id": 0,
      "url": ""
    }
  ],
  "info": {
    "version": "",
    "description": "",
    "date_created": "",
    "contributor": "",
    "year": "",
    "url": ""
  },
  "images": [
    {
      "file_name": "10.jpg",
      "id": 0,
      "license": 0,
      "flickr_url": "",
      "height": 864,
      "coco_url": "",
      "date_captured": 0,
      "width": 1536
    }
  ],
  "categories": [
    {
      "name": "test",
      "supercategory": "",
      "id": 1
    }
  ]
}

On the other hand when adding an attribute to a label (Simple Check Box Attribute), it doesn't seem to be properly outputted in COCO json. Am I doing something Wrong?

1 Answers

It might be worth taking a look at the integration between FiftyOne, an open source dataset exploration tool, and CVAT which provides a flexible API to upload and define how to annotate new and existing labels. This post pretty much walks through the workflow you are looking for.

You can load COCO formatted datasets into FiftyOne:

import fiftyone as fo

dataset = fo.Dataset.from_dir(
    dataset_dir="/path/to/dataset",
    dataset_type=fo.types.COCODetectionDataset,
    label_field="ground_truth",
)

Send the dataset (or a subset of it) to CVAT for annotation:

dataset.annotate("annot_run_1", label_field="ground_truth", backend="cvat")

It will automatically upload the annotations to CVAT, including formatting all attributes on your labels (like iscrowd) for you to edit in CVAT. The API for this integration also lets you specify new attributes and how they are to be annotated.

enter image description here

When you're done annotating, you can load it back into FiftyOne and write it back to disk in the COCO format.

# Load from CVAT
dataset.load_annotations("annot_run_1")

# Write back to disk
dataset.export(
    export_dir="/path/to/label.json",
    dataset_type=fo.types.COCODetectionDataset,
    label_field="ground_truth",
)
Related