/
steps_for_face_recognition.txt
73 lines (58 loc) · 4.14 KB
/
steps_for_face_recognition.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
1. Create Program which create Dataset
-Using dlib library to detect the faces - dlib.get_frontal_face_detector()
-Taking the input and converting it into GrayScale
-Detecting the faces, croping them, aligning them and saving it into a folder
-Connecting it to the sqlite3 database for storing the information of students
2. Create Trainer and trained set
-Using createLBPHFaceRecognizer() to train the faces detected, there are two
other options as well -> createEigenFaceRecognizer() and createFisherFaceRecognizer()
(Should try these options as well)
-Using Image.open(imagePath).convert('L') to convert colored and GrayScale
images into bilevel images using Floyd-Steinberg dither
--dither – Dithering method, used when converting from mode “RGB” to “P” or
from “RGB” or “L” to “1”. Available methods are NONE or FLOYDSTEINBERG (default)
-call cv2.createLBPHFaceRecognizer().train(faces, np.array(Ids))
-save the yml file formed by above call
3. Create Program to recognize
-Creating a folder with the name of today's date and storing all the pictures taken today in this folder
-Taking a pictures and detecting as many faces as possible using dlib library
-Aligning all the faces detected one by one
-Appling createLBPHFaceRecognizer() on aligned faces to recognize the face
-Storing in an array how many total times, a particular student is recognized today
-----------------------------------------------------------------------------------------------------------------------------
-Resizing an image -> image2 = cv2.resize(image, (200, 200))
Better methods are available but this is simple
-----------------------------------------------------------------------------------------------------------------------------
-Showing an image using matplotlib
from matplotlib import pyplot as plt
plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([]) # to hide tick values on X and Y
plt.show()
-----------------------------------------------------------------------------------------------------------------------------
-shape_predictor_68_face_landmarks.dat(see landmarks_finding.py for finding the landmarks)
JAW_POINTS = list(range(0, 16))
RIGHT_BROW_POINTS = list(range(17, 21)) # right side of the person, left side for whoever is watching
LEFT_BROW_POINTS = list(range(22, 26))
NOSE_POINTS = list(range(27, 35))
RIGHT_EYE_POINTS = list(range(36, 42)) # right side of the person, left side for whoever is watching
LEFT_EYE_POINTS = list(range(41, 47))
MOUTH_POINTS = list(range(48, 68))
[Extra : inside the face boundary]FACE_POINTS = list(range(17, 68))
[Extra]CHIN_POINTS=list(range(6,11))
-----------------------------------------------------------------------------------------------------------------------------
Pillow uses : https://github.com/python-pillow/Pillow/issues/513
open, covert color palette, resize
-----------------------------------------------------------------------------------------------------------------------------
References ->
Dlib face detection(Important) - http://dlib.net/face_detector.py.html
https://github.com/davisking/dlib
http://dlib.net/imaging.html
Viola-Jones method(Not Important) -
https://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework
OpenCV Documentaion(Important) - http://docs.opencv.org/2.4/modules/contrib/doc/facerec/facerec_tutorial.html
OpenFace(Tried a lot to use) - http://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Schroff_FaceNet_A_Unified_2015_CVPR_paper.pdf
OpenFace website - https://cmusatyalab.github.io/openface/
FaceNet: A Unified Embedding for Face Recognition and Clustering(Still has to read this paper, found it on openface website) -
http://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Schroff_FaceNet_A_Unified_2015_CVPR_paper.pdf
Modern Face Recognition with Deep Learning - https://medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-deep-learning-c3cffc121d78#.rytb8kr0w
Great things done by people - https://github.com/ageitgey/face_recognition#face-recognition