kpzhang93 / MTCNN_face_detection_alignment

Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Neural Networks
MIT License
2.8k stars 1.01k forks source link

speed up mtcnn #15

Open Cv9527 opened 7 years ago

Cv9527 commented 7 years ago

@kpzhang93 mtcnn is slow by CPU, is there any solution to speed it up in real time?

diego0718 commented 2 years ago

Hi everyone, Reviewing a little bit the code(python+mxnet version) i noticed that first stage part on the detect_face method takes almost the entire time of the mtcnn processing. Specifically here:

    for batch in sliced_index:
        local_boxes = self.Pool.map( detect_first_stage_warpper, \
                zip(repeat(img), self.PNets[:len(batch)], [scales[i] for i in batch], repeat(self.threshold[0])) )
        total_boxes.extend(local_boxes)

For 1 image, the first batch in sliced_index is the slowest respect the next batches. I want to know if throwing the Pool the first time is more expense in terms of time than the others or there are some other reason