Compare commits

..

7 Commits

Author SHA1 Message Date
Oli
2fbe3e77ab submission complete 2021-02-28 22:30:55 +01:00
Oli
88a1fd5940 draft complete 2021-02-28 03:53:27 +01:00
Oli
e733042b09 add .pkl files 2021-02-28 03:53:06 +01:00
Oli
c9f88940e6 add images and thumbs 2021-02-28 03:52:52 +01:00
Oli
0c0acf2d99 test images added 2021-02-27 16:03:40 +01:00
Oli
da22bd776d protect private images 2021-02-27 14:30:31 +01:00
Oli
3a97e37db9 vscode settings added 2021-02-27 12:33:56 +01:00
39 changed files with 734 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.vscode/settings.json
images/private
*.pkl

BIN
dicaprio.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

661
face_recognition.ipynb Normal file

File diff suppressed because one or more lines are too long

70
face_recognition.py Normal file
View File

@@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
"""Untitled0.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/15cy6ue9c3bBkppUv3w09d9JJNebdeBuV
"""
# Install deepface framework.
!pip install deepface
# Install matplotlib
!pip install matplotlib
!pip install dlib
# Load deepface libary
from deepface import DeepFace
# Import OpenCV to read images
import cv2
# Import matplotlib to plot images
import matplotlib.pyplot as plt
import pandas as pd
def verify(img1_path, img2_path):
# read images
img1 = cv2.imread('images/' + img1_path)
img2 = cv2.imread('images/' + img2_path)
# plot images
img1 = cv2.cvtColor(img1, cv2.COLOR_BGR2RGB)
plt.imshow(img1)
plt.show()
img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2RGB)
plt.imshow(img2)
plt.show()
# Loop models and print results
models = ["DeepFace", "Facenet", "VGG-Face", "Dlib"]
for model in models:
result = DeepFace.verify('images/' + img1_path, 'images/' + img2_path, model_name = model)
print (model + ' result: ', result)
verify("angelinajolie2.jpg", "angelinajolie4.jpg")
verify("jenniferaniston.jpg", "reesewitherspoon.jpg")
def find(img_path):
# read images
img = cv2.imread(img_path)
# plot images
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img)
plt.show()
# Loop models and print results
models = ["DeepFace", "Facenet", "VGG-Face"]
for model in models:
result = DeepFace.find(img_path, db_path = "images", model_name = model, distance_metric = 'cosine')
print (model + ' result: ', result)
# plot all verified images
for result_table in result.iloc:
print("File: " + result_table.identity)
# plot image
img = cv2.imread(result_table.identity)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img)
plt.show()
find("dicaprio.jpg")

BIN
images/angelinajolie.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

BIN
images/angelinajolie2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
images/angelinajolie3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

BIN
images/angelinajolie4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
images/angelinajolie5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 KiB

BIN
images/bradpitt.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

BIN
images/bradpitt3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

BIN
images/bradpitt4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

BIN
images/dicaprio_gatsby.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
images/jenniferaniston.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

BIN
images/reesewitherspoon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
images/stevecarell.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
images/stevecarell2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

BIN
thumbs/angelinajolie.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
thumbs/angelinajolie2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
thumbs/angelinajolie3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
thumbs/angelinajolie4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
thumbs/angelinajolie5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
thumbs/bradpitt.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
thumbs/bradpitt3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
thumbs/bradpitt4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
thumbs/dicaprio.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
thumbs/dicaprio_gatsby.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
thumbs/jenniferaniston.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
thumbs/reesewitherspoon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
thumbs/stevecarell.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
thumbs/stevecarell2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB