InsightFace: RetinaFace and ArcFace for Facial Recognition in Python

  Рет қаралды 35,962

Sefik Ilkin Serengil

Sefik Ilkin Serengil

Күн бұрын

Пікірлер: 82
@cafeecomputacao
@cafeecomputacao 24 күн бұрын
This library is truly amazing, but I am facing a situation that is challenging me. When working with a phone or computer camera, DeepFace is impeccable and very accurate, but when I use security cameras, the model loses a lot of accuracy. I am using ArcFace and RetinaFace, but the more I add images of people's faces, the more it gets confused (it keeps switching between IDs, all with very low distances, which indicates it is almost certain of the response). Did I miss something? Is there any preprocessing that should be done when building the dataset before creating the model? Or is DeepFace not recommended for security cameras? Any suggestions or help would be greatly appreciated.
@sefiks
@sefiks 24 күн бұрын
TBH, i didn't test it with security cameras, maybe one would make a comment here
@cafeecomputacao
@cafeecomputacao 23 күн бұрын
@@sefiks Alright.. do you think it's a good idea to retrain the ArcFace model with images from security cameras?
@sefiks
@sefiks 23 күн бұрын
@ training requires running experiments with many gpus for days. If you can afford, why not.
@cafeecomputacao
@cafeecomputacao 23 күн бұрын
@@sefiks i will try 🤓
@AshishUncw
@AshishUncw 10 ай бұрын
@serengil, I need some help on this code. For the Face Recognition part, is the ArcFace Model trained with weights? and, How can i change the threshold value at the output? Please help me with this.
@sefiks
@sefiks 10 ай бұрын
arcface model comes with pre-trained weights. verify function returns distance. check this distance value with your tuned threshold instead of verified key.
@tunateke9806
@tunateke9806 3 жыл бұрын
Its performance in the wild is really amazing!
@shachoud
@shachoud 3 жыл бұрын
detect face in my case taking approximately 20 to 30 sec, what did u do to get good performance? Please reply
@ujjwaltyagi8145
@ujjwaltyagi8145 2 жыл бұрын
Thanks Sefik for this amazing tutorial. I was trying to extract and save these faces detected by RetinaFaces as separate image files and I succeeded in doing so. But I later tried feeding the path of these saved extracted faces to deepface.verify() but it says that these images of extracted faces do not have a face. Can you suggest what to do?
@sefiks
@sefiks 2 жыл бұрын
if you already extracted faces with retinaface, deepface should not extract faces from those pre-processed images. Use skip option for detector backend. DeepFace.verify("img.jpg", detector_backend="skip")
@ujjwaltyagi8145
@ujjwaltyagi8145 2 жыл бұрын
@@sefiks I'll give it a try and comment the status. Thank you so much for your response.
@AshishUncw
@AshishUncw 9 ай бұрын
@Serengil , Is the threshold value fixed in the code? When I justvtry to change it and run, I still see the same value. Can you please help me out with it?
@sefiks
@sefiks 9 ай бұрын
yes, threshold is set from the code here: github.com/serengil/deepface/blob/master/deepface/modules/verification.py#L356 if you want to use your own threshold, then get the distance key from the result of verify and compare with your own threshold.
@emreparlak2729
@emreparlak2729 4 күн бұрын
hey all, i am getting the following error code on jupyter lab. can anyone help me with this? A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.operations`). You are likely doing something like: ... i get this error after doing faces = RetinaFace.detect_faces('example.jpg')
@sefiks
@sefiks 4 күн бұрын
Downgrade your tf
@khoinguyenphamang726
@khoinguyenphamang726 3 жыл бұрын
I've an issue with extract_face function, the pre-trained weigth model could not be loaded due to the limitation. I've downloaded the .h5 file manually from the url, however, i've no ideal of where and how to put it to make the code run (as it states that the directory should be '/root/.deepface/weights/retinaface.h5') . Could you please help me? Many thanks in advance
@sefiks
@sefiks 3 жыл бұрын
you should store the pre-trained weights to HOME_FOLDER/.deepface/weights you can find out the home folder with the command "cd ~" in the terminal. E.g. mine is /Users/sefik in my mac.
@khoinguyenphamang726
@khoinguyenphamang726 3 жыл бұрын
Thank you so much, but for colab users like me, what should be the HOME_FOLDER? I tried with Path.home and it indicates to /root, but i did not find any folder there. Have I mistaken that one?
@sefiks
@sefiks 3 жыл бұрын
You should create /root/.deepface in this case manually
@IffatJahanTuli
@IffatJahanTuli 2 жыл бұрын
Hello Sefik! Thanks for the tutorial. Is it possible to detect/extract the whole head including ear using retinaface?
@sefiks
@sefiks 2 жыл бұрын
Hello. Unfortunately, retinaface just returns 5 facial landmark point. However, you can do it via mediapipe: kzbin.info/www/bejne/rHaWen6Go9-nm80
@shachoud
@shachoud 3 жыл бұрын
Dear Sefik, Thanks for your video.... It's really knowledgeable. I ran the same code and it is detecting the face correctly, just that extract face function taking approximately 20 to 30 sec to give response. Can you please guide what could have gone wrong ?
@sefiks
@sefiks 3 жыл бұрын
Retinaface is very complex model. That is the reason why is it so successful. You cannot do anything to speed it up. I recommend you to use any other detector such as ssd or mtcnn if speed is important in your case.
@shachoud
@shachoud 3 жыл бұрын
@@sefiks But in your video it works very fast... I just install the retina-face library and tried extract face function. When I ran first time, it downloaded the h5 file and started the execution. Is it all I need to do ? Another question is in extract function we have model as optional attribute, what are the values of that..?
@sefiks
@sefiks 3 жыл бұрын
@@shachoud because I cut the waiting seconds in the video
@kamranhuseynov2897
@kamranhuseynov2897 2 жыл бұрын
@@shachoud retinaface is much faster model and it shouldnt take 20 seconds in any case. So, retinaface API might be slow, maybe it is loading the model everytime you use a function from Retinaface module, I would suggest writing and using retinaface model in tensorflow, not through a package.
@AlbertTLS
@AlbertTLS 2 жыл бұрын
After all faces are detected, how do you extract all the faces into a new image?
@sefiks
@sefiks 2 жыл бұрын
Call extract faces function and transfer its output to opencv as input
@azgartar
@azgartar 2 жыл бұрын
Hi Sefik, Thank you for the tutorial, very informative. However, Im using the M1 Mac with Miniforge in order to use Tensorflow, and I have 2.4. Is the a method using retina-face with Tensorflow 2.4. I am have lots of dependancy errors, and if I negate the dependancies, I get much more errors. I would appreciate any help
@sefiks
@sefiks 2 жыл бұрын
Solution is mentioned here: github.com/serengil/deepface/issues/391
@eduardmart1237
@eduardmart1237 Жыл бұрын
How to enable cuda?
@sefiks
@sefiks Жыл бұрын
Install tensorflow-gpu dependency first
@eduardmart1237
@eduardmart1237 Жыл бұрын
@@sefiks what version should i use?
@jacobjohns7891
@jacobjohns7891 3 жыл бұрын
@Sefik Ilkin Serengil Is it work correctly for 200 to 300 employees of company for there Biometric attendance from realtime webcame?
@sefiks
@sefiks 3 жыл бұрын
I guess so
@jacobjohns7891
@jacobjohns7891 3 жыл бұрын
@@sefiks Can it work for real time face recognition from webcam feed to recognize 300 employees of company?
@jacobjohns7891
@jacobjohns7891 3 жыл бұрын
@@sefiks Please reply me sir..!!
@sefiks
@sefiks 3 жыл бұрын
@@jacobjohns7891 Yes, this is applicable.
@jacobjohns7891
@jacobjohns7891 3 жыл бұрын
@@sefiks Can I get your email or any contact info there we can talk a little about it?
@ButterNCreamz
@ButterNCreamz 11 ай бұрын
Is there a formula for the confidence score? I need it for the documentation of my project.
@sefiks
@sefiks 11 ай бұрын
No, unfortunately
@ButterNCreamz
@ButterNCreamz 11 ай бұрын
@@sefiks how do you get the score? Is that from similarity?
@sefiks
@sefiks 11 ай бұрын
@@ButterNCreamz it is distance. e.g. distance = 1 - similarity for cosine.
@towdammachittamma4312
@towdammachittamma4312 3 жыл бұрын
Hi Serengil can you please make a video explaining the Video Face Recognition Demo of ArcFace
@sefiks
@sefiks 3 жыл бұрын
Please watch this video: kzbin.info/www/bejne/Y5ScpIaAmN1pras . ArcFace is available in deepface stream function.
@asmitha309
@asmitha309 Жыл бұрын
hey ,Sefik OSError: Unable to open file (truncated file: eof = 56376769, sblock->base_addr = 0, stored_eof = 118667368) I am getting this error ,how can i fix it? pls help me
@sefiks
@sefiks Жыл бұрын
Your tensorflow installation seems not okay
@quangtuyennguyen4081
@quangtuyennguyen4081 2 жыл бұрын
sir, can you tell me what backbone the Retina face use? Mobilenet0.25 or Resnet50?
@sefiks
@sefiks 2 жыл бұрын
it is not mentioned in the reference study I used: github.com/StanislasBertrand/RetinaFace-tf2
@alperen416
@alperen416 Жыл бұрын
@sefiks Selamlar. Her fotoğrafa 5 saniye ayırıyor. Bu süreyi azaltmanın bir yolu var mıdır ?
@sefiks
@sefiks Жыл бұрын
retinaface kompleks bir model. basaridan cok sure performansi sizin icin bir kisitsa kullanmanizi tavsiye etmem. ancak gpu kullanarak bu sureyi azaltabilirsiniz. opencv haarcascade kullanabilirsiniz. ancak retinaface'in basari performansina baska bir model erisememekte.
@alperen416
@alperen416 Жыл бұрын
@@sefiks teşekkürler elinize sağlık bu arada başarılı modül yapmışsınız gerçekten
@sefiks
@sefiks Жыл бұрын
Begendiyseniz lutfen repoyu yildizlayarak destek olun ☺️ videoyu da ayni sekilde.
@eduardmart1237
@eduardmart1237 Жыл бұрын
Is it possible to use this model in batch mode, for better gpu performance?
@sefiks
@sefiks Жыл бұрын
What do you mean as batch mode
@eduardmart1237
@eduardmart1237 Жыл бұрын
@@sefiks detecting several pictures at the same time.
@sefiks
@sefiks Жыл бұрын
@@eduardmart1237 no it can process one picture
@好吃的披薩
@好吃的披薩 3 жыл бұрын
Hello, I have a problem, my object detection box will run away, what is the problem
@sefiks
@sefiks 3 жыл бұрын
What do you mean?
@phamtrunghieuk15hl6
@phamtrunghieuk15hl6 2 жыл бұрын
I give a photo of the face of the person wearing the mask and the model does not detect the face. how can i fix it?
@sefiks
@sefiks 2 жыл бұрын
You cannot, those models do not care people with masks
@Colin_chen
@Colin_chen 3 жыл бұрын
thanks for your vedio. but i cant pip install deepface ,it will output error
@sefiks
@sefiks 3 жыл бұрын
I need the error message to understand what is going on
@Colin_chen
@Colin_chen 3 жыл бұрын
​@@sefiks i sent ig message thanks
@brianlee9624
@brianlee9624 Жыл бұрын
Thanks Sefik!
@dhruvingandhi3476
@dhruvingandhi3476 2 жыл бұрын
how many FPS on using nvidia 1050 GPU?
@sefiks
@sefiks 2 жыл бұрын
you have test it yourself. i have no idea.
@ThedarkNet12312
@ThedarkNet12312 3 жыл бұрын
how much image size input
@sefiks
@sefiks 3 жыл бұрын
You can pass any size image
@sanjeevikumar2896
@sanjeevikumar2896 8 ай бұрын
Hello fellows, im facing an error with recognition path, if you guys come across this error please help me with this ValueError: `padding` must be either `'VALID'` or `'same'`. Received valid.
@sefiks
@sefiks 8 ай бұрын
Upgrade retina-face to latest
@sanjeevikumar2896
@sanjeevikumar2896 8 ай бұрын
Hi@@sefiks. i have a version of 0.0.17. but it still throws the same error. Im doing this project for my college official use. can i get your instagram id or any platform so that i can clear my doubts. Please
@sanjeevikumar2896
@sanjeevikumar2896 8 ай бұрын
@@sefiksraise ValueError( ValueError: The last dimension of the inputs to a Dense layer should be defined. Found None. Full input shape received: (None, None) i faced this as well
@sefiks
@sefiks 8 ай бұрын
@@sanjeevikumar2896 try to downgrade tensorflow to 2.15
@DAFFIN69
@DAFFIN69 3 жыл бұрын
which python version are you used on anaconda, sefik i have problem in deepface because tensrflow and keras need python 3.6 < 3.7 but i have 3.9.4 i try to install python 3.6 always error not solved please, maybe you can help me thanks
@sefiks
@sefiks 3 жыл бұрын
Python 3.8.5, tensorflow 2.4.1
@dennisasamoah2213
@dennisasamoah2213 3 жыл бұрын
incredible
@duyduy5595
@duyduy5595 6 ай бұрын
This is not useful, I thought you teach us how to make a dataset, train it then use the result to recognize faces
@sefiks
@sefiks 6 ай бұрын
What makes you think that? You should read video title and description.
@jackchisholm7286
@jackchisholm7286 Жыл бұрын
Luv u
DeepFace: A Facial Recognition Library for Python
14:12
Sefik Ilkin Serengil
Рет қаралды 147 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Face Anti-Spoofing for Facial Recognition in Python
10:03
Sefik Ilkin Serengil
Рет қаралды 8 М.
OpenCV Python TUTORIAL #4 for Face Recognition and Identification
1:06:24
CodingEntrepreneurs
Рет қаралды 811 М.
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
12:14
8 Different Face Recognition Models in DeepFace
4:28
Sefik Ilkin Serengil
Рет қаралды 1,5 М.
Facial Recognition on Video with Python
25:01
sentdex
Рет қаралды 114 М.
Facial Recognition on Labeled Faces in the Wild with Python
11:19
Sefik Ilkin Serengil
Рет қаралды 6 М.