lib/model/train_val.py
def filter_roidb(roidb):
  """Remove roidb entries that have no usable RoIs."""

  def is_valid(entry):
    # Valid images have:
    #   (1) At least one foreground RoI OR
    #   (2) At least one background RoI
    overlaps = entry['max_overlaps']
    # find boxes with sufficient overlap
    fg_inds = np.where(overlaps >= cfg.TRAIN.FG_THRESH)[0]
    # Select background RoIs as those within [BG_THRESH_LO, BG_THRESH_HI)
    bg_inds = np.where((overlaps < cfg.TRAIN.BG_THRESH_HI) &
                       (overlaps >= cfg.TRAIN.BG_THRESH_LO))[0]
    # image is only valid if such boxes exist
    valid = len(fg_inds) > 0 or len(bg_inds) > 0
    return valid

  num = len(roidb)
  filtered_roidb = [entry for entry in roidb if is_valid(entry)]
  num_after = len(filtered_roidb)
  print('Filtered {} roidb entries: {} -> {}'.format(num - num_after,
                                                     num, num_after))
  return filtered_roidb
Remove roidb entries that have no usable RoIs.
Remove roidb entries that have no usable RoIs.
Remove roidb entries that have no usable RoIs .
def filter_roidb(roidb):
  def is_valid(entry):
    overlaps = entry['max_overlaps']
    fg_inds = np.where(overlaps >= cfg.TRAIN.FG_THRESH)[0]
    bg_inds = np.where((overlaps < cfg.TRAIN.BG_THRESH_HI) &
                       (overlaps >= cfg.TRAIN.BG_THRESH_LO))[0]
    valid = len(fg_inds) > 0 or len(bg_inds) > 0
    return valid
  num = len(roidb)
  filtered_roidb = [entry for entry in roidb if is_valid(entry)]
  num_after = len(filtered_roidb)
  print('Filtered {} roidb entries: {} -> {}'.format(num - num_after,
                                                     num, num_after))
  return filtered_roidb
def filter_roidb ( roidb ) : def is_valid ( entry ) : overlaps = entry [ 'max_overlaps' ] fg_inds = np . where ( overlaps >= cfg . TRAIN . FG_THRESH ) [ 0 ] bg_inds = np . where ( ( overlaps < cfg . TRAIN . BG_THRESH_HI ) & ( overlaps >= cfg . TRAIN . BG_THRESH_LO ) ) [ 0 ] valid = len ( fg_inds ) > 0 or len ( bg_inds ) > 0 return valid num = len ( roidb ) filtered_roidb = [ entry for entry in roidb if is_valid ( entry ) ] num_after = len ( filtered_roidb ) print ( 'Filtered {} roidb entries: {} -> {}' . format ( num - num_after , num , num_after ) ) return filtered_roidb
Remove roidb entries that have no usable RoIs.
Remove roidb entries that have no usable RoIs .
"""Remove roidb entries that have no usable RoIs.""" # Valid images have: #   (1) At least one foreground RoI OR #   (2) At least one background RoI # find boxes with sufficient overlap # Select background RoIs as those within [BG_THRESH_LO, BG_THRESH_HI) # image is only valid if such boxes exist
roidb