Smarthome Journal: June 18th 2020 - And MotionEye is out!

I've been battling with extreme frustration. Well not really. The frustration is quite mild. But it was there. Every solution I used had some significant flaw which exposed itself over time.
  • Tensorflow - Weak integration with Home Assistant, slow, CPU hungry.
  • Shinobi - Bulky (included full DBMS with Docker image), had a tendency to go on a rampage and crash my system
  • Kerberos - Weak detection configuration
  • MotionEye - Weak detection configuration
A lot of the above stems from two things; most of these solution are either attempting to do motion detection rather than object detection, or they are doing it on the CPU.

Object detection tends to rely trained AI nets. And even fairly simplistic ones, which absolutely CAN run even on lower spec hardware, still eat up a lot of CPU in the process. Especially if you have say, 3 cameras.

Motion detection is much less involved, but also much more error prone. Noise, light changes etc... create a wealth of problems when trying to get a security camera even remotely accurate.

Ideally, we would use a mix of the two. But, this still faces the problem that object detection is a much more intensive process.

I knew I needed to get GPU acceleration involved. Luckily, I have an NVidia card, because CUDA is what everything supports. But, the problem was that I wanted to do this inside of a Docker container. And lo and behold, I couldn't find anyone doing this.

As it turns out there are a good many reasons why I couldn't find a pre-built image:
  • Getting all of the different pieces working together is a freaking headache
  • The resultant images are huge
  • The resultant images only work on a subset of graphics cards for a subset of NVidia driver versions
So, I'm no longer bitter that a solution didn't exist.

Reading around one night though, I stumbled across pyimagesearch, a web site run by a fellow who is interested in teaching people to use Python and OpenCV to do "cool image detection stuff" (my words, not his). And it looked like OpenCV was a pretty powerful library which made a lot of the stuff I wanted to do (from a programming perspective) fairly easy.

If you have any interest whatsoever in computer vision, it is probably worth a browse. The projects are small and interesting.

And thus was born the current project, which I'm now running. It needs some tweaking, but my CPU usage is now below that of MotionEye and false positives are down vs. everything else I've used.  And detections are more accurate. There are still some kinks to work out, and I really would like to incorporate some motion detection into the pipeline using OpenCV to further optimize the processing. But yeah, this is quite cool. I'm thinking of releasing the work on GitHub/Docker Hub later. A first for me. Not that I actually expect people to use it.

Comments

Popular Posts