journal article·2025-02-08Open access

Automated Gluten Detection in Bread Images Using Convolutional Neural Networks

Aviad Elyashar, Abigail Paradise Vit, Guy Sebbag, Alex Khaytin, Avi Zakai

Applied Sciences· Volume 15· Issue 4

Abstract

Celiac disease and gluten sensitivity affect a significant portion of the population and require adherence to a gluten-free diet. Dining in social settings, such as family events, workplace gatherings, or restaurants, makes it difficult to ensure that certain foods are gluten-free. Despite the availability of portable gluten testing devices, these instruments have high costs, disposable capsules, depend on user preparation and technique, and cannot analyze an entire meal or detect gluten levels below the legal thresholds, potentially leading to inaccurate results. In this study, we propose RGB (Recognition of Gluten in Bread), a novel deep learning-based method for automatically detecting gluten in bread images. RGB is a decision-support tool to help individuals with celiac disease make informed dietary choices. To develop this method, we curated and annotated three unique datasets of bread images collected from Pinterest, Instagram, and a custom dataset containing information about flour types. Fine-tuning pre-trained convolutional neural networks (CNNs) on the Pinterest dataset, our best-performing model, ResNet50V2, achieved 77% accuracy and recall. Transfer learning was subsequently applied to adapt the model to the Instagram dataset, resulting in 78% accuracy and 77% recall. Finally, further fine-tuning the model on a significantly different dataset, the custom bread dataset, significantly improved the performance, achieving an accuracy of 86%, precision of 87%, recall of 86%, and F1-score of 86%. Our analysis further revealed that the model performed better on gluten-free flours, achieving higher accuracy scores for these types. This study demonstrates the feasibility of image-based gluten detection in bread and highlights its potential to provide a cost-effective non-invasive alternative to traditional testing methods by allowing individuals with celiac disease to receive immediate feedback on potential gluten content in their meals through simple food photography.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Celiac Disease Research and Management · Viral gastroenteritis research and epidemiology

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Computer Science, Shamoon College of Engineering, Be’er Sheva 8410501, Israel

Department of Information System, The Max Stern Yezreel Valley College, Emek Yezreel 1930600, Israel

Department of Electrical and Electronics Engineering, Shamoon College of Engineering, Be’er Sheva 8410501, Israel

References (57)

