From Africa/Agritech/Tanzania
Training with attack images pushed bean disease accuracy to 99.4%
A Tanzanian team trained a Vision Transformer on 100,000 bean leaf images, adding tiny nudges made to fool it. Accuracy rose from 97.4 percent to 99.4 percent.
Researchers at the Nelson Mandela African Institution of Science and Technology in Tanzania trained a Vision Transformer to spot bean rust and anthracnose. Adding small adversarial nudges during training, using the Fast Gradient Sign Method, lifted accuracy to 99.4 percent. The same model without the nudges scored 97.4 percent, and a hardened CNN scored 97.65 percent.
What happened
A goalkeeper who only faces easy shots looks great in training. Then a real match comes. The first hard shot goes in.
Software has the same problem. A model that only sees clean photos looks great on paper. Then a farmer holds up a phone in the wind, at noon, with dust on the lens. The model gets it wrong.
So a team in Tanzania trained their model against hard shots on purpose. They fed it photos that were changed just enough to fool it. The changes are too small for you to see. The model learned to get them right anyway.
The test
The paper is “Enhancing detection of common bean diseases using Fast Gradient Sign Method-trained Vision Transformers”. The authors are Upendo Mwaibale, Neema Mduma, Hudson Laizer and Bonny Mgawe. All four work at the Nelson Mandela African Institution of Science and Technology in Arusha, Tanzania. It was published in the journal Frontiers in Artificial Intelligence in August 2025.
The crop is the common bean. The two diseases are bean rust and bean anthracnose. Both spot and scar the leaves, and both spread if you miss them early.
The team went to bean farms in Tanzania’s Southern Highlands. They worked in the Njombe, Iringa and Mbeya regions. They shot photos with ordinary phone cameras, outdoors, over three months. The paper reports 59,072 images gathered this way.
The photos were sorted into four groups. Healthy. Rust. Anthracnose. And a fourth group for photos with noise or junk in them. Copies were made until each group held 25,000 images, giving 100,000 in total. Every photo was resized to 512 by 512 pixels.
Then came the trick. During training the team added a tiny nudge to each image, aimed at the model’s weak spot. The method is called the Fast Gradient Sign Method. The size of the nudge was set to 0.05. Training ran for six epochs, in batches of 64. The team checked results with five-fold cross-validation and an 80 to 20 split.
The result
The hardened model scored 99.4 percent accuracy. Precision, recall and F1 all came out at the same figure.
Now the comparison, which is the part that matters. The same Vision Transformer, trained without the nudges, scored 97.4 percent. A CNN trained with the same nudges scored 97.65 percent.
So the gain is about two points. That sounds small. Turn it around and it looks bigger. Errors fell from about 26 in a thousand to about 6 in a thousand. THAT IS ROUGHLY A QUARTER OF THE MISTAKES.
Every class held up. The F1 score was 0.9960 for rust, 0.9910 for anthracnose, 0.9920 for healthy leaves and 0.9970 for the junk photo group.
What it means
Two things here are worth copying.
The first is the fourth class. Most crop models have to guess when they are handed a photo of a shoe or the sky. This one has a group for junk, and it spots junk almost perfectly. A model that can say nothing useful here is safer than a model that always names a disease.
The second is the training trick. You do not need new photos to make a model steadier. You take the photos you have and bend them towards the model’s own blind spot. This is because a model fails in patterns, and you can search for those patterns on purpose.
There is a cost. The authors say a Vision Transformer needs more memory and more compute than a CNN. On a cheap phone that matters. The CNN they tested was two points less accurate and much lighter.
Business ideas from this paper
- A photo quality checker that sits in front of any crop diagnosis app and says retake this one before the model ever runs. Who buys it: farm advisory apps that already get blurred and off target uploads. A price to test: 200 dollars a month for each app. A one-week test: bolt it onto one app for seven days, then count how many photos it sent back and how many users retook them.
- A model hardening audit, where you attack a client’s crop model with small nudges, report where it breaks, and retrain it. Who buys it: agritech firms with a model already in the hands of users. A price to test: 1,500 dollars for one audit and one retrain. A one-week test: audit one public model for free, publish the break rate, then ask two firms to book a paid slot.
- A weekly bean disease report for one growing district, built from photos that extension officers send in. Who buys it: farmer cooperatives and seed companies who need to know when rust arrives. A price to test: 40 dollars a month for each cooperative. A one-week test: run it by hand for two cooperatives for one week, and see if either asks for a second week.
How sure can you be?
The 99.4 percent is real, and it is also narrow. It comes from held back photos of the same kind, from the same farms, taken in the same three months.
The authors say this plainly. They write that the dataset reflects Tanzanian field conditions and may not apply to other regions or other crops. They point out that leaf shape, symptom look and background noise all change between places.
They flag three more limits. The nudging method is a single step method, so it may not cover the full range of real world noise. They did not compare their model against other transformer designs. And the model needs more memory and compute than a CNN, which limits where it can run.
Two more things are missing from the paper. There is no field trial with farmers, so nobody has measured whether the model helps a person decide anything. And the numbers on the dataset do not line up. The text says 59,072 images were gathered. The table lists 84,072 images before copies were made. The paper does not explain the gap.
We score this paper 5 out of 10. It is published in a peer reviewed journal, which is worth real credit. It rests on one dataset from one country, and the data link points to a public repository while no code link is given.
What would settle it? Run the same trained model on bean photos from another country, and report the accuracy without retraining.
Do this today
If you run any model that takes user photos, add a class for junk. Then measure how often your model names something when the right answer is nothing.
Source: Enhancing detection of common bean diseases using Fast Gradient Sign Method-trained Vision Transformers, Frontiers in Artificial Intelligence, August 2025. pmcid:PMC12364866 · www.frontiersin.org (peer reviewed).
Just Out Tech explains new research in plain language. This article was drafted with AI assistance and checked by a human against the original source.
- A Vision Transformer trained with Fast Gradient Sign Method nudges reached 99.4 percent accuracy on bean leaf photos, against 97.4 percent for the same model trained without them.
- The dataset came from bean farms in the Njombe, Iringa and Mbeya regions of Tanzania, with 59,072 phone photos gathered over three months and balanced to 25,000 images per class.
- A fourth class for junk photos scored an F1 of 0.9970, so the model can say that an image holds no useful bean leaf at all.
Questions people ask
what is the Fast Gradient Sign Method?
It is a way of changing an image just enough to fool a model. The change is aimed at the model's own weak spot, and it is too small for a person to notice. Training on those changed images makes the model steadier. In this paper the size of the change was set to 0.05.
how much did adversarial training actually help?
Accuracy went from 97.4 percent to 99.4 percent. That is two points. In error terms it is larger, because mistakes fell from about 26 in a thousand to about 6 in a thousand. A CNN trained the same way reached 97.65 percent.
where did the bean photos come from?
From bean farms in Tanzania's Southern Highlands, in the Njombe, Iringa and Mbeya regions. The team used ordinary mobile phone cameras in natural field conditions over three months. The paper reports 59,072 images gathered, later expanded with copies to 100,000.
will this model work on beans in another country?
The paper does not show that. The authors write that the dataset reflects Tanzanian field conditions and may not apply to other regions or crops. They note that leaf shape, symptom appearance and background noise differ between places.