Group - 29 - Final Report

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 76

Synopsis

1.1 Project Title


Food Image Classification and Calorie Prediction for Dietary Analysis

1.2 Project Option

BE Final Year Project

1.3 Internal Guide


Guide. Mrs. Dhanashree Phalke and Co- Guide Mrs. Vishakha Metre.

1.4 Sponsorship and External Guide

Not Sponsored

1.5 Technical Keywords (As per ACM Keywords)


1. Convolutional Neural Networks

2. Image Processing

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

1
3. Google inception v3 model

4. VGG16, VGG19, ResNet

5. Transfer Learning

6. Region of Interest (ROI)

7. Scale Invariant Feature Transform algorithm

8. Image Segmentation

9. Color Histogram Method

10. Diet Recommendation

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

2
1.6 Problem Statement

In today's hectic world, poor dietary habits contribute to health issues like obesity and
heart disease. Conventional techniques for evaluating diets are frequently laborious and
imprecise. We suggest creating an artificial intelligence (AI) system that would provide
people access to real-time dietary habit feedback, enabling them to make decisions that
would improve their health.

1.7 Abstract

Consider being able to take a picture of your food and get comprehensive information on
its nutritional makeup right away. We hope to enable people to make educated dietary
decisions, resulting in better lifestyles and a lower risk of obesity-related diseases, by
utilising the power of food classification.Our algorithm classifies the food items by
examining their features, giving you a comprehensive knowledge of what you're
consuming and how it affects your health.As the necessity of the food arose among
people, People's concern about their diets increased along with their demand for food as
the requirement for food expanded among people. This system also shows weekly
information on the user's caloric intake and the amount of calories needed to prevent
obesity-related illnesses including cancer, heart attacks, and other ailments. In order to
identify complex pictures, We created a collection of food photographs from pre-existing

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

3
datasets in order to recognise complicated imagery.

1.8 Goals and Objectives


The main goals and objective of the system are as follows:

1. To develop a machine learning model that can accurately classify a wide variety of
foods in real time.

2. To integrate the food classification system and the decision support system into a
user-friendly interface.

3. To evaluate the system on real-world dataset to assess its accuracy and reliability.

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

