The Clover Project

The Clover Project is an integration of public/free software to develop an application using machine learning (opencv), Python, c++, and Xamarian.  The project also utilizes Raspberry PI 3 B to prototype the application.

The goal of the project is to allow a user to video a patch of clovers and the AI will detect all four leaf clovers within the specified patch.   I must admit I come into this endeavor as a programmer and scientist.  Before this project, I had never been exposed to opencv, Xamarian, or video capture and object recognition.  So for those of you feeling this is impossible, take heart.  If you are willing to spend some time learning, laughing at yourself, and you don’t mind learning from failures,  this series will get you on the way to having novice level fun with video capture and machine learning.  My hope for the application is shown in the prototype image below.  A video (or image) is processed by the application to recognize and identify a four leaf clover.

Four Leaf Clover Recognition
Four Leaf Clover Recognition

The internet is full of resources for this type of project.  However, few sites pull them all together to form a complete “life cycle” or evolution, showing the entire process from an idea to a product. My hope with this series is to help the novice understand the steps, research, and integration of technology to see their app go from being an idea to a reality.

In starting this project I am a one person shop, but I have utilized many of the resources on the net. In the upcoming post, I will attempt to do an excellent job at recognizing each location I used. This project would not have moved beyond concept without these awesome resources.

The Breakout

In this section we breakout a list of semi-sequential activities to accomplish our goal.  Each of these sections will have its own detailed post with supporting examples and discussion.

Image Collection

Images for training are an important part of the process.  A good sample size is necessary (my plan is to use 40,000 images of four leaf clovers) for any training application.  Thankfully there are methods to perturbate a small set of images.  A second set of “untrained” positive images will be used to evaluate the training.   This will be discussed in detail in the post covering image collection and training preparation.

Cascade Training with OpenCV

Firstly, This step covers the setting up of OpenCV on a virtual Linux machine. Secondly, I will show how to train (build a cascade XML file) with opencv for use with image detection.  This section will be covered over several blog posts and include how to setup opencv on a Raspberry PI for use with Python ( a great way to test a cascade file on the cheap).  At the end of this process, a working cascade file for four leaf clovers will be trained and created.

OpenCV in Python, c++ and .NET 

Several rudimentary programs will be written and discussed using opencv, Python, c++, .NET, and Xamarian.  Each will be briefly discussed. Depending on an application’s needs, each offers a unique advantage or disadvantage.

The App for Android

The final outcome is an app for Android (and possibly iOS) systems.  The desire is to provide the reader a loose framework for one person’s journey. From this framework, you can launch your own dream app and encourage others.  All the source codes, links, etc. will be shared.  The only item not shared will be the cascade file for the clover detection.  This is an item each needs the joy and pain of creating for themselves.  By the time this training is complete, it will take over one thousand hours of computing time with 5 cores, 12 GIG ram and an SSD.