本文整理汇总了Python中model.config.cfg.DATA_DIR属性的典型用法代码示例。如果您正苦于以下问题:Python cfg.DATA_DIR属性的具体用法?Python cfg.DATA_DIR怎么用?Python cfg.DATA_DIR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类model.config.cfg
的用法示例。
在下文中一共展示了cfg.DATA_DIR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: demo
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def demo(sess, net, image_name):
"""Detect pedestrians in an image using pre-computed model."""
# Load the demo image
im1_file = os.path.join(cfg.DATA_DIR, 'demo', image_name + '_visible.png')
im1 = cv2.imread(im1_file)
im2_file = os.path.join(cfg.DATA_DIR, 'demo', image_name + '_lwir.png')
im2 = cv2.imread(im2_file)
im = [im1, im2]
# Detect all object classes and regress object bounds
timer = Timer()
timer.tic()
boxes, scores = im_detect_demo(sess, net, im)
timer.toc()
print('Detection took {:.3f}s for {:d} object proposals'.format(timer.total_time, boxes.shape[0]))
# Visualize detections for each class
CONF_THRESH = 0.5
NMS_THRESH = 0.3
dets = np.hstack((boxes, scores[:, np.newaxis])).astype(np.float32, copy=False)
keep = nms(dets, NMS_THRESH)
dets = dets[keep, :]
vis_detections(im, dets, thresh=CONF_THRESH)
示例2: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where PASCAL VOC is expected to be installed.
"""
return os.path.join(cfg.DATA_DIR, 'VOCdevkit' + self._year)
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:7,代码来源:pascal_voc.py
示例3: __init__
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
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')
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:38,代码来源:coco.py
示例4: cache_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def cache_path(self):
cache_path = osp.abspath(osp.join(cfg.DATA_DIR, 'cache'))
if not os.path.exists(cache_path):
os.makedirs(cache_path)
return cache_path
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:7,代码来源:imdb.py
示例5: demo
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def demo(net, image_name):
"""Detect object classes in an image using pre-computed object proposals."""
# Load the demo image
im_file = os.path.join(cfg.DATA_DIR, 'demo', image_name)
im = cv2.imread(im_file)
# Detect all object classes and regress object bounds
timer = Timer()
timer.tic()
scores, boxes = im_detect(net, im)
timer.toc()
print('Detection took {:.3f}s for {:d} object proposals'.format(timer.total_time(), boxes.shape[0]))
# Visualize detections for each class
CONF_THRESH = 0.8
NMS_THRESH = 0.3
for cls_ind, cls in enumerate(CLASSES[1:]):
cls_ind += 1 # because we skipped background
cls_boxes = boxes[:, 4*cls_ind:4*(cls_ind + 1)]
cls_scores = scores[:, cls_ind]
dets = np.hstack((cls_boxes,
cls_scores[:, np.newaxis])).astype(np.float32)
keep = nms(torch.from_numpy(dets), NMS_THRESH)
dets = dets[keep.numpy(), :]
vis_detections(im, cls, dets, thresh=CONF_THRESH)
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:28,代码来源:demo.py
示例6: cache_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def cache_path(self):
cache_path = osp.abspath(osp.join(cfg.DATA_DIR, 'cache'))
if not os.path.exists(cache_path):
os.makedirs(cache_path)
return cache_path
示例7: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where Wider Face is expected to be installed.
"""
return os.path.join(cfg.DATA_DIR, 'WIDER/WIDER_' + self._image_set)
示例8: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where PASCAL VOC is expected to be installed.
"""
return os.path.join(cfg.DATA_DIR, 'VOCdevkit' + self._year)
示例9: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where PASCAL VOC is expected to be installed.
"""
return os.path.join(cfg.DATA_DIR, 'NC2016_Test0613')
示例10: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where PASCAL VOC is expected to be installed.
"""
return os.path.join(cfg.DATA_DIR, 'swapme')
示例11: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where PASCAL VOC is expected to be installed.
"""
#return os.path.join(cfg.DATA_DIR, 'CASIA2')
return os.path.join(cfg.DATA_DIR, 'cocostuff/coco/splicing')
示例12: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where PASCAL VOC is expected to be installed.
"""
return os.path.join(cfg.DATA_DIR, 'CASIA1')
示例13: demo
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def demo(sess, net, image_name):
"""Detect object classes in an image using pre-computed object proposals."""
# Load the demo image
im_file = os.path.join(cfg.DATA_DIR, 'demo', image_name)
im = cv2.imread(im_file)
# Detect all object classes and regress object bounds
timer = Timer()
timer.tic()
scores, boxes = im_detect(sess, net, im)
timer.toc()
print('Detection took {:.3f}s for {:d} object proposals'.format(timer.total_time, boxes.shape[0]))
# Visualize detections for each class
CONF_THRESH = 0.8
NMS_THRESH = 0.3
for cls_ind, cls in enumerate(CLASSES[1:]):
cls_ind += 1 # because we skipped background
cls_boxes = boxes[:, 4*cls_ind:4*(cls_ind + 1)]
cls_scores = scores[:, cls_ind]
dets = np.hstack((cls_boxes,
cls_scores[:, np.newaxis])).astype(np.float32)
keep = nms(dets, NMS_THRESH)
dets = dets[keep, :]
vis_detections(im, cls, dets, thresh=CONF_THRESH)
示例14: _get_default_path
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def _get_default_path(self):
"""
Return the default path where PASCAL VOC is expected to be installed.
"""
return os.path.join(cfg.DATA_DIR, 'kaist')
示例15: __init__
# 需要导入模块: from model.config import cfg [as 别名]
# 或者: from model.config.cfg import DATA_DIR [as 别名]
def __init__(self, image_set, count=5):
imdb.__init__(self, 'visual_genome_%s_%d' % (image_set, count))
self._image_set = image_set
self._root_path = osp.join(cfg.DATA_DIR, 'visual_genome')
self._name_file = osp.join(self._root_path, 'synsets.txt')
self._anno_file = osp.join(self._root_path, self._image_set + '.json')
self._image_file = osp.join(self._root_path, 'image_data.json')
with open(self._name_file) as fid:
lines = fid.readlines()
self._raw_names = []
self._raw_counts = []
for line in lines:
name, cc = line.strip().split(':')
cc = int(cc)
self._raw_names.append(name)
self._raw_counts.append(cc)
self._len_raw = len(self._raw_names)
self._raw_counts = np.array(self._raw_counts)
# First class is always background
self._vg_inds = [0] + list(np.where(self._raw_counts >= count)[0])
self._classes = ['__background__']
for idx in self._vg_inds:
if idx == 0:
continue
vg_name = self._raw_names[idx]
self._classes.append(vg_name)
self._classes = tuple(self._classes)
self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
self.set_proposal_method('gt')
# Call to get one
self.roidb