Make a surveillance camera from your raspberry pi!

Overview

rpi-surveillance

Make a surveillance camera from your Raspberry Pi 4!

The surveillance is built as following: the camera records 10 seconds video and if a motion was detected - sends the video to telegram channel.

The timestamp is printed on videos, so it is better to set the correct time on your Raspberry Pi.

The motion detection works in the following way: the camera’s H.264 encoder calculates motion vector estimates while generating compressed video. Using these vectors we threshold them by --magnitude-th argument. If more than --vectors-quorum vectors thresholded - mark current frame as containing motion. If there are more than --detection-frames consecutive frames with motion - motion detected.

Tested on Raspberry Pi 4 (4 RAM) + NoIR Camera V2.

Installation

Install package

Install Python 3 requirements:

pip3 install --user -r requirements.txt

Install provided .deb package:

sudo dpkg -i <path/to/downloaded/rpi-surveillance.deb>
sudo apt install -f

Note: the installation supposes that you already enabled camera module on your Raspberry Pi.

Create telegram bot and chat

  1. Write to @BotFather in telegram and create a bot:
/start
/newbot
<name of your bot>
<username of your bot>_bot

You will get the TOKEN. Save it for future use.

  1. Create a private channel where you will receive video sequences with motion.
  2. Add created bot to the channel (rerquires only "post messages" permission).
  3. Send message test to the channel.
  4. Run /usr/lib/rpi-surveillance/get_channel_id to get the CHANNEL_ID. Save it for future use.

Usage

To launch surveillance just run rpi-surveillance with your TOKEN and CHANNEL_ID, for example:

rpi-surveillance --token 1259140266:WAaqkMycra87ECzRZwa6Z_8T9KB4N-8OPI --channel-id -1003209177928

You can set various parameters of the surveillance:

usage: rpi-surveillance [-h] [--config CONFIG] --token TOKEN --channel-id
                        CHANNEL_ID [--temp-dir TEMP_DIR] [--log-file LOG_FILE]
                        [--resolution {640x480,1280x720,1920x1080}]
                        [--fps {25,30,60}] [--rotation {0,90,180,270}]
                        [--duration DURATION] [--magnitude-th MAGNITUDE_TH]
                        [--vectors-quorum VECTORS_QUORUM]
                        [--detection-frames DETECTION_FRAMES]

optional arguments:
  -h, --help            show this help message and exit
  --config CONFIG       Path to config file.
  --token TOKEN         Token for your telegram bot.
  --channel-id CHANNEL_ID
                        Telegram channel ID. If you don't have it please, send
                        a message to your channel and run /usr/lib/rpi-
                        surveillance/get_channel_id with your token.
  --temp-dir TEMP_DIR   Path to temporary directory for video saving before
                        sending to channel. Don't change it if you don't know
                        what you're doing.
  --log-file LOG_FILE   Path to log file for logging.
  --resolution {640x480,1280x720,1920x1080}
                        Camera resolution. Default - 640x480.
  --fps {25,30,60}      Frames per second. Default - 25.
  --rotation {0,90,180,270}
                        Frame rotation. Default - 0.
  --duration DURATION   Duration of videos in seconds. Default - 10.
  --magnitude-th MAGNITUDE_TH
                        Magnitude threshold for motion detection (lower - more
                        sensitive). Defaults: for 640x480 - 15, for 1280x720 -
                        40, for 1920x1080 - 65.
  --vectors-quorum VECTORS_QUORUM
                        Vectors quorum for motion detection (lower - more
                        sensitive). Defaults: for 640x480 - 10, for 1280x720 -
                        20, for 1920x1080 - 40.
  --detection-frames DETECTION_FRAMES
                        The number of consecutive frames with detected motion
                        to send an alert.

Build

Build was done using dpkg-buildpackage.

You might also like...
Make your master artistic punk avatar through machine learning world famous paintings.
Make your master artistic punk avatar through machine learning world famous paintings.

Master-art-punk Make your master artistic punk avatar through machine learning world famous paintings. 通过机器学习世界名画制作属于你的大师级艺术朋克头像 Nowadays, NFT is beco

