I am just starting out, but for some reason, I can't get it to detect any faces in any of my pictures. Are there any basic beginning steps you would recommend?
What I Did
~/faceRec$ python3 find_faces_in_picture.py
I found 0 face(s) in this photograph.
The unnknown.jpg image is in the same folder that im running the script in (faceRec)
from PIL import Image
import face_recognition
# Load the jpg file into a numpy array
image = face_recognition.load_image_file("unknown.jpg")
# Find all the faces in the image using the default HOG-based model.
# This method is fairly accurate, but not as accurate as the CNN model and not GPU accelerated.
# See also: find_faces_in_picture_cnn.py
face_locations = face_recognition.face_locations(image)
print("I found {} face(s) in this photograph.".format(len(face_locations)))
for face_location in face_locations:
# Print the location of each face in this image
top, right, bottom, left = face_location
print("A face is located at pixel location Top: {}, Left: {}, Bottom: {}, Right: {}".format(top$
# You can access the actual face itself like this:
face_image = image[top:bottom, left:right]
pil_image = Image.fromarray(face_image)
pil_image.show()
Is unknown.jpg a file included in the examples folder or one of your own files? All the example should "just work"
If it is one of your own image files, is it possible it's a jpeg image where the image is actually sideways but the image has an embedded EXIF rotation tag telling the program it needs to rotate the image before displaying it? If that's the case, you need to rotate the image yourself. This library won't do that automatically. This is a common source of problems if you originally took the picture on an iphone, for example. See this for more info.
face_recognition version: Click-6.7 Pillow-3.1.2 dlib-19.7.0 face-recognition-1.0.0 face-recognition-models-0.3.0 numpy-1.13.3 olefile-0.44 scipy-1.0.0
Python version: 3.5.2
Operating System: Ubuntu
Description
I am just starting out, but for some reason, I can't get it to detect any faces in any of my pictures. Are there any basic beginning steps you would recommend?
What I Did
The unnknown.jpg image is in the same folder that im running the script in (faceRec)