This commit is contained in:
Şefik Serangil 2020-02-10 17:21:21 +03:00
commit b05434f82a

View File

@ -24,6 +24,8 @@ facenet_result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "Facenet")
openface_result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "OpenFace") openface_result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "OpenFace")
``` ```
VGG-Face has the highest accuracy score but it is not convenient for real time studies because of its complex structure. Facenet is a complex model as well. On the other hand, OpenFace has a close accuracy score but it performs the fastest. That's why, OpenFace is much more convenient for real time studies.
## Similarity ## Similarity
These models actually find the vector embeddings of faces. Decision of verification is based on the distance between vectors. Distance could be found by different metrics such as [`Cosine Similarity`](https://sefiks.com/2018/08/13/cosine-similarity-in-machine-learning/), Euclidean Distance and L2 form. The default configuration finds the **cosine similarity**. You can alternatively set the similarity metric while verification as demostratred below. These models actually find the vector embeddings of faces. Decision of verification is based on the distance between vectors. Distance could be found by different metrics such as [`Cosine Similarity`](https://sefiks.com/2018/08/13/cosine-similarity-in-machine-learning/), Euclidean Distance and L2 form. The default configuration finds the **cosine similarity**. You can alternatively set the similarity metric while verification as demostratred below.
@ -34,8 +36,6 @@ result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "VGG-Face", distan
result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "VGG-Face", distance_metric = "euclidean_l2") result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "VGG-Face", distance_metric = "euclidean_l2")
``` ```
VGG-Face has the highest accuracy score but it is not convenient for real time studies because of its complex structure. Facenet is a complex model as well. On the other hand, OpenFace has a close accuracy score but it performs the fastest. That's why, OpenFace is much more convenient for real time studies.
## Verification ## 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.
@ -67,8 +67,8 @@ Deepface also offers facial attribute analysis including [`age`](https://sefiks.
```python ```python
from deepface import DeepFace from deepface import DeepFace
demography = DeepFace.analyze("img.zip") #passing nothing as 2nd argument will find everything demography = DeepFace.analyze("img.jpg") #passing nothing as 2nd argument will find everything
#demography = DeepFace.analyze("img.zip", ['age', 'gender', 'race', 'emotion']) #identical to above line #demography = DeepFace.analyze("img.jpg", ['age', 'gender', 'race', 'emotion']) #identical to above line
``` ```
Analysis function returns a json object. Analysis function returns a json object.
@ -147,4 +147,4 @@ There are many ways to support a project - starring⭐ the GitHub repos is ju
# Licence # Licence
Chefboost is licensed under the MIT License - see [`LICENSE`](https://github.com/serengil/deepface/blob/master/LICENSE) for more details. Deepface is licensed under the MIT License - see [`LICENSE`](https://github.com/serengil/deepface/blob/master/LICENSE) for more details.