本文整理汇总了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()