Beispiel #1
0
 def __init__(self,
              iou_thresh=0.35,
              neg_thresh=0.5,
              negative_mining_ratio=3,
              stds=(0.1, 0.1, 0.2, 0.2),
              num_sample=1000,
              pos_thresh=0.35,
              neg_thresh_high=0.25,
              pos_ratio=0.3,
              neg_ratio=None,
              fill_negative=False,
              **kwargs):
     super(PyramidBoxTargetGenerator, self).__init__(**kwargs)
     self._matcher = CompositeMatcher([MaximumMatcher(iou_thresh)])
     if negative_mining_ratio > 0:
         self._sampler = OHEMSampler(negative_mining_ratio,
                                     thresh=neg_thresh)
     else:
         # self._sampler = NaiveSampler()
         self._sampler = QuotaSampler(num_sample=num_sample,
                                      pos_thresh=pos_thresh,
                                      neg_thresh_high=neg_thresh_high,
                                      neg_thresh_low=-np.inf,
                                      pos_ratio=pos_ratio,
                                      neg_ratio=neg_ratio,
                                      fill_negative=fill_negative)
         self._use_negative_sampling = False
     self._cls_encoder = MultiClassEncoder()
     self._box_encoder = NormalizedBoxCenterEncoder(stds=stds)
     self._center_to_corner = BBoxCenterToCorner(split=False)
 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)