class_docstr: Random cropping with constraints
  
  Parameters
  ----------
  min_object_covered : float, default=0.1
      The cropped area of the image must contain at least this fraction of
      any bounding box supplied. The value of this parameter should be non-negative.
      In the case of 0, the cropped area does not need to overlap any of the
      bounding boxes supplied.
  min_eject_coverage : float, default=0.3
      The minimum coverage of cropped sample w.r.t its original size. With this
      constraint, objects that have marginal area after crop will be discarded.
  aspect_ratio_range : tuple of floats, default=(0.75, 1.33)
      The cropped area of the image must have an aspect ratio = width / height
      within this range.
  area_range : tuple of floats, default=(0.05, 1.0)
      The cropped area of the image must contain a fraction of the supplied
      image within in this range.
  max_attempts : int, default=50
      Number of attempts at generating a cropped/padded region of the image of the
      specified constraints. After max_attempts failures, return the original image.
class_docstr_tok: ["Random","cropping","with","constraints","Parameters","--","--","--","--","--","min_object_covered",":","float",",","default=0.1","The","cropped","area","of","the","image","must","contain","at","least","this","fraction","of","any","bounding","box","supplied",".","The","value","of","this","parameter","should","be","non-negative",".","In","the","case","of","0",",","the","cropped","area","does","not","need","to","overlap","any","of","the","bounding","boxes","supplied",".","min_eject_coverage",":","float",",","default=0.3","The","minimum","coverage","of","cropped","sample","w.r.t","its","original","size",".","With","this","constraint",",","objects","that","have","marginal","area","after","crop","will","be","discarded",".","aspect_ratio_range",":","tuple","of","floats",",","default=","(","0.75",",","1.33",")","The","cropped","area","of","the","image","must","have","an","aspect","ratio","=","width","\/","height","within","this","range",".","area_range",":","tuple","of","floats",",","default=","(","0.05",",","1.0",")","The","cropped","area","of","the","image","must","contain","a","fraction","of","the","supplied","image","within","in","this","range",".","max_attempts",":","int",",","default=50","Number","of","attempts","at","generating","a","cropped\/padded","region","of","the","image","of","the","specified","constraints",".","After","max_attempts","failures",",","return","the","original","image","."]
docstr: Propose cropping areas
docstr_tok: ["Propose","cropping","areas"]
code: def _random_crop_proposal(self, label, height, width):
      """Propose cropping areas"""
      from math import sqrt
  
      if not self.enabled or height <= 0 or width <= 0:
          return ()
      min_area = self.area_range[0] * height * width
      max_area = self.area_range[1] * height * width
      for _ in range(self.max_attempts):
          ratio = random.uniform(*self.aspect_ratio_range)
          if ratio <= 0:
              continue
          h = int(round(sqrt(min_area / ratio)))
          max_h = int(round(sqrt(max_area / ratio)))
          if round(max_h * ratio) > width:
              # find smallest max_h satifying round(max_h * ratio) <= width
              max_h = int((width + 0.4999999) / ratio)
          if max_h > height:
              max_h = height
          if h > max_h:
              h = max_h
          if h < max_h:
              # generate random h in range [h, max_h]
              h = random.randint(h, max_h)
          w = int(round(h * ratio))
          assert w <= width
  
          # trying to fix rounding problems
          area = w * h
          if area < min_area:
              h += 1
              w = int(round(h * ratio))
              area = w * h
          if area > max_area:
              h -= 1
              w = int(round(h * ratio))
              area = w * h
          if not (
              min_area <= area <= max_area
              and 0 <= w <= width
              and 0 <= h <= height
          ):
              continue
  
          y = random.randint(0, max(0, height - h))
          x = random.randint(0, max(0, width - w))
          if self._check_satisfy_constraints(
              label, x, y, x + w, y + h, width, height
          ):
              new_label = self._update_labels(
                  label, (x, y, w, h), height, width
              )
              if new_label is not None:
                  return (x, y, w, h, new_label)
      return ()
  
imports: import json
  import logging
  import random
  import warnings
  import numpy
  from ..base import numeric_types
  from ..None import ndarray
  from ..ndarray._internal import _cvcopyMakeBorder
  from ..None import io
  from .image import RandomOrderAug, ColorJitterAug, LightingAug, ColorNormalizeAug
  from .image import ResizeAug, ForceResizeAug, CastAug, HueJitterAug, RandomGrayAug
  from .image import fixed_crop, ImageIter, Augmenter
  from ..util import is_np_array
  from ..None import numpy
label_desc: Use image node_id 7 for calling the DetRandomCropAug obj's underlying member method code with example usage: obj._random_crop_proposal(label, height, width) and returns: , , x,  y,  w,  h,  new_label