"No Need To Reinvent the Weed... detection"
Turns out that the Farmbot team is the first result for an open source weed detection. In fact they have the code up on https://github.com/FarmBot-Labs/plant-detection with instructions for installing and running the code. Thank Guys!
Time to clone the repo and see whats what. If I can just use this code to find weeds I might drop the web server interface - I'm really trying to go for simplicity here. Eventually my goal is to connect all of the systems into a central processing hub. The simpler each component, the easier that integration is going to be. In this case a python script is going to be much easier to incorporate than an entire web server.
Following the Readme lets Install the dependencies and lets give it a whirl:
pip install -r requirements.txt python -m plant_detection.PlantDetection
Hey it seems to work! Lets see what the script has actually done:
Looks like there are some settings like hue and saturation – I can probably tweak those to get a better result for future runs.
The script scans the example image looking for plants – although if I had to guess its probably looking for green color – will test some actual photos to see the results there.
There are 2 “known plants” which I assume are the ones that the robot planted at some point. There probably isn’t a really good way to tell weeds from starts, even with an advanced CV system, so inputting the coordinates known plants will be the best way to have the robot not kill off your zucchini. Now, since I am planning on planting by hand that will mean that I will have to input the coordinates manually. One benefit of having the robot plant is that it can record where it planted.
There are 14 plants marked for removal, 1 has its radius too close to a known plant to remove completely, and 2 are either the know plants or weeds that are too close to remove.
Makes sense so far. I guess I will have to translate the visual coordinates into machine coordinates for the weeder arm. Will have to think about the best way to do that when it comes time.
Let’s try out the GUI interface with a photo of an actual garden bed:
I’ve cropped out the photo info to reduce confusion in the script, but this is from some site called: Dreamstime.com – the goto site for garden stock photos.
Launching the GUI with:
python -m plant_detection.PlantDetection --GUI garden_plot.png
Not too bad, looks like it found and outlined the spinach with what at first I thought were false positives. Upon closer examination of the image it seems to have found what are potentially weeds in the image. Awesome! I’m sure I can use this as a first pass aattempt – can always overcomplicate things later on if this approach doesn’t work.