Package: new-face
new_facenew_face repository includes face detection, face landmark, face alignment, and face recognition technique.Necessary softwarescmakegraphvizInstallationpip install -r requirementsorpip install new_faceorconda env create -f new_face36.yaml -n new_face36
conda env create -f new_face37.yaml -n new_face37
conda env create -f new_face38.yaml -n new_face38
conda env create -f new_face39.yaml -n new_face39Methods ListFace DetectionFace LandmarkFace AlignmentFace Recognitionhaar_detectdlib_5_pointsmtcnn_alignmentLBPHdlib_detectdlib_68_pointsdlib_alignmentOpenFacessd_dnn_detect××LBPCNNmtcnn_detect×××Face Detectionimport logging
import cv2
import imutils
from new_face import FaceDetection

FORMAT = '%(asctime)s [%(levelname)s] %(message)s'
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
logging.basicConfig(level=logging.INFO, format=FORMAT, datefmt=DATE_FORMAT)


image = cv2.imread("images/people.jpg")
resize_image = imutils.resize(image, width=1280)

face_detect = FaceDetection()
mtcnn = face_detect.load_detector(face_detect.MTCNN)

rois, raw_image, face_images = face_detect.mtcnn_detect(mtcnn,
                                                        resize_image,
                                                        conf_threshold=0.5,
                                                        vision=True,
                                                        save_path="images/mtcnn.jpg")Face Landmarkimport logging
import cv2
import imutils
from new_face import FaceLandmark

FORMAT = '%(asctime)s [%(levelname)s] %(message)s'
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
logging.basicConfig(level=logging.INFO, format=FORMAT, datefmt=DATE_FORMAT)


image = cv2.imread("images/people-3.jpg")
resize_image = imutils.resize(image, width=1280)

shape_5_predictor = FaceLandmark.load_shape_predictor("shape_predictor_5_face_landmarks.dat")
# shape_68_predictor = FaceLandmark.load_shape_predictor("shape_predictor_68_face_landmarks.dat")

face_points = FaceLandmark.dlib_5_points(image=resize_image,
                                        shape_predictor=shape_5_predictor,
                                        vision=True,
                                        save_path="images/dlib_5_points.jpg")

# face_points = FaceLandmark.dlib_68_points(image=resize_image,
#                                           shape_predictor=shape_68_predictor,
#                                           vision=True,
#                                           save_path="images/dlib_68_points.jpg")Face Alignmentimport logging
import cv2
import imutils
from new_face import FaceAlignment

FORMAT = '%(asctime)s [%(levelname)s] %(message)s'
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
logging.basicConfig(level=logging.INFO, format=FORMAT, datefmt=DATE_FORMAT)


image = cv2.imread("images/people-2.jpg")
resize_image = imutils.resize(image, width=1280)

face_alignment = FaceAlignment()
mtcnn_detector = face_alignment.load_detector(face_alignment.MTCNN)

rois, raw_image, face_images = face_alignment.mtcnn_alignment(mtcnn_detector,
                                                              resize_image,
                                                              conf_threshold=0.9,
                                                              vision=True,
                                                              save_dir="images/align",
                                                              face_size=256)Face RecognitionDataset Structure├─dataset│  └─YaleB_align_256│   ├─yaleB11│   ├─yaleB12│   ├─yaleB13│   ├─yaleB15...Train and Predict ModelTrainLBPHmodelpython train_lbph.pyTrainOpenFacemodelpython train_openface.pyTrainLBPCNNmodelpython train_lbpcnn.pyPredict byLBPHmodelpython predict_lbph.pyPredict byOpenFacemodelpython predict_openface.pyPredict byLBPCNNmodelpython predict_lbpcnn.pyReferenceSHEN, YUEH-CHUN, "LBPCNN Face Recognition Algorithm Implemented on the Raspberry Pi Access Control Monitoring System", 2021