Show source-provided references
1. Celiac disease10.1056/NEJMcp1113994 ↗
2. What is gluten?10.1111/jgh.13703 ↗
3. Prevalence of celiac disease in at-risk and not-at-risk groups in the United States: A large multicenter study10.1001/archinte.163.3.286 ↗
4. Wieser, H., Ciacci, C., Soldaini, C., Gizzi, C., and Santonicola, A. (2024). Gastrointestinal and Hepatobiliary Manifestations Associated with Untreated Celiac Disease in Adults and Children: A Narrative Overview. J. Clin. Med., 13.10.3390/jcm13154579 ↗
5. Celiac disease and the gluten-free diet: Consequences and recommendations for improvement10.1159/000369504 ↗
6. Celiac disease is associated with reduced bone mineral density and increased FRAX scores in the US National Health and Nutrition Examination Survey10.1007/s00198-016-3791-4 ↗
7. Marafini, I., Monteleone, G., and Stolfi, C. (2020). Association between celiac disease and cancer. Int. J. Mol. Sci., 21.10.3390/ijms21114155 ↗
8. Advances in celiac disease and gluten-free diet10.1016/j.jada.2008.01.011 ↗
9. Celiac disease: Understanding the gluten-free diet10.1007/s00394-016-1238-5 ↗
10. Dave Bloom, S. (2021, March 18). Restaurant Fined $105,000 for Anaphylactic Death of Customer. Available online: https://snacksafely.com/2021/03/restaurant-fined-105000-for-anaphylactic-death-of-customer/.
11. Keay, L. (Sky News, 2024). Allergy Sufferers Tell of ’Traumatic’ Experiences Ordering Food After Mistakes Led to Teenagers’ Deaths, Sky News.
12. An integrated, accurate, rapid, and economical handheld consumer gluten detector10.1016/j.foodchem.2018.08.117 ↗
13. Marić, A., and Scherf, K.A. (2021). A portable gluten sensor for celiac disease patients may not always be reliable depending on the food and the user. Front. Nutr., 8.10.3389/fnut.2021.712992 ↗
14. Evaluation of a handheld gluten detection device10.4315/0362-028X.JFP-18-184 ↗
15. Deep leaning in food safety and authenticity detection: An integrative review and future prospects10.1016/j.tifs.2024.104396 ↗
16. Gbashi, S., and Njobeh, P.B. (2024). Enhancing Food Integrity through Artificial Intelligence and Machine Learning: A Comprehensive Review. Appl. Sci., 14.10.3390/app14083421 ↗
17. Deep learning for computer vision: A brief review10.1155/2018/7068349 ↗
18. A survey of transfer learning10.1186/s40537-016-0043-6 ↗
19. Hussain, M., Bird, J.J., and Faria, D.R. (2018, January 5–7). A study on CNN transfer learning for image classification. Proceedings of the Advances in Computational Intelligence Systems: Contributions Presented at the 18th UK Workshop on Computational Intelligence, Nottingham, UK.10.1007/978-3-319-97982-3_16 ↗
20. Comparison of convolutional neural network models for food image classification
21. Yadav, S., and Chand, S. (2021, January 19–20). Automated food image classification using deep learning approach. Proceedings of the 2021 7th International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India.10.1109/ICACCS51430.2021.9441889 ↗
22. Razali, M.N., Moung, E.G., Yahya, F., Hou, C.J., Hanapi, R., Mohamed, R., and Hashem, I.A.T. (2021). Indigenous food recognition model based on various convolutional neural network architectures for gastronomic tourism business analytics. Information, 12.10.3390/info12080322 ↗
23. Moumane, K., El Asri, I., Cheniguer, T., and Elbiki, S. (2023, January 22–23). Food Recognition and Nutrition Estimation using MobileNetV2 CNN architecture and Transfer Learning. Proceedings of the 2023 14th International Conference on Intelligent Systems: Theories and Applications (SITA), Casablanca, Morocco.10.1109/SITA60746.2023.10373725 ↗
24. Patel, J., and Modi, K. (2023). Indian Food Image Classification and Recognition with Transfer Learning Technique Using MobileNetV3 and Data Augmentation. Eng. Proc., 56.10.3390/ASEC2023-15341 ↗
25. Boyd, L., Nnamoko, N., and Lopes, R. (2024). Fine-Grained Food Image Recognition: A Study on Optimising Convolutional Neural Networks for Improved Performance. J. Imaging, 10.10.3390/jimaging10060126 ↗
26. Thiodorus, G., Sari, Y.A., and Yudistira, N. (2021, January 13–14). Convolutional neural network with transfer learning for classification of food types in tray box images. Proceedings of the 6th International Conference on Sustainable Information Engineering and Technology, Malang, Indonesia.10.1145/3479645.3479687 ↗
27. Kareem, R.S.A., Tilford, T., and Stoyanov, S. (2024). Fine-grained food image classification and recipe extraction using a customized deep neural network and NLP. Comput. Biol. Med., 175.10.1016/j.compbiomed.2024.108528 ↗
28. Automated detection of celiac disease on duodenal biopsy slides: A deep learning approach10.4103/jpi.jpi_87_18 ↗
29. Kowsari, K., Sali, R., Khan, M.N., Adorno, W., Ali, S.A., Moore, S.R., Amadi, B.C., Kelly, P., Syed, S., and Brown, D.E. Diagnosis of celiac disease and environmental enteropathy on biopsy images using color balancing on convolutional neural networks. Proceedings of the Future Technologies Conference (FTC) 2019: Volume 1.10.1007/978-3-030-32520-6_55 ↗
30. Carreras, J. (2024). Celiac Disease Deep Learning Image Classification Using Convolutional Neural Networks. J. Imaging, 10.10.3390/jimaging10080200 ↗
31. Keskin Bilgiç, E., Zaim Gökbay, İ., and Kayar, Y. (2024). Innovative Approaches to Clinical Diagnosis: Transfer Learning in Facial Image Classification for Celiac Disease Identification. Appl. Sci., 14.10.21203/rs.3.rs-4381889/v1 ↗
32. Jossa-Bastidas, O., Sanchez, A.O., Bravo-Lamas, L., and Garcia-Zapirain, B. (2023). IoT system for gluten prediction in flour samples using nirs technology, Deep and Machine Learning Techniques. Electronics, 12.10.3390/electronics12081916 ↗
33. Standard photographs convolutionally processed to indirectly detect gluten in chickpea flour10.1016/j.jfca.2022.104547 ↗
34. Is my food safe?–AI-based classification of lentil flour samples with trace levels of gluten or nuts10.1016/j.foodchem.2022.132832 ↗
35. Cappelli, A., Oliva, N., and Cini, E. (2020). A systematic review of gluten-free dough and bread: Dough rheology, bread characteristics, and improvement strategies. Appl. Sci., 10.10.3390/app10186559 ↗
36. Wheat gluten: High molecular weight glutenin subunits—structure, genetics, and relation to dough elasticity10.1111/j.1750-3841.2007.00292.x ↗
37. Mioduszewski, Ł., and Cieplak, M. (2021). Viscoelastic properties of wheat gluten in a molecular dynamics study. PLoS Comput. Biol., 17.10.1371/journal.pcbi.1008840 ↗
38. The structure and properties of gluten: An elastic protein from wheat grain10.1098/rstb.2001.1024 ↗
39. Mini review: On the elasticity of wheat gluten10.1006/jcrs.1998.0227 ↗
40. The microstructure and gas retention of bread dough10.1016/S0733-5210(09)80153-7 ↗
41. Horstmann, S.W., Lynch, K.M., and Arendt, E.K. (2017). Starch characteristics linked to gluten-free products. Foods, 6.10.3390/foods6040029 ↗
42. Gluten-free bread: A case study
43. A survey on image data augmentation for deep learning10.1186/s40537-019-0197-0 ↗
44. Transfer learning using vgg-16 with deep convolutional neural network for classifying images
45. Detecting affect states using VGG16, ResNet50 and SE-ResNet50 networks10.1007/s42979-020-0114-9 ↗
46. Xia, X., Xu, C., and Nan, B. (2017, January 2–4). Inception-v3 for flower classification. Proceedings of the 2017 2nd International Conference on Image, Vision and Computing (ICIVC), Chengdu, China.
47. Szegedy, C., Ioffe, S., Vanhoucke, V., and Alemi, A. (2017, January 4–7). Inception-v4, inception-resnet and the impact of residual connections on learning. Proceedings of the AAAI Conference on Artificial Intelligence, San Francisco, CA, USA.10.1609/aaai.v31i1.11231 ↗
48. Zoph, B., Vasudevan, V., Shlens, J., and Le, Q.V. (2018, January 18–22). Learning transferable architectures for scalable image recognition. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA.10.1109/CVPR.2018.00907 ↗
49. Tan, M., and Le, Q. (2019, January 9–15). Efficientnet: Rethinking model scaling for convolutional neural networks. Proceedings of the International Conference on Machine Learning, Long Beach, CA, USA.
50. He, K., Zhang, X., Ren, S., and Sun, J. (2016, January 27–30). Deep residual learning for image recognition. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA.10.1109/CVPR.2016.90 ↗
51. He, K., Zhang, X., Ren, S., and Sun, J. (2016, January 11–14). Identity mappings in deep residual networks. Proceedings of the Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands. Proceedings, Part IV 14.
52. Tan, M., and Le, Q. (2021, January 18–24). Efficientnetv2: Smaller models and faster training. Proceedings of the International Conference on Machine Learning, Online.
53. Aneja, N., and Aneja, S. (2019, January 25–27). Transfer learning using CNN for handwritten devanagari character recognition. Proceedings of the 2019 1st International Conference on Advances in Information Technology (ICAIT), Chikmagalur, India.10.1109/ICAIT47043.2019.8987286 ↗
54. Classifying malware images with convolutional neural network models
55. Transfer learning with VGG16 and InceptionV3 for traffic sign classification10.1063/5.0216952 ↗
56. A comprehensive investigation of gluten free bread dough rheology, proving and baking performance and bread qualities by response surface design and principal component analysis10.1039/D0FO00115E ↗
57. Linear and non-linear rheological properties of gluten-free dough systems probed by fundamental methods10.1007/s12393-022-09321-3 ↗