whosthat is app for detecting people on CCTV/cameras and sending notifications with photo snapshots using Telegram bot.
This is what it looks like on my phone in action.
Never misses a single person, not even in infrared mode (during night time) :)
(blurred for privacy reasons)
- Java 14
- Spring Boot 2.4.2
- OpenCV 4.2.0-0
- darknet/yolo
- Docker 20.10.5
- Gradle 6.7.1
- HikVision VR DS-7604NI-K1 / 4P
To be able to run whosthat, working Docker installation and gradle should be available on your machine:
- check if Docker is working
If version not printed, make sure to install Docker first.
docker -v
- check if gradle is working
If version not printed, make sure to install gradle first.
gradle -v
- Clone the repo
git clone https://github.com/karlonovak/whosthat cd whosthat
- Build app and Docker image (might take a while to download darknet model)
gradle docker
- Check if Docker image created
whosthat image should be printed out.
docker images | grep whosthat
- Fill in whosthat.env file with your data (see instructions below!)
-
docker run --env-file whosthat.env whosthat
- If everything went well, success message should be shown:
Started WhosThatApplication in x.xx seconds (JVM running for y.yyy)
whosthat comes with provided example env file, whosthat.env file inside project root. Environment file should be filled in with your camera's data. Available variables are:
- [Optional] configurable log level for app, best left default
LOG_LEVEL=DEBUG
- [Mandatory] this param points to an HTTP address of a JPEG image of your camera. One such example (for my type of Hikvision camera) is shown below.
CAM_ADDRESS=http://192.168.1.50:6500/ISAPI/Streaming/channels/101/picture
- [Optional] BASIC/DIGEST auth username if needed
CAM_USER=admin
- [Optional] BASIC/DIGEST auth password if needed
CAM_PASS=admin1234
- [Optional] frequency at which snapshot is taken from the camera
CAM_FREQUENCY_IN_S=5
- [Optional] list of rectangles to exclude from detection if camera snapshots contains parts that don't need to be included for detection, example with two rectangles (delimited by '_'): 1980x0,2688x480_2400x0,2688x1520
CAM_CROP_RECTANGLES=
- [Optional] Path to darknet weights, default is the one suited for Docker container (automatically downloaded on image building)
YOLO_WEIGHTS=/opt/darknet/yolov3.weights
- [Optional] Path to darknet config, default is the one suited for Docker container (automatically downloaded on image building)
YOLO_CONFIG=/opt/darknet/cfg/yolov3.cfg
- [Mandatory] Telegram token (https://core.telegram.org/bots#6-botfather)
TELEGRAM_TOKEN=1785646214:ABHEd4GeiRNFRd_0dsvMKIgGmMVsDIBbosP
- [Mandatory] Chat ID of a group that bot should use to send detected images to (https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id)
TELEGRAM_CHAT_ID=-527125351
- [Optional] To avoid spam, declare a threshold for Telegram notifications
TELEGRAM_NOTIFICATION_THRESHOLD_IN_S=60