def __init__(self, iou_thresh=0.5, neg_thresh=0.5, negative_mining_ratio=3,
              stds=(0.1, 0.1, 0.2, 0.2), **kwargs):
     super(SSDTargetGenerator, self).__init__(**kwargs)
     self._matcher = CompositeMatcher([BipartiteMatcher(), MaximumMatcher(iou_thresh)])
     if negative_mining_ratio > 0:
         self._sampler = OHEMSampler(negative_mining_ratio, thresh=neg_thresh)
         self._use_negative_sampling = True
     else:
         #实际使用的是这个模式
         self._sampler = NaiveSampler()
         self._use_negative_sampling = False
     self._cls_encoder = MultiClassEncoder()
     self._box_encoder = NormalizedBoxCenterEncoder(stds=stds)
     self._center_to_corner = BBoxCenterToCorner(split=False)
Example #2
0
    def __init__(self):
        super(AssginTarget, self).__init__()
        self.matcher = CompositeMatcher(
            [BipartiteMatcher(share_max=False),
             MaximumMatcher(threshold=0.5)])

        self.center_to_corner = gcv.nn.bbox.BBoxCenterToCorner(split=False)

        #self.sampler = gcv.nn.sampler.NaiveSampler()
        self.sampler = gcv.nn.sampler.OHEMSampler(3.0, thresh=0.5)

        self.cls_encoder = gcv.nn.coder.MultiClassEncoder()
        self.bbox_encoder = gcv.nn.coder.NormalizedBoxCenterEncoder(
            stds=[0.1, 0.1, 0.2, 0.2])

        return