diff --git a/mtcnn/mtcnn.py b/mtcnn/mtcnn.py index 3db8b8c..9cd7bf9 100644 --- a/mtcnn/mtcnn.py +++ b/mtcnn/mtcnn.py @@ -36,7 +36,6 @@ from mtcnn.exceptions import InvalidImage from mtcnn.network.factory import NetworkFactory - __author__ = "Iván de Paz Centeno" @@ -87,7 +86,6 @@ def __init__(self, weights_file: str = None, min_face_size: int = 20, steps_thre self._pnet, self._rnet, self._onet = NetworkFactory().build_P_R_O_nets_from_file(weights_file) - @property def min_face_size(self): return self._min_face_size @@ -307,7 +305,7 @@ def detect_faces(self, img) -> list: for bounding_box, keypoints in zip(total_boxes, points.T): bounding_boxes.append({ - 'box': [int(bounding_box[0]), int(bounding_box[1]), + 'box': [max(0, int(bounding_box[0])), max(0, int(bounding_box[1])), int(bounding_box[2] - bounding_box[0]), int(bounding_box[3] - bounding_box[1])], 'confidence': bounding_box[-1], 'keypoints': {