verify function detail

This commit is contained in:
Sefik Ilkin Serengil 2020-02-11 10:31:57 +03:00 committed by GitHub
parent 37a427a149
commit bafd1020f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "VGG-Face", distan
## Verification
Verification function returns a tuple including boolean verification result, distance between two faces and max threshold to identify.
Verification function returns a tuple including boolean verification result, distance between two faces and max threshold to identify (this shows difference based on face recognition model and similarity metric).
```
(True, 0.281734, 0.30)
@ -62,17 +62,6 @@ found_distance = result[1] #distance of two face vectors
max_threshold_to_verify = result[2] #faces have a distance less than this value will be verified
```
Instead of using pre-tuned threshold values, you can alternatively check the distance by yourself.
```python
distance = result[1] #the less the better
threshold = 0.30 #threshold for VGG-Face and Cosine Similarity
if distance < threshold:
return True
else:
return False
```
# Facial Attribute Analysis
Deepface also offers facial attribute analysis including [`age`](https://sefiks.com/2019/02/13/apparent-age-and-gender-prediction-in-keras/), [`gender`](https://sefiks.com/2019/02/13/apparent-age-and-gender-prediction-in-keras/), [`emotion`](https://sefiks.com/2018/01/01/facial-expression-recognition-with-keras/) and [`race`](https://sefiks.com/2019/11/11/race-and-ethnicity-prediction-in-keras/) predictions. Analysis function under the DeepFace interface is used to find demography of a face.