class_docstr: Random padding augmenter.
  
  Parameters
  ----------
  aspect_ratio_range : tuple of floats, default=(0.75, 1.33)
      The padded area of the image must have an aspect ratio = width / height
      within this range.
  area_range : tuple of floats, default=(1.0, 3.0)
      The padded area of the image must be larger than the original area
  max_attempts : int, default=50
      Number of attempts at generating a padded region of the image of the
      specified constraints. After max_attempts failures, return the original image.
  pad_val: float or tuple of float, default=(128, 128, 128)
      pixel value to be filled when padding is enabled.
class_docstr_tok: ["Random","padding","augmenter",".","Parameters","--","--","--","--","--","aspect_ratio_range",":","tuple","of","floats",",","default=","(","0.75",",","1.33",")","The","padded","area","of","the","image","must","have","an","aspect","ratio","=","width","\/","height","within","this","range",".","area_range",":","tuple","of","floats",",","default=","(","1.0",",","3.0",")","The","padded","area","of","the","image","must","be","larger","than","the","original","area","max_attempts",":","int",",","default=50","Number","of","attempts","at","generating","a","padded","region","of","the","image","of","the","specified","constraints",".","After","max_attempts","failures",",","return","the","original","image",".","pad_val",":","float","or","tuple","of","float",",","default=","(","128",",","128",",","128",")","pixel","value","to","be","filled","when","padding","is","enabled","."]
docstr: Generate random padding region
docstr_tok: ["Generate","random","padding","region"]
code: def _random_pad_proposal(self, label, height, width):
      """Generate random padding region"""
      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(h * ratio) < width:
              h = int((width + 0.499999) / ratio)
          if h < height:
              h = height
          if h > max_h:
              h = max_h
          if h < max_h:
              h = random.randint(h, max_h)
          w = int(round(h * ratio))
          if (h - height) < 2 or (w - width) < 2:
              continue  # marginal padding is not helpful
  
          y = random.randint(0, max(0, h - height))
          x = random.randint(0, max(0, w - width))
          new_label = self._update_labels(
              label, (x, y, w, h), height, width
          )
          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 4 for calling the DetRandomPadAug obj's underlying member method code with example usage: obj._random_pad_proposal(label, height, width) and returns: , , x,  y,  w,  h,  new_label