Fungal Detection in Crops Through Raspberry Pi Deep Learning & AI Vision

fungal detection raspberry pi ai vision

Fungal infections such as powdery mildew, downy mildew, anthracnose and blight can cut crop yield sharply, and by the time a farmer sees the damage, the fungus has often already spread across the field. Traditional detection relies on experts walking the rows and inspecting leaves by hand. That is slow, expensive and hard to repeat across large areas, and it depends on skills that are scarce in many farming regions.

At Abark, we have been working on a practical answer: running deep learning-based fungal detection directly on low-cost Raspberry Pi devices, paired with AI vision, so a small camera node in the field can spot infection early, in real time, without needing an internet connection.

In this article we cover:

  1. Why fungal diseases are so costly for crop production
  2. How AI vision detects fungal symptoms on leaves
  3. What published research says about accuracy and limits
  4. Why we run the model on a Raspberry Pi instead of the cloud
  5. How our system is built, tested and deployed
  6. What this means for growers, agribusinesses and agritech partners

You can find more engineering write-ups on the Abark blog.

Why fungal diseases are so costly

Plant diseases have a direct effect on crop yield and food security, which is why early detection and identification matter so much for treatment and prevention. Fungal diseases are especially tricky for three reasons:

  • They spread quickly. Spores travel by wind, water and contact, so one infected patch can become a field-wide problem within days.
  • Early symptoms are subtle. Small spots, faint discoloration or a light coating are easy to miss on a walk-through, and many diseases look alike. Research on vegetable disease detection points out that similar-looking diseases and environmental interference are exactly what make accurate identification difficult.
  • Manual inspection does not scale. Expert inspection is time-intensive and needs a high level of expertise, which is hard to provide across many hectares or many farms.

The table below shows a few common fungal diseases and what the camera, or the human eye, is actually looking for.

Disease Typical visible signs on leaves Studied in the literature on
Powdery mildew White or grey powdery coating on the leaf surface Hops, rubber trees
Downy mildew Yellow or pale patches on the upper leaf, fuzzy growth underneath Hops, onion
Anthracnose Dark, sunken spots and lesions that spread and merge Rubber trees
Leaf blight and leaf spot Brown or tan lesions, often with rings or halos Tomato, vegetables

fig tomato leaf

Figure: tomato leaves with (a) late blight, (b) target spot and (c) bacterial spot. Image from Lu, Ehsani, Shi et al. (2018), Scientific Reports, as reproduced in Zeb et al. (2023). 

How AI vision detects fungal disease

Fungal infections leave visible traces on leaves: spots, powdery or fuzzy coatings, discoloration and lesions. Convolutional neural networks (CNNs) learn to recognise those patterns directly from labelled images, instead of relying on hand-written rules. A typical detection system moves each image through five stages.

pipeline

AI vision detection pipeline · 5 stages

The image is cleaned up, the leaf is separated from its background, the network learns the visual features of infection, and a final layer outputs a label such as healthy or a specific fungal disease.

Three ideas from the research shape how we build:

  • Classification versus detection. A classifier labels a whole image (for example healthy or powdery mildew). A detector such as YOLOv5 also draws a box around the infected area, which supports targeted treatment.
  • Segmentation focuses the model. Studies on tomato leaves found that training on segmented images, where the background is removed, produced better results than earlier published work.
  • Transfer learning saves data. Starting from networks pre-trained on ImageNet, such as Inception and VGGNet, reached 91.83% on a public dataset and 92% on rice images despite complex backgrounds (Chen, J. et al., 2020).

fig cnn block diagram

Figure: a typical CNN for plant disease detection, with convolution and pooling layers for feature extraction followed by fully connected layers that output class probabilities. Figure as reproduced in Zeb et al. (2023)

What the research shows

Deep learning has produced strong results on plant disease images across many crops and several fungal diseases. The studies below shaped our design choices. Note that some report accuracy and others report mAP (mean average precision), which are different metrics, so compare them with care.

