def __init__(self, root='', split_id=0, **kwargs): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.data_dir = osp.join(self.dataset_dir, 'i-LIDS-VID') self.split_dir = osp.join(self.dataset_dir, 'train-test people splits') self.split_mat_path = osp.join(self.split_dir, 'train_test_splits_ilidsvid.mat') self.split_path = osp.join(self.dataset_dir, 'splits.json') self.cam_1_path = osp.join(self.dataset_dir, 'i-LIDS-VID/sequences/cam1') self.cam_2_path = osp.join(self.dataset_dir, 'i-LIDS-VID/sequences/cam2') required_files = [self.dataset_dir, self.data_dir, self.split_dir] self.check_before_run(required_files) self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError( 'split_id exceeds range, received {}, but expected between 0 and {}' .format(split_id, len(splits) - 1)) split = splits[split_id] train_dirs, test_dirs = split['train'], split['test'] train = self.process_data(train_dirs, cam1=True, cam2=True) query = self.process_data(test_dirs, cam1=True, cam2=False) gallery = self.process_data(test_dirs, cam1=False, cam2=True) super(iLIDSVID, self).__init__(train, query, gallery, **kwargs)
def __init__(self, root='', split_id=0, **kwargs): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.zip_path = osp.join(self.dataset_dir, 'CUHK01.zip') self.campus_dir = osp.join(self.dataset_dir, 'campus') self.split_path = osp.join(self.dataset_dir, 'splits.json') self.extract_file() required_files = [self.dataset_dir, self.campus_dir] self.check_before_run(required_files) self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError( 'split_id exceeds range, received {}, but expected between 0 and {}' .format(split_id, len(splits) - 1)) split = splits[split_id] train = split['train'] query = split['query'] gallery = split['gallery'] train = [tuple(item + ['cuhk01'] + [item[1]]) for item in train] query = [tuple(item + ['cuhk01'] + [item[1]]) for item in query] gallery = [tuple(item + ['cuhk01'] + [item[1]]) for item in gallery] super(CUHK01, self).__init__(train, query, gallery, **kwargs)
def __init__(self, datasets_root, relabel=True, combineall=False, split_id=0): self.root = datasets_root self.relabel = relabel self.combineall = combineall self.dataset_dir = osp.join(self.root, self.dataset_dir) self.zip_path = osp.join(self.dataset_dir, 'CUHK01.zip') self.campus_dir = osp.join(self.dataset_dir, 'campus') self.split_path = osp.join(self.dataset_dir, 'splits.json') self.extract_file() self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError( 'split_id exceeds range, received {}, but expected between 0 and {}' .format(split_id, len(splits) - 1)) split = splits[split_id] train = split['train'] query = split['query'] gallery = split['gallery'] train = [tuple(item + ['cuhk01'] + [item[1]]) for item in train] query = [tuple(item + ['cuhk01'] + [item[1]]) for item in query] gallery = [tuple(item + ['cuhk01'] + [item[1]]) for item in gallery] self.train, self.query, self.gallery = train, query, gallery self._show_info(self.train, self.query, self.gallery)
def __init__(self, root='', split_id=0, **kwargs): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.cam_a_dir = osp.join( self.dataset_dir, 'prid_2011', 'single_shot', 'cam_a' ) self.cam_b_dir = osp.join( self.dataset_dir, 'prid_2011', 'single_shot', 'cam_b' ) self.split_path = osp.join(self.dataset_dir, 'splits_single_shot.json') required_files = [self.dataset_dir, self.cam_a_dir, self.cam_b_dir] self.check_before_run(required_files) self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError( 'split_id exceeds range, received {}, but expected between 0 and {}' .format(split_id, len(splits) - 1) ) split = splits[split_id] train, query, gallery = self.process_split(split) super(PRID, self).__init__(train, query, gallery, **kwargs)
def __init__(self, datasets_root, relabel=True, combineall=False, split_id=0): self.dataset_dir = osp.join(datasets_root, self.dataset_dir) self.probe_path = osp.join(self.dataset_dir, 'underground_reid', 'probe') self.gallery_path = osp.join(self.dataset_dir, 'underground_reid', 'gallery') self.split_mat_path = osp.join(self.dataset_dir, 'underground_reid', 'features_and_partitions.mat') self.split_path = osp.join(self.dataset_dir, 'splits.json') self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError('split_id exceeds range, received {}, ' 'but expected between 0 and {}'.format( split_id, len(splits) - 1)) split = splits[split_id] train = split['train'] query = split['query'] gallery = split['gallery'] train = [tuple(item + ['grid'] + [item[1]]) for item in train] query = [tuple(item + ['grid'] + [item[1]]) for item in query] gallery = [tuple(item + ['grid'] + [item[1]]) for item in gallery] self.train, self.query, self.gallery = train, query, gallery self._show_info(self.train, self.query, self.gallery)
def __init__(self, datasets_root, relabel=True, combineall=False, split_id=0): self.root = datasets_root self.relabel = relabel self.combineall = combineall self.dataset_dir = osp.join(datasets_root, self.dataset_dir) self.cam_a_dir = osp.join(self.dataset_dir, 'VIPeR', 'cam_a') self.cam_b_dir = osp.join(self.dataset_dir, 'VIPeR', 'cam_b') self.split_path = osp.join(self.dataset_dir, 'splits.json') self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError('split_id exceeds range, received {}, ' 'but expected between 0 and {}'.format( split_id, len(splits) - 1)) split = splits[split_id] train = split['train'] query = split['query'] # query and gallery share the same images gallery = split['gallery'] train = [tuple(item + ['viper'] + [item[1]]) for item in train] query = [tuple(item + ['viper'] + [item[1]]) for item in query] gallery = [tuple(item + ['viper'] + [item[1]]) for item in gallery] self.train, self.query, self.gallery = train, query, gallery self._show_info(self.train, self.query, self.gallery)
def __init__(self, datasets_root, relabel=True, combineall=False, split_id=0): self.dataset_dir = osp.join(datasets_root, self.dataset_dir) self.cam_a_dir = osp.join(self.dataset_dir, 'prid_2011', 'single_shot', 'cam_a') self.cam_b_dir = osp.join(self.dataset_dir, 'prid_2011', 'single_shot', 'cam_b') self.split_path = osp.join(self.dataset_dir, 'splits_single_shot.json') self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError( 'split_id exceeds range, received {}, but expected between 0 and {}' .format(split_id, len(splits) - 1)) split = splits[split_id] train, query, gallery = self.process_split(split) self.train, self.query, self.gallery = train, query, gallery self._show_info(self.train, self.query, self.gallery)
def __init__(self, root='', split_id=0, **kwargs): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.cam_a_dir = osp.join(self.dataset_dir, 'VIPeR', 'cam_a') self.cam_b_dir = osp.join(self.dataset_dir, 'VIPeR', 'cam_b') self.split_path = osp.join(self.dataset_dir, 'splits.json') required_files = [self.dataset_dir, self.cam_a_dir, self.cam_b_dir] self.check_before_run(required_files) self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError('split_id exceeds range, received {}, ' 'but expected between 0 and {}'.format( split_id, len(splits) - 1)) split = splits[split_id] train = split['train'] query = split['query'] # query and gallery share the same images gallery = split['gallery'] train = [tuple(item) for item in train] query = [tuple(item) for item in query] gallery = [tuple(item) for item in gallery] super(VIPeR, self).__init__(train, query, gallery, **kwargs)
def __init__(self, root='', split_id=0, **kwargs): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.split_path = osp.join(self.dataset_dir, 'splits_prid2011.json') self.cam_a_dir = osp.join(self.dataset_dir, 'prid_2011', 'multi_shot', 'cam_a') self.cam_b_dir = osp.join(self.dataset_dir, 'prid_2011', 'multi_shot', 'cam_b') required_files = [self.dataset_dir, self.cam_a_dir, self.cam_b_dir] self.check_before_run(required_files) splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError( 'split_id exceeds range, received {}, but expected between 0 and {}' .format(split_id, len(splits) - 1)) split = splits[split_id] train_dirs, test_dirs = split['train'], split['test'] train = self.process_dir(train_dirs, cam1=True, cam2=True) query = self.process_dir(test_dirs, cam1=True, cam2=False) gallery = self.process_dir(test_dirs, cam1=False, cam2=True) super(PRID2011, self).__init__(train, query, gallery, **kwargs)
def __init__(self, datasets_root, relabel=True, combineall=False, split_id=0, cuhk03_labeled=False, cuhk03_classic_split=False): self.relabel = relabel self.combineall = combineall self.root = datasets_root self.dataset_dir = osp.join(self.root, self.dataset_dir) self.data_dir = osp.join(self.dataset_dir, 'cuhk03_release') self.raw_mat_path = osp.join(self.data_dir, 'cuhk-03.mat') self.imgs_detected_dir = osp.join(self.dataset_dir, 'images_detected') self.imgs_labeled_dir = osp.join(self.dataset_dir, 'images_labeled') self.split_classic_det_json_path = osp.join( self.dataset_dir, 'splits_classic_detected.json') self.split_classic_lab_json_path = osp.join( self.dataset_dir, 'splits_classic_labeled.json') self.split_new_det_json_path = osp.join(self.dataset_dir, 'splits_new_detected.json') self.split_new_lab_json_path = osp.join(self.dataset_dir, 'splits_new_labeled.json') self.split_new_det_mat_path = osp.join( self.dataset_dir, 'cuhk03_new_protocol_config_detected.mat') self.split_new_lab_mat_path = osp.join( self.dataset_dir, 'cuhk03_new_protocol_config_labeled.mat') self.preprocess_split() if cuhk03_labeled: split_path = self.split_classic_lab_json_path if cuhk03_classic_split else self.split_new_lab_json_path else: split_path = self.split_classic_det_json_path if cuhk03_classic_split else self.split_new_det_json_path splits = read_json(split_path) assert split_id < len( splits ), 'Condition split_id ({}) < len(splits) ({}) is false'.format( split_id, len(splits)) split = splits[split_id] train = [ tuple(item + ['cuhk03'] + [item[1]]) for item in split['train'] ] query = [ tuple(item + ['cuhk03'] + [item[1]]) for item in split['query'] ] gallery = [ tuple(item + ['cuhk03'] + [item[1]]) for item in split['gallery'] ] self.train, self.query, self.gallery = train, query, gallery self._show_info(self.train, self.query, self.gallery)
def __init__(self, datasets_root, relabel=True, combineall=False, split_id=0): self.dataset_dir = osp.join(datasets_root, self.dataset_dir) self.data_dir = osp.join(self.dataset_dir, 'i-LIDS_Pedestrian/Persons') self.split_path = osp.join(self.dataset_dir, 'splits.json') self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError('split_id exceeds range, received {}, but ' 'expected between 0 and {}'.format( split_id, len(splits) - 1)) split = splits[split_id] train, query, gallery = self.process_split(split) self.train, self.query, self.gallery = train, query, gallery self._show_info(self.train, self.query, self.gallery)
def __init__(self, root='', split_id=0, **kwargs): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.data_dir = osp.join(self.dataset_dir, 'i-LIDS_Pedestrian/Persons') self.split_path = osp.join(self.dataset_dir, 'splits.json') required_files = [self.dataset_dir, self.data_dir] self.check_before_run(required_files) self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError('split_id exceeds range, received {}, but ' 'expected between 0 and {}'.format( split_id, len(splits) - 1)) split = splits[split_id] train, query, gallery = self.process_split(split) super(iLIDS, self).__init__(train, query, gallery, **kwargs)
def __init__(self, root='', split_id=0, **kwargs): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.probe_path = osp.join(self.dataset_dir, 'underground_reid', 'probe') self.gallery_path = osp.join(self.dataset_dir, 'underground_reid', 'gallery') self.split_mat_path = osp.join(self.dataset_dir, 'underground_reid', 'features_and_partitions.mat') self.split_path = osp.join(self.dataset_dir, 'splits.json') required_files = [ self.dataset_dir, self.probe_path, self.gallery_path, self.split_mat_path ] self.check_before_run(required_files) self.prepare_split() splits = read_json(self.split_path) if split_id >= len(splits): raise ValueError('split_id exceeds range, received {}, ' 'but expected between 0 and {}'.format( split_id, len(splits) - 1)) split = splits[split_id] train = split['train'] query = split['query'] gallery = split['gallery'] train = [tuple(item + ['grid'] + [item[1]]) for item in train] query = [tuple(item + ['grid'] + [item[1]]) for item in query] gallery = [tuple(item + ['grid'] + [item[1]]) for item in gallery] super(GRID, self).__init__(train, query, gallery, **kwargs)
def __init__( self, root='', split_id=0, cuhk03_labeled=False, cuhk03_classic_split=False, **kwargs ): self.root = osp.abspath(osp.expanduser(root)) self.dataset_dir = osp.join(self.root, self.dataset_dir) self.download_dataset(self.dataset_dir, self.dataset_url) self.data_dir = osp.join(self.dataset_dir, 'cuhk03_release') self.raw_mat_path = osp.join(self.data_dir, 'cuhk-03.mat') self.imgs_detected_dir = osp.join(self.dataset_dir, 'images_detected') self.imgs_labeled_dir = osp.join(self.dataset_dir, 'images_labeled') self.split_classic_det_json_path = osp.join( self.dataset_dir, 'splits_classic_detected.json' ) self.split_classic_lab_json_path = osp.join( self.dataset_dir, 'splits_classic_labeled.json' ) self.split_new_det_json_path = osp.join( self.dataset_dir, 'splits_new_detected.json' ) self.split_new_lab_json_path = osp.join( self.dataset_dir, 'splits_new_labeled.json' ) self.split_new_det_mat_path = osp.join( self.dataset_dir, 'cuhk03_new_protocol_config_detected.mat' ) self.split_new_lab_mat_path = osp.join( self.dataset_dir, 'cuhk03_new_protocol_config_labeled.mat' ) required_files = [ self.dataset_dir, self.data_dir, self.raw_mat_path, self.split_new_det_mat_path, self.split_new_lab_mat_path ] self.check_before_run(required_files) self.preprocess_split() if cuhk03_labeled: split_path = self.split_classic_lab_json_path if cuhk03_classic_split else self.split_new_lab_json_path else: split_path = self.split_classic_det_json_path if cuhk03_classic_split else self.split_new_det_json_path splits = read_json(split_path) assert split_id < len( splits ), 'Condition split_id ({}) < len(splits) ({}) is false'.format( split_id, len(splits) ) split = splits[split_id] train = split['train'] query = split['query'] gallery = split['gallery'] super(CUHK03, self).__init__(train, query, gallery, **kwargs)