Git Product home page Git Product logo

Comments (7)

serengil avatar serengil commented on June 5, 2024

Good spot. If we add the normalization name into the pickle file, then this will be sorted easily.

similarly, expand_percentage, align arguments have an impact on representations but these are also discarded, too. these should be added into the file name.

from deepface.

AndreaLanfranchi avatar AndreaLanfranchi commented on June 5, 2024

`expand_percentage" does not have an impact on representations as those are constrained by fixed size input by each model. I don't think is relevant.

More relevant instead the "align" argument.

from deepface.

serengil avatar serengil commented on June 5, 2024

that is another bug. we should consider expand_percentage while we are finding bulk embeddings here - https://github.com/serengil/deepface/blob/master/deepface/modules/recognition.py#L173

from deepface.

AndreaLanfranchi avatar AndreaLanfranchi commented on June 5, 2024

that is another bug. we should consider expand_percentage while we are finding bulk embeddings here - https://github.com/serengil/deepface/blob/master/deepface/modules/recognition.py#L173

I don't think. Expansion of a facial area doesn't have any impact on representation.
But as you wish ... I only signalled a condition. Won't spend more time on this.

from deepface.

serengil avatar serengil commented on June 5, 2024

Expand percentage has definitely an impact on embeddings.

from deepface import DeepFace

img_path = "target.jpg"

DeepFace.represent(img_path=img_path, model_name="Facenet")[0]["embedding"][0:10]
DeepFace.represent(img_path=img_path, model_name="Facenet", expand_percentage=10)[0]["embedding"][0:10]

You can see the representation of same image with different expand_percentage values.

[0.47962263226509094,
 1.0006622076034546,
 1.0271168947219849,
 -0.6997617483139038,
 0.5685179233551025,
 -0.8650573492050171,
 1.301469087600708,
 0.4709436297416687,
 0.6177820563316345,
 1.1736094951629639]
[0.07209590077400208,
 1.220704197883606,
 1.0250455141067505,
 -1.0584845542907715,
 0.7029904723167419,
 -0.8850963711738586,
 0.9492990970611572,
 0.7604453563690186,
 0.7631895542144775,
 0.7458571791648865]

from deepface.

AndreaLanfranchi avatar AndreaLanfranchi commented on June 5, 2024

I'll try to eplain: for me the usage and the meaning of expand_percentage is totally off and it should not even apply.
There are multiple reasons:

  1. Each detector has its own ways to define a face bounding box: some more squared some more rectangular. But they have one thing in common: the boundaries of the bounding box are exactly what are meant to be the boundaries of a detected face
  2. expand_dims increases the boundaries of such facial area potentially including portions of the image which have nothing to do with the face
  3. embeddings are always computed on a fixed size (each model has its own) input shape which means two things: 1) the wider (the more expanded facial area) the more CPU costs to resize the image and 2) the more "noise" around the face the more the embeddings get apart

Expand percentage has definitely an impact on embeddings.

Of course ... if you expand the facial area the resized input for the model receives a "smaller face" hence different embeddings
Long story short : imo expand_percentage introduces a distortion argument which tampers with detections and embeddings.
I only think it could be useful for visualization purposes : hence I completely removed it in my fork and won't reason again on it.

from deepface.

serengil avatar serengil commented on June 5, 2024

Closed with PR - #1185

from deepface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.