Skip to content
← Back to portfolio

BSc thesis · Group project · 2026

A Deep Learning Framework for Mango Variety and Disease Classification Using Fruit and Leaf Images: Cross-Task Benchmarking and Multimodal Fusion for Variety Recognition

Arshad Al Galib · Jakariya Abbas · Abdul Bashir

BSc in Computer Science & Engineering, Manarat International University · Supervisor: Md. Zahurul Haque, Assistant Professor, Department of CSE

Completed October 2026 · Examination held 10 October 2026

Overview

Tasks
4

20 / 19 / 5 / 8 classes

Images
17,467

across four task datasets

Benchmark
16

experiments · four backbones

Paired test
100.0%

Macro-F1 · n = 387

The 100.0% result is population-specific; see Scope and Limitations.

Abstract

Mango variety and disease recognition are usually studied one view at a time. This thesis benchmarks four classification tasks, selects a common backbone from 16 validation experiments, and compares six unimodal and fusion conditions on documented pairs. The final model, MF-06, reaches 100.0% accuracy and Macro-F1 on a locked 387-pair, 19-class test set; the gain over fruit-only is not statistically significant at α = 0.05.

The four task datasets contain 17,467 images: 6,497 fruit-variety images across 20 classes, 3,070 leaf-variety images across 19 classes, 1,500 fruit-disease images across 5 classes, and 6,400 leaf-disease images across 8 classes. The variety images are primary field data collected in Naogaon, Rajshahi; the disease resources are treated separately. The 16-experiment benchmark selects EfficientNetV2-S as the common backbone, with a mean validation Macro-F1 of 0.97128 and a worst-task value of 0.94211. The multimodal study uses the 19 varieties shared by both variety datasets, with 2,203 training, 385 validation, and 387 held-out pairs.

MF-06 uses frozen EfficientNetV2-S fruit and leaf encoders, 512-dimensional projections, eight-head bidirectional cross-attention, and a 19-class classifier. On the held-out test, fruit-only reaches 98.79% Macro-F1 and leaf-only 92.45%, while MF-06 reaches 100.00%. The improvement over leaf-only is strongly supported; the improvement over fruit-only is not significant at α = 0.05. Under validation-only robustness testing, the worst condition—simultaneous JPEG-50 compression of both modalities—reached 0.990293 Macro-F1 (99.03% retention), and Grad-CAM/Grad-CAM++ analysis covers 19 representative validation cases, one per class. The 100% result is specific to the evaluated 387-pair, 19-class population and is not evidence of unrestricted field performance.

Keywords: Mango variety classification · Mango disease classification · Dual-modality learning · EfficientNetV2-S · Multimodal fusion · Cross-attention · Macro-F1 · Explainable AI · Robustness · Agricultural computer vision

Author contribution: Jakariya Abbas carried out the field dataset collection and the multimodal fusion pipeline.

Datasets

Task datasets and frozen train, validation, and test splits
TaskClassesImages
Fruit variety206,497
Leaf variety193,070
Fruit disease51,500
Leaf disease86,400

Task datasets total 17,467 images. The paired multimodal population contains 2,203 training pairs, 385 validation pairs, and 387 held-out test pairs across the 19 varieties shared by both variety datasets.

Variety images are primary field data from Naogaon, Rajshahi. The disease resources are separate; MangoFruitBD is a four-class detection resource and was not substituted into the five-class fruit-disease benchmark.

Methodology

MF-06 uses frozen EfficientNetV2-S fruit and leaf encoders. Each 1280×7×7 feature map is projected to 512 dimensions; the two 49-token sequences are fused with eight-head bidirectional cross-attention (dropout 0.20), mean-pooled, and passed through a 1024 → 512 → 19 classifier. The fusion head has 3,949,587 trainable parameters; the end-to-end model has approximately 44.30M. No post-selection backbone fine-tuning was performed.

Scroll to view the full figure, or open it full size.

Diagram of the MF-06 architecture with frozen EfficientNetV2-S fruit and leaf encoders, 512-dimensional projections, eight-head bidirectional cross-attention, and a 19-class classifier.
Figure 3. MF-06 architecture. Frozen EfficientNetV2-S fruit and leaf encoders; 512-dimensional projections; eight-head bidirectional cross-attention; 1024 → 512 → 19 classifier. Open full size ↗

Backbone Benchmark

