diff --git a/.vscode/launch.json b/.vscode/launch.json index f843587..dafa255 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "Python: Module", "type": "python", "request": "launch", - "module": "set_detect_notify", + "module": "wyzely_detect", "justMyCode": true } ] diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..37441be --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "files.eol": "\n" +} \ No newline at end of file diff --git a/README.md b/README.md index 3887547..94f1282 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Wyzely Detect -Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your phone (or other devices) +Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices ### Features - Recognize objects @@ -13,22 +13,22 @@ Recognize faces/objects in a video stream (from a webcam or a security camera) a ## Prerequisites ### Poetry/Python - Camera, either a webcam or a Wyze Cam - - All RTSP feeds _should_ work, however. -- Python - - 3.10.5 is confirmed to work and problems have been encountered with 3.11 -- Poetry -### Docker + - All RTSP feeds _should_ work, however. +- Python 3.10 or 3.11 +- Poetry +### Docker - A Wyze Cam - - Any other RTSP feed _should_ work, as mentioned above -- Python -- Poetry + - Any other RTSP feed _should_ work, as mentioned above +- Docker +- Docker Compose + ## What's not required - A Wyze subscription -## Usage +## Usage ### Installation -1. Clone this repo with `git clone https://github.com/slashtechno/wyze-face-recognition.git` +1. Clone this repo with `git clone https://github.com/slashtechno/wyze-face-recognition.git` 2. `cd` into the cloned repository 3. Then, either install with [Poetry](https://python-poetry.org/) or run with Docker @@ -38,7 +38,7 @@ Recognize faces/objects in a video stream (from a webcam or a security camera) a #### Poetry 1. `poetry install` -2. `poetry run -- set-detect-notify` +2. `poetry run -- wyzely-detect` ### Configuration The following are some basic CLI options. Most flags have environment variable equivalents which can be helpful when using Docker. diff --git a/docker-compose.yml b/docker-compose.yml index 08e323c..4480bde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ networks: all: services: bridge: - container_name: bridge-wyze + container_name: bridge-wyzely-detect restart: unless-stopped image: mrlt8/wyze-bridge:latest # I think we can remove the ports, since we're using the network @@ -20,7 +20,7 @@ services: all: ntfy: image: binwiederhier/ntfy - container_name: ntfy-wyze + container_name: ntfy-wyzely-detect command: - serve environment: @@ -33,10 +33,10 @@ services: restart: unless-stopped networks: all: - facial_recognition: - container_name: face-recognition-wyze + wyzely-detect: + container_name: wyzely-detect restart: unless-stopped - # image: ghcr.io/slashtechno/wyze_face_recognition:latest + # image: ghcr.io/slashtechno/wyzely-detect:latest build: context: . dockerfile: Dockerfile @@ -47,7 +47,7 @@ services: environment: - URL=rtsp://bridge:8554/cv - NO_DISPLAY=true - - NTFY_URL=http://ntfy:80/set-detect-notify + - NTFY_URL=http://ntfy:80/wyzely-detect depends_on: - bridge diff --git a/pyproject.toml b/pyproject.toml index f78c1c5..a5dc457 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "wyzely-detect" -version = "0.1.0" -description = "Detect all the things" +version = "0.1.8" +description = "Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices" authors = ["slashtechno <77907286+slashtechno@users.noreply.github.com>"] license = "MIT" readme = "README.md" @@ -9,8 +9,7 @@ packages = [{include = "wyzely_detect"}] [tool.poetry.dependencies] -# As of 10/21/23, Python 3.11 doesn't work (at least on Windows) -# Seems "^3.10" won't work because of TensorFlow or another library +# Works on 3.10 and 3.11, at least in my testing python = ">=3.10, <3.12" python-dotenv = "^1.0.0" @@ -25,6 +24,7 @@ torch = ">=2.0.0, !=2.0.1, !=2.1.0" # https://stackoverflow.com/a/76477590/18270659 # https://discuss.tensorflow.org/t/tensorflow-io-gcs-filesystem-with-windows/18849/4 +# Might be able to remove this version constraint later tensorflow-io-gcs-filesystem = "0.31.0" @@ -47,6 +47,7 @@ build-backend = "poetry.core.masonry.api" # Where possible, `black` will attempt to format to 88 characters # However, setting ruff to 135 will allow for longer lines that can't be auto-formatted line-length = 135 +extend-select= ["FIX002"] [tool.poetry.scripts] wyzely-detect = "wyzely_detect.__main__:main" \ No newline at end of file diff --git a/wyzely_detect/__main__.py b/wyzely_detect/__main__.py index 32f6ccb..2166a24 100644 --- a/wyzely_detect/__main__.py +++ b/wyzely_detect/__main__.py @@ -34,8 +34,8 @@ def main(): print("No .env file found") argparser = argparse.ArgumentParser( - prog="Detect It", - description="Detect it all!", + prog="Wyzely Detect", + description="Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices", # noqa: E501 epilog=":)", ) @@ -118,13 +118,13 @@ def main(): # Defaults for the stuff here and down are already set in notify.py. # Setting them here just means that argparse will display the default values as defualt # TODO: Perhaps just remove the default parameter and just add to the help message that the default is set is x - + # TODO: Make ntfy optional in ntfy.py notifcation_services = argparser.add_argument_group("Notification Services") notifcation_services.add_argument( "--ntfy-url", default=os.environ["NTFY_URL"] if "NTFY_URL" in os.environ and os.environ["NTFY_URL"] != "" - else "https://ntfy.sh/set-detect-notify", + else "https://ntfy.sh/wyzely-detect", type=str, help="The URL to send notifications to", ) diff --git a/wyzely_detect/utils/notify.py b/wyzely_detect/utils/notify.py index 89ae851..fce34de 100644 --- a/wyzely_detect/utils/notify.py +++ b/wyzely_detect/utils/notify.py @@ -32,7 +32,7 @@ def thing_detected( detection_window: int = 15, detection_duration: int = 2, notification_window: int = 15, - ntfy_url: str = "https://ntfy.sh/set-detect-notify", + ntfy_url: str = "https://ntfy.sh/wyzely-detect", ) -> dict: """ A function to make sure 2 seconds of detection is detected in 15 seconds, 15 seconds apart.