Python datasets.imdb() Examples
The following are 30
code examples of datasets.imdb().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
datasets
, or try the search function
.
Example #1
Source File: pascal_voc.py From dpl with MIT License | 6 votes |
def selective_search_IJCV_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, '{:s}_selective_search_IJCV_top_{:d}_roidb.pkl'. format(self.name, self.config['top_k'])) if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb gt_roidb = self.gt_roidb() ss_roidb = self._load_selective_search_IJCV_roidb(gt_roidb) roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #2
Source File: pascal_voc2.py From Faster-RCNN_TF with MIT License | 6 votes |
def selective_search_IJCV_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, '{:s}_selective_search_IJCV_top_{:d}_roidb.pkl'. format(self.name, self.config['top_k'])) if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb gt_roidb = self.gt_roidb() ss_roidb = self._load_selective_search_IJCV_roidb(gt_roidb) roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #3
Source File: pascal_voc.py From SubCNN with MIT License | 6 votes |
def selective_search_IJCV_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, '{:s}_selective_search_IJCV_top_{:d}_roidb.pkl'. format(self.name, self.config['top_k'])) if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb gt_roidb = self.gt_roidb() ss_roidb = self._load_selective_search_IJCV_roidb(gt_roidb) roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #4
Source File: kitti_tracking.py From Faster-RCNN_TF with MIT License | 5 votes |
def region_proposal_roidb(self): """ Return the database of regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_' + cfg.SUBCLS_NAME + '_' + cfg.REGION_PROPOSAL + '_region_proposal_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} roidb loaded from {}'.format(self.name, cache_file) return roidb if self._image_set != 'testing': gt_roidb = self.gt_roidb() print 'Loading region proposal network boxes...' if self._image_set == 'trainval': model = cfg.REGION_PROPOSAL + '_trainval/' else: model = cfg.REGION_PROPOSAL + '_train/' rpn_roidb = self._load_rpn_roidb(gt_roidb, model) print 'Region proposal network boxes loaded' roidb = datasets.imdb.merge_roidbs(rpn_roidb, gt_roidb) else: print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL + '_trainval/' roidb = self._load_rpn_roidb(None, model) print 'Region proposal network boxes loaded' print '{} region proposals per image'.format(self._num_boxes_proposal / len(self.image_index)) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote roidb to {}'.format(cache_file) return roidb
Example #5
Source File: pascal3d.py From SubCNN with MIT License | 5 votes |
def selective_search_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_selective_search_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb if int(self._year) == 2007 or self._image_set != 'test': gt_roidb = self.gt_roidb() ss_roidb = self._load_selective_search_roidb(gt_roidb) roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) else: roidb = self._load_selective_search_roidb(None) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #6
Source File: pascal3d.py From SubCNN with MIT License | 5 votes |
def region_proposal_roidb(self): """ Return the database of regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_' + cfg.SUBCLS_NAME + '_' + cfg.REGION_PROPOSAL + '_region_proposal_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} roidb loaded from {}'.format(self.name, cache_file) return roidb if self._image_set != 'test': gt_roidb = self.gt_roidb() print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL rpn_roidb = self._load_rpn_roidb(gt_roidb, model) print 'Region proposal network boxes loaded' roidb = datasets.imdb.merge_roidbs(rpn_roidb, gt_roidb) else: print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL roidb = self._load_rpn_roidb(None, model) print 'Region proposal network boxes loaded' print '{} region proposals per image'.format(self._num_boxes_proposal / len(self.image_index)) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote roidb to {}'.format(cache_file) return roidb
Example #7
Source File: imagenet3d.py From SubCNN with MIT License | 5 votes |
def __init__(self, image_set, imagenet3d_path=None): datasets.imdb.__init__(self, 'imagenet3d_' + image_set) self._image_set = image_set self._imagenet3d_path = self._get_default_path() if imagenet3d_path is None \ else imagenet3d_path self._data_path = os.path.join(self._imagenet3d_path, 'Images') self._classes = ('__background__', 'aeroplane', 'ashtray', 'backpack', 'basket', \ 'bed', 'bench', 'bicycle', 'blackboard', 'boat', 'bookshelf', 'bottle', 'bucket', \ 'bus', 'cabinet', 'calculator', 'camera', 'can', 'cap', 'car', 'cellphone', 'chair', \ 'clock', 'coffee_maker', 'comb', 'computer', 'cup', 'desk_lamp', 'diningtable', \ 'dishwasher', 'door', 'eraser', 'eyeglasses', 'fan', 'faucet', 'filing_cabinet', \ 'fire_extinguisher', 'fish_tank', 'flashlight', 'fork', 'guitar', 'hair_dryer', \ 'hammer', 'headphone', 'helmet', 'iron', 'jar', 'kettle', 'key', 'keyboard', 'knife', \ 'laptop', 'lighter', 'mailbox', 'microphone', 'microwave', 'motorbike', 'mouse', \ 'paintbrush', 'pan', 'pen', 'pencil', 'piano', 'pillow', 'plate', 'pot', 'printer', \ 'racket', 'refrigerator', 'remote_control', 'rifle', 'road_pole', 'satellite_dish', \ 'scissors', 'screwdriver', 'shoe', 'shovel', 'sign', 'skate', 'skateboard', 'slipper', \ 'sofa', 'speaker', 'spoon', 'stapler', 'stove', 'suitcase', 'teapot', 'telephone', \ 'toaster', 'toilet', 'toothbrush', 'train', 'trash_bin', 'trophy', 'tub', 'tvmonitor', \ 'vending_machine', 'washing_machine', 'watch', 'wheelchair') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.JPEG' 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 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._imagenet3d_path), \ 'imagenet3d path does not exist: {}'.format(self._imagenet3d_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
Example #8
Source File: pascal_voc.py From OICR-pytorch with MIT License | 5 votes |
def selective_search_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_selective_search_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = pickle.load(fid) print ('{} ss roidb loaded from {}'.format(self.name, cache_file)) return roidb if int(self._year) == 2007 or self._image_set != 'test': gt_roidb = self.gt_roidb() # ss_roidb = self._load_selective_search_roidb(gt_roidb) # roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) roidb = self._load_selective_search_roidb(gt_roidb) elif int(self._year) == 2007 : gt_roidb = self.gt_roidb() roidb = self._load_selective_search_roidb(gt_roidb) else: roidb = self._load_selective_search_roidb(None) with open(cache_file, 'wb') as fid: pickle.dump(roidb, fid, pickle.HIGHEST_PROTOCOL) print ('wrote ss roidb to {}'.format(cache_file)) return roidb
Example #9
Source File: pascal_voc.py From OICR-pytorch with MIT License | 5 votes |
def __init__(self, image_set, year, devkit_path=None): datasets.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 = ('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._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, '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)
Example #10
Source File: kitti_tracking.py From SubCNN with MIT License | 5 votes |
def region_proposal_roidb(self): """ Return the database of regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_' + cfg.SUBCLS_NAME + '_' + cfg.REGION_PROPOSAL + '_region_proposal_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} roidb loaded from {}'.format(self.name, cache_file) return roidb if self._image_set != 'testing': gt_roidb = self.gt_roidb() print 'Loading region proposal network boxes...' if self._image_set == 'trainval': model = cfg.REGION_PROPOSAL + '_trainval/' else: model = cfg.REGION_PROPOSAL + '_train/' rpn_roidb = self._load_rpn_roidb(gt_roidb, model) print 'Region proposal network boxes loaded' roidb = datasets.imdb.merge_roidbs(rpn_roidb, gt_roidb) else: print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL + '_trainval/' roidb = self._load_rpn_roidb(None, model) print 'Region proposal network boxes loaded' print '{} region proposals per image'.format(self._num_boxes_proposal / len(self.image_index)) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote roidb to {}'.format(cache_file) return roidb
Example #11
Source File: pascal_voc.py From SubCNN with MIT License | 5 votes |
def selective_search_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_selective_search_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb if int(self._year) == 2007 or self._image_set != 'test': gt_roidb = self.gt_roidb() ss_roidb = self._load_selective_search_roidb(gt_roidb) roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) else: roidb = self._load_selective_search_roidb(None) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #12
Source File: pascal_voc2.py From Faster-RCNN_TF with MIT License | 5 votes |
def selective_search_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_selective_search_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb if int(self._year) == 2007 or self._image_set != 'test': gt_roidb = self.gt_roidb() ss_roidb = self._load_selective_search_roidb(gt_roidb) roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) else: roidb = self._load_selective_search_roidb(None) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #13
Source File: pascal_voc2.py From Faster-RCNN_TF with MIT License | 5 votes |
def region_proposal_roidb(self): """ Return the database of regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_' + cfg.REGION_PROPOSAL + '_region_proposal_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} roidb loaded from {}'.format(self.name, cache_file) return roidb if self._image_set != 'test': gt_roidb = self.gt_roidb() print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL rpn_roidb = self._load_rpn_roidb(gt_roidb, model) print 'Region proposal network boxes loaded' roidb = datasets.imdb.merge_roidbs(rpn_roidb, gt_roidb) else: print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL roidb = self._load_rpn_roidb(None, model) print 'Region proposal network boxes loaded' print '{} region proposals per image'.format(self._num_boxes_proposal / len(self.image_index)) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote roidb to {}'.format(cache_file) return roidb
Example #14
Source File: mot_tracking.py From SubCNN with MIT License | 5 votes |
def region_proposal_roidb(self): """ Return the database of regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_' + cfg.SUBCLS_NAME + '_' + cfg.REGION_PROPOSAL + '_region_proposal_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} roidb loaded from {}'.format(self.name, cache_file) return roidb if self._image_set != 'test': gt_roidb = self.gt_roidb() print 'Loading region proposal network boxes...' model = 'train/' rpn_roidb = self._load_rpn_roidb(gt_roidb, model) print 'Region proposal network boxes loaded' roidb = datasets.imdb.merge_roidbs(rpn_roidb, gt_roidb) else: print 'Loading region proposal network boxes...' model = 'test/' roidb = self._load_rpn_roidb(None, model) print 'Region proposal network boxes loaded' print '{} region proposals per image'.format(self._num_boxes_proposal / len(self.image_index)) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote roidb to {}'.format(cache_file) return roidb
Example #15
Source File: coco.py From X-Detector with Apache License 2.0 | 5 votes |
def __init__(self, image_set, year, devkit_path=None): datasets.imdb.__init__(self, 'coco_' + year + '_' + image_set) # COCO specific config options self.config = {'top_k' : 2000, 'use_salt' : True, 'cleanup' : True, 'crowd_thresh' : 0.7, 'min_size' : 2} # name, paths self._year = year self._image_set = image_set self._data_path = self._get_default_path() if devkit_path is None \ else devkit_path # 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(zip(self.classes, xrange(self.num_classes))) self._class_to_coco_cat_id = dict(zip([c['name'] for c in cats], self._COCO.getCatIds())) self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb self.competition_mode(False) self._data_name = image_set + year # e.g., "val2014" if self._data_name == 'test-dev2015': self._data_name_path = 'test2015' else: self._data_name_path = self._data_name
Example #16
Source File: pascal_voc.py From X-Detector with Apache License 2.0 | 5 votes |
def __init__(self, image_set, year, devkit_path=None): datasets.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, 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._comp_id = 'comp4' # PASCAL specific config options self.config = {'cleanup' : True, 'use_salt' : True} 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)
Example #17
Source File: pascal3d.py From Faster-RCNN_TF with MIT License | 5 votes |
def region_proposal_roidb(self): """ Return the database of regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_' + cfg.SUBCLS_NAME + '_' + cfg.REGION_PROPOSAL + '_region_proposal_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} roidb loaded from {}'.format(self.name, cache_file) return roidb if self._image_set != 'test': gt_roidb = self.gt_roidb() print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL rpn_roidb = self._load_rpn_roidb(gt_roidb, model) print 'Region proposal network boxes loaded' roidb = datasets.imdb.merge_roidbs(rpn_roidb, gt_roidb) else: print 'Loading region proposal network boxes...' model = cfg.REGION_PROPOSAL roidb = self._load_rpn_roidb(None, model) print 'Region proposal network boxes loaded' print '{} region proposals per image'.format(self._num_boxes_proposal / len(self.image_index)) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote roidb to {}'.format(cache_file) return roidb
Example #18
Source File: pascal_voc.py From oicr with MIT License | 5 votes |
def __init__(self, image_set, year, devkit_path=None): datasets.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 = ('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 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, '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)
Example #19
Source File: pascal_voc.py From oicr with MIT License | 5 votes |
def selective_search_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_selective_search_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb if int(self._year) == 2007 or self._image_set != 'test': gt_roidb = self.gt_roidb() # ss_roidb = self._load_selective_search_roidb(gt_roidb) # roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) roidb = self._load_selective_search_roidb(gt_roidb) else: roidb = self._load_selective_search_roidb(None) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #20
Source File: imagenet3d.py From Faster-RCNN_TF with MIT License | 5 votes |
def __init__(self, image_set, imagenet3d_path=None): datasets.imdb.__init__(self, 'imagenet3d_' + image_set) self._image_set = image_set self._imagenet3d_path = self._get_default_path() if imagenet3d_path is None \ else imagenet3d_path self._data_path = os.path.join(self._imagenet3d_path, 'Images') self._classes = ('__background__', 'aeroplane', 'ashtray', 'backpack', 'basket', \ 'bed', 'bench', 'bicycle', 'blackboard', 'boat', 'bookshelf', 'bottle', 'bucket', \ 'bus', 'cabinet', 'calculator', 'camera', 'can', 'cap', 'car', 'cellphone', 'chair', \ 'clock', 'coffee_maker', 'comb', 'computer', 'cup', 'desk_lamp', 'diningtable', \ 'dishwasher', 'door', 'eraser', 'eyeglasses', 'fan', 'faucet', 'filing_cabinet', \ 'fire_extinguisher', 'fish_tank', 'flashlight', 'fork', 'guitar', 'hair_dryer', \ 'hammer', 'headphone', 'helmet', 'iron', 'jar', 'kettle', 'key', 'keyboard', 'knife', \ 'laptop', 'lighter', 'mailbox', 'microphone', 'microwave', 'motorbike', 'mouse', \ 'paintbrush', 'pan', 'pen', 'pencil', 'piano', 'pillow', 'plate', 'pot', 'printer', \ 'racket', 'refrigerator', 'remote_control', 'rifle', 'road_pole', 'satellite_dish', \ 'scissors', 'screwdriver', 'shoe', 'shovel', 'sign', 'skate', 'skateboard', 'slipper', \ 'sofa', 'speaker', 'spoon', 'stapler', 'stove', 'suitcase', 'teapot', 'telephone', \ 'toaster', 'toilet', 'toothbrush', 'train', 'trash_bin', 'trophy', 'tub', 'tvmonitor', \ 'vending_machine', 'washing_machine', 'watch', 'wheelchair') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.JPEG' 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 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._imagenet3d_path), \ 'imagenet3d path does not exist: {}'.format(self._imagenet3d_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
Example #21
Source File: pascal3d.py From Faster-RCNN_TF with MIT License | 5 votes |
def selective_search_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_selective_search_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb if int(self._year) == 2007 or self._image_set != 'test': gt_roidb = self.gt_roidb() ss_roidb = self._load_selective_search_roidb(gt_roidb) roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) else: roidb = self._load_selective_search_roidb(None) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #22
Source File: pascal_voc.py From dpl with MIT License | 5 votes |
def __init__(self, image_set, year, devkit_path=None): datasets.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 = ('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, 'use_diff' : False, '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)
Example #23
Source File: pascal_voc.py From dpl with MIT License | 5 votes |
def selective_search_roidb(self): """ Return the database of selective search regions of interest. Ground-truth ROIs are also included. This function loads/saves from/to a cache file to speed up future calls. """ cache_file = os.path.join(self.cache_path, self.name + '_selective_search_roidb.pkl') if os.path.exists(cache_file): with open(cache_file, 'rb') as fid: roidb = cPickle.load(fid) print '{} ss roidb loaded from {}'.format(self.name, cache_file) return roidb if int(self._year) == 2007 or self._image_set != 'test': gt_roidb = self.gt_roidb() # ss_roidb = self._load_selective_search_roidb(gt_roidb) # roidb = datasets.imdb.merge_roidbs(gt_roidb, ss_roidb) roidb = self._load_selective_search_roidb(gt_roidb) else: roidb = self._load_selective_search_roidb(None) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote ss roidb to {}'.format(cache_file) return roidb
Example #24
Source File: pascal_voc.py From SubCNN with MIT License | 4 votes |
def __init__(self, image_set, year, pascal_path=None): datasets.imdb.__init__(self, 'voc_' + year + '_' + image_set) self._year = year self._image_set = image_set self._pascal_path = self._get_default_path() if pascal_path is None \ else pascal_path self._data_path = os.path.join(self._pascal_path, 'VOCdevkit' + self._year, '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, xrange(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 self._num_subclasses = 240 + 1 # load the mapping for subcalss to class filename = os.path.join(self._pascal_path, 'subcategory_exemplars', '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._pascal_path), \ 'PASCAL path does not exist: {}'.format(self._pascal_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
Example #25
Source File: nthu.py From SubCNN with MIT License | 4 votes |
def __init__(self, image_set, nthu_path=None): datasets.imdb.__init__(self, 'nthu_' + image_set) self._image_set = image_set self._nthu_path = self._get_default_path() if nthu_path is None \ else nthu_path self._data_path = os.path.join(self._nthu_path, 'data') self._classes = ('__background__', 'Car', 'Pedestrian', 'Cyclist') 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 if cfg.IS_RPN: self._roidb_handler = self.gt_roidb else: self._roidb_handler = self.region_proposal_roidb # num of subclasses self._num_subclasses = 227 + 36 + 36 + 1 # load the mapping for subcalss to class filename = os.path.join(self._nthu_path, '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 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._nthu_path), \ 'NTHU path does not exist: {}'.format(self._nthu_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
Example #26
Source File: kitti_tracking.py From SubCNN with MIT License | 4 votes |
def __init__(self, image_set, seq_name, kitti_tracking_path=None): datasets.imdb.__init__(self, 'kitti_tracking_' + image_set + '_' + seq_name) self._image_set = image_set self._seq_name = seq_name self._kitti_tracking_path = self._get_default_path() if kitti_tracking_path is None \ else kitti_tracking_path self._data_path = os.path.join(self._kitti_tracking_path, image_set, 'image_02') self._classes = ('__background__', 'Car', 'Pedestrian', 'Cyclist') self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes))) self._image_ext = '.png' 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 image_set == 'training' and seq_name != 'trainval': self._num_subclasses = 220 + 1 else: self._num_subclasses = 472 + 1 # load the mapping for subcalss to class if image_set == 'training' and seq_name != 'trainval': filename = os.path.join(self._kitti_tracking_path, 'voxel_exemplars', 'train', 'mapping.txt') else: filename = os.path.join(self._kitti_tracking_path, 'voxel_exemplars', 'trainval', '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 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_tracking_path), \ 'kitti_tracking path does not exist: {}'.format(self._kitti_tracking_path) assert os.path.exists(self._data_path), \ 'Path does not exist: {}'.format(self._data_path)
Example #27
Source File: imagenet.py From DetNet_pytorch with MIT License | 4 votes |
def __init__(self, image_set, devkit_path, data_path): imdb.__init__(self, image_set) self._image_set = image_set self._devkit_path = devkit_path self._data_path = data_path synsets_image = sio.loadmat(os.path.join(self._devkit_path, 'data', 'meta_det.mat')) synsets_video = sio.loadmat(os.path.join(self._devkit_path, 'data', 'meta_vid.mat')) self._classes_image = ('__background__',) self._wnid_image = (0,) self._classes = ('__background__',) self._wnid = (0,) for i in xrange(200): self._classes_image = self._classes_image + (synsets_image['synsets'][0][i][2][0],) self._wnid_image = self._wnid_image + (synsets_image['synsets'][0][i][1][0],) for i in xrange(30): self._classes = self._classes + (synsets_video['synsets'][0][i][2][0],) self._wnid = self._wnid + (synsets_video['synsets'][0][i][1][0],) self._wnid_to_ind_image = dict(zip(self._wnid_image, xrange(201))) self._class_to_ind_image = dict(zip(self._classes_image, xrange(201))) self._wnid_to_ind = dict(zip(self._wnid, xrange(31))) self._class_to_ind = dict(zip(self._classes, xrange(31))) #check for valid intersection between video and image classes self._valid_image_flag = [0]*201 for i in range(1,201): if self._wnid_image[i] in self._wnid_to_ind: self._valid_image_flag[i] = 1 self._image_ext = ['.JPEG'] self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb # Specific config options self.config = {'cleanup' : True, 'use_salt' : True, 'top_k' : 2000} 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)
Example #28
Source File: imagenet.py From dafrcnn-pytorch with MIT License | 4 votes |
def __init__(self, image_set, devkit_path, data_path): imdb.__init__(self, image_set) self._image_set = image_set self._devkit_path = devkit_path self._data_path = data_path synsets_image = sio.loadmat(os.path.join(self._devkit_path, 'data', 'meta_det.mat')) synsets_video = sio.loadmat(os.path.join(self._devkit_path, 'data', 'meta_vid.mat')) self._classes_image = ('__background__',) self._wnid_image = (0,) self._classes = ('__background__',) self._wnid = (0,) for i in xrange(200): self._classes_image = self._classes_image + (synsets_image['synsets'][0][i][2][0],) self._wnid_image = self._wnid_image + (synsets_image['synsets'][0][i][1][0],) for i in xrange(30): self._classes = self._classes + (synsets_video['synsets'][0][i][2][0],) self._wnid = self._wnid + (synsets_video['synsets'][0][i][1][0],) self._wnid_to_ind_image = dict(zip(self._wnid_image, xrange(201))) self._class_to_ind_image = dict(zip(self._classes_image, xrange(201))) self._wnid_to_ind = dict(zip(self._wnid, xrange(31))) self._class_to_ind = dict(zip(self._classes, xrange(31))) #check for valid intersection between video and image classes self._valid_image_flag = [0]*201 for i in range(1,201): if self._wnid_image[i] in self._wnid_to_ind: self._valid_image_flag[i] = 1 self._image_ext = ['.JPEG'] self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb # Specific config options self.config = {'cleanup' : True, 'use_salt' : True, 'top_k' : 2000} 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)
Example #29
Source File: kitti.py From SubCNN with MIT License | 4 votes |
def __init__(self, image_set, kitti_path=None): datasets.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, xrange(self.num_classes))) self._image_ext = '.png' 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 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' # load the mapping for subcalss to class filename = os.path.join(self._kitti_path, cfg.SUBCLS_NAME, prefix, '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 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)
Example #30
Source File: imagenet.py From dafrcnn-pytorch with MIT License | 4 votes |
def __init__(self, image_set, devkit_path, data_path): imdb.__init__(self, image_set) self._image_set = image_set self._devkit_path = devkit_path self._data_path = data_path synsets_image = sio.loadmat(os.path.join(self._devkit_path, 'data', 'meta_det.mat')) synsets_video = sio.loadmat(os.path.join(self._devkit_path, 'data', 'meta_vid.mat')) self._classes_image = ('__background__',) self._wnid_image = (0,) self._classes = ('__background__',) self._wnid = (0,) for i in xrange(200): self._classes_image = self._classes_image + (synsets_image['synsets'][0][i][2][0],) self._wnid_image = self._wnid_image + (synsets_image['synsets'][0][i][1][0],) for i in xrange(30): self._classes = self._classes + (synsets_video['synsets'][0][i][2][0],) self._wnid = self._wnid + (synsets_video['synsets'][0][i][1][0],) self._wnid_to_ind_image = dict(zip(self._wnid_image, xrange(201))) self._class_to_ind_image = dict(zip(self._classes_image, xrange(201))) self._wnid_to_ind = dict(zip(self._wnid, xrange(31))) self._class_to_ind = dict(zip(self._classes, xrange(31))) #check for valid intersection between video and image classes self._valid_image_flag = [0]*201 for i in range(1,201): if self._wnid_image[i] in self._wnid_to_ind: self._valid_image_flag[i] = 1 self._image_ext = ['.JPEG'] self._image_index = self._load_image_set_index() # Default to roidb handler self._roidb_handler = self.gt_roidb # Specific config options self.config = {'cleanup' : True, 'use_salt' : True, 'top_k' : 2000} 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)