logo
On this page

Import resources and models


Introduction

This document will introduce how to import the AI resources and models provided by ZegoEffects SDK.

Implementation Steps

  1. 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.

    Note

    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.

  2. 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.

    Untitled
    // 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 before 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 or later, 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 or later. 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"]];
    
    1
    Copied!
  3. 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.

    Untitled
    // Pass in the model and resource path list, must be called before create
    [ZegoEffects setResources:resourcesList];
    
    1
    Copied!

Supported Models and Resources

Please refer to the table below for the models and resources supported by the current ZegoEffects SDK:

Resource/ModelDescriptionSupported Functions
CommonResourcesCommon resources for Face beautification and Face shape retouchFace beautification, Face shape retouch
FaceWhiteningResourcesColor lookup table resources for skin tone enhancement.Skin tone enhancement
PendantResourcesSticker resources(Only versions before 2.0.0 support)Stickers
RosyResourcesColor lookup table resources for cheek blusherCheek blusher
TeethWhiteningResourcesColor lookup table resources for teeth whiteningTeeth whitening
FaceDetectionModelFace detection modelFace detection, eyes enlarging, and face slimming
SegmentationModelPortrait segmentation modelPortrait segmentation
SkinColorResourcesSkin color adjustment resources for Face beautificationDark skin, Wheatish, Cold white, Warm white, Pink white
ClarityResourcesResources for clarity function in Face beautificationClarity

Previous

Import the SDK

Next

Online Authentication