PyTorch Behind New Technology for Intelligent Farming

Facebook's popular PyTorch machine learning (ML) library is being used to power "a new generation of AI-enhanced farming machines," the social media giant reported last week--primarily, to spot weeds and kills.

California-based Blue River Technology, a subsidiary of John Deere, has turned to artificial intelligence (AI) and robotics technology to identify weeds among crops in real time and treat them without harming the crops. The company's See & Spray robotic farming machine combines ML and computer vision to provide farmers with a more consistent, precise, and efficient means of weeding crops.

The See & Spray equipment attaches to the front of a modern tractor and covers multiple crop rows as it moves through a field. It collects images of crops and weeds via 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, the robotic equipment sprays only the locations where weeds were found. This approach reduces the amount of herbicide used to control weeds, the company says, passing cost savings on to farmers and promoting sustainable agricultural practices. 

"The machine needs to make real-time decisions on what is a crop and what is a weed," said Chris Padwick, Director of Computer Vision and Machine Learning at Blue River Technology, in a blog post. "As the machine drives through the field, high resolution cameras collect imagery at a high frame rate. We developed a convolutional neural network (CNN) using PyTorch to analyze each frame and produce a pixel-accurate map of where the crops and weeds are. Once the plants are all identified, each weed and crop is mapped to field locations, and the robot sprays only the weeds. This entire process happens in milliseconds, allowing the farmer to cover as much ground as possible since efficiency matters." Here is a great See & Spray Video that explains the process in more detail.

"We chose PyTorch because it's very flexible and easy to debug," Padwick added. "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."

PyTorch, one of the most popular ML libraries, was developed primarily by Facebook's AI Research lab (FAIR). Based on the Torch open-source machine learning library, and released under the Modified BSD license, it has been gaining fans and market share against its closest competitor, Google's TensorFlow, since version 1.0 was released in 2018. Microsoft has been a supporter of PyTorch from early days and now the chief maintainer of the PyTorch build for Windows.

About the Author

John K. Waters is the editor in chief of a number of sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at