AI Effects
  • iOS : Objective-C
  • Android
  • Overview
  • Release notes
  • SDK downloads
  • Demo app
  • Sample codes
  • Getting started
    • Integrate the SDK
    • Import resources and models
    • Online authentication
    • Implement basic image processing
  • Guides
    • Face beautification
    • Face shape retouch
    • Beauty makeups
    • Background segmentation
    • Face detection
    • Stickers
    • Filters
  • Tutorials
  • Error codes
  • Documentation
  • AI Effects
  • Getting started
  • Import resources and models

Import resources and models

Last updated:2022-04-19 16:17

Introduction

Before you can use the AI features of the ZegoEffects SDK, you need to import the resources or models required for these features.

  • To use the features such as skin tone enhancement, teeth whitening, cheek blusher, and stickers, import the related resources first.
  • To use the features such as eyes enlarging, face slimming, and portrait segmentation, import the related models first.

Implementation steps

  1. Specify the absolute path of the AI ​​resources or models.

    // Specify the absolute path of the resources or models. Specify the absolute path of resources for the features such as skin tone enhancement, teeth whitening, cheek blusher, and stickers.  Specify the absolute path of models for the features such as portrait segmentation, eyes enlarging, and face slimming.
    NSString *faceWhiteningResources = [[NSBundle mainBundle] pathForResource:@"FaceWhiteningResources" ofType:@"bundle"];
    NSString *pendantResources = [[NSBundle mainBundle] pathForResource:@"PendantResources" ofType:@"bundle"];
    NSString *teethWhiteningResources = [[NSBundle mainBundle] pathForResource:@"TeethWhiteningResources" ofType:@"bundle"];
    NSString *rosyResources = [[NSBundle mainBundle] pathForResource:@"RosyResources" ofType:@"bundle"];
    
    // Specify the absolute path of the face recognition model, which is required for features such as face detection, eyes enlarging, and face slimming.
    NSString *faceDetectionModelPath = [[NSBundle mainBundle] pathForResource:@"FaceDetectionModel" ofType:@"model"];
    
    // Specify the absolute path of the portrait segmentation model, which is required for the AI portrait segmentation feature.
    NSString *segmentationModelPath = [[NSBundle mainBundle] pathForResource:@"SegmentationModel" ofType:@"model"];
    
    NSArray<NSString *> * resourcesList = @[faceWhiteningResources, pendantResources, teethWhiteningResources, rosyResources,faceDetectionModelPath,segmentationModelPath];
  1. Before calling the create method to create a ZegoEffects object, call the setResources method to set the resource or model path list and load the resources and models.

    // Set the path list for resources or models, which must be called before calling the `create` method to create a ZegoEffects object.
      [ZegoEffects setResources:resourcesList;

Supported resources and models

The following table shows the resources and models that the SDK currently supports:

Resource Description Supported feature
FaceWhiteningResources Color lookup table resources for skin tone enhancement. Skin tone enhancement
PendantResources Sticker resources 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
Page Directory