Python-experiments - A Repository which contains python scripts to automate things and make your life easier with python
Python-experiments - A Repository which contains python scripts to automate things and make your life easier with python

Python Experiments A Repository which contains python scripts to automate things

A very lightweight monitoring system for Raspberry Pi clusters running Kubernetes.
A very lightweight monitoring system for Raspberry Pi clusters running Kubernetes.

OMNI A very lightweight monitoring system for Raspberry Pi clusters running Kubernetes. Why? When I finished my Kubernetes cluster using a few Raspber

Run object detection model on the Raspberry Pi

Using TensorFlow Lite with Python is great for embedded devices based on Linux, such as Raspberry Pi.

 Tutorial to set up TensorFlow Object Detection API on the Raspberry Pi
Tutorial to set up TensorFlow Object Detection API on the Raspberry Pi

A tutorial showing how to set up TensorFlow's Object Detection API on the Raspberry Pi

An air quality monitoring service with a Raspberry Pi and a SDS011 sensor.

Raspberry Pi Air Quality Monitor A simple air quality monitoring service for the Raspberry Pi. Installation Clone the repository and run the following

A tutorial showing how to train, convert, and run TensorFlow Lite object detection models on Android devices, the Raspberry Pi, and more!
A tutorial showing how to train, convert, and run TensorFlow Lite object detection models on Android devices, the Raspberry Pi, and more!

A tutorial showing how to train, convert, and run TensorFlow Lite object detection models on Android devices, the Raspberry Pi, and more!

🍅🍅🍅YOLOv5-Lite: lighter, faster and easier to deploy. Evolved from yolov5 and the size of model is only 1.7M (int8) and 3.3M (fp16). It can reach 10+ FPS on the Raspberry Pi 4B when the input size is 320×320~
🍅🍅🍅YOLOv5-Lite: lighter, faster and easier to deploy. Evolved from yolov5 and the size of model is only 1.7M (int8) and 3.3M (fp16). It can reach 10+ FPS on the Raspberry Pi 4B when the input size is 320×320~

