Comments (4)
I found dlib cannot detect face from the third and fifth images. But I do not understand why because all images are cropped from one image, on which 5 faces been successfully detected.
from face_recognition.
First, you can check the length of the array returned from face_recognition.face_encodings(known_image)
before accessing [0]
to prevent the basic error. If no faces are detected, the array will be empty.
Second, dlib is trying to find a face within the image. It's not trying to decide if the whole image is a face. Since you already have the images cropped to the whole face, you can skip the step of face detection by telling face_recognition where the face is located like this:
known_image = face_recognition.load_image_file("face_2.jpg")
# Since the image is already cropped, we know the face location is just the whole image size
face_location = (0, known_image.shape[1], known_image.shape[0], 0)
# Pass in an array of known face locations to skip the step of face detection
known_encoding = face_recognition.face_encodings(known_image, [face_location])[0]
print(known_encoding)
array([-0.07084331, 0.13144939, 0.06481101, -0.05566324, -0.10227886,
0.02378505, -0.02929443, -0.16121498, 0.09502754, -0.09116761,
0.16282618, 0.01120954, -0.22670874, -0.07019024, 0.07189877,
0.08362474, -0.13715625, -0.04159784, -0.13862796, -0.04521821,
0.06266126, 0.09748268, 0.06780834, -0.03782643, -0.09195558,
-0.32051048, -0.06524452, -0.07020397, 0.02561777, -0.06362872,
0.02519293, -0.03309638, -0.25325459, -0.05337401, -0.04081663,
0.02959361, -0.1108077 , -0.10953825, 0.20097654, -0.03071829,
-0.19747683, 0.10650204, 0.05199543, 0.17633158, 0.20601764,
-0.08934571, -0.00882005, -0.07672026, 0.15298177, -0.20318791,
0.06232864, 0.14546208, 0.10586035, 0.09767602, 0.07987885,
-0.03630037, 0.09194864, 0.12821943, -0.18550503, 0.01531077,
0.16177645, -0.11098912, -0.0145441 , -0.00749754, 0.13307199,
0.06760155, -0.06180105, -0.12176102, 0.0763557 , -0.10216746,
-0.0853331 , 0.01694381, -0.12842602, -0.12923945, -0.33743614,
0.06042334, 0.28734946, 0.14279479, -0.21950229, -0.00438824,
-0.12347218, 0.02389126, 0.0859604 , 0.06279413, -0.01622978,
-0.06947765, -0.07259755, 0.09392088, 0.17706268, -0.02612238,
-0.02010851, 0.31076789, 0.10003579, -0.02693687, 0.03024578,
0.05860615, -0.10163979, -0.08813927, -0.1216615 , 0.03181211,
0.0669135 , -0.1004982 , 0.00465229, 0.19129516, -0.24604803,
0.23892471, -0.00085283, -0.00195196, 0.07778236, -0.06403588,
-0.03284847, -0.00111775, 0.07869174, -0.20308636, 0.21220191,
0.12809221, -0.01532205, 0.09983703, 0.0276077 , 0.06673215,
-0.07806585, 0.00037921, -0.20924436, -0.12015466, 0.05508876,
0.06190829, 0.0230726 , 0.07592089])
That will run a lot faster anyway.
from face_recognition.
Thanks a lot! mate
from face_recognition.
Sure thing! It was a good question. :)
from face_recognition.
Related Issues (20)
- Jetson Nano 4GB: Segmentation fault (core dumped) - dlib and face_recognition HOT 1
- Doesn't works with ffmpeg 6.0_1
- Doesn't works
- 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
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.