Open Source

ML Applications

PyTorch drives next-gen intelligent farming machines

August 6, 2020

PyTorch is helping to power a new generation of AI-enhanced farming machines. For farmers, weeds pose a very real threat to the health of crops at a time when global population growth is raising food demand while also making resources such as land and water increasingly scarce.

Seeking solutions to helping farmers produce more food with fewer resources, California-based Blue River Technology, a subsidiary of John Deere, has turned to artificial intelligence and robotics technology. The company’s See & Spray robotic farming machine combines machine learning (ML) and computer vision to identify weeds among crops in real time and to treat weeds while leaving crops unharmed — giving farmers a more consistent, precise, and efficient means of weeding crops.

As the See & Spray machine moves through a field, it collects images of crops and weeds through the use of a high-resolution camera array. Each frame captured by the camera is analyzed by a PyTorch-enabled neural network to identify weeds and crops and map their locations. Once the map has been created, in a matter of milliseconds the robot then sprays only the locations where weeds were found. This approach reduces the amount of herbicide used to control weeds, passing cost savings on to farmers and promoting sustainable agricultural practices.

“This is a challenging problem because many weeds look just like crops,” Chris Padwick, Director of Computer Vision and Machine Learning at Blue River Technology, wrote in a PyTorch Medium post.

To address this, Padwick said the team at Blue River Technology consulted with professional agronomists and weed scientists on labeling weeds correctly and used PyTorch for training all of their ML models.

“We chose PyTorch because it’s very flexible and easy to debug. New team members can quickly get up to speed, and the documentation is thorough,” Padwick wrote. “The framework gives us the ability to support production model workflows and research workflows simultaneously.”

See & Spray can distinguish between crops (in green) and weeds (in red).

Continuing to improve on its AI-powered agricultural processes involves more than just deploying neural network models onto robots. Engineers at Blue River Technology also need to regularly perform experiments and research to improve their models’ performance, a process that also involves a good deal of data science and analysis related to testing and process improvement. To monitor and evaluate these machine learning runs, engineers use the Weights & Biases platform, which also makes it easy to visualize PyTorch models during training.

The advantage of PyTorch, Padwick wrote, is its speed and flexibility, allowing engineers to add new features very quickly. “We have built a set of internal libraries on top of PyTorch, which allow us to perform repeatable machine learning experiments,” he wrote. “At the end of the day, we need to build the most accurate and fastest models for our field machines. PyTorch enables us to iterate quickly, then productionize our models and deploy them in the field.”

Learn more about how Blue River is using PyTorch to build intelligent agricultural machines.