AI Weed Detector
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 our Udemy course to learn how to create your own dataset from scratch. You get a sweet discount and it also supports us (Adam and Kayla) as we create more awesome content for Immersive Limit!
Code and Dataset
If you are more of a DIY person, check out the code: https://github.com/akTwelve/cocosynth
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: https://github.com/akTwelve/cocosynth/blob/master/datasets/README.md