code: def crop_detection(
      img: torch.Tensor,
      boxes: np.ndarray,
      crop_box: Tuple[float, float, float, float],
  ) -> Tuple[torch.Tensor, np.ndarray]:
      """Crop and image and associated bboxes
  
      Args:
      ----
          img: image to crop
          boxes: array of boxes to clip, absolute (int) or relative (float)
          crop_box: box (xmin, ymin, xmax, ymax) to crop the image. Relative coords.
  
      Returns:
      -------
          A tuple of cropped image, cropped boxes, where the image is not resized.
      """
      if any(val < 0 or val > 1 for val in crop_box):
          raise AssertionError(
              "coordinates of arg `crop_box` should be relative"
          )
      h, w = img.shape[-2:]
      xmin, ymin = int(round(crop_box[0] * (w - 1))), int(
          round(crop_box[1] * (h - 1))
      )
      xmax, ymax = int(round(crop_box[2] * (w - 1))), int(
          round(crop_box[3] * (h - 1))
      )
      cropped_img = F.crop(img, ymin, xmin, ymax - ymin, xmax - xmin)
      # Crop the box
      boxes = crop_boxes(
          boxes,
          crop_box if boxes.max() <= 1 else (xmin, ymin, xmax, ymax),
      )
  
      return cropped_img, boxes
  
file_path: doctr/doctr/transforms/functional/pytorch.py
imports: from copy import deepcopy
  from typing import Tuple
  import numpy
  import torch
  from torchvision.transforms import functional
  from doctr.utils.geometry import rotate_abs_geoms
  from .base import create_shadow_mask, crop_boxes
label_desc: Use image node_id 3 for calling a global function with example usage: crop_detection(img, boxes, crop_box) and returns: cropped_img,  boxes