Fresh or Stale: Leveraging Deep Learning to Detect Freshness of Fruits and Vegetables
Rehanul Ahmed, Md. Mahidul Haque, Somak Saha, Chamak Saha, Mayurakshmi Dutta, Dewan Ziaul Karim, Moin Mostakim, Annajiat Alim Rasel
Abstract
In the Gross Domestic Product of Bangladesh, the contribution of agriculture is considerable. Fruit and vegetable quality surveillance are essential in the agricultural production system to reduce fruit and vegetable degradation and wastage at the initial production phases and prevent foodborne diseases. To automate food quality assurance, deep learning techniques have been used to improve time potency. Among them, computer vision methodologies have been widely used in recent times.In order to classify fresh and stale fruit and vegetables, the paper aims to build an efficient custom model, "FreshDNN" using convolutional neural network that will be faster in terms of computation and memory efficiency. In the research, the proposed model FreshDNN was trained with 6 pre-trained CNN models such as ResNet152V2, MobileNetV2, EfficientNetV2L, Xception, DenseNet201, and InceptionV3 using a merged dataset of 36800 images of 8 different fruits and vegetables from Kaggle and Mendeley, of which 25760 images are training data. This enabled the proposed model to differentiate between fresh and stale fruit and vegetables. It was found that FreshDNN performed better than all pre-trained CNN models in Validation accuracy (97.8%) on 7360 images (Validation dataset) and Test accuracy (97.64%) on 3680 images (Test dataset). In addition, the custom model surpassed all of the pre-trained models with respect to Precision (98%), Recall (98%), F1 score (98%), and ROC-AUC score (99.98%) respectively. Also, the novel model was significantly more efficient than all pre-trained models in terms of parameters (0.394 million), and memory space (4.6 MB), and was the fastest in terms of computation (65.77 minutes).To generalize the model, 5-fold cross-validation was used and observed both the highest Validation accuracy (97.624%) and Test(97.658%) accuracy with excellent accuracy of Training (99.357%).