4
1.9 Relevant mathematics associated with the Project.
Let ‘S’ be the system where,
S = {I, O, P, Fs, Ss} (1
where,
• I = Set of input

• O = Set of output

• P = Set of technical processes

• Fs = Set of Failure State

• Ss = Set of Success State

1. input data:
I : A set of food images.
P : User-specific dietary profiles and preferences
M : Pre-trained CNN model
D : Database of labelled food items.

2. output Data:
C : Accurate food classification results,

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

5
R : Personalized dietary recommendations.

3. The Process P:
P = (V (I, P, M, D), C(I, P, M, D) = C, D(C, P, D) = R)
V=Visualization, C=Compilation and D=displaying Output.

4. The Failure state as Fs:


inaccurate Food Classification: Low classification accuracy (AC).
Ineffective or Inappropriate Recommendations: High recommendation
ineffectiveness (IR).
Low User Satisfaction and Non-Adherence: Low user satisfaction (S) and non-
adherence (A).

5. The Success state as Ss:


Accuracy of Food Classification: High classification accuracy (AC).
AC= Number of correctly classified images / Total number of images

6. Mathematical Function :
Classification: C_i = classify_food(I_i, M)
Recommendation: R = generate_recommendations(C, P, D)
E(R,P)=Evaluation Metrics

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

6
1.10 Names of Conferences / Journals where papers can be published

I. IEEE International Conference on Computer Vision (ICCV)

II. International Conference on Machine Learning (ICML)

1.11 Review of Conference/Journal Papers supporting Project idea

Name: Indian Food Image Classification with Transfer Learning


Standard: 4th IEEE International Conference
Author: B. Anderson and H. Lee
Year: 2021
Drawback: Less accuracy to classify food Items using SVM.

Name: Food Image Recognition and calorie prediction


Standard: Proceedings of the ACM International Conference on Multimedia.
Author: T.Chen and Y.Wang et al.
Year: 2021
Drawback: Require user to manually input the size and dimension of portion they
ate.

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

7
Name: A deep convolutional neural network for food detection and recognition.
Standard: ACM
Author: M.A.Subhi and S.M.Ali et al.
Year: 2021
Drawback : Poor feature extraction.

1.12 Plan of Project Execution


Table 1.1: Project Planner

Sr. Task Durati Start End


No. on Date Date
1. Group Formation 6 21 July 26 July
2. Decide Area of Interest 2 26 July 28 July
3. Search Topic 5 28 July 2 Aug
4. Topic Selection 5 2 Aug 7 Aug
6. Search Related Information 12 7 Aug 19 Aug

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

8
7. Understanding Concept 7 19 Aug 26 Aug
8. Search Essential Document 6 26 Aug 1 Sep
Software
9 Problem Definition 2 1 Sep 2 Sep
10 Literature Survey 2 1 Sep 2 Sep
11. SRS and synopsis submission 10 3 Sep 12 Sep
12. Project review I 01 15 15
Sep Sep
13. Project Planning 09 16 Sep 25 Sep
14. Modeling and design 20 26 Sep 14 Oct
15. Project review II 01 18 Oct 18 Oct
16. Workbook signing 04 19 Oct 22 Oct
17. Report submission and ppt 05 23 Oct 27 Oct

D.Y.P.C.O.E.,Akurdi,Pune
Engineering Department of Computer

9
2.1 Area of Projec
Web/ML/DL

2.2 Technical Keywords

1. Convolutional Neural Networks

2. Image Processing

3. Google inception v3 model

4. VGG16, VGG19, ResNet

5. Transfer Learning

6. Region of Interest (ROI)

7. Scale Invariant Feature Transform algorithm

8. Image Segmentation

9. Color Histogram Method

10.Diet Recommendation.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

6
Introduction
The project aims to assist consumers in monitoring their caloric consumption.Use picture
recognition techniques that work on all systems that work with them. Food items must
have bounding boxes drawn around them by the user in order for the system to begin food
item recognition within those bounding boxes. Segment each food item region, extract
characteristics, and then use a convolution neural network to categorise it into one of the
100 food categories in order to identify them more precisely. may alert consumers to
issues with their eating patterns, such as unhealthy eating and unhealthful food trends. It is
helpful in preventing illness. The idea we have suggests employing convolutional neural
networks, which are widely used for image identification, to identify and recognise food
items in food images and display their calorie content. will use support vector machines
(SVM) to categorise the food items that our model has been trained to identify into distinct
categories (e.g., dosa, idli etc.)

3.1 Project Idea

1. Obesity and overeating have led to increased health concerns, including


hypertension, diabetes, and heart-related problems.

2. According to WHO figures, being overweight or obese causes at least 2.8 million
deaths annually.

3.2 Motivation of the Project

1. The motivation for the project is to develop a system that can help people to make
healthier food choices.
2. The system can also help users to identify and avoid foods that they are allergic to
avoid by their doctor.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

7
3. In addition, the system can be used to develop personalized dietary
recommendations or users based on their individual needs.

3.3 Literature Survey

Sr. Title and Conference/ Algorithms/ Advantages &


No Authors Journal Methodology used. Drawback
Name
1 Indian Food 2021 4th The models utilized IncceptionV3 provides
Image International are IncceptionV3, the best accuracy when
Classification Conference on VGG16, VGG19, and classifying food items.
with Transfer Computational ResNet. The CNN-
Learning- B. Systems and Classifier is built Complexity when
Anderson Information using the pre-trained working with massive
and H. Lee, Technology model. datasets.
for
Sustainable
Solutions
(CSITSS)
2 Food Image 2021 IEEE Color segmentation, Capable of determining
Recognition International k-means clustering, calories from a mixed
and Calorie Symposium and texture quantity of food by
Prediction- on Multimedia segmentation taking a photo with a
T. Chen and techniques. mobile device and
Y. Wang et Cloud-SVM and deep inputting it into the
al Neural Network to system.
increase performance Require users to
of image identify manually enter the size
model. and dimensions of the
piece they ate.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

8
3 Image Based 2020 IEEE Traditional Image Automatic food
Food Journal of Recognition Approach recognition
Classification Biomedical with Manually technologies will be
and Volume and Health Designed Features investigated to
Estimation Informatics and End-to-End demonstrate how they
for Dietary Image Recognition can aid dietitians in
Assessment- Learning. detecting the foods
M. Davis and consumed by
A. Wilson et consumers.
al

4. Deep Proceedings Residual Networks Improved Training and


residual of the 2021 accuracy
learning for IEEE
image conference Network depth may
recognition- paper on lead to overfitting.
K.He et al Computer
Vision and
pattern
recognition
5. Rethinking Proceedings Inception Architecture Improved Feature
the inception of the 2021 extraction
architecture IEEE
for computer conference
vision- C. paper on Complex architecture
Szegedy et al Computer design.
Vision and
pattern
recognition
6. Obesity and National Information Source link between the
cancer risk- Cancer obesity and cancer risk
R. Patel et al Institute
Website 2022
7. A deep 2022 IEEE- CNN for food Accurate Food Image
convolutional EMBS detection and recognition
neural Conference on recognition.
network for biomedical Data availathe bility
food Engineering and model

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

9
detection and and Sciences generalization
recognition-
M.A.Subhi
and S.M.Ali
8. Calories 16th IEEE YOLO Model Less accuracy rate as
prediction International compared to other
from food Conference on models.
images- Image
Manal Processing
Chokr, Shady (ICIP), Cairo,
Elbassouni Egypt

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

10
Problem Definition and scope

4.1 Problem Statement


Obesity, a significant chronic illness, has spread due to the ease with which food can be
delivered to our doorsteps. As people became more aware of the importance of food, their
concerns about their diet grew.
Our goal is to create a calorie measuring system that allows users to input food images and
anticipate their calorie content.
and as a result, number of calories present in the uploaded food image will be predicted.

4.1.1 Goals and objectives


Goal :

● To develop an image-based food classification system that can be used to provide

dietary recommendations to users.

● To make the system accurate, reliable, and easy to use.

● To make the system accessible to a wide range of users, including those with

limited technical knowledge.

Objective :

● To develop a machine learning model that can accurately classify a wide variety of

foods in real-time.

● To develop a decision support system that can generate personalized dietary

recommendations based on the user's individual needs and preferences.

● To integrate the food classification system and the decision support system into a

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

11
user-friendly interface.

● To evaluate the system on real-world dataset to assess its accuracy and reliability.

4.1.2 Statement of scope

To develop the food image classification model that can predict the calories from the image provided
from dataset and give dietary recommendation for disease like obesity.

4.2 Major Constraints

● Limited and noisy food image data.

● Variability in food appearance.

● Portion size recognition challenges.

● Ethical and privacy concerns.

● Bias and fairness issues.

● Complex personalized recommendations.

● User-friendly interface design.

● Nutritional accuracy challenges.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

12
● Interoperability issues with existing apps

4.3 Methodologies of Problem-solving and efficiency issues

● Data Preparation: Collect and clean a diverse food image dataset.

● Model Development: Choose deep learning models and train for food

classification.

● Evaluation: Assess performance using standard metrics and cross-validation.

● Dietary Recommendations: Develop algorithms for personalized

recommendations.

● Ethical Considerations: Address fairness, bias, and privacy issues.

● Efficiency Enhancement: Optimize models, employ cloud solutions and hardware

acceleration.

● Iterative Improvement: Continuously update models and gather user feedback.

● User Interface: Design a user-friendly interface for end-users.

● Legal Compliance: Ensure adherence to relevant data protection regulations.

4.4 Outcomes
5
● The project is to develop a system that can help people to make healthier food
choices.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

13
● The system can also help users to identify and avoid foods that they are allergic to
avoid by their doctor.
● In addition, the system can be used to develop personalized dietary
recommendations for users based on their individual needs. This can be especially
helpful for people with chronic diseases such as obesity disease.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

14
5.1 Applications

● Dietary Tracking Apps: Integration into apps for users to track and improve their

diets.

● Nutritional Guidance: Providing personalized nutritional recommendations.

● Healthcare: Supporting dietary management for individuals with specific health

conditions.

● Food Service Industry: Automating menu labeling and portion control.

● Research: Enhancing nutritional research with image data.

● Public Health: Monitoring and promoting healthy eating habits.

5.2 Hardware Resources Required

1. Computer: A standard desktop or laptop with a modern CPU and GPU for model
training.
2. Camera: A camera or smartphone for image capture.
3. Cloud Resources: For scalability, cloud-based GPU instances can be used.
4. Mobile Devices: For end-user applications, smartphones or tablets may be
required.

5.3 Software Resources Required

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

15
1. Machine Learning Frameworks: Such as TensorFlow, PyTorch, or scikit-learn for
model development.
2. Image Processing Libraries: OpenCV for image preprocessing.
3. Data Management Tools: Databases (e.g., MySQL, MongoDB) for data storage.
4. User Interface Tools: For app or web development, such as React, Angular, or
Android Studio.
5. Cloud Services: If using cloud-based resources for scalability.
6. Privacy and Security Tools: For data protection and compliance with regulation

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

16
Project Plan
5.1 Project Estimates
The system implementation was based on the iterative paradigm of development. The
iterative model is a software development life cycle (SDLC) that begins with a simple
implementation and gradually develops complexity and functionality until the final
system is ready.

Figure 5.1: Iterative Development Model

• A Design phase: The design step involves creating a software solution that meets
requirements. This might be a new design or an expansion of an existing design.

• An Implementation and Test phase : During the Implementation and Test phase,
software is coded, integrated, and tested.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

17
• A Review phase : The review step involves evaluating the program, reviewing
current requirements, and proposing modifications and additions to them.

5.1 Reconciled Estimates

5.1.1 Cost Estimate

The initial cost estimate of the project before beginning the implementation process is
INR 11000 for in-house resources . This cost may vary according to project development
and deployment.

5.1.1.1 Time Estimates

The initial time estimate for the complete implementation of the primary objectives is 55- 60
days depending on the schedule of the developers. The secondary objectives require an
additional efforts. Also, depending on the stage of development, the testing and debugging
would require an additional of 15 days.

5.1.2 Project Resources

5.1.2.1 People:

1. Project Members (Adishri Kadam, Aman Shukla, Aman Singh, Khushi Magotra )
1. Guide (Mrs. Dhanashree Phalke)

2. Co-Guide (Mrs.Dipali Kirange)

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

18
5.1.2.2 Hardware

1. CPU Speed (2GHz)

2. RAM 8GB

5.1.2.3 Software

1. Operating System: Ubuntu 16.04 and above/Windows 8 and above.


2. IDE : Visual Studio Code, Android Studio.
3. Machine Learning Frameworks: Such as TensorFlow, PyTorch, or scikit-learn for
model development.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

19
5.2 Risk Management w.r.t. NP Hard analysis
This section discusses Project risks and the approach to managing them.

5.2.1 Risk Identification


For risks identification, a review of the scope document, requirements specifications and
schedule is done. Answers to the questionnaire revealed some risks.

1. Have top software and customer managers formally committed to support the
project?
Image Classification and calorie prediction for Dietary Analysis project can only benefit
the stakeholders. In today’s times, top software and customer managers have not formally
committed the project but in near future they will.

6.Are requirements fully understood by the team and its customers?


Yes, SRS has underlined all the requirements very clearly.
Have customers been involved fully in the definition of requirements?
Yes, the customers will get complete benefits from the system and hence they are
interested in it.
Do end-users have realistic expectations?
Yes.
Does the software engineering team have the right mix of skills?
Yes. The team was divided into Three groups – Model Training, Web and Model Testing
teams according to the skills.
5.Are project requirements
stable?
Yes.
6.Is the number of people on the project team adequate to do the job?
Yes.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

20
7.Do all customer/user constituencies agree on the importance of the project and on
the requirements for the system/product to be built?
Yes. The project mainly focuses on dietery analysis which is the core important part of
the daily lifestyle.

5.2.2 Risk Analysis


• Attacker goals
We need to consider what an attacker’s goals might be. The standard goals of any
attacker in any security-relevant context are typically attacks against integrity,
confi- dentiality, and availability.

• Privacy
The privacy of the users matter the most. And this is supposed to be anonymous.

5.2.3 Overview of Risk Mitigation, Monitoring, Management


• To reduce the risks following actions can be taken:
● Service and support offerings.

● Regular scheduled maintenance.

● Parallel mechanism is used.

5.3 Project Schedule

5.3.1 Project task set

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

21
• UI modules

• Data collection and Preparation

• Model Development and Training

• System Integration and Testing

• Deployment

• Maintenance

5.3.2 Task network

Figure 5.2: Task Network

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

22
5.3.3 Timeline Chart

Figure 5.3: Time Line GANTT chart

5.4 Team Organization

Our strategy is to divide the tasks amongst four of us. We decided a deadline for each
task. In the end we combine the results of individuals into one single outcome.this is an
approach of an Stage-Gate SDLC

5.4.1 Team structure

Table 5.1: Team Structure for the Project

Sr. Name Role


No.
1 Adishri Kadam Web and Dashboard Design
2 Khushi Magotra Data Collection and Preprocessing
3 Aman Shukla, Aman Singh Model Building and Testing

5.4.2 Management reporting and communication


Dedicated Team of four developers working together and taking ownership of different
actions to be performed with project progress is the attitude followed by following ways:

• Daily Scrums

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

23
• Inter team communications via virtual platforms

• Github Collaboration

• Guidance from Mentors on monthly basis

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

24
Software requirement specification

6.1 Introduction

In response to the rising concern over health and nutrition, our project focuses on creating
an advanced food classification system. This system uses Convolutional Neural Networks
(CNNs) and image processing to precisely identify various food items and, more
importantly, offers personalized dietary recommendations tailored to users' specific needs
and preferences. By allowing users to upload food images, the system can predict calorie
content and provide weekly consumption statistics to combat issues like obesity and
related diseases. Our proprietary CNN architecture achieves an impressive 88.7% testing
accuracy and 93.29% training accuracy for food recognition, promising a transformative
impact on dietary management.

6.1.1 Purpose and Scope of Document

The purpose of this project is to develop an image-based food classification and calorie
measurement system that can accurately and efficiently classify a wide range of food
items and estimate their calorie content. The system will also be able to generate
personalized dietary recommendations for users based on their individual needs and
preferences.
The scope of this project encompasses several key components:

● CNN-Based Image Classification: The development of a Convolutional Neural

Network (CNN) module to accurately classify a diverse array of food items based
on uploaded images.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

25
● Calorie Estimation: Implementation of a machine learning-based module for

precise calorie estimation, ensuring high accuracy in determining the calorie


content of various food items.

● Dietary Recommendations: Creation of a dietary recommendation module that

tailors personalized dietary suggestions to users, considering their specific dietary


requirements and preference.

6.1.2 Overview of responsibilities of Developer


1. Image Classification

Design and train a CNN model for accurate food item classification using a large
dataset of food images.

2. Calorie Estimation:

Develop a machine learning model to predict calorie content by collecting


and training on calorie data for different foods.

3. Dietary Recommendations:

Create a module for personalized dietary recommendations based on user-


specific factors like age, gender, weight, activity level, dietary restrictions, and
calorie goals.

4. User Interface:

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

26
Develop a user-friendly interface for easy image uploads, viewing results,
and receiving dietary recommendations.

6.2 Usage Scenario

• Scenario 1: A successful login with valid credentials:


1. User needs to enter his login credentials.

2. User enters his username.

3. User enters his password.

4. User logins successfully into the system.

• Scenario 2: An unsuccessful login with wrong credentials:

1. User needs to enter his login credentials.

2. User enters his username.

3. User enters his password.

4. But User couldn’t login successfully into the system.

5. User presses forget password link.

6. User gets password reset link on his registered email id.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

27
7. User resets his password and successfully logins into the system.

• Scenario 3: Successful Login:

1. User uploads a photo of a food item. The system classifies the food item and
estimates its calorie content.
2. User cprovides the diet to the system. The system tells whether it’s good
diet or not and generates personalized dietary recommendations for the user.

6.3 User profiles


Actor 1: User

• Users would be expected to login every time to Upload or download.


• Users will be able to query for encrypted data and search using attribute based en-
cryption.

Actor 2: Admin
• Admin can manage the user data.
• Admin can add and delete the user.

6.2.2 Use-cases

Table 6.2: Use Case table

Sr. Use case Descripti Actors

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

28
No on
Actors can register User
1 Register
themselves to the application
Actors Can Login User
2 Login
themselves to the application
Actor Can upload the food images
3 Store Data User

Actor can Analyse their diet


4 Diet Analysis User

Actor can view history and compare.


5 View History User

Actor can manage the registered users


6 Manage User Admin
Actor can manage the user data
7 Manage Data Admin

6.2.3 Use Case View

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

29
Figure 6.1: Use Case Diagram

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

30
6.3 Functional Model and Description

A description of each major software function, along with data flow (structured analysis)
or class hierarchy (Analysis Class diagram with class description for object oriented
system) is presented.

6.3.1 Data Flow Diagram

6.3.1.1 Level 0 Data Flow Diagram

Figure 6.2: DFD Level 0

6.3.1.1 Level 1 Data Flow Diagram

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

31
Figure 6.3: DFD Level

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

32
6.3.2 Sequence Diagram

Figure 6.4: Sequence Diagram

6.3.3 Non Functional Requirements:

● Usability: Software should have a simple and user-friendly interface. The

navigating to various sites should be more convenient for consumers, saving


them time and confusion.

● Security: Encrypt and store user data securely. Implement user authentication

to safeguard accounts.

● Deployment: Maintain adequate backups to avoid data loss.

● Backup: There should be an enough back-up maintain feature for the entire

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

33
data, to prevent losing any data.

● Platform/Browser Independence: The system should be compatible with

contemporary browsers like Firefox and Chrome, as well as mainstream


operating systems such as Linux, Windows, Mac OS, and Android.

6.3.4 State Diagram:

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

34
Figure 6.6: Transaction State transition diagram

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

35
Design Document

7.1 Introduction
Project integrates image recognition, nutrition analysis, and calorie prediction. Data
collection involves sourcing images and nutritional data. The food image classifier,
trained with deep learning models, recognizes food items. Nutritional data is retrieved
from trusted sources. A regression or neural network model predicts calories. The user-
friendly interface lets users upload images and receive dietary insights. Deployment in the
cloud ensures scalability. Rigorous testing and security measures are in place. This
system has the potential to revolutionize dietary monitoring and healthy living.

7.2 Data design

7.2.1 Internal software data structure

Designing an internal database for your food recognition and calorie estimation project is
a critical aspect of the development process. Below is a simplified example of how you can
structure your database for such a project. Keep in mind that the actual structure and comp
lexity of your database will depend on your specific project requirements and the techno
logy stack you are using.

7.2.2 Database description

1. Database Type:

● Specify the type of database you plan to use (e.g., SQL, NoSQL) based on the

project's requirements.
2. Database Schema:

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

36
● Design the database schema, including tables and their relationships. For

example, you might have tables for food items, images, nutritional data, and user
information.
3. Data Storage:

● Describe where the database will be hosted and how data will be stored, such as

on a cloud server or an on-premises system.

4. Data Security:

● Explain the security measures in place to protect the database, including

authentication, authorization, and encryption.


5. Scalability:

● Address how the database can scale to accommodate increasing data volumes and

user demands.
6. Data Retrieval and Querying:

● Detail how the database will be queried to retrieve food item information,

nutritional data, and user-specific data.


7. Data Backup and Recovery:

● Outline strategies for regular data backups and recovery procedures in case of

data loss or system failures.


8. Data Privacy and Compliance:

● Ensure compliance with data privacy regulations, and specify how user data will

be handled securely.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

37
9. Performance Optimization:

● Discuss measures taken to optimize database performance, including indexing

and query optimization.


10. Data Maintenance and Updates:

● Describe how the database will be maintained and updated with new data, and the

frequency of such updates.

This data design and database description will serve as the foundation for your project's
data management. It is crucial to ensure data reliability, security, and efficiency throughout
the project's development.

7.3 Architectural Design

Designing a Food Image Classification, Dietary Analysis, and calorie prediction system.
This project integrates image recognition, nutrition analysis, and calorie prediction. Data
collection involves sourcing images and nutritional data. The food image classifier,
trained with deep learning models, recognizes food items. Nutritional data is retrieved

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

38
from trusted sources. A regression or neural network model predicts calories. The user-
friendly interface lets users upload images and receive dietary insights. Deployment in the
cloud ensures scalability. Rigorous testing and security measures are in place. This
system has the potential to revolutionize dietary monitoring and healthy living.

Figure 7.1: System Architecture

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

39
Project Implementation

8.1 Introduction

In an era where dietary choices significantly impact health and well-being, the
development of advanced technologies to assist individuals in making informed food
choices has never been more crucial. "Food Image Classification and Calorie Prediction
for Dietary Analysis" represents an innovative solution at the intersection of computer
vision, machine learning, and nutrition science. This project seeks to create a powerful
tool that can accurately classify food items from images and predict their calorie content,
empowering users to make informed dietary decisions.This project holds the promise of
revolutionizing the way we understand and manage our dietary choices, ultimately
contributing to healthier and more informed lifestyles.

8.2 Tools and Technologies Used

● Programming Languages: Python.

● Machine Learning Frameworks: TensorFlow, Keras, or PyTorch.

● Image Processing: OpenCV, PIL.

● Deep Learning Models: CNNs

● Data Management: Pandas, NumPy, databases.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

40
● Web Development: Django or Flask (if a user interface is needed).

● Cloud Computing: AWS, GCP, or Azure.

● IDEs: Jupyter Notebook, PyCharm, Visual Studio Code.

● Data Visualization: Matplotlib, Seaborn, Plotly.

● Model Evaluation: Scikit-Learn, TensorBoard.

● Collaboration: Jira, Confluence, GitHub.

● Library Dependencies: Specific libraries for image preprocessing and data

handling

8.3 Methodologies /Algorithm details


Convolutional Neural Networks (CNNs), a form of Deep Neural Network, are generally
used to recognize images. CNN consists of several fundamental layers, including hidden
and fully linked layers. Hidden layers extract and learn characteristics from training
photos, whereas fully linked layers categorize them.
● The suggested system utilizes four convolutional layers with a kernel size of 3x3.
After each convolutional layer, a pooling layer decreases picture dimensions while
retaining spatial invariance, lowering the CNN network's overall computing cost.
● This minimizes the CNN network's computation costs. In our design, we employed
max pooling with a filter size of 2x2 and strides of one to acquire the most

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

41
significant features, which were selected by taking the feature's maximum value
from the preceding layers.
● After turning all characteristics into a vector, a fully connected (FC) layer is
utilized to map and categorize test pictures. We employed two FC layers, and the
final layer predicted the probability distribution using the SoftMax classifier.

8.4 System Modules

8.4.1 Image Classification Module:

● Responsible for food image classification.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

42
● Utilizes deep learning models like CNNs for accurate food item recognition.

● Provides an API for image analysis requests.

8.4.2 Developer:

● Conducts various testing types, including unit tests, integration tests, and user

acceptance tests.

● Defines metrics and criteria for assessing system accuracy and performance.

● Monitors system behavior and performance, ensuring reliable results.

● Handles the deployment of the system to a cloud-based infrastructure.

● Ensures scalability for handling increased user demand and growing data.

These system modules work together to create a robust, integrated application for food
image classification, dietary analysis, and calories prediction. Each module has specific
responsibilities and functionalities, contributing to the project's overall success and
usability.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

43
9. Software Testing
In order to check whether the product required and the product built is meeting the ex-
pected requirement, software testing has to be done. Software testing is an activity to
check whether the actual result matches with the expected result and to make sure that the
soft- ware is defect free. It helps to identify errors, gaps or missing requirements in
contrary to the actual requirement. Software testing can be done either manually or by
using automated tools.

9.1 Type of Testing Used

● Functional Testing

● Non-Functional Testing or Performance Testing

● Maintenance (Regression and Maintenance)

● Integration Testing: Integration testing ensures that all components of a food sales

forecast program work properly. It defines the scope and foundation for integration
testing, testing internal and external system interfaces, testing security capabilities,
and testing accessibility features. System-level qualification tests evaluate the
combined functioning of hardware and software to determine the system's response.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

44
● Unit Testing: Unit testing involves testing separate components of an application.

Alpha testing is used to uncover any potential faults or defects before releasing the
final product.

● Alpha testing: Alpha testing is used to uncover any flaws or defects before

releasing the final operating system.

● Back-end Testing: Back-end testing involves evaluating the databases that hold

input from front-end applications.

● Black-box testing: Black-box testing analyzes system functionality without

understanding the internal structure or design, comparing input and output values.

● Component testing: Component testing involves evaluating various functionality

as a single code and identifying defects after linking them.

● End-to-End Testing: End-to-end testing involves testing the whole application

environment in a scenario similar to real-world use.

● Functional Testing: Functional testing involves evaluating the output to ensure it

meets the requirements.

● Graphical User Interface (GUI) Testing: Graphical User Interface (GUI)

Testing: Checks button and input field sizes, as well as text and table alignment.

● Performance Testing: To determine if the system achieves its performance

criteria.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

45
9.2 Test Cases

Test Test Case Test Steps Expected Actual Result Status


Case Description Result
ID

TC001 Test Food Image 1.Input a The CNN The CNN Pass
Classification food image correctly correctly
from the classifies the classifies the
dataset. food item. food item.
2. Apply
image
processing
techniques.
3. Use the
CNN model
for food
classification.
TC002 Test Calorie 1. Input a The The regression Pass
Estimation food image regression model
from the model accurately
dataset. accurately estimates the
2. Apply estimates the calorie content
image calorie of the food item.
processing content of the
techniques. food item.
3. Use the
CNN model
for food
classification.
4. Use the
regression
model for
calorie
estimation.
TC003 Test Diverse 1. Input The CNN The CNN Pass
Food Images various food correctly correctly
images from classifies classifies food

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

46
different food items items from
cuisines and from diverse diverse cuisines
styles. cuisines and and styles.
2. Apply styles.
image
processing
and
classification

.
TC004 Test Image Pre- The The Pass
processing 1. Input a preprocessing preprocessing
food image. procedures procedures
2. Apply improve the improve the
image dataset's dataset's quality
segmentation quality and and utility.
and feature utility.
extraction.

TC005 Test Accuracy 1. Input a set The Pass


of Food of food classification The
Classification images. accuracy classification
2. Apply meets or accuracy meets
image exceeds the or exceeds the
processing specified specified
and performance performance
classification. standards. standards.
3. Compare
the results to
ground truth
labels.
TC006 Test Calorie 1. Input a set The calorie The calorie Pass
Estimation of food estimation estimation
Precision images. precision precision meets
2. Apply meets or or exceeds the
image exceeds the defined
processing, defined performance
classification, performance criteria.
and calorie criteria.
estimation.
3. Compare

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

47
the estimated
calorie values
to actual
values.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

48
10. Results

10.1 Screenshots

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

49
D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

50
D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

51
D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

52
10.2 Result Table

Data Used Training Accuracy Testing Accuracy

Combined Dataset 93.29 78.7%

FooDD Dataset 95.45 97.16%

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

53
11. Deployment and Maintenance

11.1 Operational Requirements to run System

1. Programming Languages: Python.


2. Machine Learning Frameworks: TensorFlow, Keras, or PyTorch.
3. Image Processing: OpenCV, PIL.
4. Deep Learning Models: CNNs
5. Data Management: Pandas, NumPy, databases.
6. Web Development: Django or Flask (if a user interface is needed).
7. Cloud Computing: AWS, GCP, or Azure.
8. IDEs: Jupyter Notebook, PyCharm, Visual Studio Code.
9. Data Visualization: Matplotlib, Seaborn, Plotly.
10. Model Evaluation: Scikit-Learn, TensorBoard.
11. Collaboration: Jira, Confluence, GitHub.
12. Library Dependencies: Specific libraries for image preprocessing and data handling

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

54
12. Future Scope and Conclusion

12.1 Future Scope

The future scope for "Food Image Classification and Calorie Prediction for Dietary
Analysis" using machine learning is highly promising and dynamic. Up to the present,

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

55
significant progress has been made in the development of models for food image
classification and calorie prediction for dietary analysis using machine learning. The focus
has largely been on refining the choice of models, curating and expanding datasets, and
setting the foundation for future implementations. The ongoing work involves model
selection and optimization to enhance accuracy in food image classification and calorie
prediction, which will undoubtedly bolster the system's dietary analysis capabilities.
Furthermore, efforts are directed towards dataset augmentation and quality improvement,
ensuring that the models are trained on diverse and representative data.

Shortly, the emphasis will shift towards practical implementation and model comparison.
The aim is to deploy these systems in real-world scenarios, such as dietary monitoring apps
and services. This deployment will allow for direct user interaction and feedback, bringing
about an era of immediate dietary guidance. Wearable devices may be integrated to
facilitate real-time dietary insights and recommendations based on user preferences and
health goals. The pursuit of personalization remains a key focus, tailoring
recommendations to individual dietary preferences, health objectives, and restrictions.
Additionally, the next steps involve expanding the system's capabilities to encompass
comprehensive nutrient tracking, offering behavioral insights, and adapting to cross-
cultural dietary variations along with that comparative analysis of different models will be
instrumental in refining system performance.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

56
12.2 Conclusion

In the realm of dietary analysis, "Food Image Classification and Calorie Prediction for
Dietary Analysis" represents a groundbreaking technological advancement with far-
reaching implications. This project harnesses the power of machine learning to not only
accurately classify food items from images but also predict their calorie content, thus
empowering individuals to make informed dietary choices. As we conclude this journey,

It is evident that the intersection of technology and nutrition science holds immense
potential. The system's ability to provide dietary insights, encourage healthier eating
habits, and promote personalized nutrition is poised to transform the way we approach
food. By continuously improving accuracy, embracing multi-modal analysis, and
integrating real-time feedback, we can shape a future where dietary decisions are not only
healthier but also sustainable. As we move forward, it is our hope that this project will
contribute not only to individual well-being but also to the broader fields of nutrition
research and public health, making a positive impact on society as a whole. The path to a
healthier and more informed future begins here, at the convergence of technology and
dietary analysis.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

57
12.3 Appendix B(Idea Matrix)

Responsibl
Modules Technology to be How it will be used Time e
used Allotted
Person
This technology will
HTML, CSS, Js serve as the 1-3 weeks
Login/ frontend for our
application Aman
Registrati
We will code the Singh,
on Python 2-3 weeks Aman
algorithms in python.
Shukla

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

58
Laboratory assignments on Project Analysis of
Algorithmic Design

The problem under consideration is the accurate classification of food images and the
subsequent analysis of their nutritional content for dietary assessment. This involves
developing a system that can automatically identify and classify various types of foods
depicted in images and then provide nutritional insights based on the identified items.

1. Feasibility Assessment:

We can assess the feasibility of this project from a business perspective using the IDEA
Matrix:
Increase: This project could potentially increase efficiency in dietary assessment by
automating the process, and saving time and resources.
Deliver: The system could deliver value to nutritionists, dietitians, and individuals seeking
to monitor their dietary intake.
Accelerate: By automating food classification and dietary analysis, the project could
accelerate the pace of nutritional assessments.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

59
Associate: The project could be associated with existing platforms or services related to
health and wellness, enhancing their capabilities.

2. NP-Hard, NP-Complete, or Satisfiability Issues:

In the context of food image classification and dietary analysis, the problem may involve
NP-Hard or NP-Complete challenges, especially in the classification of a wide range of food
items and the analysis of their nutritional content. Modern algebra and relevant
mathematical models could be applied to optimize algorithms for image recognition and
nutritional analysis, potentially addressing these complexity issues.

3. Input, Output, and Functionality:

In the context of food image classification and dietary analysis, the input (x) would be an
image containing one or more food items, and the output (y) would be the classification of
the items along with their respective nutritional information. The function (f(x)) would
involve the process of image recognition and analysis to identify the foods and extract
relevant nutritional data from a database or through analysis of the image itself.

Laboratory assignments on Project Quality and Reliability


Testing of Project Design
Design Exploration and Parallel Processing (Divide and Conquer)

● Divide the image classification task into smaller, independent subtasks (e.g., feature
extraction, classification).
● Implement these subtasks using libraries or frameworks that support
distributed/parallel/concurrent processing (e.g., TensorFlow with multi-GPU
support).

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

60
● Analyze the performance improvement achieved through parallelization compared
to a sequential implementation.

Deliverables:

● Code demonstrating parallel processing for image classification tasks.


● Performance comparison between sequential and parallel implementations.

Functional Dependency Modeling and UML Diagrams

● Identify functional dependencies between modules involved in image


processing, classification, and calorie prediction.
● Construct a functional dependency graph depicting these dependencies.
● Create UML diagrams (e.g., Class diagrams, Sequence diagrams) to represent
the system architecture, object interactions, and data flow.
● Utilize appropriate software modeling tools (e.g., UML modeling software) for
creating these diagrams.

Deliverables:

● Functional dependency graph representing relationships between modules.


● A set of UML diagrams depicting the system architecture and object
interactions.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

61
Testing and Reliability Evaluation

● Design test cases (black-box testing) for various functionalities like image
classification, calorie prediction, and edge cases (e.g., blurry images, unrecognized
food items).
● Utilize tools like Mathematica or open-source alternatives for generating test data
(e.g., synthetic images with varying calorie content).
● Implement test cases and execute them against the system to identify bugs or
inconsistencies.

Deliverables:

● A set of test cases covering various functionalities of the system.


● Test results with identified bugs or inconsistencies.
● Analysis of UML diagram reliability based on test case execution.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

62
Reviewer Comments of Paper Submitted
1. Name of the Conference/Journal where paper was submitted:IJSARET
2. Paper accepted/rejected: Accepted
3. Review comments by reviewer: No
4. Corrective actions if any:No

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

63
Term-II Project Laboratory Assignments
Task 1: Review and Corrective Actions

Review of Design:

1. Feedback Analysis:

● We carefully reviewed the feedback from the Term I assessment, focusing on areas
such as model accuracy, user interface design, and database performance.
● Additionally, we analyzed comments and suggestions received from prestigious
competitions and conferences like those organized by IITs and Central Universities.

2. Corrective Actions:

Based on the feedback, we implemented several key changes:

● Enhanced model accuracy by refining the training data and fine-tuning


hyperparameters.
● Improved the user interface for a more intuitive and visually appealing experience.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

64
● Optimized database queries to ensure faster data retrieval and improved storage
efficiency.
● Each modification was thoroughly documented along with the rationale behind it.

Deliverables:

● A revised design document detailing the specific changes made in response to the
feedback
● A comprehensive report summarizing the feedback analysis and the corrective actions
taken.

Task 2: Project Workstation Setup

Workstation Selection and Installation:

1. Selection:

● We carefully selected suitable hardware components, including a high-performance desktop with modern
CPU and GPU capabilities, to meet the system's requirements.
● Additionally, we considered cloud resources such as AWS for scalability and resource management.

2. Installation:

● We installed all the required software and libraries, including Python with TensorFlow, OpenCV for image
processing, and database systems for data storage.
● Development environments such as Jupyter Notebook and PyCharm were set up for efficient coding and
development workflows.

Report Preparation:

● A detailed report was prepared documenting the entire workstation setup process,
including hardware specifications, software installations, and configuration steps.
● Screenshots and logs were included to provide a visual representation of the setup.

Task 3: Programming and Implementation

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

65
Project Functions and Interfaces:

1. Programming:

● We implemented the core project functions, including food image classification using
CNNs and calorie prediction using regression models.
● Interfaces and GUI elements were developed as per the specifications outlined in the
Term I submission, focusing on user-friendly interactions.

2. Integration:

● Modules such as image processing, classification, calorie estimation, and dietary


recommendations were seamlessly integrated to ensure smooth functionality.
● Code refactoring was performed to enhance performance and readability.

Deliverables:

● A source code repository was created with detailed commit history, showcasing the
implemented functionalities and interfaces.
● Comprehensive documentation was prepared, including algorithm descriptions and
code snippets.

Task 4: Testing and Evaluation

Test Tool Selection:

1. Tool Selection:

● We selected appropriate testing tools, including unit testing frameworks like PyTest
for functional testing and JMeter for performance testing.

Testing Process:

1. Functional Testing:

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

66
● Unit tests were conducted to verify the functionality of individual components.
● Integration testing was performed to ensure seamless interaction between modules.
● The system was validated against the initial requirements to ensure compliance.

2. Performance Testing:

● Performance tests were conducted to evaluate system response time and accuracy
under various load conditions.
● Based on the test results, optimizations were implemented to improve system
performance.

3. Security Testing:

● Security testing was conducted to ensure data encryption, secure storage practices, and
user authentication mechanisms were in place.

4. Reliability Testing:

● Reliability tests were performed to assess the system's stability and functionality over
time.

Testing Reports:

● Comprehensive testing reports were generated, including charts, graphs, and


summaries of test results.
● The reports also documented identified issues and the corrective actions taken.

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

67
Information of Project Group Members

Name: Aman Singh

Date of birth: 30 March, 2002


Gender: Male
Address: Jammu
Email: iamansingh02@gmail.com
Contact Number: +91 7889391045
Placement Details: Placed at Rockwell Automation
Paper Published : Yes

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

68
Name: Adishri Kadam

Date of birth: 08 March, 2002


Gender: Female
Address: Solapur
Email: adishrikadam3766@gmail.com
Contact Number: +91 9307370915
Placement Details: Placed at Persistent
Paper Published : Yes

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

69
Name: Aman Shukla

Date of birth: 10 August, 2002


Gender: Male
Address: Vaaranasi
Email: amanshukla360s@gmail.com
Contact Number: +91 8709742412

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

70
Placement Details:Appearing
Paper Published : Yes

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

71
Name: Khushi Magotra

Date of birth: 01 Sep, 2002


Gender: Female
Address: Jammu
Email: khushimagotra94@gmail.com
Contact Number: +91 6006207688
Placement Details:Appearing
Paper Published : Yes

D.Y.P.C.O.E.,Akurdi,Pune Department of Computer Engineering

72

You might also like