Setup your own intruder detection system .. in under 10 minutes

I was looking to build a security system that captures pictures and alerts me when an intruder walks in to my home or is ringing the door bell. My constraints being:

  • Off the shelf wireless IP camera
  • Local Ubuntu box to process those images
  • Ease of maintenance and management
  • Secure, to the T.. for Security

I found a few options for wireless IP cameras on Amazon and that setup was easy. I was looking to do more - since these cameras send you notifications on each detected motion. I wanted to be alerted and told if this alert is worth looking at - meaning if there was infact an intruder attempting to break in.

I looked for tools and found a lot of material. Mainly though, all thanks to Adam Geitgey I found Machine Learning is fun . I was able to learn multiple approaches to implementing face recognition solutions from his blog and from all the links he posted.

In summary of his multipart post, I had choice** between OpenFace or the face_recognition.

Adam wrote face_recognition as a python application which combines the aspects of face detection, analysis and recognition for easy installation and use. Face recognition claimed that it was easy to setup, ran on the local ubuntu box and was hence secure since it did not be exposed to the internet.

I chose to use face_recognition, and it was really simple to install and learn. I ran into only a couple of issues but was able to resolve them easily. This post details how I made it even simpler.

I started by following instructions on the github README but did not want to setup python3 on the system - and was looking to use pyenv instead.

Mainly the issues were around installing ‘dlib’ - “Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real world problems”.

I found instructions to setup dlib on this gist - but was not thrilled since I did not want to use python3.

Further search yielded a clue - instructions to install with pyenv on mac.

I converted those instructions to make them work on Ubuntu as follows:

pyenv install 3.6.3
pyenv versions  #ensure it shows versions you have including the recently installed 3.6.3
pip install dlib
pip install face_recognition

I documented it all in Dockerfile as a reference. I realized that I needed to install cmake before dlib could compile. I will keep on updating to make this more automated.

And that’s all. I was able to run face_recognition via command line.

I intend to try out the VM for face_recognition. It is a little heavier install and will require more resources but allow me to do more machine learning.

Face Detection seemed so complicated in the beginning but with all these tools it has become so easy to use - I am amazed!!

** There are options that allow you to use the cloud - AWS Rekognition, Google and many others - this post is limited to setting it up on a dedicated box. Setting it up privately also protects the privacy of the owner - after all this is about security.

P.S: Also it did not really take me 10 minutes to do this from scratch….I read and read a lot for more than a week before I could reach this point. In the end the setup turned out to be this simple. It served as a catchy title though :money_mouth_face:

comments powered by Disqus