Comments (8)
You could use multiple pictures of the same person a number of different ways. It just depends on your exact use case.
If you run face_recognition.face_encodings(picture_of_me)[0]
on 30 pictures of the same person, you'll have 30 different encodings of the same person. Each encoding is an array of 128 numbers.
All 30 should be almost equal to each other (within 0.6 in euclidian distance across all 128 numbers), but of course that might not be the case. So you could handle that different ways:
- You could compare each unknown picture separately against all 30 known samples of the same person. This would work, but would be slow as you scale to more people. But it's easy to tell when someone is not a match for any of the known people.
- You could train any kind of classifier (like an SVM or whatever) like you said. In that case, you would still get a prediction that your unknown person matches one of your known people even if they aren't really a match. But you should get a low confidence score which you can use to determine that the match isn't good enough to consider a real match. So you can use that to know.
It really all depends on your use case. There's other cool stuff you can do like get the encodings for every image in a folder and use the Chinese Whispers algorithm to automatically cluster every face into groups where each group is one real person (i.e. discover all the individual people in a batch of images).
from face_recognition.
The facial encoding was generated based on a pre-trainned data set, which in turn was generated by deep learning algorithm. This ensure a certain accuracy and uniqueness for the generated facial encoding. It is expected that even if you use multiple images of a same person, the encodings variance should be insignificant toward classification usage. Ofc you could always setup a SVM to further enhance the process but that will come at the cost of performance and setup complexity for enhancement which expected to be minimal.
from face_recognition.
I dont even bother...
from sklearn.svm import SVC
encodings_array = []
names_array = []
with open('data.json') as json_data:
nodes = json.load(json_data)
for node in nodes:
encodings_array.append(node['encoding'])
names_array.append(node['name'])
clf = SVC()
clf.fit(encodings_array, names_array)
I just have all the name of people(string) into an array and fit them in without encoding.
later on I do
name = clf.predict([face_encoding])[0]
and wolalala
from face_recognition.
Wouldn't it be more accurate to train with multiple images of each person? Multiple images could help to build an "average" encoding of the person.
So if inside the "known images" folder the script finds a person folder, it would encode its face based on the average of all that person's single encodings. That makes sense?
I wonder if it could be a feature for the lib, or you just tell me if I'm in the wrong direction
from face_recognition.
If I'd setup a SVM, what label should I take as target label?
My columns are "filepath, filename, e1, e2, e3... e128", where e[1-128] are the encoding values
from face_recognition.
Hi, the label can be the name of the person in the image. So, if you have, for example, 30 images for each person, you will have 30 arrays (face_encodings) with the label person1; then another 30 arrays with label person2 and further on. After, http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.LabelEncoder.html the labels can be encoded, in order to feed them to the SVM, http://scikit-learn.org/stable/auto_examples/svm/plot_iris.html#sphx-glr-auto-examples-svm-plot-iris-py. Therefore, fit (X, y, sample_weight=None) will receive as X the matrix with all the encodings(arrays) from all the pictures, and as y an array with all the labels.
from face_recognition.
This clarifies it a lot! Thanks
Just curious, SVC is a classifier, but what would you recommend to use to find similar faces? Just euclidian distance between encodings and then filtering using a threshold (~0.6).
Are there any other alternatives?
from face_recognition.
Great question @john-bonachon , I have just reaching this point myself.
In the original blog post of @ageitgey , he demonstrated using OpenFace demo classifier which used SVC.
You could check out this link for more classifiers available from sklearn
. I strongly recommend going through each in detail to find suitable configuration for your use case 🔎
from face_recognition.
Related Issues (20)
- Not working HOT 3
- Not accurate HOT 1
- Problem "ValueError: operands could not be broadcast together with shapes ( , ) (128, )" Solution
- fcaial recognition wrong person
- I want to detect whether the faces in the pictures are complete HOT 1
- Face similiarity for multiple images
- Fr
- test HOT 1
- Windows installation HOT 5
- Windows face_recognition run time error HOT 1
- Facial
- Shared My Dockerfile
- Face recognition in the Voynich manuscript
- face_recognition only works with obama. HOT 3
- kindly integrate face alignment step
- Import gets stuck while using it inside a myfunctions module
- Attribute error HOT 1
- dlib HOT 2
- image de-duplication by comparing faces images.
- Will your face_recognition application allow me to store pictures with names tide to them and just later down the line submit a new photo of someone who i dont remember i actually stored, and then the application when i send the photo identifies the person in the photo because its the exact person i stored of their name in a different photo i have saved?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from face_recognition.