文档中心
AI_Vision AI 美颜
文档中心
体验 App
SDK 中心
API 中心
常见问题
代码市场
进入控制台
立即注册
登录
中文站 English
  • 文档中心
  • AI 美颜
  • 快速开始
  • 导入资源和模型

导入资源和模型

更新时间:2025-04-15 16:22

本文档将为您介绍,如何导入 ZegoEffects SDK 内部提供的 AI 资源与模型。

实现流程

  1. 在使用 ZegoEffects SDK 提供的 AI 功能前,请在 下载 页面的 SDK 内部,获取最新版本的 AI 资源与模型(后缀为 bundle 或 model 的文件),并将其拷贝到您的工程中,以在后续步骤中使用。

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

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

    // 传入模型和资源的绝对路径。美颜,美型,美白,白牙,红润,挂件贴纸,大眼、瘦脸、人像分割功能须导入资源及模型。
    NSString *commonResources = [[NSBundle mainBundle] pathForResource:@"CommonResources" ofType:@"bundle"];
    NSString *faceWhiteningResources = [[NSBundle mainBundle] pathForResource:@"FaceWhiteningResources" ofType:@"bundle"];
    // 仅 2.0.0 之前版本支持挂件贴纸功能
    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 *colorfulStyleFolderResources = [[NSBunble mainBundle] pathForResource:@"ColorfulStyleResources", ofType:nil];
    NSString *colorfulStyleBundle = [colorfulStyleFolderResources stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.bundle", @"Authmn"]];
    // 美妆资源 (如眼线-自然)
    NSString *makeupFolderResources = [[NSBunble mainBundle] pathForResource:@"MakeupResources", ofType:nil];
    NSString *makeupBundle = [makeupFolderResources stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/%@.bundle", @"eyelinerdir",@"eyelashesdir_natural"]];
    
    // 只支持 2.0.0 及以后版本,清晰功能资源
    NSString *clarityResources = [[NSBundle mainBundle] pathForResource:@"ClarityResources" 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.0.0 及以后版本。美黑:meihei、麦色:maise、冷白:lengbai、暖白:nuanbai、粉白:fenbai)
    //例 美黑
    NSString *skinColorFolderPath = [[NSBundle mainBundle] pathForResource:@"SkinColorResources" ofType:nil];
    NSString *skinColorBundlePath = [skinColorFolderPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.bundle", @"meihei"]];
  3. 在调用 create 接口创建对象之前,先调用 setResources 接口传入模型和资源路径列表,加载模型和资源。

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

支持的模型和资源

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

资源/模型 描述 支持功能
CommonResources 美颜美型通用资源 美颜、美型
FaceWhiteningResources 美白颜色查找表资源 美白
PendantResources 挂件贴纸资源(仅 2.0.0 之前版本支持) 挂件
RosyResources 红润颜色查找表资源 红润
TeethWhiteningResources 白牙颜色查找表资源 白牙
ColorfulStyleResources 风格滤镜资源 滤镜
MakeupResources 美妆功能资源 腮红、眼睫毛、眼线、眼影、口红、美瞳
FaceDetectionModel 人脸检测模型 人脸检测、大眼、瘦脸
SegmentationModel 人像分割模型 人像分割
SkinColorResources 美颜调整肤色资源 美黑、麦色、冷白、暖白、粉白
ClarityResources 美颜清晰功能资源 清晰
本篇目录
  • 免费试用
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    咨询客服
    微信扫码,24h在线

    联系我们

  • 文档反馈