<gh_stars>0
from pycocotools.coco import COCO


class CocoReader(COCO):
    def __init__(self, annotation_file=None):
        """
        Constructor of Microsoft COCO helper class for reading and visualizing annotations.
        :param annotation_file (str): location of annotation file
        :param image_folder (str): location to the folder that hosts images.
        :return:
        """
        # load dataset
        super().__init__(annotation_file)

    def get_scene_id(self, img_id):
        return self.imgs[img_id]['scene_id']


if __name__ == "__main__":
    coco_reader = CocoReader("/home/mikkel/workspace/pose_estimation/6DPoseAnnotator/enabled_validation_images_6d_pose_coco.json")
    img_ids = [0]
    ann_ids = coco_reader.getAnnIds(imgIds=img_ids)
    annotations = coco_reader.loadAnns(ids=ann_ids)
    print(ann_ids)
    print(annotations)
    print(coco_reader.loadImgs(0))






from pycocotools.coco import COCO


class CocoReader(COCO):
    def __init__(self, annotation_file=None):
        """
        Constructor of Microsoft COCO helper class for reading and visualizing annotations.
        :param annotation_file (str): location of annotation file
        :param image_folder (str): location to the folder that hosts images.
        :return:
        """
        # load dataset
        super().__init__(annotation_file)

    def get_scene_id(self, img_id):
        return self.imgs[img_id]['scene_id']


if __name__ == "__main__":
    coco_reader = CocoReader("/home/mikkel/workspace/pose_estimation/6DPoseAnnotator/enabled_validation_images_6d_pose_coco.json")
    img_ids = [0]
    ann_ids = coco_reader.getAnnIds(imgIds=img_ids)
    annotations = coco_reader.loadAnns(ids=ann_ids)
    print(ann_ids)
    print(annotations)
    print(coco_reader.loadImgs(0))
Constructor of Microsoft COCO helper class for reading and visualizing annotations.         :param annotation_file (str): location of annotation file         :param image_folder (str): location to the folder that hosts images.         :return: # load dataset