/

March 2, 2020

Weed Detection Using Machine Learning: A game changer in agriculture

Weed detection

Our world today is changing faster than ever before. We all have experienced this change in our daily lives, whether it is purchasing a new car and getting accustomed to the car’s latest technology, connecting your home appliances through the internet, or just helping our grandparents get accustomed to Instagram. This exponential growth of technology in our everyday lives has transformed the world we live in.

This transformation has never been more apparent than in the agriculture industry. It is common now for tractors, combines, sprayers, etc. to have auto-steer where the machine automatically steers through the field and applies fertilizer only where needed through variable rate application. This auto-drive capability came years before the auto-drive capability we see today in cars. Combines today measure real-time harvest yield so the grower can identify the high yield and low yield portions of the field. On top of that, many machines are connected to the internet, which lets growers download their data.

Structural damages will be identified in two different ways: tarps, which are likely used to protect broken roofs, and rubbles. After creating and training these two detectors, we ran them and added the results directly to ArcGIS, without leaving it.

Today’s farmer has more data available and much more computing power than it took to put a man on the Moon.

All of this raw data processing becomes a full-time job just to pour through the results, so a decision can be made to reduce cost or increase profit. This time-consuming process creates tension since many times it is unknown whether the increased time investment will increase efficiencies and profit. Today’s grower is presented with so much data through federated systems, vice integrated systems, that many times they must process the data themselves to draw out an actionable decision.

A recent addition to the grower’s tool bag is drone imagery. Many growers have embraced using drones to aid in their decision-making process. Drone imagery is used to assess plant health, weed detection, weed pressure, pest infestation, drainage and irrigation issues, plant count in a field to access harvest income, etc. Drones can cover a 100 acre (40 hectares) field in 30 to 40 minutes, saving the valuable grower’s time over traditional methods.

Fortunately, automatic weed detection using machine learning and artificial intelligence (AI) is now possible. The results show substantial time savings using algorithms, reducing the grower’s cost, and increasing their efficiency. Picterra’s machine learning algorithm does just that.

Why weed detection using machine learning is crucial in agriculture

A good example is Shattercane (Sorghum bicolor), a common weed in the United States, which can be difficult to control. This plant grows quickly, competes aggressively with the crop, can get as large as mature corn plants, and resembles a corn plant. This hard to control weed can introduce fungi, bacteria, and nematodes, causing the grower a decrease in harvest yield and income. Killing the weed with herbicide is expensive and reduces the grower’s margin. Besides, herbicide sprayers can only get into cornfields during the first part of the growing season due to late maturity corn plant size. Obviously, the best defense is to prevent the weed from infecting other fields. However, if the weed is ingested into the combine as the corn is harvested, the Shattercane seeds will easily be transferred to other fields as the combine harvests crop in other fields. To prevent this, the grower will get out of the combine prior to ingesting it and remove the weed. But to do this, they must know where the weed is in the field.
Here comes the drone imagery, which brings actionable data to the grower and makes weed detection possible. Once the field is flown, and all imagery is stitched together, it’s time for inspection of the locations of Shattercane.

The image depicts a 43 acres (17 hectares) cornfield that was made by stitching together 393 photographs taken at nadir, i.e. pointing towards the ground.
The image depicts a 43 acres (17 hectares) cornfield that was made by stitching together 393 photographs taken at nadir, i.e. pointing towards the ground.

There are two methods to perform weed detection and identify Shattercane in this example. The first is to manually scroll through the image at a high level of magnification in a georectified application such as Google Earth Professional. The second method is to use AI to automate weed detection.

Let’s have a look at an invasive species called Johnsongrass, a grass closely related to Shattercane. An invasion can be dramatic for a field as it grows so quickly that it can kill the crop planted. It needs to be removed before the harvest, as it can contain enough hydrogen cyanide to kill cattle and horses. In collaboration with the company Eagle Eye Imaging LLC that has acquired the drone imagery over several fields affected, we trained a detector of Johnsongrass weed and assessed its performances and benefits in terms of time and accuracy gained.

Manual Weed Detection

