Fixed minor bug: all regions now are (left, top, width, height)

This commit is contained in:
Andrea Oliveri 2022-10-23 16:33:00 +02:00
parent 9069a2854a
commit eeca8775ca
7 changed files with 7 additions and 7 deletions

View File

@ -95,7 +95,7 @@ def load_image(img):
def detect_face(img, detector_backend = 'opencv', grayscale = False, enforce_detection = True, align = True):
img_region = [0, 0, img.shape[0], img.shape[1]]
img_region = [0, 0, img.shape[1], img.shape[0]]
#----------------------------------------------
#people would like to skip detection and alignment if they already have pre-processed images

View File

@ -45,7 +45,7 @@ def detect_face(detector, img, align = True):
sp = detector["sp"]
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
img_region = [0, 0, img.shape[1], img.shape[0]]
face_detector = detector["face_detector"]
detections = face_detector(img, 1)

View File

@ -40,7 +40,7 @@ def detect_face(face_detector, detector_backend, img, align = True):
face, region = obj[0] #discard multiple faces
else: #len(obj) == 0
face = None
region = [0, 0, img.shape[0], img.shape[1]]
region = [0, 0, img.shape[1], img.shape[0]]
return face, region

View File

@ -11,7 +11,7 @@ def detect_face(face_detector, img, align = True):
resp = []
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
img_region = [0, 0, img.shape[1], img.shape[0]]
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #mtcnn expects RGB but OpenCV read BGR
detections = face_detector.detect_faces(img_rgb)

View File

@ -40,7 +40,7 @@ def detect_face(detector, img, align = True):
resp = []
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
img_region = [0, 0, img.shape[1], img.shape[0]]
faces = []
try:

View File

@ -20,7 +20,7 @@ def detect_face(face_detector, img, align = True):
"""
face = None
img_region = [0, 0, img.shape[0], img.shape[1]] #Really?
img_region = [0, 0, img.shape[1], img.shape[0]] #Really?
faces = RetinaFace.extract_faces(img_rgb, model = face_detector, align = align)

View File

@ -51,7 +51,7 @@ def detect_face(detector, img, align = True):
resp = []
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
img_region = [0, 0, img.shape[1], img.shape[0]]
ssd_labels = ["img_id", "is_face", "confidence", "left", "top", "right", "bottom"]