new output shape of vgg is 4096

This commit is contained in:
Sefik Ilkin Serengil 2024-01-08 16:55:24 +00:00
parent f3551f7abf
commit d498d510bd
3 changed files with 5 additions and 5 deletions

View File

@ -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.
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/embedding.jpg" width="95%" height="95%"></p>

View File

@ -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")

View File

@ -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")