Face stylization guide

The MediaPipe Face Stylizer task lets you apply face stylizations to faces in an image. You can use this task to create virtual avatars in various styles.

The task uses the BlazeFaceStylizer model, which consists of a face generator and a face encoder. The BlazeStyleGAN face generator, which is a lightweight implementation of the StyleGAN model family, generates and edits faces according to a specified style. The face encoder, which uses a MobileNet V2 backbone, maps input images to the faces generated by the face generator.

Try it!

Get Started

Start using this task by following one of these implementation guides for your target platform. These platform-specific guides walk you through a basic implementation of this task, using a recommended model and code examples with the recommended configuration options:

Task details

This section describes the capabilities, inputs, outputs, and configuration options of this task.

Features

  • Input image processing - Processing includes image rotation, resizing, normalization, and color space conversion.
Task inputs Task outputs
Still images Face Stylizer outputs an image with a stylization of the most prominent face from the input image.

Configurations options

This task has the following configuration options:

Option Name Description Value Range Default Value
errorListener Sets an optional error listener. N/A Not set

Models

The Face Stylizer requires a face stylization model to be downloaded and stored in your project directory. The face stylization models in this section are based on the BlazeStyleGAN architecture. Each model was trained to apply a specific style to faces within input images.

Color sketch

The model transforms faces into an image that mimics a sketch with colored pencil strokes and brush strokes. The style used to train this model is shown below:

Color sketch output

Model name Input shape Quantization type Versions
Color sketch 256 x 256 x 3 Float32 Latest

Color ink

The model transforms faces into an image that mimics a watercolor painting. The style used to train this model is shown below:

Color ink output

Model name Input shape Quantization type Versions
Color ink 256 x 256 x 3 Float32 Latest

Oil painting

The model transforms faces into an image that mimics an oil painting. The style used to train this model is shown below:

oil painting output

Model name Input shape Quantization type Versions
Oil painting 256 x 256 x 3 Float32 Latest