# 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*** API，請上傳以下資產：
  - 您的自拍照片。
* 執行 AI 任務 ***/s2s/v2.0/task/hair-length-detection*** 
傳送一張正面自拍圖片來執行髮長偵測任務。使用其檔案 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：結果為字串，顯示偵測到的髮長類型。以下以陣列列出所有可能的結果字串：

```json
["above the ears", "ear length", "ear length or longer", "short hair", "short hair or longer", "above chest", "above chest or longer", "long hair"]
```
* 拍攝建議
![拍攝建議](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（現代 TLS/HTTP 支援）   - jq >= 1.6（穩健的 JSON 解析） |
| Node.js（JavaScript） | Node >= 18（支援全域 fetch） |
| JavaScript | - Chrome / Edge >= 80   - Firefox >= 74   - Safari >= 13.1 |
| PHP | PHP >= 7.4（現代 TLS/相容性），ext-curl（建議）或 allow_url_fopen=On + ext-openssl、ext-json |
| Python | Python >= 3.10（支援 f-strings），requests >= 2.20.0 |
| Java | Java 11+（支援 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 authentication'。請在標頭中放入您的 'API Key'：`Authorization:Bearer YOUR_API_KEY`。請注意 'Bearer' 與 'YOUR_API_KEY' 之間有一個空格。

Type: http
Scheme: bearer

## Download OpenAPI description

 - [AI 頭髮長度分析](https://docs.perfectcorp.com/_bundle/@l10n/zh-TW/reference/ai_hair_length_detection.yaml)

## V1.0

 - [POST /s2s/v2.0/task/hair-length-detection](https://docs.perfectcorp.com/zh-tw/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-tw/reference/ai_hair_length_detection/v1.0/paths/~1s2s~1v2.0~1task~1hair-length-detection~1%7Btask_id%7D/get.md)
