ADD FOOD: Leveraging the Edamam API for Tailored Dietary Solutions for ADD Individuals

Project Diary: Jim Verheijen, MA Data Driven Design Student 1712516

 

Premise:

An adaptive digital solution designed to assist individuals, especially those with ADD, in making healthier dietary choices. The project leverages the capabilities of the Edamam API (Edamam, 2023) to provide recipe recommendations based on available kitchen ingredients.

 

Synopsis:

In a world faced with dietary challenges, individuals with ADD confront unique obstacles, like impulse-driven choices leading to unhealthy diets and potential food waste. Addressing this, our project introduces a tailored digital platform using the Edamam API, offering recipe recommendations based on available ingredients. This isn’t just a meal suggestion tool; it’s designed with ADD individuals’ specific needs in mind. By merging with Edamam’s vast recipe database, the platform promotes healthier eating habits, reduces food wastage, and eases decision-making. The system stands as a beacon of how technology, when aligned with deep empathy and understanding, can transform dietary choices, especially for those grappling with ADD’s complexities.

 

Research & Problem Space:

The research addresses the intersection of technological advancements and socio-cultural implications, highlighting the critical role of ethical considerations in technology use.

The pain points that are identified:

  • Dietary Challenges: ADD individuals often face impulse-driven eating habits.
  • Decision Fatigue: The vast array of online recipes can be overwhelming, making meal planning taxing.
  • Unhealthy Convenience: The difficulty in decision-making might lead to unhealthy, quick food choices.
  • Potential Food Waste: Impulsive buying and decision fatigue can result in unused ingredients.

 

The central research question is: “How can the Edamam API assist individuals with ADD in developing healthier dietary habits?”

 

APIs (Application Programming Interfaces): APIs are tools that allow software applications to communicate and share data (Redhat, 2022). They enable the integration of specific functions or data sources from third parties. For this project, the Edamam API will be utilized.

 

ADD (Attention Deficit Disorder): ADD is a neurological condition characterized by attention difficulties and hyperactivity and one’s acting on impulses (Janssens, 2022). It’s a subtype of ADHD, where the individual experiences inattention without notable hyperactivity.

 

The Double Diamond process, comprising the four phases of Discover, Define, Develop, and Deliver, was chosen to navigate the project’s complexities. Grounded in critical-making principles, this approach guarantees designs remain user-centric and reflective throughout  (Ratto, 2011).

 

Discover:

In the “Discover” phase, understanding ADD individuals’ dietary challenges was paramount. They often struggle with impulse control, affecting their eating habits (Margues, 2020; Pinto, 2022). With rising ADD diagnoses (Kazda, 2023) and economic repercussions (Bisset, 2023), AI and data-driven tools stood out as a solution to minimize food waste. Such tools can forecast dietary needs and suggest personalized meals, supporting ADD diets (Rahman, 2023). Despite increased screen time (Rodgers, 23), many recognize the value of digital aids (Kenter, 2022).

 

Define:

Edamam API Exploration & Integration:

Initially, supermarket data scraping was planned for real-time ingredient updates, but the Edamam API largely filled that role. However, the API sometimes provided outdated or missing recipe links, leading to user disruptions.

  • Dove into the Edamam API documentation, aiming to effectively utilize its capabilities and synchronize them with the project’s requirements.
  • Prioritized fast data fetches to ensure timely responses, vital for ADD users. Such optimization was necessary to cater to their quick interaction needs.
  • Merged the API to harness the extensive recipe database
  • Navigated hurdles such as API rate limits.

 

Script Functionality:

  • Modules: Uses the requests module to interact with the Edamam APIs.
  • Recipe API: The code fetches recipes, printing ingredients and related details. This is achieved by interfacing with Edamam’s recipes API.
  • Food Database API: A separate segment fetches data about various foods using the food-database API, revealing food IDs, labels, and categories.
  • Error Handling: If expected data is not received from either API, appropriate error messages are displayed.

 

Lo-Fi Prototype Creation:

A paper-based design was made to display recipes.

  • Swiping Interface: Transitioned from a catalog design to a Tinder-like swipe mechanism for intuitive UX.
  • Design: Created a minimalistic, distraction-free design tailored for ADD users, ensuring focused interaction.
  • User-Centric: The swipe design supports swift decisions, meeting the quick interaction preferences of ADD individuals.

