This document will introduce how to import the AI resources and models provided by ZegoEffects SDK.
Before using the AI features provided by ZegoEffects SDK, please download the latest version of AI resources and models (files with the suffix bundle or model) from the downloads page of the SDK, and copy them to your project for later use.
If you need to use functions such as Face beautification, Face shape retouch, Skin tone enhancement, Teeth whitening, Cheek blusher, Stickers, Eyes enlarging, Face sliming, and Portrait segmentation, please import the corresponding resources and models from the SDK package first.
Specify the absolute path of the AI resources and models. Please download the latest version of AI resources and models (files with the suffix bundle or model) from the downloads page.
// Pass in the absolute paths of the models and resources. Resources and models for Face beautification, Face shape retouch, Skin tone enhancement, Teeth whitening, Cheek blusher, Stickers, Eyes enlarging, Face sliming, and Portrait segmentation need to be imported.
NSString *commonResources = [[NSBundle mainBundle] pathForResource:@"CommonResources" ofType:@"bundle"];
NSString *faceWhiteningResources = [[NSBundle mainBundle] pathForResource:@"FaceWhiteningResources" ofType:@"bundle"];
// Only versions below 2.0.0 support Stickers feature
NSString *pendantResources = [[NSBundle mainBundle] pathForResource:@"PendantResources" ofType:@"bundle"];
NSString *teethWhiteningResources = [[NSBundle mainBundle] pathForResource:@"TeethWhiteningResources" ofType:@"bundle"];
NSString *rosyResources = [[NSBundle mainBundle] pathForResource:@"RosyResources" ofType:@"bundle"];
// Only supported in version 2.0.0, resources for clarity function
NSString *clarityResources = [[NSBundle mainBundle] pathForResource:@"ClarityResources" ofType:@"bundle"];
// Pass in the absolute path of the face detection model. Face detection, Eyes enlarging, and Face sliming functions require importing this model.
NSString *faceDetectionModelPath = [[NSBundle mainBundle] pathForResource:@"FaceDetectionModel" ofType:@"model"];
// Pass in the absolute path of the portrait segmentation model. Portrait segmentation function requires importing this model.
NSString *segmentationModelPath = [[NSBundle mainBundle] pathForResource:@"SegmentationModel" ofType:@"model"];
NSArray<NSString *> * resourcesList = @[commonResources, faceWhiteningResources, pendantResources, teethWhiteningResources, rosyResources,faceDetectionModelPath,segmentationModelPath];
// Adjust skin color resources (Only supported in version 2.0.0. Options: meihei, maise, lengbai, nuanbai, fenbai)
// Example: meihei (dark skin)
NSString *skinColorFolderPath = [[NSBundle mainBundle] pathForResource:@"SkinColorResources" ofType:nil];
NSString *skinColorBundlePath = [skinColorFolderPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.bundle", @"meihei"]];
Before calling the create interface to create an object, call the setResources interface to pass in the model and resource path list to load the models and resources.
// Pass in the model and resource path list, must be called before create
[ZegoEffects setResources:resourcesList];
Please refer to the table below for the models and resources supported by the current ZegoEffects SDK:
Resource/Model | Description | Supported Functions |
---|---|---|
CommonResources | Common resources for Face beautification and Face shape retouch | Face beautification, Face shape retouch |
FaceWhiteningResources | Color lookup table resources for skin tone enhancement. | Skin tone enhancement |
PendantResources | Sticker resources(Only versions below 2.0.0 support) | Stickers |
RosyResources | Color lookup table resources for cheek blusher | Cheek blusher |
TeethWhiteningResources | Color lookup table resources for teeth whitening | Teeth whitening |
FaceDetectionModel | Face detection model | Face detection, eyes enlarging, and face slimming |
SegmentationModel | Portrait segmentation model | Portrait segmentation |
SkinColorResources | Skin color adjustment resources for Face beautification | Dark skin, Wheatish, Cold white, Warm white, Pink white |
ClarityResources | Resources for clarity function in Face beautification | Clarity |