YOLOv5-Lite:lighter, faster and easier to deploy Perform a series of ablation experiments on yolov5 to make it lighter (smaller Flops, lower memory, a

A facial recognition doorbell system using a Raspberry Pi

Facial Recognition Doorbell This project expands on the person-detecting doorbell system to allow it to identify faces, and announce names accordingly

Releases(v2.2.2)
Owner
Vladyslav
Machine learning and computer vision developer.
Vladyslav
Equivariant Imaging: Learning Beyond the Range Space

[Project] Equivariant Imaging: Learning Beyond the Range Space Project about the

Georges Le Bellier 3 Feb 06, 2022
Official implementation of VaxNeRF (Voxel-Accelearated NeRF).

VaxNeRF Paper | Google Colab This is the official implementation of VaxNeRF (Voxel-Accelearated NeRF). VaxNeRF provides very fast training and slightl

naruya 132 Nov 21, 2022
Lama-cleaner: Image inpainting tool powered by LaMa

Lama-cleaner: Image inpainting tool powered by LaMa

Qing 5.8k Jan 05, 2023
Multi-Template Mouse Brain MRI Atlas (MBMA): both in-vivo and ex-vivo

Multi-template MRI mouse brain atlas (both in vivo and ex vivo) Mouse Brain MRI atlas (both in-vivo and ex-vivo) (repository relocated from the origin

8 Nov 18, 2022
ViSER: Video-Specific Surface Embeddings for Articulated 3D Shape Reconstruction

ViSER: Video-Specific Surface Embeddings for Articulated 3D Shape Reconstruction. NeurIPS 2021.

Gengshan Yang 59 Nov 25, 2022
Node for thenewboston digital currency network.

Project setup For project setup see INSTALL.rst Community Join the community to stay updated on the most recent developments, project roadmaps, and ra

thenewboston 27 Jul 08, 2022
[NeurIPS'21] "AugMax: Adversarial Composition of Random Augmentations for Robust Training" by Haotao Wang, Chaowei Xiao, Jean Kossaifi, Zhiding Yu, Animashree Anandkumar, and Zhangyang Wang.

[NeurIPS'21] "AugMax: Adversarial Composition of Random Augmentations for Robust Training" by Haotao Wang, Chaowei Xiao, Jean Kossaifi, Zhiding Yu, Animashree Anandkumar, and Zhangyang Wang.

VITA 112 Nov 07, 2022
Py4fi2nd - Jupyter Notebooks and code for Python for Finance (2nd ed., O'Reilly) by Yves Hilpisch.

Python for Finance (2nd ed., O'Reilly) This repository provides all Python codes and Jupyter Notebooks of the book Python for Finance -- Mastering Dat

Yves Hilpisch 1k Jan 05, 2023
Official code repository for A Simple Long-Tailed Rocognition Baseline via Vision-Language Model.

BALLAD This is the official code repository for A Simple Long-Tailed Rocognition Baseline via Vision-Language Model. Requirements Python3 Pytorch(1.7.

peng gao 42 Nov 26, 2022
This repository provides the code for MedViLL(Medical Vision Language Learner).

MedViLL This repository provides the code for MedViLL(Medical Vision Language Learner). Our proposed architecture MedViLL is a single BERT-based model

SuperSuperMoon 39 Jan 05, 2023
Implementation of the paper "Fine-Tuning Transformers: Vocabulary Transfer"

Transformer-vocabulary-transfer Implementation of the paper "Fine-Tuning Transfo

LEYA 13 Nov 30, 2022
RETRO-pytorch - Implementation of RETRO, Deepmind's Retrieval based Attention net, in Pytorch

RETRO - Pytorch (wip) Implementation of RETRO, Deepmind's Retrieval based Attent

Phil Wang 556 Jan 04, 2023
PanopticBEV - Bird's-Eye-View Panoptic Segmentation Using Monocular Frontal View Images

Bird's-Eye-View Panoptic Segmentation Using Monocular Frontal View Images This r

63 Dec 16, 2022
EigenGAN Tensorflow, EigenGAN: Layer-Wise Eigen-Learning for GANs

Gender Bangs Body Side Pose (Yaw) Lighting Smile Face Shape Lipstick Color Painting Style Pose (Yaw) Pose (Pitch) Zoom & Rotate Flush & Eye Color Mout

Zhenliang He 321 Dec 01, 2022
Pip-package for trajectory benchmarking from "Be your own Benchmark: No-Reference Trajectory Metric on Registered Point Clouds", ECMR'21

Map Metrics for Trajectory Quality Map metrics toolkit provides a set of metrics to quantitatively evaluate trajectory quality via estimating consiste

Mobile Robotics Lab. at Skoltech 31 Oct 28, 2022
Auxiliary data to the CHIIR paper Searching to Learn with Instructional Scaffolding

Searching to Learn with Instructional Scaffolding This is the data and analysis code for the paper "Searching to Learn with Instructional Scaffolding"

Arthur Câmara 2 Mar 02, 2022
Cycle Consistent Adversarial Domain Adaptation (CyCADA)

Cycle Consistent Adversarial Domain Adaptation (CyCADA) A pytorch implementation of CyCADA. If you use this code in your research please consider citi

Hyunwoo Ko 2 Jan 10, 2022
Using pytorch to implement unet network for liver image segmentation.

Using pytorch to implement unet network for liver image segmentation.

zxq 1 Dec 17, 2021
A real-time approach for mapping all human pixels of 2D RGB images to a 3D surface-based model of the body

DensePose: Dense Human Pose Estimation In The Wild Rıza Alp Güler, Natalia Neverova, Iasonas Kokkinos [densepose.org] [arXiv] [BibTeX] Dense human pos

Meta Research 6.4k Jan 01, 2023
ALBERT-pytorch-implementation - ALBERT pytorch implementation

ALBERT-pytorch-implementation developing... 모델의 개념이해를 돕기 위한 구현물로 현재 변수명을 상세히 적었고

BG Kim 3 Oct 06, 2022