Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Docker is working again
Browse files Browse the repository at this point in the history
Resorted to reinstalling `torchvision` via `pip`
  • Loading branch information
slashtechno committed Mar 8, 2024
1 parent 4c398b9 commit 771154c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 26 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
FROM python:3.10.5-buster

LABEL org.opencontainers.image.description "Dokcer image for running wyzely-detect"
LABEL org.opencontainers.image.description "Docker image for running wyzely-detect"
LABEL org.opencontainers.image.source "https://github.com/slashtechno/wyzely-detect"

RUN apt update && apt install libgl1 -y
RUN pip install poetry


WORKDIR /app

COPY . .

RUN poetry install

ENTRYPOINT ["poetry", "run", "python", "-m", "wyzely_detect"]
RUN poetry run pip uninstall -y torchvision
RUN poetry run pip install torchvision

ENTRYPOINT ["poetry", "run", "python", "-m", "--", "wyzely_detect", "--no-display"]
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Recognize faces/objects in a video stream (from a webcam or a security camera) a
### 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
Expand All @@ -37,20 +38,24 @@ Cloning the repository is not required when installing from PyPi but is required
2. `cd` into the cloned repository
3. Then, either install with [Poetry](https://python-poetry.org/) or run with Docker

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

#### Installing from PyPi with pip
#### 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
#### 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](https://github.com/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.

Expand Down
33 changes: 24 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ services:
restart: unless-stopped
image: mrlt8/wyze-bridge:latest
# The ports can be removed since we're using the network
# Just an unnecesary security risk to expose them but can be useful for debugging
# Just an unnecesary security risk to expose them but can be useful for debugging
# ports:
# - 1935:1935 # RTMP
# - 8554:8554 # RTSP (this is really the only one we need)
# - 8888:8888 # HLS
# - 5000:5000 # WEB-UI
# - 5000:5000 # WEB-UI
environment:
- WYZE_EMAIL=${WYZE_EMAIL} # Replace with wyze email
- WYZE_PASSWORD=${WYZE_PASSWORD} # Replace with wyze password
# This is a simple configuration without 2FA.
# For advanced configuration, including using an API key, see https://github.com/mrlt8/docker-wyze-bridge/wiki/Two-Factor-Authentication
# Either replace the following with your Wyze username and password, or set the environment variables
- WYZE_EMAIL=${WYZE_EMAIL}
- WYZE_PASSWORD=${WYZE_PASSWORD}
networks:
all:
ntfy:
Expand All @@ -35,12 +38,24 @@ services:
all:
wyzely-detect:
container_name: wyzely-detect
restart: unless-stopped
image: ghcr.io/slashtechno/wyzely-detect:latest
# restart: unless-stopped
# image: ghcr.io/slashtechno/wyzely-detect:latest
# Building from source is also an option
# build:
# context: .
# dockerfile: Dockerfile
build:
context: .
dockerfile: Dockerfile
command:
- "--ntfy-url"
# Replace "wyzely-detect" with the desired notification stream
- "http://ntfy:80/wyzely-detect"

- "--rtsp-url"
# Replace "cv" with the desired rtsp stream
- "rtsp://bridge:8554/cv"

# Example second rtsp stream
# - "--rtsp-url"
# - "rtsp://bridge:8554/camera"
volumes:
- ./faces:/app/faces
networks:
Expand Down
19 changes: 9 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 771154c

Please sign in to comment.