本文整理匯總了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