Gathering feedback from 2 developers and 2 individuals with ADD provided pivotal insights:

  • API Constraints: Developers emphasized potential slowdowns with extensive ingredient inputs, steering away from a comprehensive recommendation engine.
  • Database Necessity: Storing user preferences necessitated a separate database, increasing the complexity.
  • User Experience: ADD individuals in an early test favored more intuitive ingredient selection rather than text input into a development environment, resulting in the use of images and potential use of technologies such as image recognitio for input.
  • Recipe Accuracy: Some pointed out mismatches between available ingredients and suggested recipes.

 

Reflection:

In reflection, striking a balance between technical constraints and user needs became evident. I saw areas for improvement in the ingredient input system. While features like bill image recognition or barcode scanning are promising, they currently exceed the project’s scope.

 

Develop:

Initially, users were directly asked, “Do you want to visit the supermarket?” Based on feedback, this question was refined for clarity. Now, users decide if they prefer to cook with available ingredients or are open to new dishes.

The script provides recipe suggestions based on user ingredients:

  1. Modules: Imports recipe_api and food_api for fetching recipe and food data.
  2. Scoring: The function score_recipes_based_on_ingredients ranks recipes by how many of the recipe’s ingredients the user possesses. It also notes what’s missing.
  3. Ingredient Checking: check_availability verifies if user ingredients are in the known food database.
  4. User Input: Users specify if they want recipes based on their ingredients (yes) or random suggestions (no).
  5. Recommendations:
    • For yes: Users input their ingredients. Recipes are then ranked by ingredient matches and displayed.
    • For no: Random recipes are showcased

Terminal

Hi-Fi Prototype Creation:

A hi-fi Figma prototype was created, spanning four screens, showcasing the process from ingredient entry to recipe recommendation.

Second feedback round with four ADD individuals, two of whom reviewed the lo-fi version, insights:

  • “I buy what I see”: Highlighting the ADD challenge with real-world impulses, leading to a more images, which can be profided by the Edamam API.
  • “I need a timer when to cook”: Underscoring the need for cooking reminders and cues to update the app with ingredients potentially keeping track of inventory.
  • “Can it also show what I still need?”: Prompting a redesign in ingredient presentation, emphasizing missing items, while showing what is already there.

 

Reflection:

Engaging with individuals with ADD offered invaluable feedback on the prototype and its features:

  • Highlighting missing recipe ingredients for shopping ease.
  • Timely notifications for cooking and ingredient inventory reminders.
  • Addressing their spontaneous shopping habits, emphasizing a user-friendly interface and potential features like on-the-spot recipe suggestions using image recognition for receipts or barcodes.

 

Deliver:

Revisions were made from user feedback on the hi-fi Figma prototype, leading to new features for improved user experience and alignment with project objectives.

  • Timed Notification: Implemented a timer for meal reminders and inventory updates, crucial for ADD individuals.
  • Smart Shopping: Introduced a structured list to guide purchases, considering ADD impulsivity, with potential future enhancements using image recognition for bills or barcodes.

 

 

Critical making & thinking:

This project, at its core, was an exercise in critical making—a method that marries hands-on production and critical reflection to produce socially beneficial technologies.

Reflective breakdown of the project:

    1. Stakeholder Engagement: Prioritized feedback from ADD individuals, turning the product from a generic tool into a tailored solution.
    2. Iterative Approach: Stayed adaptive, knowing the initial version required refinements.
    3. Focus on Core Features: Chose clarity and simplicity over multiple features, aligning with the ADD perspective.
    4. Understanding Real-world Issues: Addressed real challenges faced by ADD individuals, like impulsiveness, rather than just offering recipes.
    5. Future Image Recognition: Considered receipt scanning for immediate ingredient updates and recipe suggestions, streamlining the user experience.
    6. Wide Appeal: The app’s design can benefit those aiming for efficient meal planning or reducing food waste.
    7. Smart Appliance Syncing: Future versions may connect with smart fridges for real-time ingredient tracking.

 

Limitations:

  • API Rate Limits: The Edamam API’s rate limits could cause occasional delays during peak times, impacting the user experience.
  • Database Dependency: Relying on Edamam means limited control over data accuracy. Outdated or missing recipes could disrupt user trust.
  • Third-party Constraints: Dependency on the Edamam API reduces our system’s adaptability and binds it to a single data source.
  • Recommendation Staticity: Our system uses static data, whereas advanced recommendation engines adapt to user preferences over time.

 

