facenet-pytorch icon indicating copy to clipboard operation
facenet-pytorch copied to clipboard

Poor performance speed on CPU

Open yossibiton opened this issue 4 years ago • 3 comments

I followed this part in the README and executed the kaggle notebook for performance comparison. I'm using MacBook Pro with the following processor : 2.6 GHz 6-Core Intel Core i7.

The facenet-pytorch was the slowest detector (by far), as opposed to the results shown on your readme. Can you explain this surprising difference when switching from GPU to CPU ?

I can't add photos so i will just copy the output from the notebook:

facenet-pytorch

Detecting faces in 540x960 frames, 109.412 seconds Detecting faces in 720x1280 frames, 180.797 seconds Detecting faces in 1080x1920 frames, 298.694 seconds

facenet-pytorch (non batched)

Detecting faces in 540x960 frames, 79.293 seconds Detecting faces in 720x1280 frames, 127.121 seconds Detecting faces in 1080x1920 frames, 239.866 seconds

dlib

Detecting faces in 540x960 frames, 10.327 seconds Detecting faces in 720x1280 frames, 18.395 seconds Detecting faces in 1080x1920 frames, 38.444 seconds

mtcnn package

Detecting faces in 540x960 frames, 43.172 seconds Detecting faces in 720x1280 frames, 71.451 seconds Detecting faces in 1080x1920 frames, 146.714 seconds

yossibiton avatar May 03 '20 10:05 yossibiton

the packages i'm using are : torch 1.4.0
facenet-pytorch 2.2.9
dlib 19.19.99
tensorflow 2.1.0
mtcnn 0.1.0

yossibiton avatar May 03 '20 11:05 yossibiton

I used it. It was real quick using gpu.

x13machine avatar Jul 06 '20 01:07 x13machine

I am facing the similar issue on face detection. Even in GPU I am not able to attain the real time speed on the live feed. I am using open-cv to read the camera feed and passing to facenet-pytorch mtcnn module. The bottleneck I see is in the mtcnn.detect() which takes 0.08 to 0.1 second per frame which is like 10 to 12.5 FPS. Could anyone suggest on how attain real-time speed?

ghimireadarsh avatar Sep 02 '21 09:09 ghimireadarsh