def this()

in opencv/src/main/scala/com/microsoft/azure/synapse/ml/opencv/ImageTransformer.scala [426:515]


  def this() = this(Identifiable.randomUID("ImageTransformer"))

  val stages: ArrayMapParam = new ArrayMapParam(this, "stages", "Image transformation stages")

  def setStages(value: Array[Map[String, Any]]): this.type = set(stages, value)

  val emptyStages: Array[Map[String, Any]] = Array[Map[String, Any]]()

  def getStages: Array[Map[String, Any]] = if (isDefined(stages)) $(stages) else emptyStages

  private def addStage(stage: Map[String, Any]): this.type = set(stages, getStages :+ stage)

  val toTensor: BooleanParam = new BooleanParam(
    this,
    "toTensor",
    "Convert output image to tensor in the shape of (C * H * W)"
  )

  def getToTensor: Boolean = $(toTensor)
  def setToTensor(value: Boolean): this.type = this.set(toTensor, value)

  @transient
  private lazy val validElementTypes: Array[DataType] = Array(FloatType, DoubleType)
  val tensorElementType: DataTypeParam = new DataTypeParam(
    parent = this,
    name = "tensorElementType",
    doc = "The element data type for the output tensor. Only used when toTensor is set to true. " +
      "Valid values are DoubleType or FloatType. Default value: FloatType.",
    isValid = ParamValidators.inArray(validElementTypes)
  )

  def getTensorElementType: DataType = $(tensorElementType)
  def setTensorElementType(value: DataType): this.type = this.set(tensorElementType, value)

  val tensorChannelOrder: Param[String] = new Param[String](
    parent = this,
    name = "tensorChannelOrder",
    doc = "The color channel order of the output channels. Valid values are RGB and GBR. Default: RGB.",
    isValid = ParamValidators.inArray(Array("rgb", "RGB", "bgr", "BGR"))
  )

  def getTensorChannelOrder: String = $(tensorChannelOrder)
  def setTensorChannelOrder(value: String): this.type = this.set(tensorChannelOrder, value)

  val normalizeMean: DoubleArrayParam = new DoubleArrayParam(
    this,
    "normalizeMean",
    "The mean value to use for normalization for each channel. " +
      "The length of the array must match the number of channels of the input image."
  )

  def getNormalizeMean: Array[Double] = $(normalizeMean)
  def setNormalizeMean(value: Array[Double]): this.type = this.set(normalizeMean, value)

  val normalizeStd: DoubleArrayParam = new DoubleArrayParam(
    this,
    "normalizeStd",
    "The standard deviation to use for normalization for each channel. " +
      "The length of the array must match the number of channels of the input image."
  )

  def getNormalizeStd: Array[Double] = $(normalizeStd)
  def setNormalizeStd(value: Array[Double]): this.type = this.set(normalizeStd, value)

  val colorScaleFactor: DoubleParam = new DoubleParam(
    this,
    "colorScaleFactor",
    "The scale factor for color values. Used for normalization. " +
      "The color values will be multiplied with the scale factor.",
    ParamValidators.gt(0d)
  )

  def getColorScaleFactor: Double = $(colorScaleFactor)
  def setColorScaleFactor(value: Double): this.type = this.set(colorScaleFactor, value)

  setDefault(
    inputCol -> "image",
    outputCol -> (uid + "_output"),
    toTensor -> false,
    tensorChannelOrder -> "RGB",
    tensorElementType -> FloatType
  )

  def normalize(mean: Array[Double], std: Array[Double], colorScaleFactor: Double): this.type = {
    this
      .setToTensor(true)
      .setNormalizeMean(mean)
      .setNormalizeStd(std)
      .setColorScaleFactor(colorScaleFactor)
  }