Face Find API
Endpoint ini memungkinkan Anda untuk mencari kecocokan wajah dalam database pribadi Anda.
Endpoint
POST /v1/face/find
Request Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
database_name | string | Yes | - | Nama database tempat pencarian akan dilakukan |
image_base64 | string | Yes | - | Gambar wajah dalam format base64 untuk dicari |
threshold | number | No | 0.5 | Nilai threshold untuk menentukan kecocokan (0-1) |
Request Example
json
{
"database_name": "default",
"image_base64": "data:image/jpeg;base64,...",
"threshold": 0.4
}
Response
Success Response with Matches
json
{
"message": "Face search completed",
"data": [
{
"imageId": "cGdH12x4sdY4xs0BnGHo",
"metadata": {}
"confidence": 0.4999999999999999
},
{
"imageId": "FPUIY1YtM7sHy9uoDXtk",
"metadata": {
"name": "John Doe"
},
"confidence": 0.6554356432234345
}
]
}
Success Response with No Matches
json
{
"message": "Face search completed",
"data": []
}
Response Fields
Field | Type | Description |
---|---|---|
message | string | Status message |
data | array | Array of matching faces |
data[].imageId | string | ID unik dari gambar yang cocok |
data[].metadata | string | Metadata dari gambar yang cocok |
data[].confidence | number | Nilai kepercayaan kecocokan (0-1) |
Understanding Threshold
- Threshold tinggi (0.7-0.9): Kecocokan yang sangat ketat, false positive rendah
- Threshold sedang (0.4-0.7): Kecocokan seimbang, cocok untuk kebanyakan kasus
- Threshold rendah (0.1-0.4): Kecocokan longgar, menangkap lebih banyak kemungkinan
Understanding Confidence
- 0.8-1.0: Kecocokan sangat kuat
- 0.6-0.8: Kecocokan kuat
- 0.4-0.6: Kecocokan sedang
- 0.2-0.4: Kecocokan lemah
- 0.0-0.2: Kecocokan sangat lemah
Error Responses
400 Bad Request
json
{
"error": "Invalid parameters",
"message": "Threshold must be between 0 and 1"
}
404 Not Found
json
{
"error": "Database not found",
"message": "The specified database does not exist"
}