parameters: (self, rand_box, gt_boxes)
return_statement: return ious
docstring: check if overlap with any gt box is larger than threshold
docstring_summary: check if overlap with any gt box is larger than threshold
docstring_tokens: check if overlap with any gt box is larger than threshold
function: def _check_satisfy(self, rand_box, gt_boxes):
          """
          check if overlap with any gt box is larger than threshold
          """
          l, t, r, b = rand_box
          num_gt = gt_boxes.shape[0]
          ls = np.ones(num_gt) * l
          ts = np.ones(num_gt) * t
          rs = np.ones(num_gt) * r
          bs = np.ones(num_gt) * b
          mask = np.where(ls < gt_boxes[:, 1])[0]
          ls[mask] = gt_boxes[mask, 1]
          mask = np.where(ts < gt_boxes[:, 2])[0]
          ts[mask] = gt_boxes[mask, 2]
          mask = np.where(rs > gt_boxes[:, 3])[0]
          rs[mask] = gt_boxes[mask, 3]
          mask = np.where(bs > gt_boxes[:, 4])[0]
          bs[mask] = gt_boxes[mask, 4]
          w = rs - ls
          w[w < 0] = 0
          h = bs - ts
          h[h < 0] = 0
          inter_area = h * w
          union_area = np.ones(num_gt) * max(0, r - l) * max(0, b - t)
          union_area += (gt_boxes[:, 3] - gt_boxes[:, 1]) * (gt_boxes[:, 4] - gt_boxes[:, 2])
          union_area -= inter_area
          ious = inter_area / union_area
          ious[union_area <= 0] = 0
          max_iou = np.amax(ious)
          if max_iou < self.min_overlap:
              return None
          # check ground-truth constraint
          if self.config['gt_constraint'] == 'center':
              for i in range(ious.shape[0]):
                  if ious[i] > 0:
                      gt_x = (gt_boxes[i, 1] + gt_boxes[i, 3]) / 2.0
                      gt_y = (gt_boxes[i, 2] + gt_boxes[i, 4]) / 2.0
                      if gt_x < l or gt_x > r or gt_y < t or gt_y > b:
                          return None
          elif self.config['gt_constraint'] == 'corner':
              for i in range(ious.shape[0]):
                  if ious[i] > 0:
                      if gt_boxes[i, 1] < l or gt_boxes[i, 3] > r \
                          or gt_boxes[i, 2] < t or gt_boxes[i, 4] > b:
                          return None
          return ious
function_tokens: def _check_satisfy ( self , rand_box , gt_boxes ) : l , t , r , b = rand_box num_gt = gt_boxes . shape [ 0 ] ls = np . ones ( num_gt ) * l ts = np . ones ( num_gt ) * t rs = np . ones ( num_gt ) * r bs = np . ones ( num_gt ) * b mask = np . where ( ls < gt_boxes [ : , 1 ] ) [ 0 ] ls [ mask ] = gt_boxes [ mask , 1 ] mask = np . where ( ts < gt_boxes [ : , 2 ] ) [ 0 ] ts [ mask ] = gt_boxes [ mask , 2 ] mask = np . where ( rs > gt_boxes [ : , 3 ] ) [ 0 ] rs [ mask ] = gt_boxes [ mask , 3 ] mask = np . where ( bs > gt_boxes [ : , 4 ] ) [ 0 ] bs [ mask ] = gt_boxes [ mask , 4 ] w = rs - ls w [ w < 0 ] = 0 h = bs - ts h [ h < 0 ] = 0 inter_area = h * w union_area = np . ones ( num_gt ) * max ( 0 , r - l ) * max ( 0 , b - t ) union_area += ( gt_boxes [ : , 3 ] - gt_boxes [ : , 1 ] ) * ( gt_boxes [ : , 4 ] - gt_boxes [ : , 2 ] ) union_area -= inter_area ious = inter_area / union_area ious [ union_area <= 0 ] = 0 max_iou = np . amax ( ious ) if max_iou < self . min_overlap : return None # check ground-truth constraint if self . config [ 'gt_constraint' ] == 'center' : for i in range ( ious . shape [ 0 ] ) : if ious [ i ] > 0 : gt_x = ( gt_boxes [ i , 1 ] + gt_boxes [ i , 3 ] ) / 2.0 gt_y = ( gt_boxes [ i , 2 ] + gt_boxes [ i , 4 ] ) / 2.0 if gt_x < l or gt_x > r or gt_y < t or gt_y > b : return None elif self . config [ 'gt_constraint' ] == 'corner' : for i in range ( ious . shape [ 0 ] ) : if ious [ i ] > 0 : if gt_boxes [ i , 1 ] < l or gt_boxes [ i , 3 ] > r or gt_boxes [ i , 2 ] < t or gt_boxes [ i , 4 ] > b : return None return ious