# COCO Dataset format

Hasty allows you to export your project in the very well-known COCO dataset format. You can find more information about this format [here](http://cocodataset.org/#format-data).

{% hint style="info" %}
Please note that the main COCO project has tasks for object and keypoint detection, panoptic and stuff segmentation, densepose, and image captioning.\
There are external extensions that include things like attributes, but it is not in the standard one. So, when exporting your project in the COCO format you will not get any attribute data.
{% endhint %}

### **COCO Masks Decoding Python Example** <a href="#strong-coco-masks-decoding-python-example-strong-code-br-code" id="strong-coco-masks-decoding-python-example-strong-code-br-code"></a>

```python
#Decode binary masks encoded via RLE.
from pycocotools.mask import decode

ann = {
    "id": 0,
    "image_id": 53,
    "category_id": 1,
    "segmentation": {
    "size": [ 
    2211,
    2097
    ],
    "counts": "WRQR14oT20K?D5M0O7I6K3M005K3M004L0N4N001O02N001N2O0001O2N00001O02N0000N3O0000002N00001O000O1O1000000000001O00000N20000000O01000000000000N2000O10O1000N20O10000N200000O01000000N11000000000000N20000000000O3N00001O2N001O0N3O002M2O002M3L7J101H>A_SbS3"
    },  
    "area": 6718,
    "bbox": [
    504,
    842,
    117,
    75
    ],
    "iscrowd": 0
}

mask = decode(ann["segmentation"])
```

### **The Annotation Object (“ann”)** <a href="#strong-the-annotation-object-ann-strong" id="strong-the-annotation-object-ann-strong"></a>

#### **Attributes** <a href="#strong-attributes-strong" id="strong-attributes-strong"></a>

**id (**&#x73;tring)\
The annotation ID

**image\_id (**&#x69;nteger)\
The ID of the image

**category\_id** (integer)\
The ID of the category of the object instance

**segmentation**

* **size (**&#x6C;ist of integers)\
  Height and width of the image
* **counts (**&#x73;tring)\
  An RLE-encoded binary mask of an object instance

**area** (float)\
The total area of the encoded mask in squared pixels

**bbox (**&#x6C;ist of integers)\
List of bounding box values

**iscrowd (**&#x62;oolean)\
Indicates if the ground truth (gt) object is marked as a crowd region (1) or not (0). If it is, then the predicted bounded box can match any subregion of the ground truth. Currently, Hasty does not provide an option to mark objects as iscrowd, so the value will be set as 0

{% hint style="info" %}
In image annotation, crowd regions are areas in the image where multiple instances overlap and it is hard to differentiate individual objects.

As of today, Hasty does not have functionality to mark crowded regions in app.
{% endhint %}

You can learn more about **pycocotools** Python package in the [documentation](https://github.com/ppwwyyxx/cocoapi/tree/master/PythonAPI/pycocotools).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudfactory.com/export-formats/coco-dataset-format.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
