code: def filter_boxes_inside_shape(boxes, shape):
      """
      Args:
          boxes: (nx4), float
          shape: (h, w)
  
      Returns:
          indices: (k, )
          selection: (kx4)
      """
      assert boxes.ndim == 2, boxes.shape
      assert len(shape) == 2, shape
      h, w = shape
      indices = np.where(
          (boxes[:, 0] >= 0)
          & (boxes[:, 1] >= 0)
          & (boxes[:, 2] <= w)
          & (boxes[:, 3] <= h)
      )[0]
      return indices, boxes[indices, :]
  
file_path: tensorpack/examples/FasterRCNN/common.py
imports: import numpy
  import cv2
  from tensorpack.dataflow import RNGDataFlow
  from tensorpack.dataflow.imgaug import ImageAugmentor, ResizeTransform
label_desc: Use image node_id 5 for calling a global function with example usage: filter_boxes_inside_shape(boxes, shape) and returns: indices,  boxes