Study Crop and disease Method Reported result
Ferentinos (2018) 25 plant species, 58 disease and healthy classes CNN models trained on 87,848 images 99.53% for the best model
Elaraby et al. (2022) 25 diseases across 5 crops AlexNet with particle swarm optimization 98.83% accuracy
Chen, Z. et al. (2022) Anthracnose and powdery mildew on rubber trees YOLOv5 with Involution Bottleneck and SE modules 86.5% and 86.8% accuracy, 70% mAP, 5.4% gain over baseline YOLOv5
Li, J. et al. (2022) Five vegetable diseases Improved YOLOv5s 93.1% mAP, 0.03 s detection time, 17.1 MB model
Kim et al. (2020) Onion downy mildew in the field Weakly supervised deep learning on field camera images 74.1% to 87.2% mAP in real time
Chen, J. et al. (2020) Public plant dataset and rice Transfer learning with Inception and VGGNet pre-trained on ImageNet 91.83% and 92%
Shoaib et al. (2022) Tomato leaf disease U-Net segmentation plus EfficientNet Above 99% on binary and six-class tasks using segmented images
Tanrikulu et al. (2022) Downy and powdery mildew on hops CNN with curated dataset Better results after adding suitable images and removing unhelpful ones
Li, Nie and Chao (2020) Several plant datasets Shallow CNN combined with kernel SVM or random forest Comparable to deeper models with far fewer parameters

Three lessons stand out for anyone building a field system:

  • Data quality matters as much as the model. The hops study improved results simply by adding images that met its standards and removing images that did not help learning.
  • Lightweight detectors work. The vegetable study reached 93.1% mAP with a 17.1 MB model and 0.03 s detection time, which is the size and speed range that edge hardware can realistically handle.
  • Segmentation helps. On tomato leaves, models trained on segmented images outperformed earlier published results, because the network focuses on the leaf rather than the background.

The real challenge: lab accuracy versus field conditions

High accuracy on a clean benchmark does not guarantee the same accuracy in a real field. Several studies make this point clearly:

  • Real-world capture lowers performance. In a cassava study using smartphone photos and video taken on a farm, the F1 score for severely infected plants dropped by 32% because the model’s recall fell (Ramcharan et al., 2018). The authors conclude that models for practical use must balance accuracy and recall.
  • Datasets are rarely diverse enough. Arnal Barbedo (2019) identifies the lack of image datasets that cover the full variety of symptoms seen in reality as the fundamental obstacle. Collecting individual lesions and spots instead of whole leaves improved accuracy by an average of 12%, with no crop below 75% across 10 diseases.
  • One leaf can have several problems. Arsenovic et al. (2019) built a 79,265-image dataset, expanded it with generative adversarial networks and classic augmentation, and tested real-world tasks such as detecting several diseases on one leaf. Their model reached 93.67% accuracy.
  • Class imbalance creates false alarms. Fuentes et al. (2020) use a Filter Bank to correct class imbalance and false positives in tomato disease detection under realistic, high-variance conditions.

This is why we treat deployment as the real test. Our work focuses on what happens when the camera is in a field with changing light, wind, dust, overlapping leaves and cluttered backgrounds, not just on results from a curated dataset.

Why run the model on a Raspberry Pi?

Cloud-based detection needs a reliable connection and a round trip for every image. Many farms have neither. Running the model on the device changes the economics and the reliability of field monitoring:

  • Real-time results. The leaf is analysed where it is captured, so an alert can fire within a fraction of a second.
  • Works offline. Detection continues in fields with weak or no connectivity, and data can sync later when a network is available.
  • Low cost and low power. Raspberry Pi nodes are inexpensive and can run on small batteries or solar panels, so many nodes can cover a large area.
  • Privacy and bandwidth. Only the result (for example “suspected powdery mildew, zone 4”) needs to be sent, not a stream of images.
Cloud inference Edge GPU board (for example Jetson Nano) Raspberry Pi
Needs internet Yes No No
Power use Low on device, high in data centre Medium to high Low to medium
Cost per node Camera plus connectivity plan Higher Low
Model size allowed Unlimited Large Medium, optimized models
Best for Batch analysis and training Drones and gateways Affordable, always-on field nodes with a camera

The literature shows this direction is realistic. One hybrid approach selected features with a flower pollination algorithm and used a lightweight CNN with a single classification layer, then ran the final model on an NVIDIA Jetson Nano mounted on a UAV to diagnose leaf diseases on tomato, apple and grape plants quickly and accurately (Artificial et al., 2022). Li, Nie and Chao (2020) showed that shallow CNNs combined with classical classifiers can compete with deep networks while using far fewer parameters. Chen, Z. et al. (2022) used an Involution Bottleneck module specifically to cut inputs and computation, and Wang et al. (2022) built a lightweight YOLOv5 using GhostNet to shrink the model.

