docstr: :return: valid_boxes: Nx4, valid_boxes_idx: N
docstr_tok: [":","return",":","valid_boxes",":","Nx4",",","valid_boxes_idx",":","N"]
code: def _validate_boxes(
      self,
      valid_ratio_range: List[float],
      im_size: int,
      gt_boxes: "np.array of Nx4",
      scale: float,
  ):
      """
      :return: valid_boxes: Nx4, valid_boxes_idx: N
      """
      ws = (gt_boxes[:, 2] - gt_boxes[:, 0]).astype(np.int32)
      hs = (gt_boxes[:, 3] - gt_boxes[:, 1]).astype(np.int32)
      maxs = np.maximum(ws, hs)
      box_ratio = maxs / im_size
      mins = np.minimum(ws, hs)
      target_mins = mins * scale
  
      low = valid_ratio_range[0] if valid_ratio_range[0] > 0 else 0
      high = (
          valid_ratio_range[1]
          if valid_ratio_range[1] > 0
          else np.finfo(np.float32).max
      )
  
      valid_boxes_idx = np.nonzero(
          (low <= box_ratio) & (box_ratio < high) & (target_mins >= 2)
      )[0]
      valid_boxes = gt_boxes[valid_boxes_idx]
      return valid_boxes, valid_boxes_idx
  
imports: import copy
  import math
  import random
  import numpy
  from copy import deepcopy
  from typing import List, Tuple
  from collections import defaultdict
  from .chip_box_utils import nms, transform_chip_boxes2image_boxes
  from .chip_box_utils import find_chips_to_cover_overlaped_boxes
  from .chip_box_utils import transform_chip_box
  from .chip_box_utils import intersection_over_box
label_desc: Use image node_id 12 for calling the AnnoCropper obj's underlying member method code with example usage: obj._validate_boxes(valid_ratio_range, im_size, gt_boxes, scale) and returns: valid_boxes,  valid_boxes_idx