Skip to content

karlonovak/whosthat

Repository files navigation

About The Project

whosthat is app for detecting people on CCTV/cameras and sending notifications with photo snapshots using Telegram bot.

whosthat in action

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)
alt text

Built With

  • Java 14
  • Spring Boot 2.4.2
  • OpenCV 4.2.0-0
  • darknet/yolo

Tested with

  • Docker 20.10.5
  • Gradle 6.7.1
  • HikVision VR DS-7604NI-K1 / 4P

Getting Started

Prerequisites

To be able to run whosthat, working Docker installation and gradle should be available on your machine:

  • check if Docker is working
    docker -v
    If version not printed, make sure to install Docker first.
  • check if gradle is working
    gradle -v
    If version not printed, make sure to install gradle first.

Installation

  1. Clone the repo
    git clone https://github.com/karlonovak/whosthat
    cd whosthat
  2. Build app and Docker image (might take a while to download darknet model)
    gradle docker
  3. Check if Docker image created
    docker images | grep whosthat
    whosthat image should be printed out.
  4. Fill in whosthat.env file with your data (see instructions below!)
  5. docker run --env-file whosthat.env whosthat
  6. If everything went well, success message should be shown:
    Started WhosThatApplication in x.xx seconds (JVM running for y.yyy)

Environment file

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:

  1. [Optional] configurable log level for app, best left default
LOG_LEVEL=DEBUG
  1. [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
  1. [Optional] BASIC/DIGEST auth username if needed
CAM_USER=admin
  1. [Optional] BASIC/DIGEST auth password if needed
CAM_PASS=admin1234
  1. [Optional] frequency at which snapshot is taken from the camera
CAM_FREQUENCY_IN_S=5
  1. [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=
  1. [Optional] Path to darknet weights, default is the one suited for Docker container (automatically downloaded on image building)
YOLO_WEIGHTS=/opt/darknet/yolov3.weights
  1. [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
  1. [Mandatory] Telegram token (https://core.telegram.org/bots#6-botfather)
TELEGRAM_TOKEN=1785646214:ABHEd4GeiRNFRd_0dsvMKIgGmMVsDIBbosP
  1. [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
  1. [Optional] To avoid spam, declare a threshold for Telegram notifications
TELEGRAM_NOTIFICATION_THRESHOLD_IN_S=60

About

Detects humans on camera streams and alerts users via Telegram Bot. Tested with HikVision.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published