Identification of edible wild vegetable species based on deep learning
Edible wild vegetables possess both nutritional and medicinal values. However,the traditional identification of wild edible vegetables mainly relies on subjective human experience,which is inefficient and carries a high risk of error. Therefore,rapid and accurate identification of edible wild vegetables is of great significance for the development of the wild vegetable industry and the assurance of food safety. Eight types of edible wild vegetables known as the "Seven Heads and One Brain"in the Nanjing region were selected as the research subjects and a database of 2400 images were constructed. Training and validation were conducted using 6 different deep learning models,including 3 representative convolutional neural network(CNN)models(AlexNet、VGG16 and ResNet50)and 3 vision transformers(ViT)models (ViT、CaiT and DeiT). Furthermore,the decision-making mechanisms of the deep learning models were analyzed using Gradient-Weighted Class Activation Mapping. The results showed that ResNet50 achieved an accuracy rate of 94.68% on the validation set,with precision,recall value,and F1-score of 97.66%,97.74%,and 97.70%,respectively,and performed the best among the 6 models. Subsequently,the attention mechanism modules,convolutional block attention module and coordinate attention module were added to the optimal ResNet50 model for further optimization. The results showed that the accuracy of CBAM-ResNet50 and CA-ResNet50 models achieved 97.67% and 98.34%,respectively,representing enhancements of 2.99 and 3.66 percent point. The above research results confirmed that the CNN model can achieve better results than ViT on the dataset in this paper. It is feasible to use deep learning to identify edible wild vegetable spe-cies,and adding attention modules can lead to higher recognition accuracy.