Source-linked AI summary

Empowering Local Agriculture: A Deep Learning-Powered Web System for Identifying Bangladeshi Mango Varieties

Monowar Islam, Safaruzzaman Shovo

arXiv:2608.28161v1cs.CVcs.LG

TL;DR

Bangladeshi mango identification is difficult because closely related cultivars resemble one another under varied field imaging conditions, while existing datasets and deployments are limited. The study builds a real-world nine-class dataset, fine-tunes three pretrained CNNs, and deploys the best model in a Streamlit web application. EfficientNetB0 achieves 98.01% validation accuracy and 97.36% test accuracy, with approximately 4 million parameters for lightweight deployment.

  • Problem

    Existing mango-recognition research gives limited attention to Bangladeshi cultivars and challenging real-world imaging conditions, while many systems stop at static evaluation.

  • Method

    The study collects a real-world Bangladeshi mango dataset, fine-tunes three ImageNet-pretrained CNN architectures, and integrates the selected model into a Streamlit application.

  • Results

    98.01% validation accuracy and 97.36% test accuracy are achieved by EfficientNetB0, with a macroaveraged F1-score of 0.98.

  • Takeaways & Limitations

    The deployed system provides accessible mango-variety predictions with class probabilities for farmers, extension workers, and market participants.

  • Takeaways & Limitations

    The current web application requires an active internet connection, limiting use in remote orchards with limited connectivity.

Abstract

from arXiv · show

Mango variety identification in Bangladesh is challenging because closely related cultivars can have similar visual characteristics and images are often captured under varying real-world conditions. This work presents a deep learning-based web system for automatic identification of Bangladeshi mango varieties. We collected 2,013 high-quality mango images (3024x4032 pixels) from local markets and farms and organized them into nine classes, combining Bari-4 and Bari-7 as a single Bari class. The dataset was divided into training (70%), validation (15%), and test (15%) sets, with image augmentation applied to improve model generalization. Three pretrained CNN architectures, ResNet18, ResNet50, and EfficientNetB0, were fine-tuned under consistent training settings. EfficientNetB0 achieved the best performance, obtaining 98.01% validation accuracy and 97.36% test accuracy, compared with 86.47% and 78.55% test accuracy for ResNet18 and ResNet50, respectively. Class-wise F1-scores for EfficientNetB0 ranged from 0.93 to 0.99, while the Bari class achieved an F1-score of 0.97. The selected EfficientNetB0 model has approximately 4 million parameters, making it suitable for lightweight deployment. We integrated the model into a Streamlit web application that enables users to upload a mango image and receive a predicted variety with class probabilities. The system provides an accessible, practical tool for mango identification and demonstrates the potential of deep learning for supporting agricultural applications in Bangladesh.

I. INTRODUCTION

Bangladesh’s diverse mango sector needs reliable variety identification because manual grading is inconsistent and visually similar cultivars are difficult to distinguish. This work addresses gaps in Bangladeshi data, architectural comparison, and practical deployment through a web-based deep learning system.

  • Bangladesh’s mango supply chain relies heavily on subjective expert judgment, creating inconsistency and difficulty distinguishing visually similar cultivars.
  • Existing mango-recognition studies largely use non-Bangladeshi cultivars or controlled images, leaving real-world Bangladeshi conditions minimally studied.
  • The study constructs a 2,013-image dataset covering nine commercially important Bangladeshi mango cultivars collected from real-world sources.
  • ResNet18, ResNet50, and EfficientNetB0 are systematically compared using transfer learning with identical augmentation and training regimens.
  • 97.36% test accuracy is achieved by EfficientNetB0, establishing the reported benchmark for Bangladeshi mango classification.
  • The selected model is deployed through a Streamlit application that provides real-time variety predictions and class probabilities.

II. RELATED WORK

Prior fruit and mango-classification systems demonstrate the value of CNNs but often rely on small, controlled, geographically limited datasets or lack accessible deployment. This study targets both the data and deployment gaps for Bangladeshi mango varieties.

  • Earlier handcrafted-feature pipelines often failed to generalise when illumination, scale, or viewpoint varied substantially.
  • Other studies commonly used laboratory images, small per-class samples, or non-Bangladeshi cultivars, limiting direct applicability to local conditions.
  • Prior Bangladeshi mango work classified four varieties with a custom CNN achieving 96% accuracy, but lacked broader variety coverage and deployment.
  • Deployment-oriented systems addressed real-time or web recognition but generally focused on coarse fruit categories or fewer mango varieties.
  • The present study fills the identified gaps with a 2,013-image real-world Bangladeshi dataset, architectural comparison, and public web deployment.

III. METHODOLOGY

The methodology follows five sequential stages, from dataset acquisition and preprocessing through model training, evaluation, and web deployment.

  • The workflow comprises dataset acquisition and preprocessing, splitting and augmentation, transfer learning, training and evaluation, and web application deployment.

A. Dataset Collection

The dataset was collected from Bangladeshi orchards and markets under natural, varied conditions and organized into nine classes after merging BARI-4 and BARI-7 as Bari.

  • A. Dataset Collection: Images were captured at 3024×4032-pixel resolution in Rajshahi, Chapai Nawabganj, Faridpur, and Dhaka using natural daylight and varied backgrounds.
  • A. Dataset Collection: The initial collection contained 2,013 images distributed across labelled folders for Bangladeshi mango varieties.
  • A. Dataset Collection: BARI-4 and BARI-7 were merged into one Bari class because their visual traits are highly similar and they are commonly marketed collectively.
  • A. Dataset Collection: Figure 1 illustrates within-variety variation in background, lighting, and orientation across representative samples.

