def __init__(self, image_set, data_path, mc): imdb.__init__(self, 'kitti_'+image_set, mc) self._image_set = image_set self._data_root_path = data_path self._lidar_2d_path = os.path.join(self._data_root_path, 'lidar_2d') self._gta_2d_path = os.path.join('/rscratch18/schzhao/SqueezeSeg/data', 'gtav_predicted') self._lidar_R_path = os.path.join(self._data_root_path, 'lidar_R') self._gta_R_path = os.path.join(self._data_root_path, 'gtav_R') self._lidar_multiplier_path = os.path.join(self._data_root_path, 'lidar_multiplier') self._gta_multiplier_path = os.path.join(self._data_root_path, 'gtav_multiplier') self._lidar_mask_path = os.path.join(self._data_root_path, 'lidar_mask') self._gta_mask_path = os.path.join(self._data_root_path, 'gtav_mask') # a list of string indices of images in the directory self._image_idx = self._load_image_set_idx() # a dict of image_idx -> [[cx, cy, w, h, cls_idx]]. x,y,w,h are not divided by # the image width and height ## batch reader ## self._perm_idx = None self._cur_idx = 0 # TODO(bichen): add a random seed as parameter self._shuffle_image_idx()
def __init__(self, image_set, devkit_path=None): imdb.__init__(self, 'bdds_' + image_set) self._image_set = image_set self._devkit_path = self._get_default_path() if devkit_path is None \ else devkit_path self._data_path = os.path.join(self._devkit_path, 'BDDS') self._classes = tuple(map(str, range(61))) self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # Default to roidb handler # self._roidb_handler = self.selective_search_roidb self._roidb_handler = self.gt_roidb self._salt = str(uuid.uuid4()) self._comp_id = 'comp4' # PASCAL specific config options self.config = { 'cleanup': True, 'use_salt': True, 'use_diff': False, 'matlab_eval': False, 'rpn_file': None, 'min_size': 2 } assert os.path.exists(self._devkit_path), \ 'BDDS path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, year): imdb.__init__(self, 'coco_' + year + '_' + image_set) # COCO specific config options self.config = {'use_salt': True, 'cleanup': True} # name, paths self._year = year self._image_set = image_set self._data_path = osp.join(cfg.DATA_DIR, 'coco') # load COCO API, classes, class <-> id mappings self._COCO = COCO(self._get_ann_file()) cats = self._COCO.loadCats(self._COCO.getCatIds()) self._classes = tuple(['__background__'] + [c['name'] for c in cats]) self._class_to_ind = dict( list(zip(self.classes, list(range(self.num_classes))))) self._class_to_coco_cat_id = dict( list(zip([c['name'] for c in cats], self._COCO.getCatIds()))) self._image_index = self._load_image_set_index() # Default to roidb handler self.set_proposal_method('gt') self.competition_mode(False) # Some image sets are "views" (i.e. subsets) into others. # For example, minival2014 is a random 5000 image subset of val2014. # This mapping tells us where the view's images and proposals come from. self._view_map = { 'minival2014': 'val2014', # 5k val2014 subset 'valminusminival2014': 'val2014', # val2014 \setminus minival2014 'test-dev2015': 'test2015', } coco_name = image_set + year # e.g., "val2014" self._data_name = (self._view_map[coco_name] if coco_name in self._view_map else coco_name) # Dataset splits that have ground-truth annotations (test splits # do not have gt annotations) self._gt_splits = ('train', 'val', 'minival')
def __init__(self, image_set, devkit_path=None): imdb.__init__(self, 'dc_' + image_set) self._image_set = image_set self._devkit_path = self._get_default_path() if devkit_path is None \ else devkit_path self._data_path = self._devkit_path self._classes_file_path = os.path.join(self._devkit_path, 'labels.txt') self._classes = self.get_classes(self._classes_file_path) self._class_to_ind = dict( list(zip(self.classes, list(range(self.num_classes))))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb self._salt = str(uuid.uuid4()) self._comp_id = 'comp4' # PASCAL specific config options self.config = { 'cleanup': True, 'use_salt': True, 'use_diff': False, 'matlab_eval': False, 'rpn_file': None } assert os.path.exists(self._devkit_path), \ 'DC_Set path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, year, devkit_path=None): imdb.__init__(self, 'voc_' + year + '_' + image_set) self._year = year self._image_set = image_set self._devkit_path = self._get_default_path() if devkit_path is None \ else devkit_path self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year) self._classes = ('__background__', # always index 0 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor') self._class_to_ind = dict(zip(self.classes, range(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # Default to roidb handler #self._roidb_handler = self.selective_search_roidb self._roidb_handler = self.gt_roidb self._salt = str(uuid.uuid4()) self._comp_id = 'comp4' # PASCAL specific config options self.config = {'cleanup' : True, 'use_salt' : True, 'use_diff' : False, 'matlab_eval' : False, 'rpn_file' : None, 'min_size' : 2} assert os.path.exists(self._devkit_path), \ 'VOCdevkit path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, year, devkit_path=None): imdb.__init__(self, 'MUSICMA++' + year + '_' + image_set) self._year = year self._image_set = image_set self._devkit_path = self._get_default_path() if devkit_path is None \ else devkit_path self._data_path = os.path.join(self._devkit_path, 'MUSICMA++_2017') self._split_path = os.path.join(self._devkit_path, 'train_val_test') self._classes = list(pa.read_csv(self._devkit_path + "/MUSICMA_classification/class_names.csv", header=None)[1]) for i in range(len(self._classes)): self._classes[i] = self._classes[i].lower().strip() self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes))))) self._image_ext = '.png' self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb self._salt = str(uuid.uuid4()) self._comp_id = 'comp4' # PASCAL specific config options self.config = {'cleanup': True, 'use_salt': True, 'use_diff': False, 'matlab_eval': False, 'rpn_file': None} assert os.path.exists(self._devkit_path), \ 'VOCdevkit path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._split_path)
def __init__(self, imgs_path, annos_path): imdb.__init__(self, 'eyelevel5k') self.imgs_path = imgs_path self.annos_path = annos_path self._anno = [] self.prepare_list() self._num_images = len(self._img_anno_list)
def __init__(self, image_set, year, classes, maxNrRois, cacheDir, devkit_path=None): imdb.__init__(self, 'voc_' + year + '_' + image_set) self._year = year self._image_set = image_set self._maxNrRois = maxNrRois self._ROOT_DIR = os.path.join(os.path.dirname(__file__), '..') self._cacheDir = cacheDir self._devkit_path = self._get_default_path() if devkit_path is None \ else devkit_path self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year) self._classes = classes #('__background__', # always index 0 # 'aeroplane', 'bicycle', 'bird', 'boat', # 'bottle', 'bus', 'car', 'cat', 'chair', # 'cow', 'diningtable', 'dog', 'horse', # 'motorbike', 'person', 'pottedplant', # 'sheep', 'sofa', 'train', 'tvmonitor') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.selective_search_roidb # PASCAL specific config options self.config = {'cleanup' : True, 'use_salt' : True, 'top_k' : 2000} assert os.path.exists(self._devkit_path), \ 'VOCdevkit path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, path=None): imdb.__init__(self, image_set) self._data_path = path self._image_set = image_set self._classes = ('__background__', 'person') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() self.cache_path = './'
def __init__(self, datasets): self._datasets = datasets self._check_consistency() self._classes = self._datasets[0]._classes name = " ".join([dataset.name for dataset in datasets]) imdb.__init__(self,'IMDB Groups:{}'.format(name)) self._image_index = self._get_img_paths()
def __init__(self, vatics): self._vatics = vatics self._check_consistency() name = " ".join([vatic.name for vatic in vatics]) imdb.__init__(self,'Vatic Group:{}'.format(name)) self._image_ext = '.jpg' self._image_index = self._get_image_index()
def __init__(self, name, classes, train_split="train", test_split="test", CLS_mapper={}): imdb.__init__(self,'vatic_' + name) assert data_map.has_key(name),\ 'The {} dataset does not exist. The available dataset are: {}'.format(name, data_map.keys()) self._data_path = data_map[name] assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path) self.CLS_mapper = CLS_mapper self._classes = classes self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) annotation_path = os.path.join(self._data_path, "annotations.json") assert os.path.exists(annotation_path), \ 'Annotation path does not exist.: {}'.format(annotation_path) self._annotation = json.load(open(annotation_path)) self.original_classes = self.get_original_classes() meta_data_path = os.path.join(self._data_path, "meta.json") self._meta = load_meta(meta_data_path) if train_split == "train" or train_split == "test": pass elif train_split == "all": print("Use both split for training") self._meta["train"]["sets"] += self._meta["test"]["sets"] else: raise("Options except train and test are not supported!") if test_split == "train" or test_split == "test": pass elif test_split == "all": print("Use both split for testing") self._meta["test"]["sets"] += self._meta["train"]["sets"] else: raise("Options except train and test are not supported!") self._image_ext = self._meta["format"] self._image_ext = '.jpg' self._image_index = self._get_image_index()
def __init__(self): imdb.__init__(self, 'dataset') self._classes = ('background', 'text') self._data_path = self._get_data_path() self._class_to_ind = dict( list(zip(self.classes, list(range(self.num_classes))))) self._image_ext = '.jpg' self._image_set = 'train' self._image_index = self._load_image_set_index() self._roidb_handler = self.gt_roidb ##初始化roidb self.get_training_roidb() ###打乱roidb的顺序 self._shuffle_roidb_inds()
def __init__(self, image_set, year, devkit_path=None): imdb.__init__(self, 'voc_' + year + '_' + image_set) self._year = year self._image_set = image_set self._devkit_path = cfgs.DATASET_DIR self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year) self._classes = ( '__background__', # always index 0 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor') #训练自己的类别 # self._classes = ('__background__', # always index 0 # 'cyclist', 'person', 'vehicle') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # PASCAL specific config options self.config = { 'cleanup': True, 'use_salt': False, 'use_diff': False, 'matlab_eval': False, 'min_size': 2 } assert os.path.exists(self._devkit_path), \ 'VOCdevkit path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, data_splits_path, data_path, mc): imdb.__init__(self, 'kitti_' + image_set, mc) self._image_set = image_set self._data_splits_path = data_splits_path self._lidar_2d_path = os.path.join(data_path, 'lidar_2d') # a list of string indices of images in the directory self._image_idx = self._load_image_set_idx() # a dict of image_idx -> [[cx, cy, w, h, cls_idx]]. x,y,w,h are not divided by # the image width and height ## batch reader ## self._perm_idx = None self._cur_idx = 0 # TODO(bichen): add a random seed as parameter self._shuffle_image_idx()
def __init__(self, image_set, devkit_path): imdb.__init__(self, image_set) self._image_set = image_set self._devkit_path = devkit_path self._data_path = os.path.join(self._devkit_path, 'data') self._classes = ( '__background__', # always index 0 'person', 'backpack', 'bottle', 'cup', 'bowl', 'banana', 'apple', 'orange', 'pizza', 'donut', 'tv', 'laptop', 'cell phone', 'book', 'screw', 'block', 'beam') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = ['.jpg', '.png'] self._image_index = self._load_image_set_index() self._salt = str(uuid.uuid4()) self._comp_id = 'comp4' # Specific config options self.config = { 'cleanup': True, 'use_salt': True, 'top_k': 2000, 'use_diff': False, 'rpn_file': None } assert os.path.exists(self._devkit_path), \ 'Devkit path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, year, devkit_path=None): imdb.__init__(self, 'voc_' + year + '_' + image_set) self._year = year self._image_set = image_set self._devkit_path = self._get_default_path( ) if devkit_path is None else devkit_path self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year) self._classes = ( '__background__', # always index 0 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor') self._class_to_ind = dict(zip(self.classes, range(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.selective_search_roidb # <bound method pascal_voc.selective_search_roidb of <datasets.pascal_voc.pascal_voc object at 0x7f6ba91be0f0>> # PASCAL specific config options self.config = {'cleanup': True, 'use_salt': True, 'top_k': 2000} assert os.path.exists(self._devkit_path), \ 'VOCdevkit path does not exist: {}'.format(self._devkit_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self,pascal_path='/share/manage/NEU/home3/work/pytorch/detection/new_remote_data'): imdb.__init__(self, 'newremotedata') self._image_set = 'trainval' self._pascal_path = pascal_path self._data_path = os.path.join(self._pascal_path, 'img') self._classes = ('__background__', # always index 0 'ship') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb self._salt = str(uuid.uuid4()) self._comp_id = 'comp4' # PASCAL specific config options self.config = {'cleanup': True, 'use_salt': True, 'use_diff': False, 'matlab_eval': False, 'rpn_file': None, 'min_size': 2}
def __init__(self, image_set): imdb.__init__(self, 'clutteredMNIST') self._image_set = image_set self._data_path = './clutteredMNIST' self._classes = ( '__background__', # always index 0 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9') self._class_to_ind = dict(zip(self.classes, range(self.num_classes))) self._image_ext = '.png' self._image_index = self._load_image_set_index() self._roidb_handler = self.gt_roidb assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, year, dist_path=None): imdb.__init__(self, image_set) self._year = year #self._image_set = image_set.split('casia_')[1] self._dist_path = self._get_default_path() if dist_path is None \ else dist_path self._data_path = self._dist_path self._classes = ( '__background__', # always index 0 'tamper', 'authentic') self._classes = ( 'authentic', # always index 0 'tamper') self._class_to_ind = dict( list(zip(self.classes, list(range(self.num_classes))))) self._image_ext = {'.png', '.jpg', '.tif', '.bmp', '.JPG'} # self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, kitti_path=None): imdb.__init__(self, 'kitti_' + image_set) self._image_set = image_set self._kitti_path = self._get_default_path() if kitti_path is None \ else kitti_path self._data_path = os.path.join(self._kitti_path, 'data_object_image_2') self._classes = ('__background__', 'Car', 'Pedestrian', 'Cyclist') self._class_to_ind = dict(zip(self.classes, range(self.num_classes))) self._image_ext = '.png' self._image_index = self._load_image_set_index_new() # Default to roidb handler if cfg.IS_RPN: self._roidb_handler = self.gt_roidb else: self._roidb_handler = self.region_proposal_roidb # num of subclasses if image_set == 'train' or image_set == 'val': self._num_subclasses = 125 + 24 + 24 + 1 prefix = 'validation' else: self._num_subclasses = 227 + 36 + 36 + 1 prefix = 'test' self.config = {'top_k': 100000} # statistics for computing recall self._num_boxes_all = np.zeros(self.num_classes, dtype=np.int) self._num_boxes_covered = np.zeros(self.num_classes, dtype=np.int) self._num_boxes_proposal = 0 assert os.path.exists(self._kitti_path), \ 'KITTI path does not exist: {}'.format(self._kitti_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
def __init__(self, image_set, pascal3d_path=None): imdb.__init__(self, 'pascal3d_' + image_set) self._year = '2012' self._image_set = image_set self._pascal3d_path = self._get_default_path() if pascal3d_path is None \ else pascal3d_path self._data_path = os.path.join(self._pascal3d_path, 'VOCdevkit' + self._year, 'VOC' + self._year) self._classes = ( '__background__', # always index 0 'aeroplane', 'bicycle', 'boat', 'bottle', 'bus', 'car', 'chair', 'diningtable', 'motorbike', 'sofa', 'train', 'tvmonitor') self._class_to_ind = dict(zip(self.classes, range(self.num_classes))) self._image_ext = '.jpg' self._image_index = self._load_image_set_index() # Default to roidb handler if cfg.IS_RPN: self._roidb_handler = self.gt_roidb else: self._roidb_handler = self.region_proposal_roidb # num of subclasses if cfg.SUBCLS_NAME == 'voxel_exemplars': self._num_subclasses = 337 + 1 elif cfg.SUBCLS_NAME == 'pose_exemplars': self._num_subclasses = 260 + 1 else: assert (1), 'cfg.SUBCLS_NAME not supported!' # load the mapping for subcalss to class filename = os.path.join(self._pascal3d_path, cfg.SUBCLS_NAME, 'mapping.txt') assert os.path.exists(filename), 'Path does not exist: {}'.format( filename) mapping = np.zeros(self._num_subclasses, dtype=np.int) with open(filename) as f: for line in f: words = line.split() subcls = int(words[0]) mapping[subcls] = self._class_to_ind[words[1]] self._subclass_mapping = mapping # PASCAL specific config options self.config = {'cleanup': True, 'use_salt': True, 'top_k': 2000} # statistics for computing recall self._num_boxes_all = np.zeros(self.num_classes, dtype=np.int) self._num_boxes_covered = np.zeros(self.num_classes, dtype=np.int) self._num_boxes_proposal = 0 assert os.path.exists(self._pascal3d_path), \ 'PASCAL3D path does not exist: {}'.format(self._pascal3d_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)