https://doi.org/10.4081/jae.2026.2108
Efficient and explainable attention-based multitask learning for fruit type, ripeness, and disease classification
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.
Published: 25 September 2026
Precision agriculture increasingly relies on automated crop monitoring to support disease prevention and harvest decisions. However, most existing systems treat fruit type, ripeness, and disease classification as separate tasks, leading to high computational costs in real-world deployments. This paper proposes an efficient and explainable multitask learning (MTL) model for fruit monitoring that performs all three tasks simultaneously. The MTL model uses a shared lightweight MobileNetV2 backbone with a convolutional block attention module (CBAM) to extract both shared and discriminative features. Dedicated classification heads then utilize these features to generate predictions for each task. To address the scarcity of fully annotated agricultural datasets, we combine multiple public datasets and apply a partial label-masking strategy to handle missing annotations. In addition, the proposed model is evaluated using several backbone architectures, including ResNet-50, EfficientNetV2-M, and ViT-B/16, under both single optimizer and separate optimizers. Experimental results demonstrate that the proposed MTL model achieves 99.39% (fruit type), 96.35% (ripeness), and 99.7% (disease) accuracy, while using only 5.5M parameters, outperforming single-task solutions. Furthermore, gradient-based explainability analysis provides transparency into the model's decision-making process.
Downloads
Ahmed MS, 2023. Fruit Image Dataset: 22 Classes. Kaggle. Available from: https://www.kaggle.com/datasets/mdsagorahmed/fruit-image-dataset-22-classes
Ali A, 2019. PlantVillage Dataset. Kaggle. Available from: https://www.kaggle.com/datasets/abdallahalidev/plantvillage-dataset
Atila Ü, Uçar M, Akyol K, Uçar E, 2021. Plant leaf disease classification using EfficientNet deep learning model. Ecol Inform 61:101182. DOI: https://doi.org/10.1016/j.ecoinf.2020.101182
Attri I, Awasthi LK, Sharma TP, Rathee P, 2023. A review of deep learning techniques used in agriculture. Ecol Inform 77:102217. DOI: https://doi.org/10.1016/j.ecoinf.2023.102217
Bai C, Zhang L, Gao L, Peng L, Li P, Yang L, 2024. DINOV2-FCS: a model for fruit leaf disease classification and severity prediction. Front Plant Sci 15:1475282. DOI: https://doi.org/10.3389/fpls.2024.1475282
Bhattarai S, 2018. New Plant Diseases Dataset. Kaggle. Available from: https://www.kaggle.com/datasets/vipoooool/new-plant-diseases-dataset
Dai G, Tian Z, Fan J, Sunil CK, Dewi C, 2024. DFN-PSAN: multi-level deep information feature fusion extraction network for interpretable plant disease classification. Comput Electron Agric 216:108481. DOI: https://doi.org/10.1016/j.compag.2023.108481
Diyansah D, 2024. Fruit Ripeness Level Dataset. Kaggle. Available from: https://www.kaggle.com/datasets/dudinurdiyansah/fruit-ripeness-level-dataset/data
Dosovitskiy A, Beyer L, Kolesnikov A, Weissenborn D, Zhai X, Unterthiner T, et al., 2021. An image is worth 16×16 words: transformers for image recognition at scale. arXiv:2010.11929.
Duarte K, Rawat YS, Shah M, 2021. PLM: partial label masking for imbalanced multi-label classification. arXiv:2105.10782. DOI: https://doi.org/10.1109/CVPRW53098.2021.00308
Fu R, Wang X, Wang S, Sun H, 2025. PMJDM: a multi-task joint detection model for plant disease identification. Front Plant Sci 16:1599671. DOI: https://doi.org/10.3389/fpls.2025.1599671
Hamed BS, Hussein MM, Mousa AM, 2023. Plant disease detection using deep learning. Int J Intell Syst Appl 15:38-50. DOI: https://doi.org/10.5815/ijisa.2023.06.04
He K, Zhang X, Ren S, Sun J, 2015. Deep residual learning for image recognition. arXiv:1512.03385. DOI: https://doi.org/10.1109/CVPR.2016.90
Hemalatha S, Jayachandran JJB, 2024. A multitask learning-based vision transformer for plant disease localization and classification. Int J Comput Intell Syst 17:188. DOI: https://doi.org/10.1007/s44196-024-00597-3
Hu D, Zhao L, Ren Y, Wang S, Ye X, Zhang H, et al., 2025. A lightweight vision transformer with embedded hybrid attention for quick response code defect classification. Eng Appl Artif Intell 150:110575. DOI: https://doi.org/10.1016/j.engappai.2025.110575
Krishna MS, Machado P, Otuka RI, Yahaya SW, Neves dos Santos F, Ihianle IK, 2025. Plant leaf disease detection using deep learning: a multi-dataset approach. J 8:4. DOI: https://doi.org/10.3390/j8010004
Mi Z, Yan WQ, 2024. Strawberry ripeness detection using deep learning models. Big Data Cogn Comput 8:92. DOI: https://doi.org/10.3390/bdcc8080092
Nair S, Bajpai K, Fadnavis S, Jain S, Sheikh Z, 2024. Plant Fettle Detector: unifying fruit quality tracking and plant disease detection through advanced image analysis. In: Proceedings of the 2024 3rd International Conference for Innovation in Technology (INOCON). IEEE; pp. 1-5. DOI: https://doi.org/10.1109/INOCON60754.2024.10512262
Padhiary M, Saha D, Kumar R, Sethi LN, Kumar A, 2024. Enhancing precision agriculture: a comprehensive review of machine learning and AI vision applications in all-terrain vehicles for farm automation. Smart Agric Technol 8:100483. DOI: https://doi.org/10.1016/j.atech.2024.100483
Sandhi A, 2024. A comprehensive hybrid model for apple fruit disease detection using multi-architecture feature extraction. Preprints 202410.1894.v1. DOI: https://doi.org/10.20944/preprints202410.1894.v1
Sandler M, Howard A, Zhu M, Zhmoginov A, Chen LC, 2019. MobileNetV2: inverted residuals and linear bottlenecks. arXiv:1801.04381. DOI: https://doi.org/10.1109/CVPR.2018.00474
Selvaraju RR, Cogswell M, Das A, Vedantam R, Parikh D, Batra D, 2017. Grad-CAM: visual explanations from deep networks via gradient-based localization. In: Proceedings of the 2017 IEEE International Conference on Computer Vision (ICCV). IEEE; pp. 618-26. DOI: https://doi.org/10.1109/ICCV.2017.74
Singh D, Jain N, Jain P, Kayal P, Kumawat S, Batra N, 2020. PlantDoc: a dataset for visual plant disease detection. In: Proceedings of the 7th ACM IKDD CoDS and 25th COMAD (CoDS COMAD 2020). Association for Computing Machinery; pp. 249-53. DOI: https://doi.org/10.1145/3371158.3371196
sshikamaru, 2018. Fruit Recognition. Kaggle. Available from: https://www.kaggle.com/datasets/sshikamaru/fruit-recognition
Sultana N, Jahan M, Uddin MS, 2022. An extensive dataset for successful recognition of fresh and rotten fruits. Data Brief 44:108552. DOI: https://doi.org/10.1016/j.dib.2022.108552
Tan M, Le QV, 2021. EfficientNetV2: smaller models and faster training. arXiv:2104.00298.
Tapia-Mendez E, Cruz-Albarran IA, Tovar-Arriaga S, Morales-Hernandez LA, 2023. Deep learning-based method for classification and ripeness assessment of fruits and vegetables. Appl Sci 13:12504. DOI: https://doi.org/10.3390/app132212504
Uddin AH, 2020. Plant Doc Dataset. Kaggle. Available from: https://www.kaggle.com/datasets/abdulhasibuddin/plant-doc-dataset
Wang CY, Yeh IH, Liao HYM, 2024. YOLOv9: learning what you want to learn using programmable gradient information. arXiv:2402.13616. DOI: https://doi.org/10.1007/978-3-031-72751-1_1
Wang P, Niu T, Mao Y, Zhang Z, Liu B, He D, 2021. Identification of apple leaf diseases by improved deep convolutional neural networks with an attention mechanism. Front Plant Sci 12:723294. DOI: https://doi.org/10.3389/fpls.2021.723294
Woo S, Park J, Lee JY, Kweon IS, 2018. CBAM: convolutional block attention module. arXiv:1807.06521. DOI: https://doi.org/10.1007/978-3-030-01234-2_1
Yang B, Wang Z, Guo J, Guo L, Liang Q, Zeng Q, et al., 2023. Identifying plant disease and severity from leaves: a deep multitask learning framework using triple-branch Swin Transformer and deep supervision. Comput Electron Agric 209:107809. DOI: https://doi.org/10.1016/j.compag.2023.107809
Yu J, Dai Y, Liu X, Huang J, Shen Y, Zhang K, et al., 2024. Unleashing the power of multi-task learning: a comprehensive survey spanning traditional, deep, and pretrained foundation model eras. arXiv:2404.18961.
Zhang W, 2023. A fruit ripeness detection method using adapted deep learning-based approach. Int J Adv Comput Sci Appl 14:121. DOI: https://doi.org/10.14569/IJACSA.2023.01409121
Zhang Y, Yang X, Cheng Y, Wu X, Sun X, Hou R, et al., 2024. Fruit freshness detection based on multi-task convolutional neural network. Curr Res Food Sci 8:100733. DOI: https://doi.org/10.1016/j.crfs.2024.100733
CRediT authorship contribution
Rida El Chall, writing – review & editing, conceptualization, methodology, software, supervision. Sarah Alayan, writing – original draft, conceptualization, methodology, software. Abed Ellatif Samhat, writing – review & editing, supervision. All authors read and approved the final version of the manuscript and agreed to be accountable for all aspects of the work.
Data Availability Statement
All the data and materials used are included and referenced in this paper. The source code and implementation details are publicly available at: https://github.com/ml-research-ul/AgriMTL
How to Cite

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
PAGEPress has chosen to apply the Creative Commons Attribution NonCommercial 4.0 International License (CC BY-NC 4.0) to all manuscripts to be published.