Skip to content

Commit

Permalink
Merge pull request #70 from MattyB95/coordinatesBug
Browse files Browse the repository at this point in the history
Fixed getting negative image coordinates from 'box' key. Fixes #11
  • Loading branch information
ipazc committed Dec 4, 2019
2 parents 718372b + cb32dd9 commit dc72bd8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions mtcnn/mtcnn.py
Expand Up @@ -36,7 +36,6 @@
from mtcnn.exceptions import InvalidImage
from mtcnn.network.factory import NetworkFactory


__author__ = "Iván de Paz Centeno"


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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': {
Expand Down

0 comments on commit dc72bd8

Please sign in to comment.