mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 20:15:21 +00:00
progress bar
This commit is contained in:
parent
07df6b812e
commit
8d304056a8
@ -65,7 +65,7 @@ def build_model(model_name):
|
|||||||
|
|
||||||
return model_obj[model_name]
|
return model_obj[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):
|
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):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This function verifies an image pair is same person or different persons.
|
This function verifies an image pair is same person or different persons.
|
||||||
@ -90,6 +90,8 @@ def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric =
|
|||||||
|
|
||||||
detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib
|
detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib
|
||||||
|
|
||||||
|
prog_bar (boolean): enable/disable a progress bar
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Verify function returns a dictionary. If img1_path is a list of image pairs, then the function will return list of dictionary.
|
Verify function returns a dictionary. If img1_path is a list of image pairs, then the function will return list of dictionary.
|
||||||
|
|
||||||
@ -138,8 +140,7 @@ def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric =
|
|||||||
|
|
||||||
#------------------------------
|
#------------------------------
|
||||||
|
|
||||||
#calling deepface in a for loop causes lots of progress bars. this prevents it.
|
disable_option = (False if len(img_list) > 1 else True) or not prog_bar
|
||||||
disable_option = False if len(img_list) > 1 else True
|
|
||||||
|
|
||||||
pbar = tqdm(range(0,len(img_list)), desc='Verification', disable = disable_option)
|
pbar = tqdm(range(0,len(img_list)), desc='Verification', disable = disable_option)
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ def analyze(img_path, actions = ['emotion', 'age', 'gender', 'race'] , models =
|
|||||||
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.
|
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 as retinaface, mtcnn, opencv, ssd or dlib.
|
||||||
|
|
||||||
prog_bar (boolean): enable/disable a progress bar
|
prog_bar (boolean): enable/disable a progress bar
|
||||||
Returns:
|
Returns:
|
||||||
The function returns a dictionary. If img_path is a list, then it will return list of dictionary.
|
The function returns a dictionary. If img_path is a list, then it will return list of dictionary.
|
||||||
@ -456,7 +457,7 @@ def analyze(img_path, actions = ['emotion', 'age', 'gender', 'race'] , models =
|
|||||||
|
|
||||||
return resp_obj
|
return resp_obj
|
||||||
|
|
||||||
def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine', model = None, enforce_detection = True, detector_backend = 'opencv', align = True):
|
def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine', model = None, enforce_detection = True, detector_backend = 'opencv', align = True, prog_bar = True):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This function applies verification several times and find an identity in a database
|
This function applies verification several times and find an identity in a database
|
||||||
@ -478,6 +479,8 @@ def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine',
|
|||||||
|
|
||||||
detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib
|
detector_backend (string): set face detector backend as retinaface, mtcnn, opencv, ssd or dlib
|
||||||
|
|
||||||
|
prog_bar (boolean): enable/disable a progress bar
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
This function returns pandas data frame. If a list of images is passed to img_path, then it will return list of pandas data frame.
|
This function returns pandas data frame. If a list of images is passed to img_path, then it will return list of pandas data frame.
|
||||||
"""
|
"""
|
||||||
@ -552,7 +555,7 @@ def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine',
|
|||||||
|
|
||||||
representations = []
|
representations = []
|
||||||
|
|
||||||
pbar = tqdm(range(0,len(employees)), desc='Finding representations')
|
pbar = tqdm(range(0,len(employees)), desc='Finding representations', disable = prog_bar)
|
||||||
|
|
||||||
#for employee in employees:
|
#for employee in employees:
|
||||||
for index in pbar:
|
for index in pbar:
|
||||||
@ -597,7 +600,7 @@ def find(img_path, db_path, model_name ='VGG-Face', distance_metric = 'cosine',
|
|||||||
|
|
||||||
resp_obj = []
|
resp_obj = []
|
||||||
|
|
||||||
global_pbar = tqdm(range(0,len(img_paths)), desc='Analyzing')
|
global_pbar = tqdm(range(0, len(img_paths)), desc='Analyzing', disable = prog_bar)
|
||||||
for j in global_pbar:
|
for j in global_pbar:
|
||||||
img_path = img_paths[j]
|
img_path = img_paths[j]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user