calebolson123 / BabySleepCoach

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

Can't see video feed on webapp. #35

Closed rtxco closed 6 months ago

rtxco commented 6 months ago

I know the rtsp link is working because I can see it via VLC media player. I ran docker logs and came up with a bunch of errors I don't really understand. The webapp UI is visible, just no video feed. image

image

image

image

albvar commented 6 months ago

Install net tools on the docker container and show us what ports are running. Then show us your F12 developer network tab show us errors reaching the stream.

rtxco commented 6 months ago

image

image

@albvar hope this helps

Install net tools on the docker container and show us what ports are running. Then show us your F12 developer network tab show us errors reaching the stream.

rtxco commented 6 months ago

image

rtxco commented 6 months ago

@calebolson123 any help here? thanks in advance

calebolson123 commented 6 months ago

Hey man, apologies for the difficulty in getting it all configured. As you can tell I don't work these projects full time, just as free time and willingness allows :). Hopefully I can help you get it up and running.

The environment variable most likely causing your issues is gonna be CAM_URL. You should be able to use the same url you're using for VLC player, as part of that environment variable in the app. If you're running w/ docker-compose, it should load up your .env file. For sanity, I would suggest jumping into the container(docker exec -it <container_id> bash) and checking out your environment variables w/ env | sort. My full CAM_URL is: CAM_URL=rtsp://username:pw@192.168.50.130:554/h264Preview_01_sub. I just ran a fresh install on a mac and it all worked except for some startup issues highlighted in other gh issues.. i'll be addressing those in a PR soon here. It looks like you're beyond those issues, however.

Can you find the request matching this screenshot in your network console? This is the request which gets video frames from the server, and is subsequently rendered in browser

image
calebolson123 commented 6 months ago

https://github.com/calebolson123/BabySleepCoach/pull/36

rtxco commented 6 months ago

@calebolson123 hey caleb thanks for the assistance. I ran the env | sort for peace of mind and returned this

APP_DIR=/usr/app/babysleepcoach CAM_URL=rtsp://user:pw@192.168.1.95:554/stream1 DEBUG=False HATCH_IP=192.168.HATCH.IP HOME=/root HOSTNAME=7ec86f69a02c NODE_VERSION=21.6.2 OWL=False PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PIP_BREAK_SYSTEM_PACKAGES=1 PORT=80 PWD=/usr/app/babysleepcoach REACT_APP_BACKEND_IP=192.168.1.79:8001 REACT_APP_RESOURCE_SERVER_IP=192.168.1.79:8000 SHLVL=1 TERM=xterm VIDEO_PATH=/usr/app/babysleepcoach/video YARNVERSION=1.22.19 =/usr/bin/env root@7ec86f69a02c:/usr/app/babysleepcoach#

So I think that checks out regarding the env file.

rtxco commented 6 months ago

@calebolson123 I changed the IP in the env file to just localhost as per your recent suggestion, and now i see this image So I guess there's something wrong with the request to get video frames which makes sense why I don't have a video feed. How do I fix this lol. My camera is working, I can see it on VLC with the exact same URL that's in my ENV. Ports are open.

image

image

rtxco commented 6 months ago

Not sure if this helps but when I go to the Request URL that is in that Raw header, it shows me this image

calebolson123 commented 6 months ago

Do you mind telling me what kind of camera you have?

Also, are you sure the trailing /stream1 on your CAM_URL is correct? You have /stream1 in the url used in vlc player? for my reolink camera, i use /h264Preview_01_sub.

rtxco commented 6 months ago

Do you mind telling me what kind of camera you have?

Also, are you sure the trailing /stream1 on your CAM_URL is correct? You have /stream1 in the url used in vlc player? for my reolink camera, i use /h264Preview_01_sub.

Well I have no idea why or how, but I did a fresh install just like you mentioned, and it works. Using the exact same Cam url and other variables. I don't get it. Haha.

I do have a random question still, if I train this AI with say for example my wife, and then want to use it for the baby who isn't here yet, is there a way I can delete it's knowledge up till that point? Or does it require a fresh install.

calebolson123 commented 6 months ago

Good deal, glad it's up. There are a lot of things I would do to improve this thing, but it limps along okay.. and I'm currently deep into another project. By open sourcing I was hoping others would be able to improve it further.

On the swapping of subjects: There's no built-in way of swapping subjects currently. But you can swap training data around if you move some files around. I don't have a clean set of steps right now, but if you trace the code around training, you can piece what it does together. If I recall correctly, I'm saving images to filesystem (BabySleepCoach/blanket_model/input) every time you click awake/asleep button. Then that file is read along w/ all prior samples collected, and used to create a new version of the model which reloaded in in real time.

So you could keep your labeled samples of your wife by just copying and pasting elsewhere, and clearing out the images in blanket_model/input/* & resetting image_data.json to look like: { "baby": [], "no_baby": [] }. If i recall correctly, the JSON bit was just a speedup trick i came up w/ to get around reading and parsing all the sample images every time the user retrains the model.

If you 1) "reset" image_data.json & 2) remove the images under the input dir, and maybe a reboot, you should be able to wipe the system clean. user_defined_crop_area.txt is the other file that persists to fs.. this is where the bounding box of pixels the system actually processes on, is stored. This is for performance improvements. But if you're trying to wipe clean for your baby, I would just empty that file. The app should force you to reset the bounds

calebolson123 commented 6 months ago

I'm going to close this, feel free to create new issues!