code: def filter_roidb(roidb):
      """remove roidb entries without usable rois"""
  
      def is_valid(entry):
          """valid images have at least 1 fg or bg roi"""
          overlaps = entry["max_overlaps"]
          fg_inds = np.where(overlaps >= config.TRAIN.FG_THRESH)[0]
          bg_inds = np.where(
              (overlaps < config.TRAIN.BG_THRESH_HI)
              & (overlaps >= config.TRAIN.BG_THRESH_LO)
          )[0]
          valid = len(fg_inds) > 0 or len(bg_inds) > 0
          # valid = len(fg_inds) > 0
          return valid
  
      num = len(roidb)
      filtered_roidb = [entry for entry in roidb if is_valid(entry)]
      num_after = len(filtered_roidb)
      logger.info(
          "load data: filtered %d roidb entries: %d -> %d"
          % (num - num_after, num, num_after)
      )
  
      return filtered_roidb
  
file_path: insightface/detection/retinaface/rcnn/utils/load_data.py
imports: import numpy
  from ..logger import logger
  from ..config import config
  from ..dataset import *
label_desc: Use image node_id 4 for calling a global function with example usage: filter_roidb(roidb) and returns: filtered_roidb, valid