YYuanAnyVision/mxnet_mtcnn_face_detection

How to understand the extract_image_chips?

taylover-pei opened this issue · 2 comments

chips = detector.extract_image_chips(img, points, 144, 0.37)

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!

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

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 ;)