Open leonardofmed opened 6 years ago
I am interested in implementing a solution similar to this, I have been investigating the model training and looking for a viable solution for implementation, without reaching yet.
I still have not been able to do this.
According to the example in file: face_recognition_knn.py in line 90 and 91 is written like this:
X.append(face_recognition.face_encodings(image, known_face_locations=face_bounding_boxes)[0]) y.append(class_dir)
and line 95 is: n_neighbors = int(round(math.sqrt(len(X))))
and I found that in line 100: knn_clf = neighbors.KNeighborsClassifier(n_neighbors=n_neighbors, algorithm=knn_algo, weights='distance') knn_clf.fit(X, y)
The example seems that it use X, y and n_neighbors to generate the data knn_clf and use it to save the .clf file.
I'm just thinking that the program may store the data (X, y and n_neighbors) in a new directory variable or object first, and dump it into a file (let say a FaceDB file), rather than saving the knn_clf (.clf)
Think about split this example into 2 python program, 1 for trainning, and 1 for face recognition. The trainning program generate the first version of FaceDB file, then, we can open the same FaceDB file, and add more face encodings data into X and y (line 90, 91), and update n_neighbors (line 95) and update the FaceDB file.
For the face recognition, first step would be open the FaceDB file and go for the KNeighborsClassifier function (line 100) and then process the face recognition part...
Is it possible?