Manual weed detection, in contrast to the weed detection using machine learning, has been the traditional way of visual inspection, performed from above. In the case of Johnsongrass, after the field is flown and photographs are stitched together as shown in Figure 1, manual weed detection can start. It requires the user to view the stitched, georectified image in an application such as Google Earth Professional. It also allows determination of the weed coordinates, which can be loaded into the combine or manually tracked by the grower on some other navigation device. This way, the grower can stop the combine before ingesting the weed into the combine and remove it.
In this example, the drone was flown at an altitude of 300 feet (91 meters) above ground level resulting in a resolution of 1.64 inches/pixel (4.17 centimeters/pixel). The manual method of weed detection requires the user to zoom into a high level of magnification, allowing the visual identification of the weed, as shown in Figure 2. At the needed high level of magnification in the middle of the field where all corn looks the same with no identifying markers, it was difficult to scroll through the field without becoming lost. Because of these factors, this manual method of weed detection became time-consuming. Once the weeds were identified, and a pin dropped on the stitched image, the weed coordinates were manually transferred into a spreadsheet.

Shuttercane image example
Shuttercane image example

The data post-processing encompassed downloading the photographs from the drone, stitching them into a georectified Orthomosaic, loading the stitched image into Google Earth Professional, inspecting the field, dropping pins and creating a coordinate spreadsheet. For this 43 acre field, this process took on the order of three hours to complete, which comes close to one hour per 10 acres. Although effective in identifying the weed, this time investment becomes larger for larger fields. So when using this manual weed identification process, the grower must balance their hourly cost of inspecting the field versus allowing the weed to be transferred to other fields and killing it with expensive herbicides.

Weed Detection using Machine Learning

Today’s drone technology provides a handy tool for our food producers. However, when done manually, it’s so time-consuming that it makes weed detection nearly impossible to be applied on a bigger scale. Weed detection using Machine Learning is a game-changer as it allows us to significantly cut the time spent on manual work and the cost of it.
With the Picterra platform, it’s possible to train and run the detector that will localize the exact position of the Johnsongrass. It doesn’t require any background in Machine Learning, Data Science, or even coding. All that needs to be done is to register on Picterra, upload good-quality images (multiple formats are available, including .tiff,.tif, .png, and .jpg) and to train the detector to differentiate between what you want to find and what you don’t.

Below you can see some of the training areas and counterexamples provided to train the model:

Within the training areas, the weed has been annotated with polygons. It has a different texture than the regular crops and a strong intensity in the near-infrared (NIR) band. Then, Eagle Eye Imaging LLC highlighted training areas without annotation to give the detector a counterexample – of plants that the user is not interested in detecting. Discrimination with animal tracks was also made as an example. The training of the detector took about 30min (each training iteration of the model takes about 1min30). Running the detector over the entire image took about 5min, which brings the total time to train the model and detect the weeds to less than an hour.

The detector could spot all the weed plants localized manually by photointerpretation (recall =100%). Besides, it allowed weed detection of the plants which were missed at the photointerpretation time.
Looking at the different size of weed plants, here are the detections categorized by size:

  • At least 6m2 (Blue)
  • At least 2m2 (Green)
  • All (purple)

The detector was added to the library of detectors and ready to be used on other images. When it was used over another field, it required only to add three additional examples to the detector to adapt it and handle further the variabilities.

The entire project is accessible on the Picterra platform: http://bit.ly/37IpHfc. If you want to build your own detector, create an account on Picterra, and feel free to contact us contact@picterra.ch.

Custom detector for weed detection built on Picterra.
Custom detector for weed detection built on Picterra.

Key takeaways

  1. Common weeds like Shattercane (Sorghum bicolor) and Johnsongrass are challenging to control and can have a devastating impact on agriculture. They grow fast, introduce fungi and bacteria, and quickly transfer from one field to another. That’s why food producers must know the exact location of these weeds before taking measures against them.
  2. Drone technology is a game-changer for food producers. Drones fly over the fields and take good-quality photos that then need to be stitched into one georectified image in an application such as Google Earth Professional. However, for successful weed detection, having the pictures is just the beginning – data must be carefully analyzed. It can be done manually, but the process is time-consuming and prone to errors. The food producer must balance the time it takes to analyze the photograph versus the probability of transferring the weed to another field. This business decision has been made much easier by using a AI weed detector.
  3. The best weed detection results possible can be achieved with the combination of drone images and Machine Learning algorithms. Thanks to Picterra, it was possible for Eagle Eye Imaging LLC, to find the localization of the Johnsongrass and have a ready-to-use weed detector for other fields in just a few minutes. Before, it took them several hours scrolling through the image visually to get similar results.

Want to learn more?

sign up to our newsletter