本文整理匯總了Python中model.bbox_transform.bbox_transform方法的典型用法代碼示例。如果您正苦於以下問題:Python bbox_transform.bbox_transform方法的具體用法?Python bbox_transform.bbox_transform怎麽用?Python bbox_transform.bbox_transform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model.bbox_transform
的用法示例。
在下文中一共展示了bbox_transform.bbox_transform方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois, labels):
"""Compute bounding-box regression targets for an image."""
# Inputs are tensor
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
assert gt_rois.shape[1] == 4
# 返回roi相對與其匹配的gt (dx,dy,dw,dh)四個回歸值,shape(len(rois),4)
targets = bbox_transform(ex_rois, gt_rois)
if cfg.TRAIN.BBOX_NORMALIZE_TARGETS_PRECOMPUTED:
# 是否歸一化
# Optionally normalize targets by a precomputed mean and stdev
targets = ((targets - targets.new(cfg.TRAIN.BBOX_NORMALIZE_MEANS))
/ targets.new(cfg.TRAIN.BBOX_NORMALIZE_STDS))
# labels.unsqueeze(1) -> (128, 1)
return torch.cat(
[labels.unsqueeze(1), targets], 1) # (128, 5) 類別和4個回歸值
示例2: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois, labels):
"""Compute bounding-box regression targets for an image."""
# Inputs are tensor
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
assert gt_rois.shape[1] == 4
targets = bbox_transform(ex_rois, gt_rois)
if cfg.TRAIN.BBOX_NORMALIZE_TARGETS_PRECOMPUTED:
# Optionally normalize targets by a precomputed mean and stdev
targets = ((targets - targets.new(cfg.TRAIN.BBOX_NORMALIZE_MEANS))
/ targets.new(cfg.TRAIN.BBOX_NORMALIZE_STDS))
return torch.cat(
[labels.unsqueeze(1), targets], 1)
開發者ID:Sunarker,項目名稱:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代碼行數:17,代碼來源:proposal_target_layer.py
示例3: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois):
"""Compute bounding-box regression targets for an image."""
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
assert gt_rois.shape[1] == 5
return bbox_transform(torch.from_numpy(ex_rois), torch.from_numpy(gt_rois[:, :4])).numpy()
開發者ID:Sunarker,項目名稱:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代碼行數:10,代碼來源:anchor_target_layer.py
示例4: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois):
"""Compute bounding-box regression targets for an image."""
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
assert gt_rois.shape[1] == 5
return bbox_transform(ex_rois, gt_rois[:, :4]).astype(np.float32, copy=False)
示例5: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois):
"""Compute bounding-box regression targets for an image."""
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
assert gt_rois.shape[1] == 5
targets = bbox_transform(ex_rois, gt_rois)
return targets
示例6: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois, labels):
"""Compute bounding-box regression targets for an image."""
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
assert gt_rois.shape[1] == 4
targets = bbox_transform(ex_rois, gt_rois)
if cfg.TRAIN.BBOX_NORMALIZE_TARGETS_PRECOMPUTED:
# Optionally normalize targets by a precomputed mean and stdev
targets = ((targets - np.array(cfg.TRAIN.BBOX_NORMALIZE_MEANS))
/ np.array(cfg.TRAIN.BBOX_NORMALIZE_STDS))
return np.hstack(
(labels[:, np.newaxis], targets)).astype(np.float32, copy=False)
示例7: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois):
"""Compute bounding-box regression targets for an image."""
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
assert gt_rois.shape[1] == 5
return bbox_transform(ex_rois, gt_rois[:, :4]).astype(np.float32, copy=False)
示例8: _compute_targets
# 需要導入模塊: from model import bbox_transform [as 別名]
# 或者: from model.bbox_transform import bbox_transform [as 別名]
def _compute_targets(ex_rois, gt_rois):
"""Compute bounding-box regression targets for an image."""
assert ex_rois.shape[0] == gt_rois.shape[0]
assert ex_rois.shape[1] == 4
if cfg.SUB_CATEGORY:
assert gt_rois.shape[1] == 6
else:
assert gt_rois.shape[1] == 5
return bbox_transform(torch.from_numpy(ex_rois), torch.from_numpy(gt_rois[:, :4])).numpy()