From d498d510bdfa97da5d1698590450ad4de51ec9c1 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Mon, 8 Jan 2024 16:55:24 +0000 Subject: [PATCH] new output shape of vgg is 4096 --- README.md | 6 +++--- tests/test_enforce_detection.py | 2 +- tests/test_represent.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b136e6b..a4549c3 100644 --- a/README.md +++ b/README.md @@ -90,15 +90,15 @@ Face recognition models basically represent facial images as multi-dimensional v embedding_objs = DeepFace.represent(img_path = "img.jpg") ``` -This function returns an array as embedding. The size of the embedding array would be different based on the model name. For instance, VGG-Face is the default model and it represents facial images as 2622 dimensional vectors. +This function returns an array as embedding. The size of the embedding array would be different based on the model name. For instance, VGG-Face is the default model and it represents facial images as 4096 dimensional vectors. ```python embedding = embedding_objs[0]["embedding"] assert isinstance(embedding, list) -assert model_name = "VGG-Face" and len(embedding) == 2622 +assert model_name = "VGG-Face" and len(embedding) == 4096 ``` -Here, embedding is also [plotted](https://sefiks.com/2020/05/01/a-gentle-introduction-to-face-recognition-in-deep-learning/) 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. Similar to 2D barcodes, vertical dimension stores no information in the illustration. +Here, embedding is also [plotted](https://sefiks.com/2020/05/01/a-gentle-introduction-to-face-recognition-in-deep-learning/) with 4096 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. Similar to 2D barcodes, vertical dimension stores no information in the illustration.

diff --git a/tests/test_enforce_detection.py b/tests/test_enforce_detection.py index 7fa281d..74c4704 100644 --- a/tests/test_enforce_detection.py +++ b/tests/test_enforce_detection.py @@ -33,7 +33,7 @@ def test_disabled_enforce_detection_for_non_facial_input_on_represent(): assert "w" in objs[0]["facial_area"].keys() assert "h" in objs[0]["facial_area"].keys() assert isinstance(objs[0]["embedding"], list) - assert len(objs[0]["embedding"]) == 2622 # embedding of VGG-Face + assert len(objs[0]["embedding"]) == 4096 # embedding of VGG-Face logger.info("✅ disabled enforce detection with non facial input test for represent tests done") diff --git a/tests/test_represent.py b/tests/test_represent.py index 2dd68ea..4b45594 100644 --- a/tests/test_represent.py +++ b/tests/test_represent.py @@ -10,7 +10,7 @@ def test_standard_represent(): for embedding_obj in embedding_objs: embedding = embedding_obj["embedding"] logger.debug(f"Function returned {len(embedding)} dimensional vector") - assert len(embedding) == 2622 + assert len(embedding) == 4096 logger.info("✅ test standard represent function done")