Deep learning methods guide computers to insect identification

Digvir Jayas, vice president of research at the University of Manitoba and a grain storage expert, shows off a jar of flour loaded with red flour beetles. Jayas recently introduced some new science surrounding computer vision and teaching computers how to recognize insects within grain bins. | Robert Arnason photo

Three-year olds are known for a long list of bad habits: biting other kids, throwing toys at their mom and answering every question with “no.”

Despite those irrational behaviours, they are also smart.

Show a three-year-old girl a van, a truck and a car, and she will quickly learn to identify the three types of vehicles.

Digvir Jayas, vice-president of research at the University of Manitoba and grain storage expert, said computers aren’t as smart as three- year olds, at least when it comes to computer vision and identifying objects.

But scientists are now teaching computers to think like a three-year old, so the machines can see the differences between one object and another.

“Computer programs try to mimic that human thinking,” Jayas said. “And that’s what is increasing the capability of identifying these objects.”

Jayas, a former Canada Research Chair in Stored Grain Ecosystems, is not interested in teaching computers how to recognize cars, vans and trucks. Instead, Jayas and other scientists have developed a program where computers can identify insects within grain bins.

The programming method, known as deep learning, is a key part of a stored grain monitoring system. Such systems can be used to detect insects in a grain bin before the grain is mixed into other bins or before it’s delivered to the elevator.

In the past, grain-monitoring systems weren’t needed in Western Canada because on-farm grain bins were small. Grain, even in the centre of the bin, got sufficiently cold to kill the insects.

That’s changed.

Now a single grain bin may store 70,000 bushels.

“If you put the grain in a 35-foot-diameter bin and load the bin in late August when the temperature could be 30 or 35 C, the centre of that bin will not cool probably below 20 C. Even when our outside temperature would be hitting -40 C,” Jayas said.

Meaning, it’s now possible for insects to survive the winter in Western Canada.

“(With) the larger bin the insects don’t get detected. Then you shift (the grain) to the grain car and they could be mixed into the whole system,” Jayas said.

“The more you mix un-infested grain with infested grain, you increase the fumigation cost.”

Jayas and his U of M team, along with scientists at Beijing University of Posts and Telecommunications, wrote about their research in Computers and Electronics in Agriculture, earlier this year.

The paper, Detection of Stored Grain Insects Using Deep Learning is complicated, but the concept is simple: the scientists programmed the computer to learn on its own, how to recognize insects.

“Think of a system that can classify pictures of animals as ‘cat’, ‘dog’, ‘tiger’, ‘lion’ or ‘elephant’,” says a post on Towards Data Science, a website. “Instead of manually finding unique visual characteristics and patterns from images of those animals and then coding it up, you can program the computer… to find visual patterns and differences between images of different animals all by itself. The idea here is that the computer ‘learns’ by itself.”

So, it’s similar to the three-year-old girl who learns to recognize a van, a car and a truck.

“I’m sure a three-year-old kid is not doing any measurements,” Jayas said. “They just have the shape in their mind (and) this shape represents a car.”

So far, the results are encouraging and the computer can correctly identify insects, in stored grain, nearly 90 percent of the time.

A computer that teaches itself how to recognize insects is a neat trick, but do farmers and grain companies want insect monitoring systems?

“In Canada, they are not as commonly used. But there is a need for them,” Jayas said.

“The farmer could have the insect monitor inside the bin and get a signal that you have some insect activity in the grain.”

Knowing that, the producer could do something, such as using aeration to reduce the temperature and freeze the insects.

“If the technology was there to detect the insects (sooner), then it would help manage our grains better in Canada,” Jayas added. “In Canada… we have a zero tolerance for insects. If even one insect is found in the grain, the elevator is supposed to reject that grain.”

Another way the monitoring system could work is with a smart phone. A producer could take a photo of a grain sample and upload it to the internet.

Then the grower might receive a message: take action X to kill the insect.

Detecting insects with deep learning programs may have a fit in Canada, but it may be more useful in tropical climates where insect populations can explode inside grain bins.

“In some countries they do a fumigation on a quarterly basis, even if there is low insect (population),” Jayas said.

An insect monitoring system might prevent the unnecessary use of chemicals because fumigation could be used only when needed.

Stored grain insects in Canada

The Canadian Grain Commission identifies dozens of stored grain pests on its website, but it lists eight common insect pests:

  • Rusty grain beetle
  • Red flour beetle
  • Confused flour beetle
  • Sawtoothed grain beetle
  • Granary weevil
  • Rice weevil
  • Yellow mealworm
  • Lesser grain borer

Source: Canadian Grain Commission

About the author


Stories from our other publications