Skip to content
wb666greene edited this page May 25, 2018 · 1 revision

Welcome to the SecurityDVR_AI_addon wiki!

(This is my first attempt at a Wiki and github project, I would appreciate tips to improve formatting and organization)

Backstory:

I've been running video home security DVR software going back to Geovision on Windows 95 after I had an order of checks stolen from my mailbox and forged checks started showing up at stores around town.

I moved to Zoneminder on Linux (Motion was another option but I found clearer installation instructions for Zoneminder at the time) when my Geovision system didn't survive the upgrade to Windows 2000 for lack of drivers. These systems worked great except for a very high false alarm rate unless you have near total control of the lighting in the camera's field of view (which I did for the locations I placed cameras), otherwise its about impossible to get useful alerts from outdoor areas unless you can tolerate a high false alarm rate. Even with my carefully chosen camera locations for Geovision and Zoneminder it literally did take years to get the motion detection parameters tweaked to avoid occasional floods of false alarms caused by unusual weather conditions. But these "push" Email alerts provided peace of mind and a nice notification of when the mail or a package was delivered.

When I retired in 2013 I wanted to replace my Zoneminder system with a full coverage HD (2 Mpixel) cameras covering a 360 degree view of our property. Driveway ambushes and home invasions were becoming way too common on late night news crime reports, so some kind of "early warning" system became a priority.

It happened that Costco had a nice close out price on a FLIR Lorex 12 camera HD-CVI system that might let me reuse my existing video cables. This system works great for 24/7 or timed schedule recording, but its video motion detection was far inferior to the algorithms used in Zoneminder or Motion, so getting alerts pushed to me with a tolerable false alarm rate was clearly going to be impossible because all my new cameras would be looking "outdoors".

My solution was to fire up the old Zoneminder system when I left the house for Email alerts if key areas detected intrusion, and let the Lorex system record everything going on outside 24/7. Actually I got a pre-paid burner phone and used the provider's Email-to-SMS gateway to get timely "push" alerts and then open the Email to see the captured "snapshots" which I generally didn't do if it was around the time of the usual mail or FedEx or UPS deliveries. This was a far from ideal solution, but better than nothing. Inconvenient, but functional and in need of improvement as it doesn't supply the early warning I desired, which this project does now supply.

My first attempt was to add PIR Motion detectors to cover the fields of view of the cameras. Turns out these have the same false alarm issues as video motion detection if they see sunlight on days with strong shadows, fast moving clouds, etc. so the logical AND of the video and PIR motion detection had minimal impact on the false alarm rate.

Next I tried image processing solutions such as Haar Cascade "face detctors", Histogram of Oriented Gradients "people detectors", etc. that became accessible with the release of OpenCV 3.x. These work great on test images, but nowhere near well enough with the widely variable lighting and generally high camera angles of security images -- they seem to need a "mug shot" type of camera position and more controlled lighting than is generally possible in security monitoring applications. The Ebook (https://www.pyimagesearch.com/practical-python-opencv/) and PyImageSearch blog posts by Adrian Rosebrock saved me a ton of time and was well worth the price.

So finally I started learning about Convolutional Neural Networks and "Artificial Intelligence". Again the Py ImageSearch blog posts and his new Ebook on Deep Learing and Neural Networks for computer vision (https://www.pyimagesearch.com/deep-learning-computer-vision-python-book/) really jump-started me up the learning curve.

This blog post was my "Rosetta Stone" breakthrough -- https://www.pyimagesearch.com/2018/02/19/real-time-object-detection-on-the-raspberry-pi-with-the-movidius-ncs/ after buying a Movidius Neural Compute Stick and downloading and installing his sample code, I was blown away by the object detection done on the live PiCamera images -- especially the detection of people in the scene.

I quickly modified his python script to accept jpg snapshot images transferred to one of my Raspberry Pi systems from the Lorex (already running as part of my OpenCV work) instead of the live video stream from the PiCamera and had a usefully working system in a couple of days. After about a week of testing with us just going on about our business (no alerts sent, just collecting input images and "people detected" outputs and comparing via "slide show" software) with near zero false alarm rate and inconsequential false negative rate (the next frame got it right!), I realized I had something of possibly great generality that needed to be shared!

The only false detections I've observed were reasonable -- things like my wife putting hand washed clothes over a chair on the pool deck to dry, or when I put my hat on top of a "tower fan" standing on the patio.

Since I've never seen a video security DVR or "Netcam" system that can't ftp images to a server somewhere, I decided to rip out all the ugly code needed to work around the lameness of my FLIR Lorex system and create a clean simple reference system that people can implement and try using a Raspberry Pi with Pi Camera module (Zero-W or better) running MotioneyeOS as the sample video security DVR, and a Raspberry Pi3 (B+ recommended) to receive the files via ftp, pass them through the Movidius object detection AI and save the positive detection images for review or attaching to alerts. The total cost should be under $200 if you shop carefully and have the normal KVM, cables, and adapters one normally needs in order to play with these small computers .

Clone this wiki locally