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: Check if constrains are satisfied
docstr_tok: ["Check","if","constrains","are","satisfied"]
code: def _check_satisfy_constraints(
      self, label, xmin, ymin, xmax, ymax, width, height
  ):
      """Check if constrains are satisfied"""
      if (xmax - xmin) * (ymax - ymin) < 2:
          return False  # only 1 pixel
      x1 = float(xmin) / width
      y1 = float(ymin) / height
      x2 = float(xmax) / width
      y2 = float(ymax) / height
      object_areas = self._calculate_areas(label[:, 1:])
      valid_objects = np.where(object_areas * width * height > 2)[0]
      if valid_objects.size < 1:
          return False
      intersects = self._intersect(
          label[valid_objects, 1:], x1, y1, x2, y2
      )
      coverages = (
          self._calculate_areas(intersects)
          / object_areas[valid_objects]
      )
      coverages = coverages[np.where(coverages > 0)[0]]
      return (
          coverages.size > 0
          and np.amin(coverages) > self.min_object_covered
      )
  
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 5 for calling the DetRandomCropAug obj's underlying member method code with example usage: obj._check_satisfy_constraints(label, xmin, ymin, xmax, ymax, width, height) and returns: unknown, False, False