Skip to main content

new_face

new_face repository includes face detection, face landmark, face alignment, and face recognition technique.


Necessary softwares

  1. cmake
  2. graphviz

Installation

pip install -r requirements

or

pip install new_face

or

conda 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_face39

Methods List

Face Detection Face Landmark Face Alignment Face Recognition
haar_detect dlib_5_points mtcnn_alignment LBPH
dlib_detect dlib_68_points dlib_alignment OpenFace
ssd_dnn_detect × × LBPCNN
mtcnn_detect × × ×

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)

Face Recognition

Dataset Structure

 ├─dataset
 │ └─YaleB_align_256
 │  ├─yaleB11
 │  ├─yaleB12
 │  ├─yaleB13
 │  ├─yaleB15
     .
     .
     .

Train and Predict Model

Train LBPH model

python train_lbph.py

Train OpenFace model

python train_openface.py

Train LBPCNN model

python train_lbpcnn.py

Predict by LBPH model

python predict_lbph.py

Predict by OpenFace model

python predict_openface.py

Predict by LBPCNN model

python predict_lbpcnn.py

Reference

Metadata

Release files for new-face 0.0.4.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for new-face 0.0.4.6
File Size Uploaded Provenance Actions
new_face-0.0.4.6.tar.gz 16.6 kB Without provenance Details for new_face-0.0.4.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for new-face 0.0.4.6
File Interpreter ABI Platform Actions
new_face-0.0.4.6-py3-none-any.whl Python 3 none any Details for new_face-0.0.4.6-py3-none-any.whl

Total release size: 42.4 kB

Release files / new_face-0.0.4.6.tar.gz

Download URL new_face-0.0.4.6.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4e71906598d8ff96cd81cdb7475e7d26456ad6e04c5b9b2cb5a4b92ef491a8c4
BLAKE2b-256 checksum
How to use checksums
ee04da29aa84f7dcebf4f1a0b59f71599ba7ffd6449867155f0fcd21ee884445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.13

Release files / new_face-0.0.4.6-py3-none-any.whl

Download URL new_face-0.0.4.6-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24258f59a4a5232591b2efab6a655ce43cabaf0e2fb8372cffabe2da977b76e4
BLAKE2b-256 checksum
How to use checksums
5cfff9421a3a1f4f5ca36e4626b4fbb36f54deb87c652df6b0c30e7b494c63a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.13

Security for new-face 0.0.4.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page