From 9c2d9e456d63eab9ec8737fc5d320375fadfb248 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Mon, 9 Jan 2023 17:54:52 +0000 Subject: [PATCH 1/6] celebrity video link updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 344ee9b..21b34d9 100644 --- a/README.md +++ b/README.md @@ -306,7 +306,7 @@ You can use deepface not just for facial recognition tasks. It's very common to

-**Celebrity Look-Alike Prediction** - [`Vlog`](https://youtu.be/RMgIKU1H8DY), [`Tutorial`](https://sefiks.com/2019/05/05/celebrity-look-alike-face-recognition-with-deep-learning-in-keras/) +**Celebrity Look-Alike Prediction** - [`Vlog`](https://youtu.be/jaxkEn-Kieo), [`Tutorial`](https://sefiks.com/2019/05/05/celebrity-look-alike-face-recognition-with-deep-learning-in-keras/)

From a737fcbbc9d5cedfa38c6599241d880381af0d99 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Fri, 13 Jan 2023 14:00:05 +0000 Subject: [PATCH 2/6] retinaface removed in tests --- tests/unit_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 1e52971..a52c69d 100644 --- a/tests/unit_tests.py +++ b/tests/unit_tests.py @@ -33,7 +33,7 @@ def evaluate(condition): # ------------------------------------------------ -detectors = ['opencv', 'mtcnn', 'retinaface'] +detectors = ['opencv', 'mtcnn'] models = ['VGG-Face', 'Facenet', 'Facenet512', 'ArcFace', 'SFace'] metrics = ['cosine', 'euclidean', 'euclidean_l2'] @@ -240,4 +240,4 @@ if test_score > expected_coverage: else: print("min required test coverage is NOT satisfied") -assert test_score > expected_coverage \ No newline at end of file +assert test_score > expected_coverage From e31cfe4bc86101949d63cc385d0c3f612b2b1452 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Mon, 16 Jan 2023 15:41:07 +0000 Subject: [PATCH 3/6] doc string --- deepface/DeepFace.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/deepface/DeepFace.py b/deepface/DeepFace.py index d4dd779..9e7ba91 100644 --- a/deepface/DeepFace.py +++ b/deepface/DeepFace.py @@ -80,7 +80,7 @@ def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric = ['img2.jpg', 'img3.jpg'] ] - model_name (string): VGG-Face, Facenet, OpenFace, DeepFace, DeepID, Dlib, ArcFace or Ensemble + model_name (string): VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib, ArcFace, SFace or Ensemble distance_metric (string): cosine, euclidean, euclidean_l2 @@ -90,7 +90,7 @@ def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric = enforce_detection (boolean): If no face could not be detected in an image, then this function will return exception by default. Set this to False not to have this exception. This might be convenient for low resolution images. - detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib + detector_backend (string): set face detector backend to opencv, retinaface, mtcnn, ssd, dlib or mediapipe prog_bar (boolean): enable/disable a progress bar @@ -285,7 +285,7 @@ def analyze(img_path, actions = ('emotion', 'age', 'gender', 'race') , models = enforce_detection (boolean): The function throws exception if no face detected by default. Set this to False if you don't want to get exception. This might be convenient for low resolution images. - detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib. + detector_backend (string): set face detector backend to opencv, retinaface, mtcnn, ssd, dlib or mediapipe. prog_bar (boolean): enable/disable a progress bar Returns: @@ -481,7 +481,7 @@ def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine', db_path (string): You should store some .jpg files in a folder and pass the exact folder path to this. - model_name (string): VGG-Face, Facenet, OpenFace, DeepFace, DeepID, Dlib or Ensemble + model_name (string): VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib, ArcFace, SFace or Ensemble distance_metric (string): cosine, euclidean, euclidean_l2 @@ -491,7 +491,7 @@ def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine', enforce_detection (boolean): The function throws exception if a face could not be detected. Set this to True if you don't want to get exception. This might be convenient for low resolution images. - detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib + detector_backend (string): set face detector backend to opencv, retinaface, mtcnn, ssd, dlib or mediapipe prog_bar (boolean): enable/disable a progress bar @@ -729,15 +729,15 @@ def represent(img_path, model_name = 'VGG-Face', model = None, enforce_detection Parameters: img_path: exact image path, numpy array (BGR) or based64 encoded images could be passed. - model_name (string): VGG-Face, Facenet, OpenFace, DeepFace, DeepID, Dlib, ArcFace. - + model_name (string): VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib, ArcFace, SFace or Ensemble + model: Built deepface model. A face recognition model is built every call of verify function. You can pass pre-built face recognition model optionally if you will call verify function several times. Consider to pass model if you are going to call represent function in a for loop. model = DeepFace.build_model('VGG-Face') enforce_detection (boolean): If any face could not be detected in an image, then verify function will return exception. Set this to False not to have this exception. This might be convenient for low resolution images. - detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib + detector_backend (string): set face detector backend to opencv, retinaface, mtcnn, ssd, dlib or mediapipe normalization (string): normalize the input image before feeding to model @@ -785,9 +785,9 @@ def stream(db_path = '', model_name ='VGG-Face', detector_backend = 'opencv', di Parameters: db_path (string): facial database path. You should store some .jpg files in this folder. - model_name (string): VGG-Face, Facenet, OpenFace, DeepFace, DeepID, Dlib or Ensemble + model_name (string): VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib, ArcFace, SFace or Ensemble - detector_backend (string): opencv, ssd, mtcnn, dlib, retinaface + detector_backend (string): opencv, retinaface, mtcnn, ssd, dlib or mediapipe distance_metric (string): cosine, euclidean, euclidean_l2 From 9c3f30db1ac763ef08040e6f07dea5d3b6e33824 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Mon, 16 Jan 2023 16:57:55 +0000 Subject: [PATCH 4/6] doc string --- deepface/DeepFace.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/deepface/DeepFace.py b/deepface/DeepFace.py index 9e7ba91..5a22ec7 100644 --- a/deepface/DeepFace.py +++ b/deepface/DeepFace.py @@ -70,10 +70,10 @@ def build_model(model_name): def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric = 'cosine', model = None, enforce_detection = True, detector_backend = 'opencv', align = True, prog_bar = True, normalization = 'base'): """ - This function verifies an image pair is same person or different persons. + This function verifies an image pair is same person or different persons. In the background, verification function represents facial images as vectors and then calculates the similarity between those vectors. Vectors of same person images should have more similarity (or less distance) than vectors of different persons. Parameters: - img1_path, img2_path: exact image path, numpy array (BGR) or based64 encoded images could be passed. If you are going to call verify function for a list of image pairs, then you should pass an array instead of calling the function in for loops. + img1_path, img2_path (string): exact image path. Alternatively, numpy array (BGR) or based64 encoded images could be passed. If you do not want to call verify function in a for loop, then you can pass an list of pairs as shown below. e.g. img1_path = [ ['img1.jpg', 'img2.jpg'], @@ -84,7 +84,7 @@ def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric = distance_metric (string): cosine, euclidean, euclidean_l2 - model: Built deepface model. A face recognition model is built every call of verify function. You can pass pre-built face recognition model optionally if you will call verify function several times. + model: Pre-built deepface model. You can pass pre-built face recognition model optionally. model = DeepFace.build_model('VGG-Face') @@ -268,14 +268,14 @@ def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric = def analyze(img_path, actions = ('emotion', 'age', 'gender', 'race') , models = None, enforce_detection = True, detector_backend = 'opencv', prog_bar = True): """ - This function analyzes facial attributes including age, gender, emotion and race + This function analyzes facial attributes including age, gender, emotion and race. In the background, analysis function builds convolutional neural network models to classify age, gender, emotion and race of the input image. Parameters: - img_path: exact image path, numpy array (BGR) or base64 encoded image could be passed. If you are going to analyze lots of images, then set this to list. e.g. img_path = ['img1.jpg', 'img2.jpg'] + img_path (string): exact image path. Alterntively, numpy array (BGR) or base64 encoded image could be passed. If you are going to analyze lots of images, then set this to list. e.g. img_path = ['img1.jpg', 'img2.jpg'] actions (tuple): The default is ('age', 'gender', 'emotion', 'race'). You can drop some of those attributes. - models: (Optional[dict]) facial attribute analysis models are built in every call of analyze function. You can pass pre-built models to speed the function up. + models: facial attribute analysis models are built in every call of analyze function. You can pass pre-built models with this argument. models = {} models['age'] = DeepFace.build_model('Age') @@ -288,6 +288,7 @@ def analyze(img_path, actions = ('emotion', 'age', 'gender', 'race') , models = detector_backend (string): set face detector backend to opencv, retinaface, mtcnn, ssd, dlib or mediapipe. prog_bar (boolean): enable/disable a progress bar + Returns: The function returns a dictionary. If img_path is a list, then it will return list of dictionary. @@ -724,10 +725,10 @@ def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine', def represent(img_path, model_name = 'VGG-Face', model = None, enforce_detection = True, detector_backend = 'opencv', align = True, normalization = 'base'): """ - This function represents facial images as vectors. + This function represents facial images as vectors. The function uses convolutional neural networks models to generate vector embeddings. Parameters: - img_path: exact image path, numpy array (BGR) or based64 encoded images could be passed. + img_path (string): exact image path. Alternatively, numpy array (BGR) or based64 encoded images could be passed. model_name (string): VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib, ArcFace, SFace or Ensemble From eff913aff136d5b41a61b0040ca298dc5b1d1799 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Fri, 20 Jan 2023 19:00:46 +0000 Subject: [PATCH 5/6] credit --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 21b34d9..029ab4c 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,9 @@ Face recognition models are actually CNN models and they expect standard sized i The performance of RetinaFace is very satisfactory even in the crowd as seen in the following illustration. Besides, it comes with an incredible facial landmark detection performance. Highlighted red points show some facial landmarks such as eyes, nose and mouth. That's why, alignment score of RetinaFace is high as well. -

+

+
The Yellow Angels - Fenerbahce Women's Volleyball Team +

You can find out more about RetinaFace on this [repo](https://github.com/serengil/retinaface). From 658e2f987edc8c054e8cbba580025bcebbf17dc3 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sat, 21 Jan 2023 09:36:12 +0000 Subject: [PATCH 6/6] github sponsors --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index fa4bc86..f9fee0b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ +github: serengil patreon: serengil?repo=deepface