本文整理汇总了Python中maskrcnn_benchmark.modeling.matcher.Matcher方法的典型用法代码示例。如果您正苦于以下问题:Python matcher.Matcher方法的具体用法?Python matcher.Matcher怎么用?Python matcher.Matcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maskrcnn_benchmark.modeling.matcher
的用法示例。
在下文中一共展示了matcher.Matcher方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from maskrcnn_benchmark.modeling import matcher [as 别名]
# 或者: from maskrcnn_benchmark.modeling.matcher import Matcher [as 别名]
def __init__(self, proposal_matcher, box_coder,
generate_labels_func,
sigmoid_focal_loss,
bbox_reg_beta=0.11,
regress_norm=1.0):
"""
Arguments:
proposal_matcher (Matcher)
box_coder (BoxCoder)
"""
self.proposal_matcher = proposal_matcher
self.box_coder = box_coder
self.box_cls_loss_func = sigmoid_focal_loss
self.bbox_reg_beta = bbox_reg_beta
self.copied_fields = ['labels']
self.generate_labels_func = generate_labels_func
self.discard_cases = ['between_thresholds']
self.regress_norm = regress_norm
示例2: make_retinanet_loss_evaluator
# 需要导入模块: from maskrcnn_benchmark.modeling import matcher [as 别名]
# 或者: from maskrcnn_benchmark.modeling.matcher import Matcher [as 别名]
def make_retinanet_loss_evaluator(cfg, box_coder):
matcher = Matcher(
cfg.MODEL.RETINANET.FG_IOU_THRESHOLD,
cfg.MODEL.RETINANET.BG_IOU_THRESHOLD,
allow_low_quality_matches=True,
)
sigmoid_focal_loss = SigmoidFocalLoss(
cfg.MODEL.RETINANET.LOSS_GAMMA,
cfg.MODEL.RETINANET.LOSS_ALPHA
)
loss_evaluator = RetinaNetLossComputation(
matcher,
box_coder,
generate_retinanet_labels,
sigmoid_focal_loss,
bbox_reg_beta = cfg.MODEL.RETINANET.BBOX_REG_BETA,
regress_norm = cfg.MODEL.RETINANET.BBOX_REG_WEIGHT,
)
return loss_evaluator
示例3: make_retinanet_loss_evaluator
# 需要导入模块: from maskrcnn_benchmark.modeling import matcher [as 别名]
# 或者: from maskrcnn_benchmark.modeling.matcher import Matcher [as 别名]
def make_retinanet_loss_evaluator(cfg, box_coder):
matcher = Matcher(
cfg.MODEL.RETINANET.FG_IOU_THRESHOLD,
cfg.MODEL.RETINANET.BG_IOU_THRESHOLD,
allow_low_quality_matches=True,
)
sigmoid_focal_loss = SigmoidFocalLoss(
cfg.MODEL.RETINANET.LOSS_GAMMA,
cfg.MODEL.RETINANET.LOSS_ALPHA
)
scheme = "free" if cfg.MODEL.SAMPLING_FREE_ON else "focalloss"
loss_evaluator = eval("RetinaNetLossComputation" + scheme.capitalize())(
matcher,
box_coder,
generate_retinanet_labels,
sigmoid_focal_loss,
bbox_reg_beta = cfg.MODEL.RETINANET.BBOX_REG_BETA,
regress_norm = cfg.MODEL.RETINANET.BBOX_REG_WEIGHT,
)
return loss_evaluator
示例4: __init__
# 需要导入模块: from maskrcnn_benchmark.modeling import matcher [as 别名]
# 或者: from maskrcnn_benchmark.modeling.matcher import Matcher [as 别名]
def __init__(self, cfg, box_coder):
"""
Arguments:
proposal_matcher (Matcher)
box_coder (BoxCoder)
"""
self.box_coder = box_coder
self.num_classes = cfg.RETINANET.NUM_CLASSES - 1
self.pre_anchor_topk = cfg.FREEANCHOR.PRE_ANCHOR_TOPK
self.smooth_l1_loss_param = (cfg.FREEANCHOR.BBOX_REG_WEIGHT, cfg.FREEANCHOR.BBOX_REG_BETA)
self.bbox_threshold = cfg.FREEANCHOR.BBOX_THRESHOLD
self.focal_loss_alpha = cfg.FREEANCHOR.FOCAL_LOSS_ALPHA
self.focal_loss_gamma = cfg.FREEANCHOR.FOCAL_LOSS_GAMMA
self.positive_bag_loss_func = positive_bag_loss
self.negative_bag_loss_func = focal_loss
示例5: __init__
# 需要导入模块: from maskrcnn_benchmark.modeling import matcher [as 别名]
# 或者: from maskrcnn_benchmark.modeling.matcher import Matcher [as 别名]
def __init__(self, cfg, crop_size, mode, post_branch, size_divisible=0):
self.size_divisible = size_divisible
self.mode = mode
self.crop_size = crop_size
self.special_deal = cfg.SEARCH.PREFIX_ANCHOR
self.post_branch = post_branch
if self.mode == 0:
if self.post_branch == "retina":
self.anchor_generator = make_anchor_generator_retinanet(cfg)
self.box_coder = BoxCoder(weights=(10., 10., 5., 5.))
self.matcher = Matcher(
cfg.MODEL.RETINANET.FG_IOU_THRESHOLD,
cfg.MODEL.RETINANET.BG_IOU_THRESHOLD,
allow_low_quality_matches=True
)
self.loss_evaluator = RetinaNetLossComputation(
cfg, self.matcher, self.box_coder
)
elif self.post_branch == "densebox":
self.loss_evaluator = DenseBoxLossComputation(cfg)
else:
raise ValueError("Post {} do not support now".format(self.post_branch))
示例6: make_retinanet_loss_evaluator
# 需要导入模块: from maskrcnn_benchmark.modeling import matcher [as 别名]
# 或者: from maskrcnn_benchmark.modeling.matcher import Matcher [as 别名]
def make_retinanet_loss_evaluator(cfg, box_coder):
matcher = Matcher(
cfg.MODEL.RETINANET.FG_IOU_THRESHOLD,
cfg.MODEL.RETINANET.BG_IOU_THRESHOLD,
allow_low_quality_matches=True,
)
sigmoid_focal_loss = SigmoidFocalLoss(
cfg.MODEL.RETINANET.LOSS_GAMMA,
cfg.MODEL.RETINANET.LOSS_ALPHA
)
loss_evaluator = RetinaNetLossComputation(
matcher,
box_coder,
generate_retinanet_labels,
sigmoid_focal_loss,
bbox_reg_beta=cfg.MODEL.RETINANET.BBOX_REG_BETA,
regress_norm=cfg.MODEL.RETINANET.BBOX_REG_WEIGHT,
)
return loss_evaluator