Skip to content

Algorithm to identify user when wearing masks or such accessaries that covers the face

Notifications You must be signed in to change notification settings

jcdino/Facial-Recognition-for-Obscured-Faces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Face-Recognition-System-Robust-to-Identify-a-Covered-Face-using-Deep-Learning

Content

  1. Teammates
  2. Abstract
  3. Algorithm Diagram
  4. Process
  5. Code Instructions
  6. Result
  7. Citation

Teammates

Abstract

As an influence of the COVID 19 pandemic, everyone is required to wear a facial mask. This made it hard to identify the user’s face using the present facial recognition systems with portable devices. Using deep learning, our project resolves this problem by creating a system that identifies the user accurately and efficiently, even when the face is covered by an accessory.

Algorithm Diagram

그림1

Process

1. Accessory Detector

The model identifies the accessory the user is wearing. The model used the MobileNet V2 architecture with the weights of ImageNet. Fine tunined the model so that it only classifies the wanted accessories. 그림2

2. Face Recognizer

A pretrained ResNet10 is used to detect the ROI of the face and FaceNet is used for facial recognition. FaceNet is trained with the images of the registered users. The 128-D embeddings extracted from the face on each image which are used to determine the features of each user. This is done by using the triplet loss function. The model determines the identifies the person in the input image by comparing their embeddings and the features of the registered users, 그림3

3. Image Composition

If the face of the input image is covered by an accessory, the accuracy of the facial recognition is returned low. The image composition process resolves this problem by recreating the face of the input image into an uncovered face. The given graphs compares two situations: compositing images with the same user’s image and a different user’s image. The graphs show that compositing the image with the same user gives a higher accuracy. image image

Code Instructions

1. Run accessory_detector/train_accessory_detector.py

Excecution code : python train_accessory_detector.py --dataset dataset_accessory
The directory dataset_accessory has the datasets of default faces and faces with masks. You may add more images into each directories.
If you want to add the type of accessories to detect, create a new directory and add images of faces wearing it.
=> Output : accessory_detector.model

2. Go to dir output_creator

3. Download nn4.small2.v1.t7

nn4.small2.v1.t7 is copyright Carnegie Mellon University and licensed under the Apache 2.0 License.

4. Run codes

  • extract_embeddings_default.py
    Excecution Code : python codes/default/extract_embeddings_default.py --dataset dataset --embeddings output/embeddings_default.pickle --detector face_detection_model --embedding-model openface_nn4.small2.v1.t7
  • train_model_default.py
    Excecution Code : python codes/default/train_model_default.py --embeddings output/embeddings_default.pickle --recognizer output/recognizer_default.pickle --le output/le_default.pickle

4-1. Repeat step4 with mask

4-2. Test result

Test the outputs of step4 and step4-1 with cameras.
Excecution Code : python codes/mask/recognize_video_mask.py --detector face_detection_model --embedding-model openface_nn4.small2.v1.t7 --recognizer output/recognizer_mask.pickle --le output/le_mask.pickle

5. Go to dir main_module

6. Download shape_predictor_68_face_landmarks.dat

shape_predictor_68_face_landmarks.dat is licensed under the Boost Software License - Version 1.0.

7. Download nn4.small2.v1.t7

nn4.small2.v1.t7 is copyright Carnegie Mellon University and licensed under the Apache 2.0 License.

8. Move accessory_detector.model

From ../accessory_detector/accessory_detector.model to ../main_module/

9. Move outputs

From ../output_creator/output/ to ../main_module/output/

10. Run zzampong.py

Excecution Code : python zzampong.py --embedding-model openface_nn4.small2.v1.t7 --recognizer output/recognizer_default.pickle --le output/le_default.pickle --recognizer_mask output/recognizer_mask.pickle --le_mask output/le_mask.pickle

Result

- Primary Fcae Detector

image

- Secondary Face Detector

image If the marked score is higher than the pre-decided threshold, the system prints out the decided user’s name and device’s status(lock/unlock) to unlock.

Citation

  1. https://www.pyimagesearch.com/2020/05/04/covid-19-face-mask-detector-with-opencv-keras-tensorflow-and-deep-learning/
  2. https://www.pyimagesearch.com/2018/09/24/opencv-face-recognition/

About

Algorithm to identify user when wearing masks or such accessaries that covers the face

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages