Skip to content

Commit

Permalink
new output shape of vgg is 4096
Browse files Browse the repository at this point in the history
  • Loading branch information
serengil committed Jan 8, 2024
1 parent f3551f7 commit d498d51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion tests/test_enforce_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_represent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down

0 comments on commit d498d51

Please sign in to comment.