slashtechno / wyzely-detect

Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices
GNU Affero General Public License v3.0
12 stars 1 forks source link

Failed to load image Python extension: libc10_cuda.so #13

Closed KyGuy2002 closed 8 months ago

KyGuy2002 commented 8 months ago

When attempting to start the container, I am receiving this error.

Do I need to install something else to make this work?

Thank you!

2024-03-03 13:23:12 /root/.cache/pypoetry/virtualenvs/wyzely-detect-9TtSrW0h-py3.10/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: 'libc10_cuda.so: cannot open shared object file: No such file or directory'If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?
2024-03-03 13:23:12   warn(
2024-03-03 13:23:31 Directory  /root /.deepface created
2024-03-03 13:23:31 Directory  /root /.deepface/weights created
2024-03-03 13:23:32 No .env file found
2024-03-03 13:23:32 No CUDA device available, using CPU
2024-03-03 13:23:32 Downloading https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8n.pt to 'yolov8n.pt'...
100% 6.23M/6.23M [00:01<00:00, 5.95MB/s]
2024-03-03 13:23:34 No stream or capture device set, defaulting to capture device 0
2024-03-03 13:23:35 [ WARN:0@29.296] global cap_v4l.cpp:997 open VIDEOIO(V4L2:/dev/video0): can't open camera by index
2024-03-03 13:23:35 [ERROR:0@29.301] global obsensor_uvc_stream_channel.cpp:159 getStreamChannelGroup Camera index out of range
2024-03-03 13:23:35 Capture for a source failed as resolution is 0x0.
2024-03-03 13:23:35 Check if the capture device is connected, working, and not in use by another program.
slashtechno commented 8 months ago

Do you have a GPU? Also, how did you install and run the program? Either way, the first line shouldn't be an issue, if I remember from my expierence. Also, do you have a webcam or video capture device? That's what is most likely causing the error near the end of the output. If you want to use a Wyze Cam, you have to set up docker-wyze-bridge. Currently, the Dockerfile for Wyzely Detect isn't up-to-date and thus, might not work. Thus, I suggest going to docker-wyze-bridge and following the quick start guide. If you face any issues, I can try to help you.

KyGuy2002 commented 8 months ago

I do have a GPU, but im not sure if I need to do anything to select or enable it. I cloned the repo and ran the docker compose command, and added creds to the file. My laptop has a webcam and I have an external webcam, but im not sure if those are accessible to WSL. I am using docker desktop with WSL 2 integration, and I ran the docker commands from within WSL. I have docker bridge setup in a seperate container, how would I link them if I dont use the one included in the compose file?

I am pretty new to all this so sorry if Im overlooking some things.

KyGuy2002 commented 8 months ago

I tried it with poetry instead of docker, and I got it to recognize my GPU but same error. I have docker bridge running also, but not sure if I need to tell it where to find it or something.

The currently activated Python version 3.8.10 is not supported by the project (>=3.10, <3.12).
Trying to find and use a compatible version. 
Using python3.10 (3.10.13)
Directory  /home/linux /.deepface created
Directory  /home/linux /.deepface/weights created
No .env file found
Using NVIDIA GeForce RTX 3050 Laptop GPU for pytorch
Set CUDA device
Downloading https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8n.pt to 'yolov8n.pt'...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6.23M/6.23M [00:00<00:00, 8.62MB/s]
No stream or capture device set, defaulting to capture device 0
[ WARN:0@16.890] global cap_v4l.cpp:997 open VIDEOIO(V4L2:/dev/video0): can't open camera by index
[ERROR:0@16.890] global obsensor_uvc_stream_channel.cpp:159 getStreamChannelGroup Camera index out of range
Capture for a source failed as resolution is 0x0.
Check if the capture device is connected, working, and not in use by another program.
slashtechno commented 8 months ago

I tried it with poetry instead of docker, and I got it to recognize my GPU but same error. I have docker bridge running also, but not sure if I need to tell it where to find it or something.

The currently activated Python version 3.8.10 is not supported by the project (>=3.10, <3.12).
Trying to find and use a compatible version. 
Using python3.10 (3.10.13)
Directory  /home/linux /.deepface created
Directory  /home/linux /.deepface/weights created
No .env file found
Using NVIDIA GeForce RTX 3050 Laptop GPU for pytorch
Set CUDA device
Downloading https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8n.pt to 'yolov8n.pt'...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6.23M/6.23M [00:00<00:00, 8.62MB/s]
No stream or capture device set, defaulting to capture device 0
[ WARN:0@16.890] global cap_v4l.cpp:997 open VIDEOIO(V4L2:/dev/video0): can't open camera by index
[ERROR:0@16.890] global obsensor_uvc_stream_channel.cpp:159 getStreamChannelGroup Camera index out of range
Capture for a source failed as resolution is 0x0.
Check if the capture device is connected, working, and not in use by another program.

This is caused by WSL not having access to the webcam. There are workarounds, but I would suggest just running it natively on Windows. However, it seems TensorFlow randomly stopped working on Windows when using Poetry, which I am doing some more testing on currently.

Given what you've said, and since it seems to be running on WSL, pass --rtsp-url <URL> to the program. You can obtain the RTSP URL from the docker-wyze-bridge Web UI.

Ideally, when I get Windows support working again, you shouldn't need to use WSL and the process will be much more seamless, like it was before the TensorFlow issue.

slashtechno commented 8 months ago

Seems the TensorFlow issue only impacts Poetry, which whilst still unfortunate and irritating, at least means that you can install via pip. Try installing via pip outside of WSL and you should be able to use the webcam.

KyGuy2002 commented 8 months ago

Using the rtsp url i was able to get it working! I suggest you add that to the readme, unless I missed it.

I will try it with the webcam and pip to make sure that works also.

Thanks!!

slashtechno commented 8 months ago

No problem - glad it's working. I'll reply to this issue once TensorFlow is working again.

I agree the README needs work. I'm going to keep this issue open until I fix it.

slashtechno commented 8 months ago

The TensorFlow issue is now fixed in v0.2.1.