Git Product home page Git Product logo

Comments (4)

buckeye17 avatar buckeye17 commented on May 29, 2024 1

Thanks @serengil and @AndreaLanfranchi!

Could I suggest that the "skip" option get a mention in the docstring? Here's what the docstring currently says for analyze():

        detector_backend (string): face detector backend. Options: 'opencv', 'retinaface',
            'mtcnn', 'ssd', 'dlib', 'mediapipe', 'yolov8' (default is opencv).

from deepface.

serengil avatar serengil commented on May 29, 2024

If you feed pre detected face to analyze, then set detector backend to skip.

Once a face is detected, it removes ears and it cannot extract face anymore from that manipulated image.

from deepface.

AndreaLanfranchi avatar AndreaLanfranchi commented on May 29, 2024

@buckeye17 to complete the answer please try to amend your last lines code to

if face_arr is not None:
    result = DeepFace.analyze(
        img_path=face_arr, 
        detector_backend = "skip",
        actions=["gender", "race"],
        )

There are basically two changes:

  1. detector_backend = "skip" this says the function the image you're feeding is already a detected face hence the stack won't try to re-detect the face once again
  2. actions=["gender", "race"] this tells the function which attributes to analyze. Note I've removed the "dominant_" prefix as that is part of the response. I mean when you analyze, say, "gender", you'll be returned the probability of gender man or woman and on behalf of the heaviest weight the "dominant_" attribute is also labelled.

Hope this helps.

from deepface.

serengil avatar serengil commented on May 29, 2024

Closed with PR - #1177

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.