def _filter_imgs(self, min_size=32):
    'Filter images too small or without ground truths.'
    valid_inds = []
    ids_with_ann = set((_['image_id'] for _ in self.coco.anns.values()))
    ids_in_cat = set()
    for (i, class_id) in enumerate(self.cat_ids):
        ids_in_cat |= set(self.coco.cat_img_map[class_id])
    ids_in_cat &= ids_with_ann
    valid_img_ids = []
    for (i, img_info) in enumerate(self.data_infos):
        img_id = self.img_ids[i]
        if (self.filter_empty_gt and (img_id not in ids_in_cat)):
            continue
        if (min(img_info['width'], img_info['height']) >= min_size):
            valid_inds.append(i)
            valid_img_ids.append(img_id)
    self.img_ids = valid_img_ids
    return valid_inds
Filter images too small or without ground truths.
def _filter_imgs(self, min_size=32):
    
    valid_inds = []
    ids_with_ann = set((_['image_id'] for _ in self.coco.anns.values()))
    ids_in_cat = set()
    for (i, class_id) in enumerate(self.cat_ids):
        ids_in_cat |= set(self.coco.cat_img_map[class_id])
    ids_in_cat &= ids_with_ann
    valid_img_ids = []
    for (i, img_info) in enumerate(self.data_infos):
        img_id = self.img_ids[i]
        if (self.filter_empty_gt and (img_id not in ids_in_cat)):
            continue
        if (min(img_info['width'], img_info['height']) >= min_size):
            valid_inds.append(i)
            valid_img_ids.append(img_id)
    self.img_ids = valid_img_ids
    return valid_inds