def to_anno_dict(self):
        """Returns a COCO annotation dictionary representation of the object.

        Returns:
            a COCO annotation dict
        """
        d = {
            "id": self.id,
            "image_id": self.image_id,
            "category_id": self.category_id,
        }

        if self.bbox is not None:
            d["bbox"] = self.bbox

        if self.keypoints is not None:
            d["keypoints"] = self.keypoints
            d["num_keypoints"] = len(self.keypoints) // 3

        if self.segmentation is not None:
            d["segmentation"] = self.segmentation

        if self.score is not None:
            d["score"] = self.score

        if self.area is not None:
            d["area"] = self.area

        if self.iscrowd is not None:
            d["iscrowd"] = self.iscrowd

        if self.attributes:
            d.update(self.attributes)

        return d
Returns a COCO annotation dictionary representation of the object.

        Returns:
            a COCO annotation dict
        
fiftyone/utils/coco.py