- Python 79.1%
- JavaScript 8.1%
- HTML 6.8%
- CSS 4.5%
- Dockerfile 1.5%
Predator-Detect-and-Notify
Introduction
This software uses the state-of-the-art YOLOv8 object detection and classification neural net to detect predators in a video stream.
It accomplishes this using model weights (soon-to-be) fine-tuned on a range of farm animals and predators. This software is licenced under AGPL-v3-or-later.
This project is meant for personal (or business) use, within a single network. This is not a saas platform, and making it one is not currently on the roadmap.
"Crop of Predalert detecting a Lynx"
Installation
*This software is Linux-native, and has yet to be tested on Windows. Your mileage on Windows may vary.
$ git clone https://gitlab.com/papiris/predator-detect-and-notify && cd predator-detect-and-notify
You need python --version >3.8 & <=3.11.
-
$ python3 -m venv .env -
$ source .env/bin/activate -
python3 -m pip install .
The installation of packages may take a while, having a cup of coffee while you wait is advised.
Your virtual environment is now prepared.
How to use
- Find the ip address and path to RTSP stream for your given IP camera(s). Look for your camera make and model here or find the stream URL manually by following this guide.
- [optional] set the IP address of your camera to static in your network router.
- Change values in config/config.toml and security.toml to suit your environment (important!)
- Make sure your virtual environment is activated. If not, repeat step 3 of the install process.
- Run
python -m predalert
The required computer resources (ram, processing, graphics) scales linearly with the number of sources and their resolution.
Roadmap
- fine-tune model weights -- [ ] on sheep, humans, dogs and lynx -- [ ] on other classes
- remove hardcodings, migrate to config file
- use multiprocessing to increase performance with many sources
- graceful handling of errors, not let one bad videostream hold back others
- add motion and proximity logic to determine threat level of predator
- filter out humans from any data processing for privacy reasons
- add option to record and store clips of predators
- add local notification system
- add webpush notification system
- add web-based UI for making changes to config file
- add web-based UI for setting areas of interest (polygons)
- enable ML offloading (to Coral Accelerator, Codeproject.ai, Deepstack)
- add privacy statement -- [ ] Improve privacy statement
- comply with AGPL-v3 (source available to all users, even when the program is served over network)
- make deployable in docker or other package format
- Add integrations with / bridges for various drones for ranged (and autonomous) grazing area surveillance
- Add integrations with / bridges for various wildlife cameras
Contributions
This project accepts contributions of many kinds. Due to my employment status (on welfare), monetary contributions are most welcome. I'll get a donation link up soon. There are many ways to contribute apart from monetarily;
- code (merge requests)
- bug reports
- training material (images/videos)
- spread the word! I love to hear about users' stories, as well as media recognition. It helps make my case to get more support for the project.
External libraries
- YOLOv8 (GNU affero General Public License (AGPL-v3))
- matplotlib (Python Software Foundation License (PSF))
- openCV (Apache Software License (Apache 2.0))
- numpy (BSD-3-Clause)
- deffcode (Apache Software License (Apache 2.0))
- RT-DETR (Apache Software License (Apache 2.0))
- vidgear (Apache Software License (Apache 2.0))