class_docstr: Distort an image with random configurations.
  
  Args:
      brightness_range (float, optional): A range of brightness. Default: 0.5.
      brightness_prob (float, optional): A probability of adjusting brightness. Default: 0.5.
      contrast_range (float, optional): A range of contrast. Default: 0.5.
      contrast_prob (float, optional): A probability of adjusting contrast. Default: 0.5.
      saturation_range (float, optional): A range of saturation. Default: 0.5.
      saturation_prob (float, optional): A probability of adjusting saturation. Default: 0.5.
      hue_range (int, optional): A range of hue. Default: 18.
      hue_prob (float, optional): A probability of adjusting hue. Default: 0.5.
class_docstr_tok: ["Distort","an","image","with","random","configurations",".","Args",":","brightness_range","(","float",",","optional",")",":","A","range","of","brightness",".","Default",":","0.5.","brightness_prob","(","float",",","optional",")",":","A","probability","of","adjusting","brightness",".","Default",":","0.5.","contrast_range","(","float",",","optional",")",":","A","range","of","contrast",".","Default",":","0.5.","contrast_prob","(","float",",","optional",")",":","A","probability","of","adjusting","contrast",".","Default",":","0.5.","saturation_range","(","float",",","optional",")",":","A","range","of","saturation",".","Default",":","0.5.","saturation_prob","(","float",",","optional",")",":","A","probability","of","adjusting","saturation",".","Default",":","0.5.","hue_range","(","int",",","optional",")",":","A","range","of","hue",".","Default",":","18.","hue_prob","(","float",",","optional",")",":","A","probability","of","adjusting","hue",".","Default",":","0.5","."]
code: def __call__(self, data):
      brightness_lower = 1 - self.brightness_range
      brightness_upper = 1 + self.brightness_range
      contrast_lower = 1 - self.contrast_range
      contrast_upper = 1 + self.contrast_range
      saturation_lower = 1 - self.saturation_range
      saturation_upper = 1 + self.saturation_range
      hue_lower = -self.hue_range
      hue_upper = self.hue_range
      ops = [
          functional.brightness,
          functional.contrast,
          functional.saturation,
          functional.hue,
      ]
      random.shuffle(ops)
      params_dict = {
          "brightness": {
              "brightness_lower": brightness_lower,
              "brightness_upper": brightness_upper,
          },
          "contrast": {
              "contrast_lower": contrast_lower,
              "contrast_upper": contrast_upper,
          },
          "saturation": {
              "saturation_lower": saturation_lower,
              "saturation_upper": saturation_upper,
          },
          "hue": {"hue_lower": hue_lower, "hue_upper": hue_upper},
      }
      prob_dict = {
          "brightness": self.brightness_prob,
          "contrast": self.contrast_prob,
          "saturation": self.saturation_prob,
          "hue": self.hue_prob,
      }
  
      im = data["img"].astype("uint8")
      im = Image.fromarray(im)
      for id in range(len(ops)):
          params = params_dict[ops[id].__name__]
          params["im"] = im
          prob = prob_dict[ops[id].__name__]
          if np.random.uniform(0, 1) < prob:
              im = ops[id](**params)
      data["img"] = np.asarray(im)
  
      for key in data.get("gt_fields", []):
          if key in ["alpha", "trimap"]:
              continue
          else:
              im = data[key].astype("uint8")
              im = Image.fromarray(im)
              for id in range(len(ops)):
                  params = params_dict[ops[id].__name__]
                  params["im"] = im
                  prob = prob_dict[ops[id].__name__]
                  if np.random.uniform(0, 1) < prob:
                      im = ops[id](**params)
              data[key] = np.asarray(im)
      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 RandomDistort obj's underlying member method code with example usage: obj.__call__(data) and returns: data