face-transform

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Face Transform

人脸变换

Analyze and transform faces through AceDataCloud's Face API suite.
Setup: See authentication for token setup.
通过AceDataCloud的人脸API套件进行人脸分析与变换。
设置: 请查看身份验证文档进行令牌设置。

Quick Start

快速开始

bash
curl -X POST https://api.acedata.cloud/face/analyze \
  -H "Authorization: Bearer $ACEDATACLOUD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"image_url": "https://example.com/portrait.jpg"}'
bash
curl -X POST https://api.acedata.cloud/face/analyze \
  -H "Authorization: Bearer $ACEDATACLOUD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"image_url": "https://example.com/portrait.jpg"}'

Available APIs

可用API

EndpointPurposeDescription
POST /face/analyze
Face DetectionDetect face keypoints (90+ points per face)
POST /face/beautify
BeautificationApply beauty/decoration effects
POST /face/change-age
Age TransformMake a face look older or younger
POST /face/change-gender
Gender SwapTransform facial gender characteristics
POST /face/swap
Face SwapReplace one person's face with another
POST /face/cartoon
Cartoon StyleConvert portrait to animated/cartoon style
POST /face/detect-live
Liveness CheckDetect if a face image is from a live person
接口用途描述
POST /face/analyze
人脸检测检测人脸关键点(每张人脸90+个关键点)
POST /face/beautify
人像美化应用美颜/装饰效果
POST /face/change-age
年龄变换让人脸看起来更老或更年轻
POST /face/change-gender
性别转换变换面部性别特征
POST /face/swap
人脸互换将一个人的脸替换为另一个人的脸
POST /face/cartoon
卡通风格将人像转换为动画/卡通风格
POST /face/detect-live
活体检测检测人脸图像是否来自真人

Workflows

工作流程

1. Face Analysis

1. 人脸分析

Detect faces and extract 90+ keypoints per face.
json
POST /face/analyze
{
  "image_url": "https://example.com/photo.jpg"
}
Response includes detailed keypoints:
nose
,
mouth
,
left_eye
,
right_eye
,
left_eyebrow
,
right_eyebrow
,
contour
— each as arrays of
{x, y}
coordinates.
检测人脸并提取每张人脸的90+个关键点。
json
POST /face/analyze
{
  "image_url": "https://example.com/photo.jpg"
}
响应包含详细的关键点:
nose
mouth
left_eye
right_eye
left_eyebrow
right_eyebrow
contour
—— 每个都是
{x, y}
坐标数组。

2. Face Beautification

2. 人像美化

json
POST /face/beautify
{
  "image_url": "https://example.com/portrait.jpg"
}
json
POST /face/beautify
{
  "image_url": "https://example.com/portrait.jpg"
}

3. Age Transformation

3. 年龄变换

json
POST /face/change-age
{
  "image_url": "https://example.com/portrait.jpg"
}
json
POST /face/change-age
{
  "image_url": "https://example.com/portrait.jpg"
}

4. Gender Swap

4. 性别转换

json
POST /face/change-gender
{
  "image_url": "https://example.com/portrait.jpg"
}
json
POST /face/change-gender
{
  "image_url": "https://example.com/portrait.jpg"
}

5. Face Swap

5. 人脸互换

Replace the face in the target image with the face from the source.
json
POST /face/swap
{
  "source_image_url": "https://example.com/source-face.jpg",
  "target_image_url": "https://example.com/target-person.jpg"
}
将目标图像中的人脸替换为源图像中的人脸。
json
POST /face/swap
{
  "source_image_url": "https://example.com/source-face.jpg",
  "target_image_url": "https://example.com/target-person.jpg"
}

6. Cartoon Style

6. 卡通风格转换

json
POST /face/cartoon
{
  "image_url": "https://example.com/portrait.jpg"
}
json
POST /face/cartoon
{
  "image_url": "https://example.com/portrait.jpg"
}

7. Liveness Detection

7. 活体检测

json
POST /face/detect-live
{
  "image_url": "https://example.com/face-photo.jpg"
}
json
POST /face/detect-live
{
  "image_url": "https://example.com/face-photo.jpg"
}

Parameters

参数

Common

通用参数

ParameterRequiredDescription
image_url
Yes (most endpoints)Source face image URL
参数是否必填描述
image_url
是(大多数接口)源人脸图像URL

/face/swap

/face/swap

ParameterRequiredDescription
source_image_url
YesURL of the face to use (replaces the face)
target_image_url
YesURL of the image to put the face onto
callback_url
NoWebhook URL for async delivery
timeout
NoMax wait time in seconds (default: 120)
参数是否必填描述
source_image_url
要使用的人脸URL(用于替换)
target_image_url
要合成人脸的目标图像URL
callback_url
用于异步交付的Webhook URL
timeout
最大等待时间(秒,默认值:120)

/face/beautify

/face/beautify

ParameterRequiredDescription
image_url
YesImage URL
smoothing
NoSkin smoothing 0–100 (default: 10)
whitening
NoWhitening 0–100 (default: 30)
face_lifting
NoFace slimming 0–100 (default: 70)
eye_enlarging
NoEye enlarging 0–100 (default: 70)
参数是否必填描述
image_url
图像URL
smoothing
磨皮程度 0–100(默认值:10)
whitening
美白程度 0–100(默认值:30)
face_lifting
瘦脸程度 0–100(默认值:70)
eye_enlarging
大眼程度 0–100(默认值:70)

/face/analyze

/face/analyze

ParameterRequiredDescription
image_url
YesImage URL
mode
No
0
= all faces (default),
1
= largest face only
face_model_version
NoAlgorithm version (recommended:
3.0
)
need_rotate_detection
No
0
= disabled (default),
1
= enabled
参数是否必填描述
image_url
图像URL
mode
0
= 检测所有人脸(默认),
1
= 仅检测最大人脸
face_model_version
算法版本(推荐:
3.0
need_rotate_detection
0
= 禁用(默认),
1
= 启用

Gotchas

注意事项

  • All face APIs return results synchronously.
    /face/swap
    additionally supports an optional
    callback_url
    parameter for async delivery (pass it to receive the result via webhook instead of waiting inline)
  • Face analyze returns 90+ keypoints per detected face, supporting multiple faces in one image
  • Face swap uses
    source_image_url
    (the face to apply) and
    target_image_url
    (the body to apply it to)
  • All APIs are currently in Alpha stage — interfaces may evolve
  • Images should contain clearly visible, front-facing faces for best results
  • Liveness detection helps distinguish live photos from printed/screen photos
  • 所有人脸API均同步返回结果。
    /face/swap
    额外支持可选的
    callback_url
    参数用于异步交付(传入该参数后,将通过Webhook接收结果,而非等待即时响应)
  • 人脸分析接口会为每个检测到的人脸返回90+个关键点,支持单张图像中的多个人脸
  • 人脸互换接口使用
    source_image_url
    (要应用的人脸)和
    target_image_url
    (要合成的主体)
  • 所有API目前处于Alpha阶段——接口可能会迭代更新
  • 为获得最佳效果,图像应包含清晰可见的正面人脸
  • 活体检测可帮助区分真人照片与打印/屏幕显示的照片