Merge pull request #581 from Andrea-Oliveri/regions

Fixed minor bug: all regions now are (left, top, width, height)
This commit is contained in:
Sefik Ilkin Serengil 2022-10-24 11:25:01 +03:00 committed by GitHub
commit 58d145ba2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 12 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,8 +45,8 @@ def detect_face(detector, img, align = True):
sp = detector["sp"]
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
confidence = None
img_region = [0, 0, img.shape[1], img.shape[0]]
face_detector = detector["face_detector"]

View File

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

View File

@ -11,8 +11,7 @@ def detect_face(face_detector, img, align = True):
resp = []
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
confidence = None
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,8 +40,7 @@ def detect_face(detector, img, align = True):
resp = []
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
confidence = None
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,8 +51,7 @@ def detect_face(detector, img, align = True):
resp = []
detected_face = None
img_region = [0, 0, img.shape[0], img.shape[1]]
confidence = None
img_region = [0, 0, img.shape[1], img.shape[0]]
ssd_labels = ["img_id", "is_face", "confidence", "left", "top", "right", "bottom"]