Face Verify API
Endpoint ini memungkinkan Anda untuk membandingkan dua gambar wajah untuk menentukan apakah keduanya adalah orang yang sama.
Endpoint
POST /v1/face/verify
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
database_name | string | Yes | Nama database untuk konteks verifikasi |
image_base64_1 | string | Yes | Gambar wajah pertama dalam format base64 |
image_base64_2 | string | Yes | Gambar wajah kedua dalam format base64 |
Request Example
json
{
"database_name": "default",
"image_base64_1": "data:image/jpeg;base64,...",
"image_base64_2": "data:image/jpeg;base64,..."
}
Response
Success Response
json
{
"message": "Face verification completed",
"data": {
"match": true,
"confidence": 0.662339141531108,
"raw_distance": 0.33766085846889204,
"threshold": 0.5
}
}
Response Fields
Field | Type | Description |
---|---|---|
message | string | Status message |
data.match | boolean | Apakah kedua wajah cocok berdasarkan threshold |
data.confidence | number | Nilai kepercayaan kecocokan (0-1) |
data.raw_distance | number | Jarak Euclidean antara fitur wajah |
data.threshold | number | Threshold yang digunakan untuk menentukan match |
Understanding Results
Match Decision
match: true
- Jika confidence >= threshold (0.5)match: false
- Jika confidence < threshold (0.5)
Confidence Levels
- 0.8-1.0: Sangat yakin sama orang
- 0.6-0.8: Yakin sama orang
- 0.4-0.6: Kemungkinan sama orang
- 0.2-0.4: Kemungkinan beda orang
- 0.0-0.2: Sangat yakin beda orang
Raw Distance
Raw distance adalah jarak Euclidean antara vektor fitur wajah:
- 0.0-0.3: Wajah sangat mirip
- 0.3-0.5: Wajah mirip
- 0.5-0.7: Wajah agak mirip
- 0.7-1.0: Wajah tidak mirip
- >1.0: Wajah sangat berbeda
Use Cases
1. Identity Verification
Memverifikasi apakah foto yang dikirim user cocok dengan foto profil mereka.
2. Duplicate Detection
Mendeteksi foto duplikat dalam database.
3. Access Control
Memverifikasi identitas untuk sistem kontrol akses.
Error Responses
400 Bad Request
json
{
"error": "Invalid image format",
"message": "Both images must be in base64 format"
}
422 Unprocessable Entity
json
{
"error": "Face detection failed",
"message": "Could not detect face in one or both images"
}