From 3396bfd8162399926fcc5632dc8e36457087ad11 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sat, 16 Jul 2022 11:46:28 +0100 Subject: [PATCH] topics ordered --- README.md | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index ca17cee..4b69c70 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,25 @@ df = DeepFace.find(img_path = "img1.jpg", db_path = "C:/workspace/my_db")

+**Embeddings** + +Face recognition models basically represent facial images as multi-dimensional vectors. Sometimes, you need those embedding vectors directly. DeepFace comes with a dedicated representation function. + +```python +embedding = DeepFace.represent(img_path = "img.jpg") +``` + +This function returns an array as output. The size of the output array would be different based on the model name. For instance, VGG-Face is the default model for deepface and it represents facial images as 2622 dimensional vectors. + +```python +assert isinstance(embedding, list) +assert len(embedding) == 2622 +``` + +Here, embedding is also plotted with 2622 slots horizontally. Each slot is corresponding to a dimension value in the embedding vector and dimension value is explained in the colorbar on the right. + +

+ **Face recognition models** - [`Demo`](https://youtu.be/i_MOwvhbLdI) Deepface is a **hybrid** face recognition package. It currently wraps many **state-of-the-art** face recognition models: [`VGG-Face`](https://sefiks.com/2018/08/06/deep-face-recognition-with-keras/) , [`Google FaceNet`](https://sefiks.com/2018/09/03/face-recognition-with-facenet-in-keras/), [`OpenFace`](https://sefiks.com/2019/07/21/face-recognition-with-openface-in-keras/), [`Facebook DeepFace`](https://sefiks.com/2020/02/17/face-recognition-with-facebook-deepface-in-keras/), [`DeepID`](https://sefiks.com/2020/06/16/face-recognition-with-deepid-in-keras/), [`ArcFace`](https://sefiks.com/2020/12/14/deep-face-recognition-with-arcface-in-keras-and-python/), [`Dlib`](https://sefiks.com/2020/07/11/face-recognition-with-dlib-in-python/) and `SFace`. The default configuration uses VGG-Face model. @@ -76,6 +95,9 @@ result = DeepFace.verify(img1_path = "img1.jpg", img2_path = "img2.jpg", model_n #face recognition df = DeepFace.find(img_path = "img1.jpg", db_path = "C:/workspace/my_db", model_name = models[1]) + +#embeddings +embedding = DeepFace.represent(img_path = "img.jpg", model_name = models[1]) ```

@@ -94,25 +116,6 @@ FaceNet, VGG-Face, ArcFace and Dlib are [overperforming](https://youtu.be/i_MOwv | OpenFace | 93.80% | - | | DeepID | - | 97.05% | -**Embeddings** - -Face recognition models basically represent facial images as multi-dimensional vectors. Sometimes, you need those embedding vectors directly. DeepFace comes with a dedicated representation function. - -```python -embedding = DeepFace.represent(img_path = "img.jpg", model_name = 'VGG-Face') -``` - -This function returns an array as output. The size of the output array would be different based on the model name. For instance, VGG-Face represents facial images as 2622 dimensional vectors. - -```python -assert isinstance(embedding, list) -assert len(embedding) == 2622 -``` - -Here, embedding is also plotted with 2622 slots horizontally. Each slot is corresponding to a dimension value in the embedding vector and dimension value is explained in the colorbar on the right. - -

- **Similarity** Face recognition models are regular [convolutional neural networks](https://sefiks.com/2018/03/23/convolutional-autoencoder-clustering-images-with-neural-networks/) and they are responsible to represent faces as vectors. We expect that a face pair of same person should be [more similar](https://sefiks.com/2020/05/22/fine-tuning-the-threshold-in-face-recognition/) than a face pair of different persons.