def _sample_bg_rois(roidb, num_bg_rois):
    '\n    Sample rois from background\n    '
    labels = roidb['max_classes']
    overlaps = roidb['max_overlaps']
    bg_inds = np.where((((overlaps < cfg.TRAIN.BG_THRESH_HI) & (overlaps >= cfg.TRAIN.BG_THRESH_LO)) | (labels == 0)))[0]
    bg_rois_per_this_image = np.minimum(num_bg_rois, bg_inds.size)
    if (bg_inds.size > 0):
        bg_inds = npr.choice(bg_inds, size=bg_rois_per_this_image, replace=False)
    return bg_inds
Sample rois from background
def _sample_bg_rois(roidb, num_bg_rois):
    '\n    \n    '
    labels = roidb['max_classes']
    overlaps = roidb['max_overlaps']
    bg_inds = np.where((((overlaps < cfg.TRAIN.BG_THRESH_HI) & (overlaps >= cfg.TRAIN.BG_THRESH_LO)) | (labels == 0)))[0]
    bg_rois_per_this_image = np.minimum(num_bg_rois, bg_inds.size)
    if (bg_inds.size > 0):
        bg_inds = npr.choice(bg_inds, size=bg_rois_per_this_image, replace=False)
    return bg_inds