Suggestions for Improvement:

  • Integrate multiple APIs to diversify recipes and reduce single-source dependency.
  • Develop a system blending static API data with a dynamic recommendation engine, tailoring suggestions based on user behavior.

 

Conclusion

In conclusion, the Intelligent Recipe Recommendation System underscored the transformative potential of API technology, specifically the Edamam API. This wasn’t just a venture into creating a platform, but an exploration of how the right technological choice can address the nuanced challenges of ADD individuals. The Edamam API exemplified how real-time, dynamic data integration can enhance user experience and efficiency. In essence, the project serves as a testament to the impactful solutions that emerge when technology is combined with deep empathy and user-centric design.

 

Bibliografie

Bisset, M. (2023, January 18). Practitioner Review: It’s time to bridge the gap – understanding the unmet needs of consumers with attention-deficit/hyperactivity disorder – a systematic review and recommendations. Retrieved from: The Association for child and adolescent mental health: https://acamh.onlinelibrary.wiley.com/doi/full/10.1111/jcpp.13752

Edamam. (2023). Edamam. Retrieved from: Edamam Home: https://www.edamam.com/

Janssens, A. (2022, June 20). Wiley Online Library. Retrieved from: Parenting roles for young people with attention-deficit/hyperactivity disorder transitioning to adult services: https://onlinelibrary.wiley.com/doi/full/10.1111/dmcn.15320

Kazda, L. (2023). Attention Deficit Hyperactivity Disorder (ADHD) Diagnosis In Children And Adolescents: Trends And Outcomes. Retrieved from: The University of Sidney: https://ses.library.usyd.edu.au/handle/2123/31065

Kenter, R. M. (2022, October 21). Internet-Delivered Self-help for Adults With ADHD (MyADHD): Usability Study. Retrieved from: JMIR Publications: https://formative.jmir.org/2022/10/e37137/

Margues, I. (2020, May 12). Effect of Impulsivity Traits on Food Choice within a Nudging Intervention. Retrieved from: National Library of Medicine: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7285079/

Pinto, S. (2022, October 16). Eating Patterns and Dietary Interventions in ADHD: A Narrative Review. Retrieved from: National Library of Medicine: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9608000/

Rahman, M. M. (2023, April 11). AI for ADHD: Opportunities and Challenges. Retrieved from: Sage Journals: https://journals.sagepub.com/doi/full/10.1177/10870547231167608

Ratto, M. (2011, July 15). Critical Making: Conceptual and Material Studies in Technology and Social Life. Retrieved from: Taylor & Francis Online: https://www.tandfonline.com/doi/abs/10.1080/01972243.2011.583819

Redhat. (2022, June 2). What is an API? Retrieved from: Redhat: https://www.redhat.com/en/topics/api/what-are-application-programming-interfaces

Rodgers, A. L. (2023, April 28). ADHD Brains on Screens: Decoding a Complicated Relationship. Retrieved from: additudemag: https://www.additudemag.com/screen-time-video-game-technology-dependence-adhd/

 

Read more "ADD FOOD: Leveraging the Edamam API for Tailored Dietary Solutions for ADD Individuals"

Creating a responsive chatbot against loneliness among students.

Premise

 

Creating a responsive chatbot against loneliness among students.

 

Synopsis

 

The lockdown has continued to isolate students from their old social life. The mental health state of many is dwindling significantly compared to pre-corona times. When we are unable to meet people, what do we do?
With that as a leading question, a chatbot was created to fight loneliness among younger people. What started out as a narrow chatbot with clickable elements turned into a responsive chatbot, able to interpret user utterances. Future recommendations include the use of sentiment analysis based on Azure and more training based on the user utterances.
Chatbots without enough learning data are rather narrow. Therefore, it is essential to keep training the chatbot with the utterances that users generate. Additionally, if the chatbot is able to interpret the sentiment of the user, it could respond accordingly. Thus, increasing the responsiveness of the chatbot drastically.

 

The Problem

 

In the current pandemic the worries about the mental wellbeing of young adults is an almost daily topic. However, nothing seems to be done about their isolated state. Social anxiety is part of the problem for people during the pandemic (Panchal et al, 2021).
Especially among the student demographic, the consequences of a lack of social life is felt (Krendl, 2021; Lippke, Fischer & Ratz, 2021; Padmanabhanunni, 2021). As a student myself I am feeling the consequences as well. With no social outlet other than my housemates, my social life has come to a stop.

 

