Xingran Hu , Jun He , Xinyu Guo , Sunyan Hong , Jing Yu
{"title":"少量咖啡豆缺陷检测的暹罗网络","authors":"Xingran Hu , Jun He , Xinyu Guo , Sunyan Hong , Jing Yu","doi":"10.1016/j.lwt.2025.118631","DOIUrl":null,"url":null,"abstract":"<div><div>Defective coffee beans compromise flavor profiles and product quality, necessitating the real-time identification of defects throughout the supply chain. While convolutional neural networks have advanced agricultural image recognition, they remain limited in few-shot classification of fine-grained defects due to dependence on large annotated datasets. This study presents a Siamese neural network approach for few-shot coffee bean defect detection through similarity-based learning. The architecture employs dual ResNet18-based branches (adapted for single-channel 224 × 224 input, outputting 512-dimensional features) with shared weights, utilizing Euclidean distance for feature matching. A dataset of 3220 images encompassing sound beans and six defect categories was constructed from samples in Yunnan Province. The model achieved 94.95 % accuracy, substantially outperforming traditional CNN (74.35 %) and support vector machine (64.28 %) approaches. The processing speed of 34 ms per image enables real-time industrial deployment. This approach demonstrates robust generalization under limited sample conditions, offering practical value for resource-constrained production environments in coffee supply chains while reducing reliance on extensive labelled datasets.</div></div>","PeriodicalId":382,"journal":{"name":"LWT - Food Science and Technology","volume":"235 ","pages":"Article 118631"},"PeriodicalIF":6.6000,"publicationDate":"2025-10-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Siamese networks for few-shot coffee bean defect detection\",\"authors\":\"Xingran Hu , Jun He , Xinyu Guo , Sunyan Hong , Jing Yu\",\"doi\":\"10.1016/j.lwt.2025.118631\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><div>Defective coffee beans compromise flavor profiles and product quality, necessitating the real-time identification of defects throughout the supply chain. While convolutional neural networks have advanced agricultural image recognition, they remain limited in few-shot classification of fine-grained defects due to dependence on large annotated datasets. This study presents a Siamese neural network approach for few-shot coffee bean defect detection through similarity-based learning. The architecture employs dual ResNet18-based branches (adapted for single-channel 224 × 224 input, outputting 512-dimensional features) with shared weights, utilizing Euclidean distance for feature matching. A dataset of 3220 images encompassing sound beans and six defect categories was constructed from samples in Yunnan Province. The model achieved 94.95 % accuracy, substantially outperforming traditional CNN (74.35 %) and support vector machine (64.28 %) approaches. The processing speed of 34 ms per image enables real-time industrial deployment. This approach demonstrates robust generalization under limited sample conditions, offering practical value for resource-constrained production environments in coffee supply chains while reducing reliance on extensive labelled datasets.</div></div>\",\"PeriodicalId\":382,\"journal\":{\"name\":\"LWT - Food Science and Technology\",\"volume\":\"235 \",\"pages\":\"Article 118631\"},\"PeriodicalIF\":6.6000,\"publicationDate\":\"2025-10-17\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"LWT - Food Science and Technology\",\"FirstCategoryId\":\"97\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S0023643825013167\",\"RegionNum\":1,\"RegionCategory\":\"农林科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q1\",\"JCRName\":\"FOOD SCIENCE & TECHNOLOGY\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"LWT - Food Science and Technology","FirstCategoryId":"97","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0023643825013167","RegionNum":1,"RegionCategory":"农林科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"FOOD SCIENCE & TECHNOLOGY","Score":null,"Total":0}
Siamese networks for few-shot coffee bean defect detection
Defective coffee beans compromise flavor profiles and product quality, necessitating the real-time identification of defects throughout the supply chain. While convolutional neural networks have advanced agricultural image recognition, they remain limited in few-shot classification of fine-grained defects due to dependence on large annotated datasets. This study presents a Siamese neural network approach for few-shot coffee bean defect detection through similarity-based learning. The architecture employs dual ResNet18-based branches (adapted for single-channel 224 × 224 input, outputting 512-dimensional features) with shared weights, utilizing Euclidean distance for feature matching. A dataset of 3220 images encompassing sound beans and six defect categories was constructed from samples in Yunnan Province. The model achieved 94.95 % accuracy, substantially outperforming traditional CNN (74.35 %) and support vector machine (64.28 %) approaches. The processing speed of 34 ms per image enables real-time industrial deployment. This approach demonstrates robust generalization under limited sample conditions, offering practical value for resource-constrained production environments in coffee supply chains while reducing reliance on extensive labelled datasets.
期刊介绍:
LWT - Food Science and Technology is an international journal that publishes innovative papers in the fields of food chemistry, biochemistry, microbiology, technology and nutrition. The work described should be innovative either in the approach or in the methods used. The significance of the results either for the science community or for the food industry must also be specified. Contributions written in English are welcomed in the form of review articles, short reviews, research papers, and research notes. Papers featuring animal trials and cell cultures are outside the scope of the journal and will not be considered for publication.