Introducing LiteRT : Google's high-performance runtime for on-device AI, formerly known as TensorFlow Lite.
Learn more
Send feedback
mediapipe_model_maker.face_stylizer.FaceStylizer
Stay organized with collections
Save and categorize content based on your preferences.
FaceStylizer for building face stylization model.
mediapipe_model_maker . face_stylizer . FaceStylizer (
model_spec : mediapipe_model_maker . face_stylizer . model_spec . ModelSpec
,
model_options : mediapipe_model_maker . face_stylizer . ModelOptions
,
hparams : mediapipe_model_maker . face_stylizer . HParams
)
Args
model_spec
Specification for the model.
model_options
Model options for creating face stylizer.
hparams
The hyperparameters for training face stylizer.
Attributes
w_avg
An average face latent code to regularize face generation in face
stylization.
Methods
create
View source
@classmethod
create (
train_data : mediapipe_model_maker . face_stylizer . dataset . classification_dataset . ClassificationDataset
,
options : mediapipe_model_maker . face_stylizer . FaceStylizerOptions
) -> 'FaceStylizer'
Creates and trains a face stylizer with input datasets.
Args
train_data
The input style image dataset for training the face stylizer.
options
The options to configure face stylizer.
Returns
A FaceStylizer instant with the trained model.
export_model
View source
export_model (
model_name : str = & #x27;face_stylizer.task'
)
Converts the model to TFLite and exports as a model bundle file.
Saves a model bundle file and metadata json file to hparams.export_dir. The
resulting model bundle file will contain necessary models for face
detection, face landmarks detection, and customized face stylization. Only
the model bundle file is needed for the downstream face stylization task.
The metadata.json file is saved only to interpret the contents of the model
bundle file. The face detection model and face landmarks detection model are
from https://storage.googleapis.com/mediapipe-assets/face_landmarker_v2.task
and the customized face stylization model is trained in this library.
Args
model_name
Face stylizer model bundle file name. The full export path is
{self._hparams.export_dir}/{model_name}.
stylize
View source
stylize (
data : mediapipe_model_maker . face_stylizer . dataset . classification_dataset . ClassificationDataset
) -> mediapipe_model_maker . face_stylizer . dataset . classification_dataset . ClassificationDataset
Stylizes the images represented by the input dataset.
Args
data
Dataset of input images, can contain multiple images.
Returns
A dataset contains the stylized images
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-05-07 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-05-07 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-05-07 UTC."]]