Coder Social home page Coder Social logo

slashtechno / wyzely-detect Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 812 KB

Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices

License: GNU Affero General Public License v3.0

Python 87.41% Dockerfile 1.28% Jupyter Notebook 11.32%
computer-vision object-detection opencv wyze wyzecam hacktoberfest

wyzely-detect's Introduction

Wyzely Detect

Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices

Features

  • Recognize objects
  • Recognize faces
  • Send notifications to your phone (or other devices) using ntfy
  • Optionally, run headless with Docker
  • Either use a webcam or an RTSP feed

Prerequisites

Python

  • Camera, either a webcam or a Wyze Cam
    • All RTSP feeds should work, however.
    • WSL, by default, does not support USB devices. It is recommended to natively run this, but it is possible to use it on WSL with streams or some workarounds.
  • Python 3.10 or 3.11
  • Poetry (optional)
  • Windows or Linux
    • I've tested this on MacOS - it works on my 2014 MacBook Air but not a 2011 MacBook Pro
    • Both were upgraded with OpenCore, with the MacBook Air running Monterey and the MacBook Pro running a newer version of MacOS, which may have been the problem

Docker

  • A Wyze Cam
    • Any other RTSP feed should work, as mentioned above
  • Docker
  • Docker Compose

What's not required

  • A Wyze subscription

Usage

Installation

Cloning the repository is not required when installing from PyPi but is required when installing from source

  1. Clone this repo with git clone https://github.com/slashtechno/wyzely-detect
  2. cd into the cloned repository
  3. Then, either install with Poetry or run with Docker

Installing from PyPi with pip (recommended)

This assumes you have Python 3.10 or 3.11 installed

  1. pip install wyzely-detect
    a. You may need to use pip3 instead of pip
  2. wyzely-detect

Poetry (best for GPU support)

  1. poetry install
    a. For GPU support, use poetry install -E cuda --with gpu
  2. poetry run -- wyzely-detect

Docker

Running with Docker has the benefit of having easier configuration, the ability to run headlessly, and easy setup of Ntfy and mrlt8/docker-wyze-bridge. However, for now, CPU-only is supported. Contributions are welcome to add GPU support. In addition, Docker is tested a less-tested method of running this program.

  1. Modify to docker-compose.yml to achieve desired configuration
  2. Run in the background with docker compose up -d

Configuration

The following are some basic CLI options. Most flags have environment variable equivalents which can be helpful when using Docker.

  • For face recognition, put images of faces in subdirectories ./faces (this can be changed with --faces-directory)
    • Keep in mind, on the first run, face rec
  • By default, notifications are sent for all objects. This can be changed with one or more occurrences of --detect-object to specify which objects to detect
    • Currently, all classes in the COCO dataset can be detected
  • To specify where notifications are sent, specify a ntfy URL with --ntfy-url
  • To configure the program when using Docker, edit docker-compose.yml and/or set environment variables.
  • For further information, use --help

How to uninstall

  • If you used Docker, run docker-compose down --rmi all in the cloned repository
  • If you used Poetry, just delete the virtual environment and then the cloned repository

wyzely-detect's People

Contributors

deepsource-autofix[bot] avatar deepsource-io[bot] avatar dependabot[bot] avatar funnukes avatar slashtechno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

funnukes

wyzely-detect's Issues

Fails when there are more than one face in the frame

The program works great until there is one face but as soon as another face comes in frame, the program stops and gives this error. Is there a way to keep the program working even when there are multiple faces? It is fine if it can recognise only one and leave the other unlabelled.

I tried to contact you but it is hard to join fosstodon without an invite, I would really like if you can help me.

Error- Traceback (most recent call last):
File "C:\Users\funnu\OneDrive\Desktop\Face and Object\wyzely_detect_main_.py", line 225, in
main()
File "C:\Users\funnu\OneDrive\Desktop\Face and Object\wyzely_detect_main_.py", line 94, in main
if face_details := utils.recognize_face(
File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wyzely_detect\utils\utils.py", line 141, in recognize_face
path_to_image = Path(df.iloc[-1]["identity"])
File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\indexing.py", line 1153, in getitem
return self._getitem_axis(maybe_callable, axis=axis)
File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\indexing.py", line 1714, in _getitem_axis
self._validate_integer(key, axis)
File "C:\Users\funnu\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\indexing.py", line 1647, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds

Failed to load image Python extension: libc10_cuda.so

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:[email protected]] global cap_v4l.cpp:997 open VIDEOIO(V4L2:/dev/video0): can't open camera by index
2024-03-03 13:23:35 [ERROR:[email protected]] 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.