Font Size: a A A

Research On Quality Detection And Grading Of Coffee Beans Based On Machine Vision And Deep Learning

Posted on:2024-03-21Degree:MasterType:Thesis
Country:ChinaCandidate:C Y ZhangFull Text:PDF
GTID:2531307160459974Subject:Agricultural Biological Environmental and Energy Engineering
Abstract/Summary:PDF Full Text Request
As China’s society and economy continue to develop,coffee,as a foreign beverage,has entered China and has become increasingly popular due to its unique taste and flavor,as well as its ability to provide a stimulating and stress-relieving effect,with potential health benefits.In recent years,China’s coffee industry has been rapidly expanding,with Yunnan serving as one of China’s largest coffee planting bases and playing an important role in coffee trade and exports.However,the specialty coffee beans produced in China lack a competitive advantage in the international market.This is mainly due to the fact that China’s methods for inspecting and grading coffee beans are relatively outdated,relying primarily on manual inspection and color-sorting machines.As a result,the standards for grading coffee quality are subjective and the use of sorting machines can lead to biased results,greatly affecting the accuracy and efficiency of coffee bean quality testing and grading.Therefore,the development of a rapid and accurate technology for quality testing and grading of coffee is of great significance.This study focuses on Yunnan Arabica small-leaf coffee beans,and uses the NY/T604-2020 agricultural industry grading standards for coffee bean quality testing as a guide.Deep learning technology is applied to achieve defect detection in coffee beans,and machine vision technology is used to obtain the grading features of coffee beans through image processing methods,ultimately establishing prediction models for the moisture content and grading of coffee beans.The specific research contents are as follows:(1)The construction of an image acquisition system for coffee beans,as well as image acquisition and preprocessing.Based on the requirements of coffee quality detection and grading,an image acquisition device is constructed to obtain images of coffee beans.To improve the quality of coffee bean images,the collected images are calibrated,denoised,and target segmented,laying the foundation for the establishment of prediction models and grading models for coffee bean moisture content.(2)The study focuses on the detection of defective coffee beans.Firstly,a dataset for detecting defective coffee beans is established and data augmentation is performed on the dataset.Then,the YOLOv5 s algorithm is employed as the deep learning model,and different attention mechanism modules and activation functions are optimized to improve the accuracy of detecting defective coffee beans.After 200 iterations of training,the model accuracy reaches 99.5%,the mean average precision is 97.6%,the recall rate is 0.98,and the recognition rate is 64 frames/s.The model size is 15 M.The improved model is compared and analyzed with current mainstream object detection models such as Faster-RCNN,SSD,YOLOv3,YOLOv4,and YOLOv5 s.The model’s performance is analyzed based on the practical situations of detecting coffee beans,including single bean detection,multiple bean detection,and agglomerate detection.In single bean detection,the accuracy rates for detecting defective coffee beans,coffee beans with shells,moldy coffee beans,and normal coffee beans are 96.7%,100%,96.7%,and 90%,respectively.The average accuracy rate of the model is 97.4%.In multiple bean detection,the average accuracy rates for 8,30,60,90,120,and 300 coffee beans are 91.25%,89%,87.7%,85.6%,80.2%,and 67.6%,respectively.In agglomerate detection analysis,the recognition accuracy rates for mild,moderate,and severe agglomeration are 90.5%,83.3%,and 45.5%,respectively,and the average accuracy rate for the three types of agglomerations is 73.1%.(3)Research on detecting moisture content in coffee beans.Color and shape features were extracted from preprocessed images of normal coffee beans.Correlation analysis was performed on 22 color features and 6 shape features,and the highly correlated features were selected for linear regression analysis.Among them,the G component and perimeter had the best fitting effect on moisture content in simple linear regression analysis,with coefficients of determination of 0.789 and 0.795,respectively.Finally,a multiple linear regression model for predicting moisture content was established using the G component and perimeter,and the model was subjected to linear diagnosis and sample correction to obtain the final moisture content prediction model.(4)A study on the grading of normal coffee beans.In this chapter,PCA was used to reduce the dimensionality of 9 coffee bean characteristic indicators that were highly significant in the moisture content prediction model,and 3 principal components were obtained.These 3 dimensions can explain 96.411% of the original data.The KNN coffee normal bean grading model was established using the reduced dimensionality data and the original data,respectively.When the K value was 16,the original data+KNN model had the highest accuracy,with the accuracy of 70.2% and 70% in the validation and test sets,respectively;The PCA+KNN model with a K-value of 2 has the highest accuracy,with accuracy rates of 93.8% and 92.2% in the validation and test sets,respectively,and has good generalization ability and stability.
Keywords/Search Tags:Coffee beans, quality inspection and grading, deep learning, moisture content, KNN
PDF Full Text Request
Related items