Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ArbitraryStyleTransferNetwork

Main ArbitraryStyleTransferNetwork class

Hierarchy

  • ArbitraryStyleTransferNetwork

Index

Constructors

constructor

  • ArbitraryStyleTransferNetwork constructor.

    Parameters

    • Default value styleCheckpointURL: string = DEFAULT_STYLE_CHECKPOINT

      Path to style model checkpoint directory.

    • Default value transformCheckpointURL: string = DEFAULT_TRANSFORM_CHECKPOINT

      Path to transformation model checkpoint directory.

    Returns ArbitraryStyleTransferNetwork

Methods

dispose

  • dispose(): void

initialize

  • initialize(): Promise<void>
  • Loads models from the checkpoints.

    Returns Promise<void>

isInitialized

  • isInitialized(): boolean
  • Returns true if model is initialized.

    Returns boolean

stylize

  • stylize(content: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, style: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, strength?: number): Promise<ImageData>
  • This function stylizes the content image given the style image. It returns an ImageData instance containing the stylized image.

    TODO(vdumoulin): Add option to resize style and content images. TODO(adarob): Add option to use model with depthwise separable convs.

    Parameters

    • content: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement

      Content image to stylize

    • style: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement

      Style image to use

    • Optional strength: number

      If provided, controls the stylization strength. Should be between 0.0 and 1.0.

    Returns Promise<ImageData>

Generated using TypeDoc