Face Recognition Tools
Project description
new_face
new_face repository includes face detection, face landmark, face alignment, and face recognition technique.
Installation
git clone https://github.com/Michael07220823/new_face.git
cd new_face/
pip install -r requirements
or
pip install new_face
Face Detection
import 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 Landmark
import 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 Alignment
import 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)
Reference
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
new_face-0.0.4.2.tar.gz
(15.8 kB
view hashes)
Built Distribution
new_face-0.0.4.2-py3-none-any.whl
(25.5 kB
view hashes)
Close
Hashes for new_face-0.0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22535a173bde87f9216bba9b3f612abf73864f9b03e8928cb757d760ada66159 |
|
MD5 | e4cbc4c3eb58c77f4181dcb9d61b42d7 |
|
BLAKE2b-256 | aaf9a222c1da285324ad8912b7d45d67a877e615872b7d91ad83187afd9da60c |