本文整理匯總了Python中model.config.cfg.USE_GPU_NMS屬性的典型用法代碼示例。如果您正苦於以下問題:Python cfg.USE_GPU_NMS屬性的具體用法?Python cfg.USE_GPU_NMS怎麽用?Python cfg.USE_GPU_NMS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類model.config.cfg
的用法示例。
在下文中一共展示了cfg.USE_GPU_NMS屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: nms
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import USE_GPU_NMS [as 別名]
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if dets.shape[0] == 0:
return []
if cfg.USE_GPU_NMS and not force_cpu:
return gpu_nms(dets, thresh, device_id=0)
else:
return cpu_nms(dets, thresh)
示例2: nms
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import USE_GPU_NMS [as 別名]
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if dets.shape[0] == 0:
return []
if cfg.USE_GPU_NMS and not force_cpu:
from nms.gpu_nms import gpu_nms
return gpu_nms(dets, thresh, device_id=0)
else:
from nms.cpu_nms import cpu_nms
return cpu_nms(dets, thresh)
示例3: nms
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import USE_GPU_NMS [as 別名]
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if dets.shape[0] == 0:
return []
if cfg.USE_GPU_NMS and not force_cpu:
return gpu_nms(dets, thresh, device_id=cfg.GPU_ID)
else:
return cpu_nms(dets, thresh)
示例4: nms
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import USE_GPU_NMS [as 別名]
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if dets.shape[0] == 0:
return []
if cfg.USE_GPU_NMS and not force_cpu:
return gpu_nms(dets, thresh, device_id=0)
else:
return cpu_nms(dets, thresh)
示例5: proposal_layer
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import USE_GPU_NMS [as 別名]
def proposal_layer(rpn_cls_prob, rpn_bbox_pred, im_info, cfg_key, anchors, num_anchors):
"""
A simplified version compared to fast/er RCNN
For details please see the technical report
:param
rpn_cls_prob: (1, H, W, Ax2) softmax result of rpn scores
rpn_bbox_pred: (1, H, W, Ax4) 1x1 conv result for rpn bbox
"""
if type(cfg_key) == bytes:
cfg_key = cfg_key.decode('utf-8')
pre_nms_topN = cfg[cfg_key].RPN_PRE_NMS_TOP_N
post_nms_topN = cfg[cfg_key].RPN_POST_NMS_TOP_N
nms_thresh = cfg[cfg_key].RPN_NMS_THRESH
# Get the scores and bounding boxes for foreground (text)
# The order in last dim is related to network.py:
# self._reshape_layer(rpn_cls_prob_reshape, self._num_anchors * 2, "rpn_cls_prob")
# scores = rpn_cls_prob[:, :, :, num_anchors:] # old
height, width = rpn_cls_prob.shape[1:3] # feature-map的高寬
scores = np.reshape(np.reshape(rpn_cls_prob, [1, height, width, num_anchors, 2])[:, :, :, :, 1],
[1, height, width, num_anchors])
rpn_bbox_pred = rpn_bbox_pred.reshape((-1, 4))
scores = scores.reshape((-1, 1))
proposals = bbox_transform_inv(anchors, rpn_bbox_pred)
proposals = clip_boxes(proposals, im_info[:2])
# Pick the top region proposals
order = scores.ravel().argsort()[::-1]
if pre_nms_topN > 0:
order = order[:pre_nms_topN]
proposals = proposals[order, :]
scores = scores[order]
# Non-maximal suppression
keep = nms(np.hstack((proposals, scores)), nms_thresh, not cfg.USE_GPU_NMS)
# Pick th top region proposals after NMS
if post_nms_topN > 0:
keep = keep[:post_nms_topN]
proposals = proposals[keep, :]
scores = scores[keep]
# Only support single image as input
blob = np.hstack((scores.astype(np.float32, copy=False), proposals.astype(np.float32, copy=False)))
return blob, scores