The Approach

 

The initial idea for the prototype was a chatbot created with IBM Watson. The user would be able to have natural conversations with the chatbot in order to feel less lonely. The chatbot would be less chatbot and more of a listening ear for socially isolated individuals.
The first conversation flow was meant to divide the conversation in three distinct emotional states, bad, neutral and positive. The chatbot would then be able to discuss the reason for the emotional state with the individual. However, it quickly became apparent that IBM Watson did not fit the goal of the chatbot.

 

It was then decided to create the chatbot through the Bot Framework Composer. The composer offers more options and has pre-trained models, which is convenient for the chatbot. Additionally, the Composer allows for an open conversation design.
Later in the process, both Azure Cognitive Services and Tensorflow were researched to implement sentiment analysis in the chatbot. Thus, improving the ability of the chatbot to interpret user utterances. 

 

1st Iteration User Testing

 

General feedback was that the chatbot did not feel like a “chatbot against loneliness”, but rather as a social hub. Additionally, the testers noted the static feeling of the conversation, since the options are clickable and not typable. The primary goal of the second iteration is to create a less restrictive chatbot. A chatbot that can understand the user and where the user is able to actually type messages instead of static clicking.

 

The Design Process Second Iteration

The second iteration uses the Bot Framework Composer, which is a visual development environment developed by Microsoft. It allows the developer to create intricate bots with various goals. It is important to note down exactly what we want to accomplish and what the bot should be able to do. Some rough guidelines for the design process:

 

  • What utterances are common in human conversations?
  • How do we fight loneliness? Should we create a bot that feels like it is listening to the person? Or should the bot talk in a more proactive manner, maybe even give suggestions to the person to battle their own loneliness.

 

Two main concepts that should be identified straight away are Intent and Utterance. Intent is identified as the intention that a user has when saying/typing something. The utterance is the entity of text/speech that the user writes/says. The bot extracts the intent from the utterance by analysing the text and searching for certain trigger words. The intent(s) drive the conversation forward, as it provides the bot with the knowledge of what the user is attempting to achieve. 

The primary goal for the second iteration in Composer was to ask the user for their name and let the bot greet them with their name. It was quite difficult to make it work as some limitations are in place. 


When the bot asked “What is your name?”, the expected utterance that acted as training data were along the lines of “My name is X” Or “I am X”. The Composer works with LUIS, a language understanding module. The convenient thing about LUIS is that it is trained on a larger scale and can thus easily work with a smaller amount of expected utterances. However, it was difficult to extract the name of the user, as a response along the lines of “My name is X” would see the Bot thinking that the name of the user was My Name Is X, instead of just X. Documentation on the possibilities of the Composer are rather constrictive and after much trying, the bot is now able to extract the name from an utterance.

Another hiccup was with the age. Similar problems arose as with the age, however the solution that worked with the extraction of the name, did not work with the extraction of the age of the user. 

