Train a Custom Haar Cascade O​bject Detector

Robomow 622

For me the best way to truly learn something is to experience it.  To do it.  Can you relate to that?  With  the goal of truly wanting to understand how the machine learning Haar Cascade object detector actually learns, I thought it would be good to create one and train it myself and document it for you along the way.  I think this will truly give us a small flavor for what machine learning is all about.

From what we have learned so far about a Haar Cascade is that it is extremely efficient and really shines when used on devices with limited computing power.  An example of this today is a modern camera.   Just before you are about to take a picture.  The lens focuses on your subjects and draws a square around their faces on the camera preview display.   Now you know the camera has been optimally focused on your subjects and you can take the best picture possible.  A really cool feature!

Now what can we do that is interesting that has not been done before.  Here is what I came up with.  I think you are going to love it!  About a year ago, I got my wife for Christmas an autonomous Vacuum Cleaner Powerbot Samsung.  I was amazed at how well it worked, I thought to myself, I wonder if anyone has done this for lawns.  Sure enough, there are plenty examples of this on the market.  I researched this pretty thoroughly and found the machine that would suit my yard.  This machine is called the Robomow 622 and it is shown below.  You can learn more about this robotic lawn mower at

Robomow 622

After one season of use, I can report back to you this product works as advertised and does an incredible job!   Hard to believe in year 2018 that you can buy a machine that you plug in the spring and it will by itself cut your lawn through the summer into the fall both front and back.  Spend about 6 hours a week on the task.  Drive itself back to its home charging base.  Charge itself and be ready to do it again week in week out.

I have been cutting lawns since I was a 12 years old.  The idea that this task can be automated for me is truly the best present a man could get.  (Ladies great gift idea for the man in your life).   The idea just blew me away.   Up until this machine, I have a yard person who has been cutting my lawn for several years.   My neighbor, a super nice man.  The amount it cost for me to have him cut my lawn for 1 season, equaled the cost of the lawn mower.  What a deal.  I have positive ROI after one year!  See my article AI can save you $40 per week.

I was so fascinated with this machine that from my phone I would instruct the mower to cut the lawn, grab a drink, kick back and just watch it mow each row and marvel at the ingenious capabilities of this robot and the people, engineers, and developers who made it a reality.  My wife thought I was out of control.  You will see her point shortly.

Now, the one thing about this machine that becomes an issue is when it docks itself to the charging station, it sits outside and is exposed to the elements of daily weather condition of rain, snow, and extreme weather temperatures.   Also there is a concern for the physical security of the robot as well.  Anyone seeing this robot might decide to borrow it with the intention of having it cut their lawn and never returning it.  So I decided to build a garagefor it.  Yes!  Yes!  This is the part where I said you will see her point.   Here is a picture of it below.

The garage is intended to look somewhat like a dog house and is intended to draw attention away from the mower, but notice something peculiar about it and that is the security video camera above the garage door.

Finally we are getting to the point.  The project we are going to work  on.  We are going to build a custom Haar Cascade Robomow detector that will automatically detect the Robomow and open the garage door when the Robomow is coming into recharge itself and automatically close itself once docked.  We will see this all in real-time because we will be streaming it to this web site looking at each frame and applying our customHaarCascade machine learning algorithm to it.   

Summary and Next Steps

  • To truly understand how to train a machine learning Haar Cascade model, we want to experience it with an example.
  • The example should run on a CPU constrained device because that is where the Haar Cascade algorithm really shines.
  • The problem we are going to solve is opening and closing the mini garage door for the Robomow house by detecting it as it comes into the view of security camera.
  • The benefit to you is you will have the step-by-step instructions, the code, on how to build your very own Haar Cascade object detector, the videos used to train the model, the tools that automate that testing. (Just replace the robomow images with the object you would like to detect)
  • You will see us train the Haar Cascade.
  • You will learn what works what does not.
  • You will learn some of the limitations of the algorithm.
  • You will learn some pretty cool hardware and software technologies along the way.
  • I will give you some pretty cool ideas on where you can take this into the future.
  • Will's wife is correct.  He is a little out of control and apparently has to much time on his hands :).

Ready to take this journey with me ?


Watch AI in action.  Click HERE to learn more