B. Dataset Split

The dataset was split stratifiably into training, validation, and test subsets, with augmentation applied only during training to improve generalisation.

  • Dataset Split: 1,409 training, 301 validation, and 303 test images resulted from a stratified 70-15-15 split.The test set remained unseen during training and hyperparameter tuning.
  • Dataset Split: Online augmentation was applied during training to improve generalisation and reduce overfitting on the limited training set.
  • Dataset Split: Random horizontal flips with probability 0.5 increased viewpoint diversity for mango images.
  • Dataset Split: Random rotations up to ±15◦ accounted for natural tilt in hand-held captures.
  • Dataset Split: Color jitter simulated natural illumination and camera white-balance variation.Brightness, contrast, and saturation were set to 0.2, with hue set to 0.1.
  • Dataset Split: Random crops scaled to 224×224 encouraged focus on discriminative regions rather than fixed-size centered objects.Crop scale ranged from 0.8–1.0.

D. Transfer Learning

Transfer learning initialized all three CNNs with ImageNet-pretrained weights before adapting their final classification layers to the mango task.

  • Transfer Learning: ImageNet-pretrained weights initialized all three models because training a deep CNN from scratch on 1,409 images was considered impracticable.ImageNet contains 1.2 million images across 1,000 object categories.
  • Transfer Learning: Each architecture replaced its final fully connected layer with a new classification head for the target task.

E. Models Compared

The study compared ResNet18, ResNet50, and EfficientNetB0 under identical training conditions, representing different trade-offs between depth, capacity, and efficiency.

  • Models Compared: 11.7 million parameters characterize ResNet18, whose skip connections support stable training across 18 layers.
  • Models Compared: 25.6 million parameters characterize ResNet50, a deeper bottleneck-residual network with higher computational cost.
  • Models Compared: Roughly 4 million parameters give EfficientNetB0 a favorable accuracy-efficiency trade-off through compound scaling.Compound scaling adjusts network depth, width, and resolution uniformly.
  • Models Compared: Identical training conditions were used for all models to ensure comparability.Training used PyTorch on an NVIDIA Tesla T4 GPU.
  • Models Compared: Accuracy, precision, recall, macro and weighted F1-score, and confusion matrices were computed on the test set.

G. Web Deployment

The selected EfficientNetB0 model was integrated into a Streamlit interface where users upload mango images and receive variety predictions with class probabilities.

  • Web Deployment: Users can upload JPEG or PNG mango images through the Streamlit web application.
  • Web Deployment: The uploaded image undergoes resizing to 224×224 and normalisation before model inference.
  • Web Deployment: The interface displays the predicted variety together with a softmax probability distribution over all nine classes.

IV. RESULTS AND DISCUSSIONS

EfficientNetB0 outperformed ResNet18 and ResNet50 in validation and test evaluation, while maintaining strong per-class performance and responsive web inference.

  • Architecture comparison: 98.01% validation accuracy and 97.36% test accuracy made EfficientNetB0 the strongest-performing architecture.The test set contained 303 held-out images, with a 2.64% misclassification rate.
  • Architecture comparison: 86.47% validation accuracy was achieved by ResNet18, whereas ResNet50 reached 78.55%.ResNet18 showed fluctuations in validation loss, while ResNet50 was described as over-parameterized for the relatively small dataset.
  • Per-class performance: 0.97 F1-score was obtained for the merged Bari class, while Harivanga had the lowest F1-score at 0.93.Amrapali, Fazlee, Kanchon Langra, Katimon, Langra, and Mollika achieved precision and recall of 0.99.
  • Overall performance: 0.98 macroaveraged F1-score and 0.98 weighted F1-score accompanied the 97.36% overall test accuracy.The confusion matrix showed most errors between Bari and Nilambori or between Bari and Harivanga.
  • Deployment: Under 1.2 seconds was required for a single Streamlit prediction on a standard cloud instance.The reported latency was intended to provide a responsive experience over mobile networks.

V. CONCLUSION AND FUTURE WORK

The study delivers a Bangladeshi mango dataset, a comparative EfficientNetB0-based classifier, and a publicly available Streamlit application. Future work focuses on broader data coverage, offline deployment, multitask prediction, and continual improvement.

  • Conclusion: 2,013 images covering nine mango varieties were collected from orchards and markets to capture field variability.The dataset supported systematic comparison of transfer-learned CNN architectures.
  • Conclusion: 97.36% test accuracy and a 0.98 macro F1-score were achieved by the EfficientNetB0 model.EfficientNetB0 outperformed ResNet18 and ResNet50 in the reported comparison.
  • Conclusion: A publicly available Streamlit web application deployed the final model for mango variety identification.The application was intended for farmers, extension workers, and market participants.
  • Future work: The dataset should expand to additional varieties, geographic regions, and post-harvest stages.Suggested varieties include Gopalbhog, Khirsapat, and Ashwina.
  • Future work: An on-device TensorFlow Lite or ONNX mobile application would address the current requirement for an active internet connection.The proposed offline deployment targets remote orchards with limited connectivity.
  • Future work: Future extensions include jointly predicting variety, ripeness, diseases, and physiological disorders.The proposed multitask system would provide a broader quality assessment tool.
Loading 2608.28161v1…