mirror of
https://github.com/serengil/deepface.git
synced 2025-06-08 12:35:22 +00:00
align arg for detectFace
This commit is contained in:
parent
412ca5743b
commit
b4631f1562
@ -779,7 +779,7 @@ def stream(db_path = '', model_name ='VGG-Face', detector_backend = 'opencv', di
|
||||
realtime.analysis(db_path, model_name, detector_backend, distance_metric, enable_face_analysis
|
||||
, source = source, time_threshold = time_threshold, frame_threshold = frame_threshold)
|
||||
|
||||
def detectFace(img_path, detector_backend = 'opencv', enforce_detection = True):
|
||||
def detectFace(img_path, detector_backend = 'opencv', enforce_detection = True, align = True):
|
||||
|
||||
"""
|
||||
This function applies pre-processing stages of a face recognition pipeline including detection and alignment
|
||||
@ -794,7 +794,7 @@ def detectFace(img_path, detector_backend = 'opencv', enforce_detection = True):
|
||||
"""
|
||||
|
||||
img = functions.preprocess_face(img = img_path, detector_backend = detector_backend
|
||||
, enforce_detection = enforce_detection)[0] #preprocess_face returns (1, 224, 224, 3)
|
||||
, enforce_detection = enforce_detection, align = align)[0] #preprocess_face returns (1, 224, 224, 3)
|
||||
return img[:, :, ::-1] #bgr to rgb
|
||||
|
||||
#---------------------------
|
||||
|
@ -153,10 +153,14 @@ def preprocess_face(img, target_size=(224, 224), grayscale = False, enforce_dete
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
#normalizing the image pixels
|
||||
|
||||
img_pixels = image.img_to_array(img)
|
||||
img_pixels = np.expand_dims(img_pixels, axis = 0)
|
||||
img_pixels /= 255 #normalize input in [0, 1]
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
if return_region == True:
|
||||
return img_pixels, region
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user