calebolson123 / BabySleepCoach

DIY Baby Sleep Tracking
https://calebolson.com
Other
201 stars 35 forks source link

python script infinite loop #9

Closed anru82 closed 6 months ago

anru82 commented 1 year ago

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!

calebolson123 commented 1 year ago

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.

anru82 commented 1 year ago

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

calebolson123 commented 1 year ago

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

peterpan192 commented 1 year ago

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? :-)

anru82 commented 1 year ago

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

calebolson123 commented 1 year ago

@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