# Automated Gluten Detection in Bread Images Using Convolutional Neural Networks
## 6 Conclusions  
In this study, we developed RGB (Recognition of Gluten in Bread), a deep learning-based method designed to support individuals with celiac disease by offering a decision-support tool for automatically detecting gluten in bread images. By fine-tuning the pre-trained ResNet50V2 CNN model on two datasets of gluten-containing and gluten-free bread, the proposed RGB method achieved accuracy scores of 77% and 78% and precision scores of 79% and 80% on the Pinterest and combined Pinterest + Instagram bread datasets, respectively. In addition, we curated and annotated three unique datasets of bread images from Pinterest and Instagram and a custom bread dataset containing information about the type of flour used in bread preparation. These datasets not only supported the training and evaluation of our model but also provided a valuable resource for future research in gluten detection. In addition, we analyzed the performance of the proposed RGBacross different types of flours using the custom bread dataset, offering deeper insights into the model's strengths and limitations when applied to specific flour types. Our analysis revealed that the ResNet50V2 CNN model performed better on gluten-free flours, achieving higher accuracy scores for these types. Furthermore, by testing the model trained on the combined dataset comprising images from Pinterest and Instagram, we assessed its generalization capability and improved its performance using fine-tuning. After fine-tuning, the model achieved an accuracy of 84% and a recall of 73% on the combined Pinterest + Instagram dataset, highlighting its robustness in adapting to new data sources. Additionally, further fine-tuning the model on the custom bread dataset improved performance, achieving an accuracy of 86%, precision of 87%, recall of 86%, and F1-score of 86% (see Table 4). These results indicate that the model successfully adapts to new data distributions and benefits from training on diverse sources. The strong performance on the custom bread dataset, which differs from the social media datasets (Pinterest and Instagram) in terms of image quality and content, suggests that the model effectively generalizes beyond social media images to a wider range of bread samples. This work also introduced a novel analysis of the model's performance on specific flour types, providing insights into variability across different categories. Such targeted analyses could inspire further studies to refine and adapt the model for specific food properties and challenges. The proposed approach has significant practical implications. By integrating this model into accessible tools, such as mobile applications, individuals with celiac disease or gluten sensitivity could receive real-time informed support when making dietary decisions. This could promote greater confidence and safety when dining out or consuming unfamiliar food products. Future research is needed to extend this approach beyond bread to other food types. Expanding the datasets and applying similar methods to a broader range of foods will enhance the model's versatility and reliability for gluten detection. This will contribute to developing comprehensive solutions for dietary support, ultimately improving the quality of life for individuals with gluten-related dietary restrictions. The proposed approach has significant practical implications. Integrating this model into accessible tools, such as mobile applications, could provide individuals with celiac disease or gluten sensitivity with real-time dietary support by allowing them to quickly assess the gluten content of bread through image classification. However, deploying deep learning models on mobile devices presents computational and resource constraints that must be addressed. Future work should focus on optimizing the model for mobile deployment through techniques such as quantization, pruning, or cloud-based inference, which can reduce computational load while maintaining classification accuracy.