[aesop_image img=”https://cmdstudio.nl/mddd/wp-content/uploads/sites/58/2021/06/ChatBotGif.gif” panorama=”off” align=”center” lightbox=”on” captionsrc=”custom” captionposition=”left” revealfx=”off” overlay_revealfx=”off”]

2nd Iteration User Testing

 

The user testing with the second iteration was more positive than the first iteration. The users enjoyed the way in which they communicated with the chatbot. It also felt familiar to normally chat with the chatbot, in contrast with the clickable elements from the first iteration.
Increased adaptiveness and responsiveness of the chatbot was a feedback point of both user testings. As such, the final iteration is an attempt on the integration of sentiment analysis into the chatbot. 

[aesop_image img=”https://cmdstudio.nl/mddd/wp-content/uploads/sites/58/2021/06/JoesTest.jpeg” panorama=”off” align=”center” lightbox=”on” captionsrc=”custom” captionposition=”left” revealfx=”off” overlay_revealfx=”off”]

 

Final Iteration

The final iteration of the prototype was aimed at improving the responsiveness of the chatbot. For this reason, research was done into both Tensorflow and Azure Cognitive Services. Both cloud services provide excellent sentiment analysis.
However, Azure Cognitive Services proves to be the most beneficial for the prototype. The reason for this is that Tensorflow can only interpret the sentiment of a given paragraph. Additionally, the Tensorflow model needs training data from the creator of the model. As the research was not as broad scale, it would be more efficient to have access to a model with pre-trained models.
Azure Cognitive Service allows for better extraction of sentiment analysis through an API call. The API call is rather sophisticated as it also provides opinion mining. Which means that the model is able to see what the subject is of an opinion. E.g. from an utterance such as, “The pizza was great.” Azure is able to extract that the user’s opinion was regarding the “pizza” and that the opinion was “great”, which would return a positive sentiment. 

[aesop_image img=”https://cmdstudio.nl/mddd/wp-content/uploads/sites/58/2021/06/SentimentGif.gif” panorama=”off” align=”center” lightbox=”on” captionsrc=”custom” captionposition=”left” revealfx=”off” overlay_revealfx=”off”]

Reflection

 

The project was fun to create. IBM Watson was easy to use and understand. However, it was rather restrictive in its free version capabilities. Luckily, the Bot Framework Composer offered many more possibilities. 
Additionally, it was difficult to find solutions to certain problems. Websites such as Stackoverflow are normally of high value for developers. A similar website for Composer does not exist. Which was frustrating, as the solution for the extraction of the user’s age was not found sadly. 

Another problem was the connection between the Azure Cognitive Services sentiment analysis API and the Composer. The API call needs a Python environment to properly send the request and receive the response. However, the Composer does not provide the adaptability for such a call, as only simple API calls are possible through the Composer. Rasa would be an interesting point of research as well. However, Rasa does need a lot of training data in comparison with Azure.

Lastly, more research has to be done on the extraction of sentiment from the chat logs. The Azure API call splits paragraphs up at the “.” mark. However, the question has to be asked, what part of the paragraph is most important for the bot to respond to? Is a positive sentiment more important than a negative sentiment?

 

Recommendation/Conclusion

 

Future recommendations for improved iterations are to integrate sentiment analysis from Azure if possible. The chatbot will be more adaptive and is able to both ask and interpret open ended questions. While the chatbot is able to acknowledge the user after asking for their name, it is not able to ask how the day of the user was. When fighting loneliness, it is important to create a chatbot that is able to ask “how was your day?”. Additionally, through sentiment analysis and perhaps even opinion mining, the chatbot is able to adapt to a user’s mood and ask questions accordingly. 

Furthermore, the chat logs of future iterations should be used to extract utterances of users that are not yet recognized by the model. E.g. if people often ask “how was your day?” to the chatbot, the designer should provide such an intent for the conversation flow. Thus, improving the adaptiveness of the chatbot. 

 

References

 

Hudson, J., Ungar, R., Albright, L., Tkatch, R., Schaeffer, J., & Wicker, E. R. (2020). Robotic Pet Use Among Community-Dwelling Older Adults. The Journals of Gerontology: Series B, 75(9), 2018-2028.

Krendl, A. C. (2021). Changes in stress predict worse mental health outcomes for college students than does loneliness; evidence from the COVID-19 pandemic. Journal of American College Health, 1-4.

Lippke, S., Fischer, M. A., & Ratz, T. (2021). Physical activity, loneliness, and meaning of friendship in young individuals–a mixed-methods investigation prior to and during the COVID-19 pandemic with three cross-sectional studies. Frontiers in Psychology12, 146

Padmanabhanunni, A., & Pretorius, T. B. (2021). The unbearable loneliness of COVID-19: COVID-19-related correlates of loneliness in South Africa in young adults. Psychiatry research296, 113658.

 

Panchal, N., Kamal, R., Orgera, K., Cox, C., Garfield, R., Hamel, L., & Chidambaram, P. (2020). The implications of COVID-19 for mental health and substance use. Kaiser family foundation.

Vasileiou, K., Barnett, J., Barreto, M., Vines, J., Atkinson, M., Long, K., … & Wilson, M. (2019). Coping with loneliness at University: A qualitative interview study with students in the UK. Mental Health & Prevention13, 21-30.

 

 

Read more "Creating a responsive chatbot against loneliness among students."

A deep dive into food recognition technology

Premise

Exploring techniques that can ease calorie tracking and optimize the quality of nutritional data.

Synopsis

During other courses I already did some research into dietary applications and their pros and cons. The three most common ways to collect data are manual input, data collection by sensors and data collection by cameras. Manual input is a threshold for users to maintain their data collection, automated technologies such as smartwatches and barcode scanning can help users with this task. During this research I want to discover which technologies are already used and which technologies have the potential to take dietary data collection to a next level.

Background

Obesity numbers have tripled since 1975. 1,9 billion adults and 340 million children and adolescents were overweight in 2016 (World Health Organization, 2020). Obesity is a serious problem; it is associated with mental health problems and reduced quality of life. This includes diabetes, heart disease, stroke and several types of cancer (Adult Obesity, 2020). Behavior usually plays an important role in obesity (Jebb, 2004). Treatment for obesity is therefore often focused on food intake and physical activity. Maintaining a behavioral change is often difficult. The adherence of a diet to maintain weight loss is crucial. New technologies that can help users adhere a diet can make a real change (Thomas et al., 2014). There are applications that help users with calorie tracking but users have to give input themselves which is a threshold to maintain calorie tracking. Therefore, I want to discover technologies that can help with calorie tracking.

 

Experiments

 

Arduino

 This course started with a few Arduino workshops which enthused me to try to work with Arduino. At first, I did some research into Arduino compatible sensors. I inspired my research on the HEALBE GoBe3 device which I already did research on during another course. This device uses a bioelectrical impedance sensor to measure calorie intake. It turns out that bioelectrical impedance sensors are quite expensive and that I had to think of another way to measure calorie intake with Arduino. I found this project based on a game of Sures Kumar in which they can measure foods by their unique resistance value. I managed to make it work and measure the resistance which I could link to different fruits. However, the results were not very promising. The resistance values of the fruits would differ from time-to-time due to temperature differences and ripeness. Secondly, there was an overlap of values by different fruits which means that the system could not detect the right fruit. This means that this method is not suitable for precise food detection. Therefore I, switched to a method I already did some experimenting with.

 

 

 

 

 

[aesop_video src=”self” hosted=”https://cmdstudio.nl/mddd/wp-content/uploads/sites/58/2021/06/Schermopname-2021-06-13-om-12.20.45.mp4″ width=”content” align=”center” disable_for_mobile=”on” loop=”on” controls=”on” mute=”off” autoplay=”off” viewstart=”off” viewend=”off” show_subtitles=”off” revealfx=”off” overlay_revealfx=”off”]

 

IBM Watson

 I already did some experimenting with IBM Watson in the past. Therefore, I knew that image recognition is a technology that can recognize foods. During my experiment with IBM Watson, I managed to use the IBM food model. This model could detect images of fruit very well with a confidence score of 90 percent. The disadvantage of using a pre-made model is that you do not have the possibility to change or complement the model with your own data. Therefore, I tried to make my own model that could detect different apple types.The model was trained with 20 apples of each type and 20 negative images of fruits that were not an apple. After the training, the model showed different confidence scores per type of apple. I checked the training images with the lowest confidence scores and noticed why they did not achieve the same score as the rest. The images that scored the lowest were not present at the same amount as the images that scored a high score. This made me realize that it is important to be very cautious choosing which image is suitable for the training data. Another thing I realized was the limitation of a system such as IBM Watson. Training customization and free implementation options were limited. The challenge is to dive into image recognition technologies that could be implemented into python.

OpenCV

The first technology that caught my attention was OpenCV. They provide computer vision libraries and tools to execute real time computer vision. I completed a tutorial in which the computer could recognize a stop sign in a picture. This method used a single image and a pre-trained Haar classifier. During my search for a tutorial to make a custom Haar classifier I found a tutorial that could make realtime object detections. This would mean that users only have to open their camera and immediately see the object detection. This caught my attention and challenged me to follow a new tutorial which would teach me to create a real time object detection model. This was pretty easy; the model used the coco dataset. This dataset is known as one of the best image datasets available. It has around 200.000 labeled images and 80 different categories. I was surprised how easy it was to install this model and detect objects in real time. It could detect 80 different objects including persons, cellphones, bananas and apples. Although this dataset worked really well it was not suitable for my goal. It could not detect any fruits other than bananas and apples. A solution for this problem was the creation of my own coco dataset that would be focused on fruits. Unfortunately, due to my limited programming knowledge and regular errors I could not manage to make this work. Therefore, I tried to find a tool that could help me to make my own custom dataset.

[aesop_video src=”self” hosted=”https://cmdstudio.nl/mddd/wp-content/uploads/sites/58/2021/06/Schermopname-2021-06-13-om-12.23.56.mp4″ align=”center” disable_for_mobile=”on” loop=”on” controls=”on” mute=”off” autoplay=”off” viewstart=”off” viewend=”off” show_subtitles=”off” revealfx=”off” overlay_revealfx=”off”]

 

 

Roboflow and Yolov5

First iteration

After some research I found a tutorial that showed me how to make a custom object detection model for multiple objects. This tutorial showed me how to use the YOLOv5 (You Only Look Once) environment to train the model and Roboflow to annotate the training images. Roboflow is a program that makes it possible to annotate every image and export the annotations into the filetype that you need. In this case I exported my file to a YOLOv5 PyTorch file. The annotation process was a lot of work because I had to draw bounding boxes on every picture. At first, I used a dataset from Kaggle. This was a dataset of 90.000 images consisting of 130 different fruits or vegetables. I selected 600 images for 6 different fruits. The images were already cut out but had to be annotated still. The results after training these images were not very good. It could not recognize the images very well. The images below show that the model created wrong bounding boxes and predictions.

 

[aesop_image img=”https://cmdstudio.nl/mddd/wp-content/uploads/sites/58/2021/06/wrong-results.jpeg” panorama=”on” align=”center” lightbox=”on” captionsrc=”custom” captionposition=”left” revealfx=”off” overlay_revealfx=”off”]

Second iteration

Therefore, I created a new dataset that I collected myself. This time I used a mix between images of fruit with a blank background and images of fruits with a mixed background. This time the results of the training were much better. I used YOLOv5 because this model is easier to implement than YOLOv4 and the results are similar (Nelson, 2021). The image below shows the score of different elements. The most elements show a flattening curve at the top which shows there were enough training iterations.  The mAP@0,5 (mean average precision) scored above the 0,5 which is commonly seen as a success (Yohanandan, 2020). Although the training of my model was a success, I still could not manage to connect the model to a camera. This is a disappointment and a challenge in future projects.

 

 

[aesop_image img=”https://cmdstudio.nl/mddd/wp-content/uploads/sites/58/2021/06/Good-graph.png” panorama=”on” imgwidth=”content” align=”center” lightbox=”on” captionsrc=”custom” captionposition=”left” revealfx=”off” overlay_revealfx=”off”]

The images above show a wrong and a good prediction. Although the prediction of the lemon is wrong, it is interesting to see that it is recognized for a banana. This is understandable because there are training images of bananas that look similar.

Future Research

Image recognition is a technology that has an enormous potential for food recognition. There are a lot of datasets and models available that are perfectly capable of recognizing fruits. Which would be a very useful addition to dietary applications when linked to a database with the caloric values. The next step would be a model that could recognize sizes or portions of food. This step would improve the quality of dietary intake data.

Conclusion

 My search for technologies that could support dietary apps was successful. I enjoyed working with Arduino and came across many amazing projects. However, I learned more during my dive into the different image recognition techniques. I discovered how many different models there are and how they work. My lack of programming knowledge was sometimes frustrating because I could not finish some projects I started with. Nevertheless, the search for solutions or different methods gave me new insights that I otherwise would not have acquired. It would be nice if I could implement some of the techniques, I learned during my graduation project.

 

References

Adult Obesity. (2020, 17 september). Centers for Disease Control and Prevention. https://www.cdc.gov/obesity/adult/causes.html#:%7E:text=Obesity%20is%20 serious%20because%20it,and%20some%20types%20of%20cancer.

Jebb, S. (2004). Obesity: causes and consequences. Women’s Health Medicine, 1(1), 38–41. https://doi.org/10.1383/wohm.1.1.38.55418

Nelson, J. (2021, 4 maart). Responding to the Controversy about YOLOv5. Roboflow Blog. https://blog.roboflow.com/yolov4-versus-yolov5/

Thomas, D. M., Martin, C. K., Redman, L. M., Heymsfield, S. B., Lettieri, S., Levine, J. A., Bouchard, C., & Schoeller, D. A. (2014). Effect of dietary adherence on the body weight plateau: a mathematical model incorporating intermittent compliance with energy intake prescription. The American Journal of Clinical Nutrition, 100(3), 787–795. https://doi.org/10.3945/ajcn.113.079822

World Health Organization. (2020a, 1 april). Obesity and overweight. https://www.who.int/news-room/fact-sheets/detail/obesity-and-overweight

Yohanandan, S. (2020, 24 juni). mAP (mean Average Precision) might confuse you! – Towards Data Science. Medium. https://towardsdatascience.com/map-mean-average-precision-might-confuse-you-5956f1bfa9e2

 

 

 

 

Read more "A deep dive into food recognition technology"