calebolson123/BabySleepCoach

python script infinite loop

anru82 opened this issue · 6 comments

Screenshot from 2023-04-17 23-01-08

Hi, I really like your work man! When I'm running the main.py script I get an infinite loop trying to find the body.
Any solutions?

Thanks!

Hey @anru82, yeah this is expected behavior, actually. You could view the system considering the baby in two states, awake or asleep. The default is that baby is awake, i.e. no face/eyes/body found, thus consider baby is up doing baby things. But if these features are in frame, you'll notice the output start indicating that it's seeing the baby. I would recommend recording a short clip (or just grab one online, but that's kinda creepy lol), and using the recorded mode.. it's easier to test with.

The script (in live mode) will just run forever until you kill it. I have it running on a raspberry pi as a linux service, so it runs in the background and is able to recover if it crashes, ideally.

Ok thank you for explaining that. What about the app? When I start it with "yarn start" I only get an icon, do I have to change something in the code?

Screenshot_2023-04-19-17-27-46-737_com android chrome

Ah, yeah there's a little bit of configuration you'll have to do to connect the webapp and script unfortunately. Check here. You'll need to update the path and IP based on your setup

The script (in live mode) will just run forever until you kill it. I have it running on a raspberry pi as a linux service, so it runs in the background and is able to recover if it crashes, ideally.

Could you share your service settings especially the restart-behaviour? :-)

I got it running thanks. How do I get the live streaming with the status?

@anru82 so the live stream doesn't show up in the web app, it shows up in a separate GUI when you have the environment variable DEBUG set to true. That's a cool idea though, to have the stream load up in the web app when you open it. Just doesn't exist in current state