•
├── images
│ ├── test-1.jpg
│ └── test-2.jpg
└── face-makeup-on-image.py
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find the mean of the pixels | |
x.mean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# detect face from image using cnn_face_detector | |
all_face_locations = cnn_face_detector(face_image, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing required libraries | |
import cv2 | |
import face_recognition | |
import os | |
import numpy as np | |
# initialize the empty list of name label | |
known_face_names = [] | |
# initialize the empty list for storing the encoding of each face |
•
├── training-images
│ ├── Barack Obama.jpg
│ ├── Narendra Modi.jpg
│ ├── Boris Johnson.jpg
│ ├── Donald Trump.jpg
│ └── Justin Trudeau.jpg
├── models
│ ├── mmod_human_face_detector.dat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TOLERANCE defines the tolerance for face comparisons | |
# The lower the number - the stricter the comparison | |
# To avoid false matches, use lower value | |
# To avoid false negatives (i.e. faces of the same person doesn't match), use higher value | |
# 0.5-0.6 works well | |
TOLERANCE = 0.50 | |
# This function returns the name of the person whose image matches with the given face (or 'Unknown Face') | |
# face_encoding is the face encoding of the face we are looking for | |
def find_match(face_encoding): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# capture the video from default camera | |
# video_stream = cv2.VideoCapture(0) | |
# read video from video file | |
video_file_path = 'test/face-demographics-walking.mp4' | |
video_stream = cv2.VideoCapture(video_file_path) | |
# initialize the number of frame needed to be skipped | |
skip = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing required libraries | |
import cv2 | |
import numpy as np | |
from keras.preprocessing import image | |
from keras.models import model_from_json | |
import face_recognition | |
# only for google colab | |
# from google.colab.patches import cv2_imshow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing required libraries | |
import cv2 | |
import numpy as np | |
from keras.preprocessing import image | |
from keras.models import model_from_json | |
import face_recognition | |
# only for google colab | |
# from google.colab.patches import cv2_imshow |
NewerOlder