A Raspberry Pi has less compute than a Jetson Nano, so models still benefit from compression techniques such as quantization (using 8-bit instead of 32-bit numbers), pruning, smaller input resolution and compact architectures. These are standard steps in edge AI deployment.

Our approach: from leaf image to field alert

Our system follows the standard stages of modern plant disease detection (image input, preprocessing, segmentation, feature extraction and classification) and tunes each one for constrained hardware. The table shows what happens at each stage and where the Abark-specific details go.

Stage What happens Abark implementation
1. Image acquisition A camera module captures leaf images in the field Standard camera sensor with 4 megapixel
2. Preprocessing Resize, normalise, correct lighting and reduce noise Resize, normalise, gray-scaling and color scaling
3. Segmentation Separate the leaf from soil, sky and neighbouring plants Leaf images extracted from plants
4. Model A compact network learns fungal symptom patterns Yolov5
5. Compression Shrink the model so it runs fast on Raspberry Pi hardware Image distillation applied, and final model size
6. On-device inference The Raspberry Pi runs the model on each image Tensorflow lite
7. Alerting The node flags suspected infection and reports it LoRa, Wi-Fi, GSM

raspberry-pi-architecture

on-device detection architecture · 4 parts and a retraining loop

Detection and decisions stay on the device. The network carries short alerts out and, occasionally, difficult images back for retraining.

Dataset and training

A detection model is only as good as its data. The research is consistent on this: more diverse images, careful cleaning and augmentation all raise real-world performance. We apply the same principles, collecting labelled images of healthy and infected leaves, expanding them with augmentation (rotation, brightness shifts, flips and noise) to simulate field variation, and holding back unseen images for testing.

The data behind the published results gives a useful benchmark. Ferentinos (2018) trained on 87,848 images covering 25 plant species and 58 classes from a public database. Arsenovic et al. (2019) collected 79,265 leaf images and expanded them with generative adversarial networks and classical augmentation. Shoaib et al. (2022) used 18,161 tomato leaf images, with and without segmentation. Ramcharan et al. (2018) tested on 720 cassava leaflets at mild, moderate and severe infection levels, and Chohan et al. (2020) worked with the PlantVillage dataset.

Models we evaluated

Leaf-level image classification and real-time object detection are the two main routes. Classification networks such as ResNet-50 (97.80% on a five-disease PlantVillage comparison in Chohan et al., 2020) and EfficientNet are accurate but heavier. Detection models such as YOLOv5 variants also locate the infected region, which helps targeted treatment, and compact versions exist for edge devices.

The review we draw on compares these published models (Zeb et al., 2023, Table 2). They come from different studies, datasets and metrics, so read the numbers as a guide, not a ranking.

Detection model Reported accuracy
Multi-class plant disease detection model 95%
Optimized YOLOv5 92%
Improved YOLOv5 86.8%
Mobile-based deep learning model 83.2%
EfficientNet CNN, two-class classification 99.5%
PlantDiseaseNet 93.67%

Results and benchmarks

We report results the way a farmer or an engineer would judge them: does it catch infections, how often does it raise a false alarm, and can it run fast enough on the device? Recall matters most in the field, because a missed infection costs more than an extra inspection. That is the lesson of the cassava study, where falling recall caused a 32% drop in F1 score for severe cases.

Metric Published reference points
Accuracy 91.83% to 99.53% across the studies above
Precision, recall and F1 Recall drops sharply on severe field images (Ramcharan et al., 2018)
mAP (if using detection) 93.1% 
Inference time per image 0.03 s on a detection model 
Model size 17.1 MB for an improved YOLOv5s 
RAM and CPU use 8gb ram

fig detection

Figure: heat maps showing where a deep network focuses on infected regions of a leaf, layer by layer. Image from Li, Zhang and Wang (2021), IEEE Access, as reproduced in Zeb et al. (2023).

Deployment and field testing

