Real-Time Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion) in Python

  Рет қаралды 40,617

Sefik Ilkin Serengil

Sefik Ilkin Serengil

Күн бұрын

Пікірлер: 118
@dragonsaige
@dragonsaige Жыл бұрын
Thank you for the amazing project and the support you have given to the community over the years. Kudos 🙏
@sefiks
@sefiks Жыл бұрын
Please do not forget to star the repo :)
@FrankZChen
@FrankZChen Жыл бұрын
Thanks!
@sefiks
@sefiks Жыл бұрын
👋🙏
@leeser6052
@leeser6052 2 жыл бұрын
thanks for this video . How to adjust the interval of video recognition to within one second to make the recognition result smoother
@sefiks
@sefiks 2 жыл бұрын
interval must be an integer and it might be 1 second in the best case
@sardorbekyorqulov
@sardorbekyorqulov 8 ай бұрын
Hello. Very understandable and fun project.
@vivamais_sejamais
@vivamais_sejamais 2 жыл бұрын
How can I do live analysis without pausing or causing delays to the livestream? Do I have to save the video and analyze it, and later display the info on the live stream? Ps: I love your work!
@sefiks
@sefiks 2 жыл бұрын
Working on a saved video works well. You do not have to do it in real time in this way. No matter how strong hardware you have, these stuff are costly operations and hard to do it in real time.
@antoniobautista1518
@antoniobautista1518 4 жыл бұрын
great work! Thanks!
@railgun0807
@railgun0807 5 ай бұрын
I have looked into this library and the other face-recognition library for Python, this one also the gender, age and emotion which are nice addition feature than just identify person. One question tho, does the "stream" have any way i can obtain those information? Or the function is still not available? Thanks in advance!
@sefiks
@sefiks 5 ай бұрын
Stream function is just for visualization, not to store any information
@railgun0807
@railgun0807 5 ай бұрын
@@sefiks i see... so if use "verify" or "find" function, is it possible to use the frame directly from cv2.VideoCapture?
@sefiks
@sefiks 5 ай бұрын
@@railgun0807 yeah, definetely
@estherli
@estherli 8 ай бұрын
Thank you for the great work! But I have a question tho. I'm using deepface for a project that recognises real-time emotion, how can I get these collected data? I can't find where the data had save in. Thanks in advance!
@sefiks
@sefiks 8 ай бұрын
You cannot collect it from stream service.
@estherli
@estherli 8 ай бұрын
@@sefiks I see. Thx!
@dennisasamoah2213
@dennisasamoah2213 4 жыл бұрын
great stuff , can you do a face liveness tutorial
@sefiks
@sefiks 4 жыл бұрын
I will soon
@dennisasamoah2213
@dennisasamoah2213 4 жыл бұрын
@@sefiks ,thank you
@jorgecarreterogulias7748
@jorgecarreterogulias7748 3 жыл бұрын
Hello thank you for everything, one question how do i get the result of the stream so i can redirect to a webpage or something similar? Or if the database face could not found, then know what happened.
@sefiks
@sefiks 3 жыл бұрын
You cannot do it as is. You should customize the library.
@nafizsadman6626
@nafizsadman6626 Жыл бұрын
Amazing work! Could you point me out how I can use the library on a video (mp4). I am trying to use it on the RAVDESS dataset to recognize emotions. But cant' seem to find API to pass videos directly as a path. UPDATE: I can set the video file path as source =. But I get error at db_path I am not planning to do face recognition. But Face detection for face emotion recognition. Is there a way to turn off the db_path? How can I retrieve the embedding after analysis of the video?
@sefiks
@sefiks Жыл бұрын
Set an empty folder to db path
@nafizsadman6626
@nafizsadman6626 Жыл бұрын
@@sefiks I have tried that but it searches for images in the folder, thus raises an error..
@НікітаГунько-к4л
@НікітаГунько-к4л 4 жыл бұрын
Great! But can we start a permanent video stream, and not just once every 5 seconds?
@sefiks
@sefiks 4 жыл бұрын
I will wait until its process completed. But still you can do. In the source code, deepface/deepface/commons/realtime.py has some arguments set manually time_threshold = 5; frame_threshold = 5 If you decrease those values, then it will process permanent video.
@bigblackballmen
@bigblackballmen 3 жыл бұрын
@@sefiks I cannot find them
@abdulrahmansabri4547
@abdulrahmansabri4547 Жыл бұрын
Thank you for your efforts. Do you know how to use stream function in colab? Thanks in advance
@sefiks
@sefiks Жыл бұрын
unfortunately, colab cannot access your webcam.
@algorithmanalysis9447
@algorithmanalysis9447 2 жыл бұрын
Selamlar Şefik, Bir proje de kütüphanenizi kullanmaya çalışıyorum. Kullandığım cihaz raspberry pi 3b. Ancak burada aşağıdaki hatayı alıyorum. Buna bir çözüm öneriniz var mı? İnternette araştırdım ancak bir çözüme ulaşamadım. Using TensorFlow backend. Detector backend is opencv WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:66: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:148: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3733: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:190: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:197: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:203: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:207: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:216: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead. WARNING:tensorflow:From /home/pi/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:223: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead. Segmentation fault
@sefiks
@sefiks 2 жыл бұрын
Bunlarin hic biri hata degil sadece uyari almissiniz
@algorithmanalysis9447
@algorithmanalysis9447 2 жыл бұрын
@@sefiks Segmentation fault şeklinde uyarıyı en son verdikten sonra Raspberyy pi da programı kapatıyor.
@algorithmanalysis9447
@algorithmanalysis9447 2 жыл бұрын
@@sefiks Galiba raspberry pi için deepface kütüphanesini kullanmak mümkün değil cihazın yetersizlikleri sebebiyle.
@sefiks
@sefiks 2 жыл бұрын
aslında ben kullandım. ancak sizin yaşadığınız problemi anlyabileceğimiz bir hata mesajı vermiyor cihaz.
@algorithmanalysis9447
@algorithmanalysis9447 2 жыл бұрын
@@sefiks Segmentation fault konusunu çözdüm. Cihaz Raspberry Pi 3B modeli. Emotional modelleme yaparken cihazin bellek veya benzer bir yetersizlik yaşıyor. Emotional modellemeyi kapattim zaten siz metota parametre olarak eklemissiniz. Bunun uzerine sorun çözüldü. Belki de sd kart ile de ilgili olabilir eski bir sd kart kullanmıştım. Ancak sonuç olarak bu şekilde çözüme kavuştu.
@Okuramachi
@Okuramachi 10 ай бұрын
Thank you for the amazing project, but what if there is nothing come out when i run the code, i can see the window comeout and i can see my face as well, and i have already creat a database folder and put my photo in it, is the selfik nessary?
@sefiks
@sefiks 10 ай бұрын
you may not set the db_folder correctly
@divyasree53
@divyasree53 2 жыл бұрын
I love your work! How can I connect multiple IP camera with deepface??
@sefiks
@sefiks 2 жыл бұрын
sincerely no idea
@JamalKhan-zl8lu
@JamalKhan-zl8lu 2 жыл бұрын
Sir should we auto-delete the pickle file or recreate the pickle file.
@sefiks
@sefiks 2 жыл бұрын
if you need, yes you can
@JamalKhan-zl8lu
@JamalKhan-zl8lu 2 жыл бұрын
@@sefiks sir then how should I do can you guide me?
@taqikhan5418
@taqikhan5418 3 жыл бұрын
love it. what if i only want to recognize faces and dont want other stuff like age gender etc?
@sefiks
@sefiks 3 жыл бұрын
Set enable_face_analysis argument to False in the stream function
@nesrinemejbri4734
@nesrinemejbri4734 2 жыл бұрын
Hi, thank you for this video. What if I want to display only the dominant emotion and nothing else?
@sefiks
@sefiks 2 жыл бұрын
currently, if enable_face_analysis argument of stream function is set to True, then it applies age, gender and emotion. This is the default behivour. You cannot disable age and gender predictions. I can add this functionality in the next release.
@Павел-ю5и
@Павел-ю5и Жыл бұрын
Hello everyone, as soon as I pass the db_path parameter, I get an AttributeError: module 'deepface.commons.functions' has no attribute 'preprocess_face'. Did you mean: 'preprocess_input'?What should I do? Thank you in advance!
@sefiks
@sefiks Жыл бұрын
there is a bug in the current pip release. use source code instead of pip package. ```shell $ git clone github.com/serengil/deepface.git $ cd deepface $ pip install -e . ```
@khawar67sp
@khawar67sp 2 жыл бұрын
Can i paste the code of real-time.py into notebook cell and get the same window as you got? M trying to do that but no window appears
@sefiks
@sefiks 2 жыл бұрын
jupyter will not let you to do this
@taqikhan5418
@taqikhan5418 3 жыл бұрын
When i installed opencv with cmake and cuda Deepface gave error, but its running ok on opencv-python installed using pip. Please Can u explain how to improve performance by utilizing gpu? Thanks in advance.
@sefiks
@sefiks 3 жыл бұрын
you need to install tensorflow-gpu before installing deepface
@taqikhan5418
@taqikhan5418 3 жыл бұрын
​@@sefiks i have uninstalled deepface then reinstalled it after installing tensotflow gpu but still it is using cpu power instead of gpu. Can you provide any link of how to use gpu with deepface library. Thanks
@DAFFIN69
@DAFFIN69 3 жыл бұрын
i am stuck in AttributeError: module 'deepface.commons.functions' has no attribute 'get_opencv_path'
@sefiks
@sefiks 3 жыл бұрын
my fault. please update deepface to 0.0.53 version.
@DAFFIN69
@DAFFIN69 3 жыл бұрын
@@sefiks i was update deepface 0.053, but in still not work, because in functions.py not found def get_opencv_path, please advise sefik ### this code in realtime.py , line 107 - 109### opencv_path = functions.get_opencv_path() face_detector_path = opencv_path+"haarcascade_frontalface_default.xml" face_cascade = cv2.CascadeClassifier(face_detector_path)
@sefiks
@sefiks 3 жыл бұрын
@@DAFFIN69 that line is updated in 0.0.53: opencv_path = OpenCvWrapper.get_opencv_path() could you confirm that you are using 0.0.53?
@DAFFIN69
@DAFFIN69 3 жыл бұрын
@@sefiks okay, work sefik, thanks very much for the update......1000% work
@sefiks
@sefiks 3 жыл бұрын
@@DAFFIN69 super!
@thelazydeveloper
@thelazydeveloper 3 жыл бұрын
can we make it do specific tasks only for example only age or gender ... please
@sefiks
@sefiks 3 жыл бұрын
No, you can't by default. It requires a little bit modification in the source code.
@lifewithchels
@lifewithchels 4 жыл бұрын
Can you get the emotions to be printed out in JSON as well?
@sefiks
@sefiks 4 жыл бұрын
Please watch this video: kzbin.info/www/bejne/fYWVhpiEbZp1mqM . DeepFace already covers this.
@lifewithchels
@lifewithchels 4 жыл бұрын
Sefik Ilkin Serengil is there a way to print JSON in real time? Instead of passing in only one image as a parameter via the Deepface.analyze() method?
@rikitiky
@rikitiky 3 жыл бұрын
Very interesting project, thank you! I want to use it in my school project, but my PyCharm can't find the image and says "WARNING: There is no image in this path. Face recognition will not be performed." What can I do about this problem?
@sefiks
@sefiks 3 жыл бұрын
You should delete the trouble causing item in your db_path
@rikitiky
@rikitiky 3 жыл бұрын
@@sefiks Thank you! I solved this problem, thanks for your advise!
@thelazydeveloper
@thelazydeveloper 3 жыл бұрын
can we make it with opencv getting a numpy array and doing same thing please
@sefiks
@sefiks 3 жыл бұрын
opencv does not come with a out-of-the-box modern facial recognition module unfortunately
@taylanylmaz7000
@taylanylmaz7000 4 жыл бұрын
Kodlamayı yaparken bilgisayarınızda yüklü olan Tensorflow, Numpy ve Python programlarının hangi sürümleri olduğunu yazabilirseniz sevinirim. İyi günler, kolay gelsin
@sefiks
@sefiks 4 жыл бұрын
Python 3.6.4, TF 1.9.0, Keras 2.2.0, numpy 1.17.0
@1ycx
@1ycx 4 жыл бұрын
Is it possible to use multiple cameras ?
@sefiks
@sefiks 4 жыл бұрын
Nope, it supports just single cam.
@paulfaverjon7294
@paulfaverjon7294 3 жыл бұрын
Hello, thank you for the tuto, when running the code, even only the first line 'from deepface import DeepFace" I get an error "Illegal Instruction : 4 " Can anyone help me ?
@sefiks
@sefiks 3 жыл бұрын
It seems that your installation is not okay.
@paulfaverjon7294
@paulfaverjon7294 3 жыл бұрын
@@sefiks Hi, thank you for your answer. I poste here how I got away with it as some beginner coder don't have the reflex of going ti guthub s overflow. The problem was not with deepface but with tensorflow. The normal version doesn't work on M1. So I used miniforge to download a mac version of TF, then installed deepface with no dependancies in a venv
@sardorbekyorqulov
@sardorbekyorqulov 8 ай бұрын
With this technology, how many faces can be detected at 1 time?
@sefiks
@sefiks 8 ай бұрын
No limit
@sanjurokuwabatake5541
@sanjurokuwabatake5541 4 жыл бұрын
can the data got in streaming be stored in a file, pls respond im working on it
@sefiks
@sefiks 4 жыл бұрын
It can but currently stream function does not support this. I recently added a find function and it does this. You can find it here: kzbin.info/www/bejne/fqPNoWB7iNmAldU
@sanjurokuwabatake5541
@sanjurokuwabatake5541 4 жыл бұрын
Sefik Ilkin Serengil thank you sefik 🤝
@fatosderdicok3066
@fatosderdicok3066 4 жыл бұрын
merhaba kolay gelsin öncelikle. Ben resimler özerin de olanları Google colab özerinde rahatlıkla yapabiliyorum. Ama gerçek zamanlı olunca google colab ile sizin kodlarınız farklı oluyor ve bu yüzden de yapamıyorum. Lütfen Google colab özerinde nasıl yapabileğim hakkında sizden bilgi istesem çok şey mi istemiş oluyorum.
@fatosderdicok3066
@fatosderdicok3066 4 жыл бұрын
fotolar özerin de benim çıktılarım {'age': 32.26633552210522, 'dominant_emotion': 'neutral', 'dominant_race': 'middle eastern', 'emotion': {'angry': 4.419447109103203, 'disgust': 0.00012736104508803692, 'fear': 5.354632064700127, 'happy': 0.3518438432365656, 'neutral': 73.14058542251587, 'sad': 16.620807349681854, 'surprise': 0.11255834251642227}, 'gender': 'Man', 'race': {'asian': 0.014853122411295772, 'black': 0.07524138782173395, 'indian': 22.850976884365082, 'latino hispanic': 10.078267008066177, 'middle eastern': 60.04456877708435, 'white': 6.936091929674149}} sizin gibi daha derli toplu görünmesi için ne yapabilirrim.
@sefiks
@sefiks 4 жыл бұрын
colab web cam'inize erişemez. sizin derli toplu dediğiniz stream fonksiyonu ama siz analyze fonksiyonunu denemişsiniz.
@julietamendez5911
@julietamendez5911 2 жыл бұрын
How do we turn off the stream? It just runs infinitely
@sefiks
@sefiks 2 жыл бұрын
you cannot. infinity is the purpose of the stream.
@동환-g7l
@동환-g7l 2 жыл бұрын
Hello! First of all, 'Deepface' is really cool. I want to apply to school projects, In real time, I should be detected the emotion of audiences ,the face of many people,.. Is this possible with Deepface?
@sefiks
@sefiks 2 жыл бұрын
yes, sure!
@pavankumardasari6606
@pavankumardasari6606 Жыл бұрын
How to use custom data with theirs
@sefiks
@sefiks Жыл бұрын
define custom data please
@komailwael9780
@komailwael9780 4 жыл бұрын
Hello, thanks for this work. If possible, I can get a code. Just display the image of the person over the same person in real-time face recognition
@sefiks
@sefiks 4 жыл бұрын
If you set enable_face_analysis argument to False, then it just applies facial recognition. Try this: DeepFace.stream(db_path = 'C:/my_db', enable_face_analysis = False)
@komailwael9780
@komailwael9780 4 жыл бұрын
Sefik Ilkin Serengil thanks
@bhagyashreetammanagoal5093
@bhagyashreetammanagoal5093 Жыл бұрын
Sir where I can get this source code
@sefiks
@sefiks Жыл бұрын
Github.com/serengil/deepface
@البروفيسور-خ6ر
@البروفيسور-خ6ر 2 жыл бұрын
I want source code pls
@sefiks
@sefiks 2 жыл бұрын
source courde is just one line of code shown in this video.
@البروفيسور-خ6ر
@البروفيسور-خ6ر 2 жыл бұрын
@@sefiks I want source code in python pls help me
@isakmessihi4687
@isakmessihi4687 4 жыл бұрын
Hi, Can you collaborate with me on a program?
@sefiks
@sefiks 4 жыл бұрын
Why not :)
@naposhen2219
@naposhen2219 4 жыл бұрын
How to use/run this code?
@sefiks
@sefiks 4 жыл бұрын
Video explains how to use and run it. Did you get any trouble.
@naposhen2219
@naposhen2219 4 жыл бұрын
@@sefiks in visual studio code need to create new file ?
@tunateke9806
@tunateke9806 4 жыл бұрын
👍👍👍👍
@ShubhamGupta-lv3cv
@ShubhamGupta-lv3cv 2 жыл бұрын
Can u please tell how to stop DeepFace.stream(), I always have to restart the kernel.
@sefiks
@sefiks 2 жыл бұрын
Press q
DeepFace API for Face Recognition and Facial Attribute Analysis
5:02
Sefik Ilkin Serengil
Рет қаралды 17 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Face Anti-Spoofing for Facial Recognition in Python
10:03
Sefik Ilkin Serengil
Рет қаралды 8 М.
InsightFace: RetinaFace and ArcFace for Facial Recognition in Python
8:05
Sefik Ilkin Serengil
Рет қаралды 35 М.
Simple Face Detection in Python
9:06
NeuralNine
Рет қаралды 89 М.
Solved face recognition install error | dlib install error
9:26
Amit Dhanawade
Рет қаралды 75 М.
Live Face Recognition in Python
16:16
NeuralNine
Рет қаралды 186 М.
DeepFace: A Facial Recognition Library for Python
14:12
Sefik Ilkin Serengil
Рет қаралды 147 М.