# AI 发型发长检测

# 概览
AI 发长测量为护发品牌与理发店提供快速方案，分析并测量头发长度，便于据此做出个性化产品与服务的决策。
我们的 AI 在海量、多样的图片数据集上精心训练，确保 AI 发型发长检测精准可靠。它分析数千张各种发质与发型的图片，能准确识别并归入五种发长，从耳上到背部中段，准确度出众。
![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/hair_length_S1_01_enu_b03bd393af.jpg)
## 接入指南
* AI 发型发长检测怎么拍照
* 正脸自拍一张
  - 拍一张清楚的照片即可，正对镜头。头发散下放下来、垂到胸前，视线直视前方，做出正对镜头的角度。
  - 也可以用 JS Camera Kit 拍照。同样把头发散下放下来、垂到胸前，不要扎起来。
* 如何用 AI 检测发长
* 请用 ***/s2s/v2.0/file*** 接口上传以下素材：
  - 您的自拍照片。
* 执行 AI 任务 ***/s2s/v2.0/task/hair-length-detection*** 
送一张正脸自拍图片来执行 AI 发型发长检测任务，把它的文件 ID 作为 AI 的输入源。
* 轮询任务状态，直到成功或报错
用这个 ***task_id*** 轮询 GET 'task/hair-length-detection' 监控任务状态，取得引擎当前的处理进度。引擎完成任务之前，状态会一直是 'running'，这一阶段不消耗点数。

## 发长分级
| 缩略图 | 发长分级 | 说明 |
|  --- | --- | --- |
| ![](https://d3ss46vukfdtpo.cloudfront.net/static/media/thumb_hair_lenth_above_the_ears.b41525da.png) | 耳上长度 | 头发刚好垂在耳朵上方，利落时髦，把脸型衬得很好看。 |
| ![](https://d3ss46vukfdtpo.cloudfront.net/static/media/thumb_hair_lenth_ear_length.0740b805.png) | 齐耳长度 | 头发垂到耳垂，俏皮百搭，打理起来省心。 |
| ![](https://d3ss46vukfdtpo.cloudfront.net/static/media/thumb_hair_lenth_short_hair.d7f24ddb.png) | 短发 | 头发剪在肩膀以上，清爽现代，既个性又好打理。 |
| ![](https://d3ss46vukfdtpo.cloudfront.net/static/media/thumb_hair_lenth_above_chest.1b624c17.png) | 中长发 | 头发垂到锁骨附近，长度恰到好处，盘发、披发都合适。 |
| ![](https://d3ss46vukfdtpo.cloudfront.net/static/media/thumb_hair_lenth_longer_hair.7fbcc9d0.png) | 长发 | 长发尽显优雅，气质经典，造型选择多。 |

* 结果参数
* term: result 是一个字符串，表示检测出的发长类型。所有可能的结果字符串列在下面的数组中：

```json
["above the ears", "ear length", "ear length or longer", "short hair", "short hair or longer", "above chest", "above chest or longer", "long hair"]
```
* 拍摄建议
![Suggestions for How to Shoot](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/AI%20Hair%20Length%20Detection_how%20to%20shoot.png)

![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/AI%20Skin%20Analysis_camera.png)
## 文件规格与错误码
* 支持的格式与尺寸

| 类型 | 支持尺寸 | 支持文件大小 | 支持格式 |
|  --- | --- | --- | --- |
| AI 发型发长检测 | 图片宽高至少 320 像素，任一维度不超过 4096 像素。若某一边超过 1080 像素，会自动缩放到该上限以内进行分析。 | < 10MB | jpg/png |

* 错误码

| 错误码 | 说明 |
|  --- | --- |
| error_below_min_image_size | 图片宽或高小于 320 像素，尺寸过小，无法使用 |
| error_face_position_invalid | 脸部需完整可见，不能被裁掉一部分 |
| error_face_position_too_small | 照片中的人脸过小，无法准确分析 |
| error_face_position_out_of_boundary | 脸部过大，或部分超出照片边缘 |
| error_insufficient_lighting | 光线太暗，分析起来很困难 |
| error_face_angle_invalid | 脸部角度不太对。正脸拍摄时，头部偏离正向请在 10 度以内；侧脸拍摄时，角度应大于 15 度 |

* 运行环境与依赖

| 示例代码语言 / 工具 | 建议运行时版本 |
|  --- | --- |
| cURL | - bash >= 3.2   - curl >= 7.58 (modern TLS/HTTP support)   - jq >= 1.6 (robust JSON parsing) |
| Node.js (JavaScript) | Node >= 18 (for global fetch) |
| JavaScript | - Chrome / Edge >= 80   - Firefox >= 74   - Safari >= 13.1 |
| PHP | PHP >= 7.4 (for modern TLS/compat), ext-curl (recommended) or allow_url_fopen=On + ext-openssl, ext-json |
| Python | Python >= 3.10 (for f-strings), requests >= 2.20.0 |
| Java | Java 11+ (for HttpClient), Jackson Databind >= 2.12.0 |



---

## JS Camera Kit


---

## 点数消耗
| AI 功能 | 消耗点数 |
|  --- | --- |
| AI 发型发长检测 V1.0 | 2 |



---

License: Privacy policy

## Servers

```
https://yce-api-01.makeupar.com
```

## Security

### BearerAuthenticationV2

使用标准的 Bearer 鉴权。把您的 API 密钥放进请求头： `Authorization:Bearer YOUR_API_KEY`。请注意 'Bearer' 与 'YOUR_API_KEY' 之间有一个空格。

Type: http
Scheme: bearer

## Download OpenAPI description

 - [AI 发型发长检测](https://docs.perfectcorp.com/_bundle/@l10n/zh-CN/reference/ai_hair_length_detection.yaml)

## V1.0

 - [POST /s2s/v2.0/task/hair-length-detection](https://docs.perfectcorp.com/zh-cn/reference/ai_hair_length_detection/v1.0/paths/~1s2s~1v2.0~1task~1hair-length-detection/post.md): 查询任务状态的方法，请参见轮询指南。
 - [GET /s2s/v2.0/task/hair-length-detection/{task_id}](https://docs.perfectcorp.com/zh-cn/reference/ai_hair_length_detection/v1.0/paths/~1s2s~1v2.0~1task~1hair-length-detection~1%7Btask_id%7D/get.md)
