Explainable Deep Learning in Berry Classification Through Attention Mechanisms and Grad-CAM
摘要
The pie production industry, which spans from sourcing to distribution, is a rapidly growing global market driven by demand for new flavors and ingredients. Accurate berry classification is essential for ensuring quality and efficiency in pie manufacturing, precision agriculture and automated food processing systems. In this paper, a lightweight multi-branch convolutional neural network (CNN) enhanced with attention mechanisms is used to classify five visually similar berry types viz., Wineberry, White Mulberry, Tayberry, Blueberry and Blackberry. The architecture leverages parallel convolutional branches and attention layers to enrich feature representation and facilitate robust inter-class discrimination. To improve generalization and mitigate overfitting, the model incorporates dropout regularization, data augmentation, and class rebalancing techniques. Experimental results demonstrate a classification accuracy of 90%, with other performance metrics exceeding values over 90%. Comparative analysis with pre-trained CNN models like VGG16, VGG19, InceptionV3 and ResNet101, shows that the proposed model outperforms these baselines in both accuracy and computational efficiency. To improve model transparency and interpretability, Grad-CAM is employed to visualize the regions influencing classification decisions, offering explainable insights into the model’s behavior. Additionally, its lightweight design makes it well-suited for real- time deployment in food quality inspection systems and pie production pipelines.