Code Monkey home page Code Monkey logo

oddspot's Introduction

oddspot

Daemon that receives emails from cameras (with motion detection images attached) and uses Deepstack to identify and tag the presence of people, vehicles, et cetra. If items of interest are located, an alert is sent out via Pushover.

Installation

oddspot installs as a Docker Compose stack. These instructions are for a stock Ubuntu 22.04 LTS system.

Install base dependencies:

sudo apt-get -y install sendemail curl
curl -fsSL get.docker.com -o get-docker.sh && sudo sh get-docker.sh
#add your user to the docker group
sudo adduser $USER docker
#either log out and back in, or run this next command for the group changes to take effect...
su - $USER

If you have a CUDA-capable NVIDIA GPU installed in your system, oddspot will work with it automatically, as long as the drivers are installed.

sudo apt-get -y install ubuntu-drivers-common nvidia-cuda-toolkit
sudo ubuntu-drivers autoinstall

#Then reboot your system for the driver to be properly loaded.
sudo reboot

Note that if you run into an "unmet dependencies" error during running of the ubuntu-drivers autoinstall command, try the following:

sudo apt-get remove --purge nvidia-* -y
sudo apt autoremove
sudo ubuntu-drivers autoinstall

If using a GPU -- Install Nvidia container toolkit as well:

# install nvidia container toolkit
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
      && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
      && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
            sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
            sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
# test and make sure the GPU is visible from a docker container
docker run --rm --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi

Sample config

Copy the conf/oddspot.ini.dist file to conf/oddspot.ini and customize it to your needs. Once created, set the proper permissions:

sudo chown ${USER}:35501 conf/oddspot.ini
sudo chmod 640 conf/oddspot.ini

Testing

If you have a GPU:

docker compose build
docker compose up

If using a CPU:

docker compose build
docker compose -f docker-compose-cpu.yml up

Then, copy a camera capture image to the system, and run the following command in another terminal window to send a test email that oddspot should pick up and process:

sendemail -f [email protected] -t oddspot@localhost -s localhost:10025 -u 'testing 123' -m 'test' -a <TESTIMAGE>.jpg

Tail /home/<USER>/oddspot/logs/oddspot.log to see if processing was successful or not.

Usage

Just launch docker compose up -d (or docker compose -f docker-compose-cpu.yml up -d for CPU-only installs). The service will properly launch after a reboot.

Modify your camera setup (via its embedded web configuration page) to send an email to oddspot@<YOURMACHINE>:<YOURPORT> on motion detection events. Make sure it attaches a snapshot of the event in jpeg or png format (and not a video). Also, to avoid flooding the script, you should probably have it so that it will only send repeat emails every minute or more. The oddspot script allows you to further limit continuous emails on a per camera basis via the min_notify_period config setting, but it should get raw emails from the cameras on motion events more frequently than that, to maximize alerting accuracy).

oddspot's People

Contributors

robby-d avatar

Stargazers

 avatar

Watchers

 avatar

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.