FaceNet can be applied to face grouping and face classification, and judge the similarity of faces through Euclidean distance, and then achieve face recognition.
[Instruction]
The solution process is:
Prepare images-> Train -> Face image inference.
Prepare images -> Face image grouping.
Prepare images -> Face image comparison.
1. 1_preprocess.ipynb
Extract face images from the images in data/image and data/image_test, scale them to 160x160 pixel, and save them in the data/image-160 and data/image_test folders.
Remarks:
The image of data/image is for training; the image of data/image_test is for testing.
The face image extracted by data/image_test will be additionally stored in data/clustering_image for use by 3_clustering.ipynb.
The images of each folder in data/image and data/image_test must be images of the same person.
The image file format must be .jpg or .png or .jpeg.
2. 2_classifier.ipynb
Training the face image classifier will be used in 5~8.
3. 3_clustering.ipynb
Prepare images -> Face image grouping.
Divide the images prepared at point 1 and the similar faces into one category, and save the results in the data/clustering_result folder.
4. 4_compare.ipynb
Prepare images -> Face image comparison.
Input six images, compare yourself with the other five images, and output the result matrix. The smaller the number, the more likely the face image is the same person.
5. 5_inference.ipynb
Input an image, classify it according to the classification model trained by 2_classifier.ipynb, and infer who the person in the image is.
Parameter Description:
input_image is the image path to be inferred.
input_pkl is the path of the classification model trained by 2_classifier.ipynb. It is not recommended to change the file location and name.
6. 6_inference_folder.ipynb
Enter the location of the image folder to be inferred, classify according to the classification model trained by 2_classifier.ipynb, and infer the person in the image in the folder.
Parameter Description:
input_image is the path of the image folder to be inferred.
input_pkl is the path of the classification model trained by 2_classifier.ipynb. It is not recommended to change the file location and name.
7. 7_inference_webcam.ipynb
Turn on the webcam and infer who the person photographed by the webcam is.
Parameter Description:
--deviceNumber 0 :0 refers to the webcam number used. If the user has more than one webcam, he can set it by himself.
8. 8_inference_api.ipynb
Use the webpage to select an image and infer who the person in the image is.
Parameter Description:
--port 8801: 8801 is the port occupied by the FaceNet webpage.
After running, if the port is not changed, you can use 9_inference_api_browser.ipynb to open the webpage.
This SDK is built in AppForAI - AI Dev Tools.
Purchase license separately: USD 600, permanent authorization, single APP authorization, single machine authorization, one-year activation, one-year download, one-year update, one-year email technical support.
Contact Us and How to Buy
Welcome to contact us. Please refer to the following link:
https://www.myai168.com/article/index?sn=11059