KiLJ4EdeN / Realtime_FacialRecognition

Real time Facial Recognition using the face_recognition module and ip cameras.
MIT License
19 stars 8 forks source link

Help with the code #1

Open cru5h3r opened 4 years ago

cru5h3r commented 4 years ago

Hi there, I want to create a "party greeter", similar to this one: https://robotzero.one/face-recognition-party-greeter-raspberry-pi/, but using my IP Camera and Ubuntu OS. The intend is to make a web request when a face is recognized. The web request will make echo dot say something using IFTTT.

I commented the line "cv2.imshow('camera', frame)", because I don't need to see the streaming video, and inserted a print function that shows the name of the found person:

for name, (top, right, bottom, left) in predictions: print("- Found {}".format(name))

The problem is that when a face is detected it keeps printing the message in the console. Few seconds of a face showing results in dozens of lines in the console with the same message.

I need somehow to limit this and make it shows the message only once. The http request also should be send only once.

Can I get some help with this? Thanks in advance.

KiLJ4EdeN commented 4 years ago

Hi there, I want to create a "party greeter", similar to this one: https://robotzero.one/face-recognition-party-greeter-raspberry-pi/, but using my IP Camera and Ubuntu OS. The intend is to make a web request when a face is recognized. The web request will make echo dot say something using IFTTT.

I commented the line "cv2.imshow('camera', frame)", because I don't need to see the streaming video, and inserted a print function that shows the name of the found person:

for name, (top, right, bottom, left) in predictions: print("- Found {}".format(name))

The problem is that when a face is detected it keeps printing the message in the console. Few seconds of a face showing results in dozens of lines in the console with the same message.

I need somehow to limit this and make it shows the message only once. The http request also should be send only once.

Can I get some help with this? Thanks in advance.

Hello, I think i know where the problem is, Since we are skipping frames, what i did is that through the time that the frames are being skipped, which is a pretty small time on a 30 fps camera the same predictions are shown on the image, which i understand is not good for your application.

What you can do is move the line: frame = show_prediction_labels_on_image(frame, predictions1) Inside the frame skipping condition: if process_this_frame % 30 == 0: So only when frames are being processed the results will be shown.

Or and alternative option would be removing the frame skipping lines.