class_docstr: Prepare dataset for image Colorization.
  
  Args:
     ab_thresh(float): Thresh value for setting mask value.
     p(float): Probability for ignoring hint in an iteration.
     num_points(int): Number of selected hints in an iteration.
     samp(str): Sample method, default is normal.
     use_avg(bool): Whether to use mean in selected hint area.
     is_train(bool): Training process or not.
  
  Return:
      data(dict)：The preprocessed data for colorization.
docstr: This method seperates the L channel and AB channel, obtain hint, mask and real_B_enc as the input for colorization task.
  
  Args:
     img(np.ndarray|paddle.Tensor): LAB image.
  
  Returns:
      data(dict)：The preprocessed data for colorization.
docstr_tok: ["This","method","seperates","the","L","channel","and","AB","channel",",","obtain","hint",",","mask","and","real_B_enc","as","the","input","for","colorization","task",".","Args",":","img","(","np.ndarray|paddle.Tensor",")",":","LAB","image",".","Returns",":","data","(","dict",")","\uff1aThe","preprocessed","data","for","colorization","."]
code: def __call__(self, data_lab):
      """
      This method seperates the L channel and AB channel, obtain hint, mask and real_B_enc as the input for colorization task.
  
      Args:
         img(np.ndarray|paddle.Tensor): LAB image.
  
      Returns:
          data(dict)：The preprocessed data for colorization.
      """
      if type(data_lab) is not np.ndarray:
          data_lab = data_lab.numpy()
      data = {}
      A = 2 * 110 / 10 + 1
      data["A"] = data_lab[:, [0], :, :]
      data["B"] = data_lab[:, 1:, :, :]
      if self.ab_thresh > 0:  # mask out grayscale images
          thresh = 1.0 * self.ab_thresh / 110
          mask = np.sum(
              np.abs(
                  np.max(np.max(data["B"], axis=3), axis=2)
                  - np.min(np.min(data["B"], axis=3), axis=2)
              ),
              axis=1,
          )
          mask = mask >= thresh
          data["A"] = data["A"][mask, :, :, :]
          data["B"] = data["B"][mask, :, :, :]
          if np.sum(mask) == 0:
              return None
      data_ab_rs = np.round(
          (data["B"][:, :, ::4, ::4] * 110.0 + 110.0) / 10.0
      )  # normalized bin number
      data["real_B_enc"] = (
          data_ab_rs[:, [0], :, :] * A + data_ab_rs[:, [1], :, :]
      )
      data["hint_B"] = np.zeros(shape=data["B"].shape)
      data["mask_B"] = np.zeros(shape=data["A"].shape)
      data["hint_B"], data["mask_B"] = self.gethint(
          data["B"], data["hint_B"], data["mask_B"]
      )
      data["A"] = paddle.to_tensor(data["A"].astype(np.float32))
      data["B"] = paddle.to_tensor(data["B"].astype(np.float32))
      data["real_B_enc"] = paddle.to_tensor(
          data["real_B_enc"].astype(np.int64)
      )
      data["hint_B"] = paddle.to_tensor(
          data["hint_B"].astype(np.float32)
      )
      data["mask_B"] = paddle.to_tensor(
          data["mask_B"].astype(np.float32)
      )
      return data
  
imports: import paddle
  import numpy
label_desc: Use image node_id 2 for calling the ColorizePreprocess obj's underlying member method code with example usage: obj.__call__(data_lab) and returns: data, None