批量换脸

批量双图换脸/换头合成,将源脸替换到目标场景图片上。语义规则:使用 B 的脸放到 A 上,B 为源脸,A 为目标场景。

meitu batch image-face-swap

注意:批量处理功能自 meitu-cli 2.1.1 起开始支持,低版本请先升级后再使用。

使用示例

# 场景一:配置文件模式(批量换脸)
meitu batch image-face-swap \
  --config ./batch.face-swap.yaml \
  --output-dir ./outputs \
  --json

# 场景二:高并发批量换脸
meitu batch image-face-swap \
  --config ./batch.face-swap.yaml \
  --output-dir ./outputs \
  --concurrency 3 \
  --max-retries 1 \
  --json-output ./result.json

配置文件示例

version: 1
defaults:
  outputDir: ./outputs
items:
  - scene: ./scenes/man_in_suit.jpg
    head: ./faces/person1.jpg
    prompt: 自然换脸融合
  - scene: ./scenes/woman_dress.jpg
    head: ./faces/person2.jpg
    prompt: 自然换脸融合
  - scene: ./scenes/group_photo.jpg
    head: ./faces/person3.jpg
    prompt: 精细换脸,保持自然

参数说明

参数必需说明
--output-dir输出目录
--configYAML/JSON 配置文件路径(批量换脸必须使用配置文件)
--concurrency类型:number;默认:3;并行执行数量
--max-retries类型:number;默认:0;失败重试次数
--skip-exist跳过已存在的输出文件
--dry-run仅预览计划,不执行
--no-progress禁用逐个任务的进度日志
--json以 JSON 格式输出结果
--json-output将结果写入指定 JSON 文件
--skill-name服务端归属的技能名称

配置项说明

配置项必需说明
scene目标场景图片(底图)路径
head源脸图片(提供人脸的一方)路径
prompt换脸效果描述