docstr: :param image:  PIL input image
  :param gt_image: PIL input gt_image
  :return:
docstr_tok: [":","param","image",":","PIL","input","image",":","param","gt_image",":","PIL","input","gt_image",":","return",":"]
code: def _train_sync_transform(self, img, mask):
      """
      :param image:  PIL input image
      :param gt_image: PIL input gt_image
      :return:
      """
      if self.random_mirror:
          # random mirror
          a = random.random()
          if a < 0.5:
              img = img.transpose(Image.FLIP_LEFT_RIGHT)
              if mask:
                  mask = mask.transpose(Image.FLIP_LEFT_RIGHT)
          crop_w, crop_h = self.crop_size
  
      if self.random_crop:
          # random scale
          base_w, base_h = self.base_size
          w, h = img.size
          assert w >= h
          if (base_w / w) > (base_h / h):
              base_size = base_w
              short_size = random.randint(
                  int(base_size * 0.5), int(base_size * 2.0)
              )
              ow = short_size
              oh = int(1.0 * h * ow / w)
          else:
              base_size = base_h
              short_size = random.randint(
                  int(base_size * 0.5), int(base_size * 2.0)
              )
              oh = short_size
              ow = int(1.0 * w * oh / h)
  
          img = img.resize((ow, oh), Image.BICUBIC)
          if mask:
              mask = mask.resize((ow, oh), Image.NEAREST)
          # pad crop
          if ow < crop_w or oh < crop_h:
              padh = crop_h - oh if oh < crop_h else 0
              padw = crop_w - ow if ow < crop_w else 0
              img = ImageOps.expand(
                  img, border=(0, 0, padw, padh), fill=0
              )
              if mask:
                  mask = ImageOps.expand(
                      mask, border=(0, 0, padw, padh), fill=0
                  )
          # random crop crop_size
          w, h = img.size
          x1 = random.randint(0, w - crop_w)
          y1 = random.randint(0, h - crop_h)
          img = img.crop((x1, y1, x1 + crop_w, y1 + crop_h))
          if mask:
              mask = mask.crop((x1, y1, x1 + crop_w, y1 + crop_h))
      elif self.resize:
          img = img.resize(self.crop_size, Image.BICUBIC)
          if mask:
              mask = mask.resize(self.crop_size, Image.NEAREST)
  
      if self.gaussian_blur:
          # gaussian blur as in PSP
          b = random.random()
          c = random.random()
          # print(a,b,c)
          if b < 0.5:
              img = img.filter(ImageFilter.GaussianBlur(radius=c))
      # final transform
      if mask:
          img = self._img_transform(img)
          mask, edge_mask = self._mask_transform(mask)
          return img, mask, edge_mask
      else:
          img = self._img_transform(img)
          return img
  
file_path: PaddleSeg/contrib/DomainAdaptation/datasets/cityscapes_noconfig.py
imports: import os
  import random
  import numpy
  import collections.abc
  from PIL import Image, ImageOps, ImageFilter, ImageFile
  import paddle
  from paddle import io
  import paddleseg.transforms.functional
label_desc: Use image node_id 4 for calling the CityDataset obj's underlying member method code with example usage: obj._train_sync_transform(img, mask) and returns: img,  mask,  edge_mask, img