mirror of
https://github.com/serengil/deepface.git
synced 2025-06-11 05:47:08 +00:00
clean code
This commit is contained in:
parent
a0c06a3792
commit
81f8adb1d5
@ -254,10 +254,8 @@ def verify(img1_path, img2_path = '', model_name ='VGG-Face', distance_metric =
|
|||||||
|
|
||||||
#------------------------------
|
#------------------------------
|
||||||
|
|
||||||
if len(img_list) > 1:
|
#calling deepface in a for loop causes lots of progress bars. this prevents it.
|
||||||
disable_option = False
|
disable_option = False len(img_list) > 1 else True
|
||||||
else: #calling deepface in a for loop causes lots of progress bars. this block prevents this problem.
|
|
||||||
disable_option = 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)
|
||||||
|
|
||||||
@ -362,7 +360,7 @@ def analyze(img_path, actions = [], models = {}, enforce_detection = True, detec
|
|||||||
if len(actions) == 0:
|
if len(actions) == 0:
|
||||||
actions= ['emotion', 'age', 'gender', 'race']
|
actions= ['emotion', 'age', 'gender', 'race']
|
||||||
|
|
||||||
print("Actions to do: ", actions)
|
#print("Actions to do: ", actions)
|
||||||
|
|
||||||
#---------------------------------
|
#---------------------------------
|
||||||
|
|
||||||
@ -375,7 +373,7 @@ def analyze(img_path, actions = [], models = {}, enforce_detection = True, detec
|
|||||||
|
|
||||||
if 'age' in actions:
|
if 'age' in actions:
|
||||||
if 'age' in models:
|
if 'age' in models:
|
||||||
print("already built age model is passed")
|
#print("already built age model is passed")
|
||||||
age_model = models['age']
|
age_model = models['age']
|
||||||
else:
|
else:
|
||||||
age_model = Age.loadModel()
|
age_model = Age.loadModel()
|
||||||
@ -397,17 +395,19 @@ def analyze(img_path, actions = [], models = {}, enforce_detection = True, detec
|
|||||||
|
|
||||||
resp_objects = []
|
resp_objects = []
|
||||||
|
|
||||||
global_pbar = tqdm(range(0,len(img_paths)), desc='Analyzing')
|
disable_option = False if len(img_paths) > 1 else True
|
||||||
|
|
||||||
|
global_pbar = tqdm(range(0,len(img_paths)), desc='Analyzing', disable = disable_option)
|
||||||
|
|
||||||
#for img_path in img_paths:
|
#for img_path in img_paths:
|
||||||
for j in global_pbar:
|
for j in global_pbar:
|
||||||
img_path = img_paths[j]
|
img_path = img_paths[j]
|
||||||
|
|
||||||
resp_obj = "{"
|
resp_obj = "{"
|
||||||
|
|
||||||
|
disable_option = False if len(actions) > 1 else True
|
||||||
|
|
||||||
#TO-DO: do this in parallel
|
pbar = tqdm(range(0,len(actions)), desc='Finding actions', disable = disable_option)
|
||||||
|
|
||||||
pbar = tqdm(range(0,len(actions)), desc='Finding actions')
|
|
||||||
|
|
||||||
action_idx = 0
|
action_idx = 0
|
||||||
img_224 = None # Set to prevent re-detection
|
img_224 = None # Set to prevent re-detection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user