Efficient and explainable attention-based multitask learning for fruit type, ripeness, and disease classification
Abstract
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.