Sixteen validation experiments crossed four tasks with four backbones. EfficientNetV2-S was selected by mean validation Macro-F1, with worst-task Macro-F1 as a secondary criterion. The selection is cross-task rather than universal: EfficientNetV2-S leads both variety tasks, while ConvNeXt V2-Tiny leads both disease tasks.

Cross-task validation benchmark
BackboneMean val Macro-F1Worst-task Macro-F1
EfficientNetV2-S0.971280.94211
ConvNeXt V2-Tiny0.965110.92024
DINOv3 ViT-B/160.957170.89628
MobileNetV4-Medium0.938790.85830

Fusion Results

Validation ablation

Six conditions were compared on the 385-pair validation population. MF-06 was selected before the held-out test was opened.

Validation-only fusion and ablation comparison
MethodMacro-F1
Fruit-only0.993134
Leaf-only0.952770
Feature concatenation0.994579
Weighted fusion (0.5 / 0.5)0.997074
Attention fusion0.955549
Bidirectional cross-attention1.000000

MF-06 improves over fruit-only by 0.006866 Macro-F1 and over leaf-only by 0.047230.

Locked paired test

The final test population contains 387 pairs across 19 varieties. MF-06 was frozen before evaluation.

Final paired 19-class test comparison and bootstrap confidence intervals
ModelAccuracyMacro-F1
Fruit-only98.7080%98.7925%
Leaf-only92.7649%92.4524%
MF-06 (fusion)100.0000%100.0000%

95% bootstrap CIs from 5,000 stratified iterations. The [1.000000, 1.000000] interval reflects zero observed errors in 387 cases; it should not be read as a guarantee of perfect performance.

Scroll to view the full figure, or open it full size.

Confusion matrix for the final MF-06 paired test on 19 mango varieties, with all 387 test pairs on the diagonal.
Figure 10. Final MF-06 paired-test confusion matrix for 19 mango varieties (n = 387). All held-out pairs were classified correctly. Open full size ↗

Paired statistics

Paired statistical comparison
ComparisonMcNemar pInterpretation
MF-06 vs fruit-only0.0625Not significant at α = 0.05
MF-06 vs leaf-only≈ 7.45 × 10⁻⁹Strongly supported

The gain over fruit-only is not statistically significant at α = 0.05.

The observed 100% error reduction is not the same as statistical significance. The result applies to the 387-pair, 19-class held-out population under the frozen protocol, not to unrestricted field performance.

Explainability

Grad-CAM and Grad-CAM++ were run on 19 representative validation cases, one per class, all correctly classified. The figure shows the fruit and leaf views for one Amrapali pair. These maps are localization diagnostics, not causal modality-contribution percentages.

Scroll to view the full figure, or open it full size.

Side-by-side Grad-CAM overlays for the fruit and leaf views of a correctly classified Amrapali pair.
Figure 8. Grad-CAM for the fruit and leaf views of a correctly classified Amrapali pair. The thesis reports 19 such cases, one per class. Open full size ↗

Robustness

Robustness testing was validation-only. The strongest degradation occurred under simultaneous JPEG-50 compression of both modalities, where Macro-F1 was 0.990293 and retention was 99.03%. Clean, brightness, blur, and zoom conditions remained near or at 1.0. These are predefined synthetic perturbations; they do not establish robustness to uncontrolled field conditions.

Scope and Limitations

  • The 100.0000% result is specific to the 387-pair, 19-class held-out population under the frozen protocol. It is not evidence of unrestricted field performance.
  • The variety data are geographically localized to Naogaon, Rajshahi, with a finite number of source groups; external validity is limited.
  • The multimodal study is restricted to the 19 varieties shared by both datasets; Lakh_Fazli is excluded from fusion.
  • The backbones were frozen during fusion training; the results do not establish gains from end-to-end fine-tuning.
  • Robustness tests use predefined synthetic perturbations, not uncontrolled field conditions.
  • The 16-experiment benchmark is validation-based. Clean post-freeze task-specific four-task test results remain outstanding in the thesis record; the final held-out test reported here is the paired 19-class evaluation.

Citation and Materials

Galib, A. A., Abbas, J., & Bashir, A. (2026). A Deep Learning Framework for Mango Variety and Disease Classification Using Fruit and Leaf Images: Cross-Task Benchmarking and Multimodal Fusion for Variety Recognition [Bachelor's thesis]. Manarat International University.

Thesis PDF, code, and result artifacts: available on request. Researcher-collected variety data: available on request. Public disease resources: cited in the thesis.