本文整理匯總了Python中core.config.cfg.DEBUG屬性的典型用法代碼示例。如果您正苦於以下問題:Python cfg.DEBUG屬性的具體用法?Python cfg.DEBUG怎麽用?Python cfg.DEBUG使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類core.config.cfg
的用法示例。
在下文中一共展示了cfg.DEBUG屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_roidb
# 需要導入模塊: from core.config import cfg [as 別名]
# 或者: from core.config.cfg import DEBUG [as 別名]
def get_roidb(
self,
gt=False,
proposal_file=None,
min_proposal_size=2,
proposal_limit=-1,
crowd_filter_thresh=0
):
"""Return an roidb corresponding to the json dataset. Optionally:
- include ground truth boxes in the roidb
- add proposals specified in a proposals file
- filter proposals based on a minimum side length
- filter proposals that intersect with crowd regions
"""
assert gt is True or crowd_filter_thresh == 0, \
'Crowd filter threshold must be 0 if ground-truth annotations ' \
'are not included.'
image_ids = self.COCO.getImgIds()
image_ids.sort()
if cfg.DEBUG:
roidb = copy.deepcopy(self.COCO.loadImgs(image_ids))[:100]
else:
roidb = copy.deepcopy(self.COCO.loadImgs(image_ids))
for entry in roidb:
self._prep_roidb_entry(entry)
if gt:
# Include ground-truth object annotations
cache_filepath = os.path.join(self.cache_path, self.name+'_gt_roidb.pkl')
if os.path.exists(cache_filepath) and not cfg.DEBUG:
self.debug_timer.tic()
self._add_gt_from_cache(roidb, cache_filepath)
logger.debug(
'_add_gt_from_cache took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
else:
self.debug_timer.tic()
for entry in roidb:
self._add_gt_annotations(entry)
logger.debug(
'_add_gt_annotations took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
if not cfg.DEBUG:
with open(cache_filepath, 'wb') as fp:
pickle.dump(roidb, fp, pickle.HIGHEST_PROTOCOL)
logger.info('Cache ground truth roidb to %s', cache_filepath)
if proposal_file is not None:
# Include proposals from a file
self.debug_timer.tic()
self._add_proposals_from_file(
roidb, proposal_file, min_proposal_size, proposal_limit,
crowd_filter_thresh
)
logger.debug(
'_add_proposals_from_file took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
_add_class_assignments(roidb)
return roidb
示例2: get_roidb
# 需要導入模塊: from core.config import cfg [as 別名]
# 或者: from core.config.cfg import DEBUG [as 別名]
def get_roidb(
self,
gt=False,
proposal_file=None,
min_proposal_size=2,
proposal_limit=-1,
crowd_filter_thresh=0
):
"""Return an roidb corresponding to the json dataset. Optionally:
- include ground truth boxes in the roidb
n- add proposals specified in a proposals file
- filter proposals based on a minimum side legth
- filter proposals that intersect with crowd regions
"""
assert gt is True or crowd_filter_thresh == 0, \
'Crowd filter threshold must be 0 if ground-truth annotations ' \
'are not included.'
image_ids = self.COCO.getImgIds()
image_ids.sort()
if cfg.DEBUG:
roidb = copy.deepcopy(self.COCO.loadImgs(image_ids))[:100]
else:
roidb = copy.deepcopy(self.COCO.loadImgs(image_ids))
for entry in roidb:
self._prep_roidb_entry(entry)
if gt:
# Include ground-truth object annotations
cache_filepath = os.path.join(self.cache_path, self.name+'_gt_roidb.pkl')
if os.path.exists(cache_filepath) and not cfg.DEBUG:
self.debug_timer.tic()
self._add_gt_from_cache(roidb, cache_filepath)
logger.debug(
'_add_gt_from_cache took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
else:
self.debug_timer.tic()
for entry in roidb:
self._add_gt_annotations(entry)
logger.debug(
'_add_gt_annotations took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
if not cfg.DEBUG:
with open(cache_filepath, 'wb') as fp:
pickle.dump(roidb, fp, pickle.HIGHEST_PROTOCOL)
logger.info('Cache ground truth roidb to %s', cache_filepath)
if proposal_file is not None:
# Include proposals from a file
self.debug_timer.tic()
self._add_proposals_from_file(
roidb, proposal_file, min_proposal_size, proposal_limit,
crowd_filter_thresh
)
logger.debug(
'_add_proposals_from_file took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
_add_class_assignments(roidb)
return roidb
示例3: get_roidb
# 需要導入模塊: from core.config import cfg [as 別名]
# 或者: from core.config.cfg import DEBUG [as 別名]
def get_roidb(
self,
gt=False,
proposal_file=None,
min_proposal_size=2,
proposal_limit=-1,
crowd_filter_thresh=0
):
"""Return an roidb corresponding to the json dataset. Optionally:
- include ground truth boxes in the roidb
- add proposals specified in a proposals file
- filter proposals based on a minimum side length
- filter proposals that intersect with crowd regions
"""
assert gt is True or crowd_filter_thresh == 0, \
'Crowd filter threshold must be 0 if ground-truth annotations ' \
'are not included.'
image_ids = self.COCO.getImgIds()
image_ids.sort()
if cfg.DEBUG:
roidb = copy.deepcopy(self.COCO.loadImgs(image_ids))[:100]
else:
roidb = copy.deepcopy(self.COCO.loadImgs(image_ids))
for entry in roidb:
self._prep_roidb_entry(entry)
if gt:
# Include ground-truth object annotations
cache_filepath = os.path.join(self.cache_path, self.name+'_gt_roidb.pkl')
if os.path.exists(cache_filepath) and not cfg.DEBUG:
self.debug_timer.tic()
logger.info('Loading cached gt_roidb from %s', cache_filepath)
with open(cache_filepath, 'rb') as fp:
roidb = pickle.load(fp)
logger.debug(
'_add_gt_from_cache took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
else:
self.debug_timer.tic()
for entry in roidb:
self._add_gt_annotations(entry)
logger.debug(
'_add_gt_annotations took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
if not cfg.DEBUG:
with open(cache_filepath, 'wb') as fp:
pickle.dump(roidb, fp, pickle.HIGHEST_PROTOCOL)
logger.info('Cache ground truth roidb to %s', cache_filepath)
if proposal_file is not None:
# Include proposals from a file
self.debug_timer.tic()
self._add_proposals_from_file(
roidb, proposal_file, min_proposal_size, proposal_limit,
crowd_filter_thresh
)
logger.debug(
'_add_proposals_from_file took {:.3f}s'.
format(self.debug_timer.toc(average=False))
)
return roidb