AI Weed Detector

Weeds detected in an image using deep learning

Weeds detected in an image using deep learning

Scroll down for code and dataset download links.

The Project

I’ve wondered for a long time whether I could use computer vision to detect weeds in my yard. I decided to implement the technique I teach in my new Udemy course to create a synthetic dataset from scratch.

Creating the Weed Dataset

At a high level, the technique is to cut out weed foregrounds and paste them randomly over weed-free grass backgrounds. Generating the synthetic image dataset of 10,000 training images and 1,000 validation images took 3 hours of manual effort and 5 hours of automated time. It took about 2 hours 15 minutes to train Mask R-CNN on my desktop computer. There’s no question in my mind that this technique saved me hundreds of hours of work.


Examples of Foregrounds

Here are some examples of the foregrounds that I used to generate synthetic images.


Examples of Synthetic Training Images

Here are some examples of automatically generated training images. Scroll to the end of the article for a link to the code.


Examples of Mask R-CNN inference

Here you can see some examples of inference running on real images of weeds from around my neighborhood.


Learn How To Create Your Own Custom COCO Dataset!

Check out my Udemy course to learn how to create your own dataset from scratch. The link will discount the course to $11.99 and also supports me (Adam) with a larger percentage of the commission as I create more awesome content for Immersive Limit!

So in other words, you can take a course (for the price of a decent sandwich) that can save you HUNDREDS of HOURS. Now that’s value. 😉

Complete Guide to Creating

COCO Datasets

Want a full walkthrough? Check out my Udemy course and learn to build your own image datasets automatically with Python.

Code and Dataset

If you are more of a DIY person, check out the code:

The dataset I used was about 7GB and I didn’t want to take up all that space on my Google Drive. Instead I have uploaded the foregrounds and backgrounds I used for the project so you can re-generate it if you like. Links are here: