How busy is our street?
How does the saying go? Oh yeah, "Location, location, location." It comes as no surprise that how busy our street is has a direct impact on our bottom line. Not only is it important that our street has decent foot traffic, but it's important that we're open during the most busy times.
There are a lot of options out there for counting pedestrians. The most common solutions we found used a fancy sensor with a beam of some sorts. Similar to, but much more sophisticated than, the laser beam you have that keeps your garage door from crushing you.
Unfortunately, all the solutions out there were really expensive (like $100/month+).
But, if you know anything about Spruce, it'll come as no surprise that we thought up our own way to solve the problem.
Before I get into more details on our solution, I want to start by explaining...
What this system is NOT
A way to identify/track specific people. We have zero face recognition. As you can see, it thinks Becca is different people during the demo. Also, this is not a perfect solution. I mean, you saw the video, right?
But I'll defend it as "about as good" as any other solution.
How Does it Work?
Actually, lets start with...
What Makes it Special?
Wait, you mean besides the fact it looks like something out of Terminator? I guess the second coolest aspect of Camerafeed is the "Tripwire". A tripwire is a line drawn in any position at any length and given labels to be assigned to people who "trip" it.
In the video above, I drew the line and gave it the labels "north" and "south." Now, depending on which way the person crosses, the appropriate label will be assigned to them. This gets sent back to our server where I can do something about it at a later date (really, for now I only care that people are here, not which direction they are traveling).
The plan is to add a second line by our front door and give it the labels "in" and "out." Unfortunately, after many tests, it may turn out that it takes too much processing power to get the sidewalk and our front walkway in one shot.
Turns Out Detecting People is Really Tough
Maybe an obvious one, yeah? But, interestingly enough, I don't think I mean it like you think I mean it.
Honestly, writing the code to detect people is as easy as writing the code to send an email. Keep in mind, knowing how to use the code is way different than knowing how the code works.
Lemme explain that a little better. Think of it as the different between making a wrench and using one to make things.
See, what I really mean by "tough" is that it's tough for the computer. I put the FPS (frames per second) on screen because I wanted to see exactly how much it was slowing down as I tweaked the computer vision settings. Turns out, a lot. As you would expect, the more precise the detection, the harder it has to work. I can actually bring my fancy Macbook Pro to its knees if I go nuts with the settings.
Alright, Whatever, How Does it Work Already?
I'm going to leave the rest of the "how does it work" stuff in the README.md so I don't have to keep coming back and updating this blog post as well as the documentation for the code.
That's it for Now
We still gotta figure out a way to setup the system permanently at the shop. I'm hoping the Amish Technologist will be able to help us with that.
A Special Thank You
I have to tip my hat to the amazing work of Adrian Rosebrock. The resources he wrote are really what made this whole project possible. I reference his writings in the docs of Camerfeed, but I think he deserves an additional shout out here.
If you are interested in doing anything computer vision related in Python, you must checkout his site http://pyimagesearch.com.