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
This component requires a GPU instance type. You must select a GPU instance type for the algorithm.
Supported computing resources
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
On the details page of a pipeline in Machine Learning Designer, drag the image generation predict component onto the canvas.
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.
Set the output path and model parameters under the Fields Setting and param setting tabs.
Set compute resources under the Tuning tab. Select a GPU instance type — the algorithm requires GPU compute.
Run the pipeline. Generated images are written to the OSS path specified in oss path for output dir.
Parameters
Fields Setting tab
| Parameter | Required | Default | Description |
|---|---|---|---|
| oss path for model | No | None | OSS path where the model file resides. Required only when no upstream Read File Data or image generation component is connected. |
| oss path for output dir | Yes | None | OSS path where generated images are saved. Must be in the same OSS bucket as the pre-trained model. |
param setting tab
| Parameter | Required | Default | Description |
|---|---|---|---|
| model type | Yes | dcgan | GAN architecture to use for image generation. Valid values: DCGAN, WGAN-GP, LSGAN, GGAN, PGGAN, StyleGAN. |
| num samples | Yes | 16 | Total number of samples to be generated. |
| number batches | Yes | 4 | Number 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
| Parameter | Required | Default | Description |
|---|---|---|---|
| Select Resource Group > Public Resource Group | No | None | Instance type and virtual private cloud (VPC) for the component. Select a GPU instance type — the algorithm requires GPU compute. |
| Dedicated resource group | No | None | Number of CPU cores, memory, shared memory, and GPUs for the component when using a dedicated resource group. |
| Maximum Running Duration (seconds) | No | None | Time 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.