YYuanAnyVision / mxnet_mtcnn_face_detection

MTCNN face detection
738 stars 314 forks source link

How to understand the extract_image_chips? #50

Open taylover-pei opened 5 years ago

taylover-pei commented 5 years ago

https://github.com/YYuanAnyVision/mxnet_mtcnn_face_detection/blob/b56065418b63a971fcf4f8f35d058513b0ce6cbf/main.py#L22 How to understand the parameters 0.37? If I want to crop the face in multi scales, such as 0.9, 1.0, 1,1...... How can I control the parameter? Looking forward to your reply!

nyk510 commented 5 years ago

Hi! taylover-pei San!

The parameter 0.37 means that cut out detected image by leaving its height (or width) times the padding.

The code to do it is as follows

            for i in range(len(shape) // 2):
                x = (padding + mean_face_shape_x[i]) / (2 * padding + 1) * desired_size
                y = (padding + mean_face_shape_y[i]) / (2 * padding + 1) * desired_size
nyk510 commented 5 years ago

If you change the scale of detector, change scale in first stage detection.

In the mtcnn_detector, run detection by the scales values.

            for scale in scales:
                return_boxes = detect_first_stage(img, self.PNets[0], scale, self.threshold[0])

so you should change the calculation method to a good feeling ;)