批量换脸
批量双图换脸/换头合成,将源脸替换到目标场景图片上。语义规则:使用 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 | 是 | 输出目录 |
--config | 是 | YAML/JSON 配置文件路径(批量换脸必须使用配置文件) |
--concurrency | 否 | 类型:number;默认:3;并行执行数量 |
--max-retries | 否 | 类型:number;默认:0;失败重试次数 |
--skip-exist | 否 | 跳过已存在的输出文件 |
--dry-run | 否 | 仅预览计划,不执行 |
--no-progress | 否 | 禁用逐个任务的进度日志 |
--json | 否 | 以 JSON 格式输出结果 |
--json-output | 否 | 将结果写入指定 JSON 文件 |
--skill-name | 否 | 服务端归属的技能名称 |
配置项说明
| 配置项 | 必需 | 说明 |
|---|---|---|
scene | 是 | 目标场景图片(底图)路径 |
head | 是 | 源脸图片(提供人脸的一方)路径 |
prompt | 是 | 换脸效果描述 |