A model that works on a laptop has to survive a real farm. The deployment decisions that matter most for a Raspberry Pi vision node are:

  • Placement and angle. The camera must see leaves at a consistent distance and angle so images look like the training data.
  • Lighting. Direct sun, shade and dusk change colour and contrast, which can hide or mimic fungal symptoms. Consistent exposure settings and lighting-aware augmentation help.
  • Power. Sleep-wake cycles, where the node wakes, captures, infers and sleeps again, let a battery and solar panel keep the node running for long periods.
  • Connectivity. Because detection happens on the device, the network is only needed to send short alerts, which suits low-bandwidth links.
  • Weather protection and upkeep. Dust, moisture and lens fouling need an enclosure and a cleaning routine.
  • Feedback loop. Misclassified images from the field are collected and used to retrain the model, which is how accuracy keeps improving after launch.

What this means for growers and agribusinesses

For growers, agribusinesses and agritech partners, on-device fungal detection turns crop scouting from an occasional chore into continuous monitoring.

Benefit What it means in practice
Earlier detection Infection is flagged at the first visible symptoms, so treatment starts before the fungus spreads across the field
Targeted treatment Alerts point to a zone or plant, which reduces blanket fungicide spraying and cost
Fewer manual inspections Experts spend time on confirmed alerts instead of walking every row
Works anywhere Offline operation suits remote farms, greenhouses and orchards with weak connectivity
Scales affordably Low-cost nodes can be added zone by zone as coverage grows
Improves over time Field images feed retraining, and the same approach extends to new crops and diseases as data grows

Limitations and what comes next

No detection system is perfect, and being clear about limits builds trust. The main constraints we plan around are:

  • Dataset coverage. Models perform best on diseases, crops and conditions that appear in their training data. New crops or regions need new images.
  • Look-alike symptoms. Several diseases share similar visual signs, so an uncertain result should trigger a human check, not an automatic treatment decision.
  • Compression trade-offs. Compressing a model for a Raspberry Pi can reduce accuracy, so the final model must be validated on the device itself, not only on a PC.
  • Labelling effort. Collecting and labelling field images, especially at lesion level, still needs expert time (Arnal Barbedo, 2019).

The research suggests promising directions: combining the camera with weather, soil and location data through IoT sensors (Basori et al., 2020), using drones or fixed cameras for wide coverage, and extending the model with data from other systems over time.

Frequently asked questions

Can AI really detect fungal disease from a leaf image?

Yes. Published studies report accuracies above 98% on large plant disease datasets (for example 99.53% in Ferentinos, 2018, and 98.83% in Elaraby et al., 2022). Accuracy in the field depends on how varied and well-labelled the training images are.

Can deep learning run on a Raspberry Pi?

Yes, when the model is compact and compressed. Research on lightweight detectors, shallow CNNs and GhostNet-based YOLOv5 shows that small models can stay accurate, and quantization and pruning make them faster and smaller on edge hardware.

Does the system need an internet connection?

No. Inference runs on the device. A connection is only needed to send alerts or sync data, and that can happen later.

Which fungal diseases and crops does Abark’s system cover?

Our system targets common fungal leaf diseases such as powdery mildew, downy mildew, anthracnose and leaf blight on crops like tomato, onion, hops and other vegetables, and it can be extended to new crops by retraining on their images.

How accurate is Abark’s system?

Published deep learning systems like ours reach about 92% to 99% accuracy, and we validate every deployment on the farm itself.

How can I try it on my farm or in my product?

Contact the team through email. We will discuss your crops, your connectivity and your budget, and scope a pilot.

Conclusion: field-ready AI for crop protection

Deep learning has already shown it can identify plant diseases with very high accuracy, and lightweight models now make it possible to run that intelligence on small, low-power hardware in the field. Combining AI vision with Raspberry Pi devices gives growers earlier warnings, lower costs and monitoring that keeps working where the internet does not reach. The remaining work is the hard, practical part: diverse field data, honest validation on the real device and a feedback loop that keeps improving the model.

That is where Abark focuses. If you want to protect your crops, or build fungal detection into your own agritech product, we would be glad to show you what we have built.

Harris Ali
+ posts

Head Of Engineering Department

Related Articles

10 Best AI MVP Development Companies for Startups in 2026 November 12, 2026 ai coding costs Revolut Cut Its AI Coding Bill by 90%. Here’s How November 5, 2026 ai workflow automation Zapier vs Custom AI Workflows: When to Build Your Own November 5, 2026