class_docstr: Randomly crop while centered on uncertain area by a certain probability.
  
  Args:
      crop_size (tuple|list): The size you want to crop from image.
      p (float): The probability centered on uncertain area.
class_docstr_tok: ["Randomly","crop","while","centered","on","uncertain","area","by","a","certain","probability",".","Args",":","crop_size","(","tuple|list",")",":","The","size","you","want","to","crop","from","image",".","p","(","float",")",":","The","probability","centered","on","uncertain","area","."]
code: def __call__(self, data):
      idex = np.random.randint(low=0, high=len(self.crop_size))
      crop_w, crop_h = self.crop_size[idex]
  
      img_h = data["img"].shape[0]
      img_w = data["img"].shape[1]
      if np.random.rand() < self.prob:
          crop_center = np.where(
              (data["alpha"] > 0) & (data["alpha"] < 255)
          )
          center_h_array, center_w_array = crop_center
          if len(center_h_array) == 0:
              return data
          rand_ind = np.random.randint(len(center_h_array))
          center_h = center_h_array[rand_ind]
          center_w = center_w_array[rand_ind]
          delta_h = crop_h // 2
          delta_w = crop_w // 2
          start_h = max(0, center_h - delta_h)
          start_w = max(0, center_w - delta_w)
      else:
          start_h = 0
          start_w = 0
          if img_h > crop_h:
              start_h = np.random.randint(img_h - crop_h + 1)
          if img_w > crop_w:
              start_w = np.random.randint(img_w - crop_w + 1)
  
      end_h = min(img_h, start_h + crop_h)
      end_w = min(img_w, start_w + crop_w)
  
      data["img"] = data["img"][start_h:end_h, start_w:end_w]
      for key in data.get("gt_fields", []):
          data[key] = data[key][start_h:end_h, start_w:end_w]
  
      return data
  
imports: import os
  import random
  import string
  import cv2
  import numpy
  from paddleseg.transforms import functional
  from paddleseg.cvlibs import manager
  from paddleseg.utils import seg_env
  from PIL import Image
label_desc: Use image node_id 2 for calling the RandomCropByAlpha obj's underlying member method code with example usage: obj.__call__(data) and returns: data, data