AI 美颜
  • iOS : Objective-C
  • Android
  • macOS
  • Windows
  • 产品简介
    • 概述
    • 发布日志
    • 计费说明
  • 下载
  • 体验 App
  • 快速开始
    • 跑通示例源码
    • 集成 SDK
    • 导入资源和模型
    • 在线鉴权
    • 实现图像处理
  • 基础功能
  • 最佳实践
  • 客户端 API
  • 常见错误码
  • 常见问题
  • 文档中心
  • AI 美颜
  • 快速开始
  • 导入资源和模型

导入资源和模型

更新时间:2024-01-12 15:33

1 概览

在使用 ZegoEffects SDK 提供的 AI 功能前,请在 下载 页面,获取最新版本的 AI 资源或模型:

  • 如果需要使用美颜,美型,美白,白牙,红润,挂件贴纸等功能,请先导入对应的资源。
  • 如果需要使用大眼、瘦脸、人像分割等功能,请先导入对应的模型。

2 使用步骤

  1. 指定 AI 资源和模型的绝对路径。请在 下载 页面,获取最新版本的 AI 资源或模型(bundle/model 文件)。

    // 传入模型和资源的绝对路径。美颜,美型,美白,白牙,红润,挂件贴纸功能均须导入资源。大眼、瘦脸、人像分割功能须导入模型。
    NSString *commonResources = [[NSBundle mainBundle] pathForResource:@"CommonResources" ofType:@"bundle"];
    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"];
    
    // 传入人脸识别模型的绝对路径。人脸检测、大眼、瘦脸功能均须导入
    NSString *faceDetectionModelPath = [[NSBundle mainBundle] pathForResource:@"FaceDetectionModel" ofType:@"model"];
    
    // 传入人像分割模型的绝对路径。AI 人像分割功能须导入
    NSString *segmentationModelPath = [[NSBundle mainBundle] pathForResource:@"SegmentationModel" ofType:@"model"];
    
    NSArray<NSString *> * resourcesList = @[commonResources, faceWhiteningResources, pendantResources, teethWhiteningResources, rosyResources,faceDetectionModelPath,segmentationModelPath];
  2. 在调用 create 接口创建对象之前,先调用 setResources 接口传入模型和资源路径列表,加载模型和资源。

    // 传入模型和资源路径列表,必须在 create 之前调用
    [ZegoEffects setResources:resourcesList];

3 支持的模型和资源

当前 ZegoEffects SDK 支持的模型和资源,请参考下表:

资源/模型 描述 支持功能
CommonResources 美颜美型通用资源 美颜、美型
FaceWhiteningResources 美白颜色查找表资源 美白
PendantResources 挂件贴纸资源 挂件
RosyResources 红润颜色查找表资源 红润
TeethWhiteningResources 白牙颜色查找表资源 白牙
FaceDetectionModel 人脸检测模型 人脸检测、大眼、瘦脸
SegmentationModel 人像分割模型 人像分割
本篇目录