Code Monkey home page Code Monkey logo

picamnn's Introduction

PiCamNN

Survelliance system with deep learning based people detection (YAD2K YOLO implementation ), and notification with Telegram.

The program is made of two different threads, one is always looking for movements and if there are some it's also writing the frames to video-file.The other thread get the frames in which were detected movements and then with a deep neural network (YOLO) is searching for persons, and if there are some it's sending the images to you with telegram.

The code has been tested on raspberry pi 3B with whom I got 2/3s per frame (if you run it on GPU you should reach 200frames per second), with previous versions of the raspberry pi you probably will not get good perormances :'( .


Requirements:

-Linux (tested on raspberry pi3 with raspbian)
-Python3
-OpenCV for Python3
-Apache2 http-server (remember to enable the apache process eg "#systemctl enable apache2;reboot")
-Tensorflow ( link For Tensorflow on raspberry Pi)
-telegram-cli(follow the installation instructions and log in with your account)
-Numpy
-Keras 2

Instructions for Raspbian:

Follow those instructions after having installed all the requirements!
git clone https://github.com/PiSimo/PiCamNN.git
cd PiCamNN
mkdir imgs

Download the tiny yolo weights(for keras 2) converted with YAD2k :

wget https://www.dropbox.com/s/xastcd4c0dv2kty/tiny.h5?dl=0 -O tiny.h5
sudo mv index.html /var/www/html/
(NOTE: If you aren't on raspbian apache's base folder might not be /var/www/html/ so check before!)

Before starting the main script you should change in picam.py some variables:

maxDays = 7 If you have stored more then maxDays videos on your devices the oldest one will be removed

baseFolder = "/var/www/html/" Change this variable if your apache hasn't created that folder

scriptFolder = "/home/pi/PiCamNN/" Change this variable with the path which contains the scripts and the weights

num_cam = -1 Number of cam to use (-1 means open the first one the system has read)

frame_check = 17 Number of empty frames to wait before killing the main process

time_chunck = 15 Seconds to wait before considering a new action

telegram_user = "" Your Telegram username you will se all the images on the chat with yourself


To run the code :

sudo python3 picam.py

After the main loop is started,every time a person get detected by the neural net you will receive the photo on telegram (on the chat with yourself).

To see the recorded videos, from your local network you have to go with your browser on the ip of your device which is running PiCamNN and from that page you will be able to download all the videos (eg. http://192.168.0.17 ).

picamnn's People

Watchers

DreamChaser 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.