Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with the code #1

Open
cru5h3r opened this issue May 28, 2020 · 1 comment
Open

Help with the code #1

cru5h3r opened this issue May 28, 2020 · 1 comment

Comments

@cru5h3r
Copy link

cru5h3r commented May 28, 2020

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants