Listen, you’re kinda spooked about the rise of artificial intelligence, and I get that. It’s a tremendously powerful technology that promises to transform the very nature of work, inevitably leading to the automation of certain white-collar jobs. Like maybe mine, for instance.

But AI also promises to make human labor smarter and more efficient, even something as traditional as small-scale farming. To that end, researchers have developed a smartphone-based program that can automatically detect diseases in the cassava plant—the most widely grown root crop on Earth—with darn near 100 percent accuracy. It’s a glimpse at a future in which farmers in the developing world trade the expertise of a handful of specialists for increasingly omnipresent and powerful technology.

The most impressive bit about the technology is that the neural network that powers it runs entirely on the smartphone, no cloud computing or hulking processors required, as the researchers detail in a preprint paper to be published in Frontiers in Plant Science. That's thanks to TensorFlow, Google's open source machine learning library, which gave rise to Inception v3, a slimmed-down network the researchers deployed. "Some neural networks require hundreds of millions of parameters, and just the file size you would need to store those is beyond what you could include in an app," says Google’s Pete Warden, tech lead on TensorFlow Mobile. "This network only has around 25 million."

That and it doesn't require anywhere near the processing power. “It only requires—I say only—but it only requires about 11 billion floating point operations to actually calculate its result,” Warden adds, “and some other networks require hundreds of billions of operations to do a similar job.”

Now, if you want to train a neural network to recognize certain objects, be it cats or dogs or chairs, you have to feed it millions and millions of images. That’s of course a hassle, and no one has millions and millions of images of diseased cassava leaves. But there's this fancy trick called transfer learning. “Happily, it turns out that networks trained to recognize certain kinds of objects can actually be taught to recognize other things with a lot less data, and that's really the idea behind transfer learning,” says Warden.

Which is useful, since images of cassava leaves aren’t as readily available as lolcats and puppers. And training a robust neural network requires feeding it the choicest of pictures. “It really comes down to the data, because garbage in, garbage out,” says Penn State agricultural engineer Amanda Ramcharan, lead author on the study. “So you want to have really clean, high-quality data sets.”

That’s exactly what she and her coauthors got. Thanks to the magic of transfer learning, they only had to feed the network 2,756 images of cassava leaves right from the field in Tanzania, then trained the system to recognize damage from ailments like cassava brown streak disease and cassava mosaic disease, plus the ravages of mites. And they trained it well—in the end, it was able to identify brown leaf spot with 98 percent accuracy and red mites at 96 percent.

You might say, well, yeah, so could an experienced farmer. Not necessarily. Even if a farmer were really good at identifying, say, cassava brown streak disease, the arrival of a novel pest might blindside them. The cassava green mite, for instance, only arrived in Africa from South America in the 1970s.

“With globalization, the spread of pests and pathogens is increasing rapidly,” says Ramcharan. “So having tools that you can deploy quickly can be really beneficial and really help with food security.”