Image generation predict

更新时间:
复制 MD 格式

The image generation predict component generates new images from a pre-trained generative adversarial network (GAN) model. Add the component to a Machine Learning Designer pipeline, connect a trained model, and run the pipeline to produce output images saved directly to OSS (Object Storage Service). It supports six GAN architectures: Deep Convolutional GAN (DCGAN), Wasserstein GAN with Gradient Penalty (WGAN-GP), Least Squares GAN (LSGAN), Graph GAN (GGAN), Progressive Growing of GAN (PGGAN), and Style Generative Adversarial Network (StyleGAN), covering image generation, image enhancement, and data enhancement use cases.

Prerequisites

Before you begin, ensure that you have:

  • A PAI Machine Learning Designer pipeline to add the component to

  • A pre-trained GAN model file accessible from an OSS path, or an upstream image generation component that outputs a model file

  • An OSS output path in the same bucket as the pre-trained model

Important

This component requires a GPU instance type. You must select a GPU instance type for the algorithm.

Supported computing resources

Deep Learning Containers (DLC)

Inputs and outputs

Input ports

The component accepts a model file through any of the following methods:

  • Connect an upstream Read File Data component that reads a model file from an OSS path.

  • Connect an upstream image generation component that produces a model file directly.

  • Leave the input port unconnected and specify the oss path for model parameter instead (see Parameters below).

Output port

The component writes generated images directly to OSS — there is no downstream output port. Images are saved to the OSS path specified in oss path for output dir.

Configure the component

Add and wire the component

  1. On the details page of a pipeline in Machine Learning Designer, drag the image generation predict component onto the canvas.

  2. Wire the model input: connect an upstream Read File Data or image generation component to the input port, or set oss path for model under the Fields Setting tab.

  3. Set the output path and model parameters under the Fields Setting and param setting tabs.

  4. Set compute resources under the Tuning tab. Select a GPU instance type — the algorithm requires GPU compute.

  5. Run the pipeline. Generated images are written to the OSS path specified in oss path for output dir.

Parameters

Fields Setting tab

ParameterRequiredDefaultDescription
oss path for modelNoNoneOSS path where the model file resides. Required only when no upstream Read File Data or image generation component is connected.
oss path for output dirYesNoneOSS path where generated images are saved. Must be in the same OSS bucket as the pre-trained model.

param setting tab

ParameterRequiredDefaultDescription
model typeYesdcganGAN architecture to use for image generation. Valid values: DCGAN, WGAN-GP, LSGAN, GGAN, PGGAN, StyleGAN.
num samplesYes16Total number of samples to be generated.
number batchesYes4Number of samples to be generated in each batch. Samples vary significantly across batches. For example, if 16 samples are to be generated, 4 samples are generated per batch.

Tuning tab

ParameterRequiredDefaultDescription
Select Resource Group > Public Resource GroupNoNoneInstance type and virtual private cloud (VPC) for the component. Select a GPU instance type — the algorithm requires GPU compute.
Dedicated resource groupNoNoneNumber of CPU cores, memory, shared memory, and GPUs for the component when using a dedicated resource group.
Maximum Running Duration (seconds)NoNoneTime limit for the component run. If exceeded, the job is terminated.

What's next

After the pipeline run completes, retrieve the generated images from the OSS path specified in oss path for output dir. Use the OSS console or OSS SDK to browse and download the output.