Пример #1
0
 def __init__(self, mode):
     print('Creating: {}'.format(cfg.dataset))
     self.name = cfg.data_dir
     self.mode = mode
     data_path = DatasetPath(mode, self.name)
     data_dir = data_path.get_data_dir()
     file_list = data_path.get_file_list()
     self.image_dir = data_dir
     self.gt_dir = file_list
Пример #2
0
 def __init__(self, mode):
     print('Creating: {}'.format(cfg.dataset))
     self.name = cfg.dataset
     self.is_train = mode == 'train'
     data_path = DatasetPath(mode)
     data_dir = data_path.get_data_dir()
     file_list = data_path.get_file_list()
     self.image_directory = data_dir
     self.COCO = COCO(file_list)
     # Set up dataset classes
     category_ids = self.COCO.getCatIds()
     categories = [c['name'] for c in self.COCO.loadCats(category_ids)]
     self.category_to_id_map = dict(zip(categories, category_ids))
     self.classes = ['__background__'] + categories
     self.num_classes = len(self.classes)
     self.json_category_id_to_contiguous_id = {
         v: i + 1
         for i, v in enumerate(self.COCO.getCatIds())
     }
     self.contiguous_category_id_to_json_id = {
         v: k
         for k, v in self.json_category_id_to_contiguous_id.items()
     }