Open yarin177 opened 5 years ago
I'd comment out each part and profile, you can save a frame and run a basic loop. Is it the face detection taking time or face matching.
if you have thousands of training pictures maybe comparing each takes time in this way, how many known pictures do you have?
maybe your webcam resolution is very high to begin with, so even resizing it takes time with this method.. ?
My webcam resoulution is low and even I tried resizing it to increase the speedwhich did nothing, I think the part that takes long is the face matching
using the hog is slow for me, are you using it? or the cnn?, if you have a gpu with cuda using cnn makes it really fast. my options are: 1.- resize your frame just for getting the location of the faces, then crop the faces from the original image (translating your locations to the original size) and with those faces make the recognition. 2.- if you have a gpu but even with the cnn model is slow try using mtcnn for the face location and the dlib for the recognition. 3.- use threads for getting your frame or just dont read all the frames.
i've try with those 3 options and at least one should work for you :D
@Reddyforcode , I am gonna try with 1 step its a good idea, but I did not understand step 2.
@sandipJava i mean even using your graphic card (GPU) the process could be slow, but there's other face detections methods. MTCNN Is a very fast one, faster than the cnn. you can check it here https://www.youtube.com/watch?v=ByV2pj3c4dM
you found a basic implementation on my GitHub.
@Reddyforcode , what is accuracy of MTCNN campare to CNN
@sandip-narwade is not as accurate as CNN but never failed for me in production, have you seen the video?
@Reddyforcode , I have seen... All are good. Currently, I am working on CNN. If any help I will ping you. Can I send mail to you if I need help?
@sandip-narwade Sure write me whenever you want :) but I check often this: readyold@icloud.com
@Reddyforcode thank you..
using the hog is slow for me, are you using it? or the cnn?, if you have a gpu with cuda using cnn makes it really fast. my options are: 1.- resize your frame just for getting the location of the faces, then crop the faces from the original image (translating your locations to the original size) and with those faces make the recognition. 2.- if you have a gpu but even with the cnn model is slow try using mtcnn for the face location and the dlib for the recognition. 3.- use threads for getting your frame or just dont read all the frames.
i've try with those 3 options and at least one should work for you :D
I don't fully understand your 1st option, does that mean resize the whole input image to a smaller resolution, then apply face detection on that smaller image, then when we get detected face, resize it (only the detected face) to the previous size for recognition?
What if my problem is that I cannot resize the input image to smaller resolution (because faces then are to small to be detected)? Is it okay to keep the image the original size, but crop only the region that faces most likely appear (my application-specific scenario), then apply face detection and then just use it for recognition without resizing anything? Is this okay? Have anyone tried this please give me some advice. Thank you a lot!!!
@congphase mtcnn can detect small faces and its faster than cnn and you can pass that face for face recognition
@Reddyforcode Can you share the MTCNN that you've used? I just have a small confusion here, because based on this performance showdown to dlib's cnn, mtcnn, others, mtcnn does not prove to perform better than dlib's cnn.
5 Years later: This seems to work just fine https://pypi.org/project/mtcnn/
Ask Question
Hey I am using the following code from face_recognition github: "https://github.com/ageitgey/face_recognition/blob/master/examples/facerec_from_webcam_faster.py" Everything works out beside that I am getting 1 fps/sec when It detects a face, when it is not, the frame rate is ~30.
I looked up on task manager to see how's my computer doing and The CPU is on ~15% as well as the GPU so it isn't hardware problem. I also tried changing the resolution to 320x240 but It did nothing same problem.