我们从Python开源项目中,提取了以下31个代码示例,用于说明如何使用fast_rcnn.config.cfg.REGION_PROPOSAL。
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 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
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
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
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
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
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)) # print out recall if self._image_set != 'test': for i in xrange(1, self.num_classes): print '{}: Total number of boxes {:d}'.format(self.classes[i], self._num_boxes_all[i]) print '{}: Number of boxes covered {:d}'.format(self.classes[i], self._num_boxes_covered[i]) if self._num_boxes_all[i] > 0: print '{}: Recall {:f}'.format(self.classes[i], float(self._num_boxes_covered[i]) / float(self._num_boxes_all[i])) with open(cache_file, 'wb') as fid: cPickle.dump(roidb, fid, cPickle.HIGHEST_PROTOCOL) print 'wrote roidb to {}'.format(cache_file) return roidb