code: def random_crop_resize(
      images,
      bboxes,
      classes,
      widths,
      heights,
      output_size,
      scaling=[0.1, 2.0],
  ):
      if scaling is None:
          scale_factor = 1.0
      else:
          scale_factor = dali.fn.random.uniform(range=scaling)
  
      sizes = dali.fn.stack(heights, widths)
      image_scale = dali.math.min(
          scale_factor * output_size[0] / widths,
          scale_factor * output_size[1] / heights,
      )
      scaled_sizes = dali.math.floor(sizes * image_scale + 0.5)
  
      images = dali.fn.resize(images, size=scaled_sizes)
  
      anchors, shapes, bboxes, classes = dali.fn.random_bbox_crop(
          bboxes,
          classes,
          crop_shape=output_size,
          input_shape=dali.fn.cast(
              scaled_sizes, dtype=dali.types.INT32
          ),
          bbox_layout="xyXY",
          allow_no_crop=False,
          total_num_attempts=64,
      )
  
      images = dali.fn.slice(
          images,
          anchors,
          shapes,
          normalized_anchor=False,
          normalized_shape=False,
          out_of_bounds_policy="pad",
      )
  
      return (
          images,
          bboxes,
          classes,
      )
  
imports: import math
  import nvidia.dali
label_desc: Use image node_id 5 for calling a global function with example usage: random_crop_resize(images, bboxes, classes, widths, heights, output_size, scaling) and returns: images,  bboxes,  classes