Code Monkey home page Code Monkey logo

Comments (16)

jsniff avatar jsniff commented on May 5, 2024

Also when running the simple example, how can we print out the confidence of match?

from face_recognition.

sbourigault avatar sbourigault commented on May 5, 2024

Question 1 : compare_faces is just a wrapper that call face_distance and applies a threshold. You can add an extra parameter to it to specify the threshold. For instance, for a value of 0.8 :

results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding,0.8)

Question 2 : If you need to see the confidence value, use the function face_distance directly : it will return a list of distances between the list of candidate faces and the target face.

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

seems when i run basic example, i get an error about dlib. any thoughts on how to fix? i'm pretty sure i have it installed already:

import dlib
ImportError: No module named dlib

from face_recognition.

ageitgey avatar ageitgey commented on May 5, 2024

If you can't import dlib, then it's not installed (at least not for the version of Python you are running).

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

can your example be called on command line? Eg, for the basic example you gave, I would just run the below:

face_recognition known/ unknownpng/

How can I run it with compare_faces on command line?

from face_recognition.

ageitgey avatar ageitgey commented on May 5, 2024

Ah, good question. Unfortunately the command line application doesn't currently report confidence values. That's something I could add in the future, though.

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

so essentially I have to run your example as a script? something like below?

from PIL import Image
import face_recognition
results = face_recognition.compare_faces("Directory/known", "Directory/unknownjpg",0.8)

It seems not to like my input. Are [my_face_encoding], unknown_face_encoding meant to be directories or something else?

from face_recognition.

ageitgey avatar ageitgey commented on May 5, 2024

I think the confusion is that your original question was about the command-line application but the answer @sbourigault gave you was the answer if you are writing code using the python library instead. Those are two different things.

Unfortunately the command-line application doesn't currently return confidence values like you want. That's a new feature that would have to be added.

If you are familiar with Python coding and want to write your own script that acts like the command line application but returns those values, you could do that. But if you aren't, it might be easier to just wait until I have a chance to add that feature to the command-line application.

To answer your other question, the parameters to that function are not meant to be directories. The parameters expected by each function are listed in the API docs. There's also a minimal code example here that shows how it works.

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

ok got it. Think I have things working now!

from face_recognition.

ageitgey avatar ageitgey commented on May 5, 2024

Awesome! Glad it's working.

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

Why do you recommend a threshold distance of point 6? Is that in literature somewhere? If so, where? Point 6 isn't a lot? It is 0 to 1 right?

from face_recognition.

ageitgey avatar ageitgey commented on May 5, 2024

0.6 is what was most accurate with the training data set according to Davis King. See his post at http://blog.dlib.net/2017/02/high-quality-face-recognition-with-deep.html

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

"The network training started with randomly initialized weights and used a structured metric loss that tries to project all the identities into non-overlapping balls of radius 0.6. " So this means that lowering this to like point 2 or point 3 isn't going to give better results? Essentially he's somehow mapped things to point 6 if good fit? I'll have to read more papers later.

Separately, I also wish this code could sort the top matches. I ran it across a video and it returns sometimes several examples. It would be helpful to sort by confidence/distance and rank the results. But I don't think results are ranked in anyway.

from face_recognition.

ageitgey avatar ageitgey commented on May 5, 2024

If instead of calling face_recognition.compare_faces(), you instead call face_recognition.face_distance(), that will return the distance between each possible match and the image you are testing. Then you could call scipy.stats.rankdata() to turn that into a ranked list (assuming you have scipy installed).

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

@ageitgey Does this work well on any ethnicity? I'm trying to do some benchmarking on asian and chinese faces. I'm wondering how it will perform. Any idea if it will break down? My preliminary results on South American faces show several matches---I'm trying to reduce with confidence and understand, etc.

from face_recognition.

jsniff avatar jsniff commented on May 5, 2024

@ageitgey Also, when you run the program, normally from command line, it does return matches with distance greater than .6. I know this, b/c when I take the matches and compare them separately with the distance program, to try to help rank them and understand, it shows the distance and for some matches they’re greater than point6, even though threshold was that. How is this possible?

from face_recognition.

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.