Project-Report-food-classifier
Project-Report-food-classifier
A project on
Bachelors of Technology
in
Computer Science and Engineering
and
Masters of Technology
in
Data Science
Submitted by:
Kumar Sauryan
Enroll. No.A505112321008
1
Department of Computer Science and Engineering
Amity School of Engineering and Technology
DECLARATION
Haryana
2
Department of Computer Science and Engineering
Amity School of Engineering and Technology
CERTIFICATE
This is to certify that KUMAR SAURYAN (Enrollment N0. A505112321008), student of
I.B.Tech + M.Tech (Data Science) VI semester, Department of Computer Science &
Engineering, ASET, Amity University Haryana, has done his Integrated Project entitled
“HEALTHY FOOD CLASSIFICATION” under my guidance and supervision during
“february 2024-april 2024”
The work was satisfactory. He has shown completed dedication and devotion to the given project
work.
Signature of Supervisor(s)
Date:
(DR RASHMI GUPTA)
Assistant Professor
Computer Science & Engineering
ASET, Amity University, Haryana
Head
Department of Computer Science & Engineering
Amity School of Engineering and Technology
Amity University Haryana, Gurgaon
3
ABSTRACT
4
LIST OF FIGURES
Figure 1 DFD Level 0
Figure 2 DFD Level 1
Figure 3 DFD Level 2
Figure 4 Entity Relationship Diagram
Figure 5(a),5(b) Working structure of decision function
Figure 6 DES Working
Figure 7 Block diagram for TDES
Figure 8 Fiestal structure for BlowFish
Figure 9 Screenshot for first page of AET
Figure 10 Screenshot for Registration form
Figure 11 (a), 11(b) Screenshot for Purchase page
Figure 12 Screenshot for credit card information
Figure 13 Screenshot for purchase key
Figure 14 Screenshot for generate key
Figure 15 Screenshot for home page for AET
Figure 16(a) Screenshot for login page
Figure 16(b) Screenshot for login page and key entry
Figure 17 Screenshot for registration page
Figure 18 Screenshot for AET Mode selection window
Figure 19 Screenshot for Algorithm selection mode
Figure 20 Screenshot for Dynamic mode window
5
Contents
Declaration i
Certificate ii
Acknowledgement iii
Abstract iv
List of Figures v
List of Tables vi
1. INTRODUCTION 1
1.1 Objective 1
1.2 Current system 2
1.3 Proposed system 3
2. BACKGROUND OF PROJECT 6
3. TECHNOLOGIES USED7
3.1. Java 7
3.1.1. AWT8
3.1.2. JDBC9
3.3. Html12
4. DESIGN OF PROJECT 15
6
4.5.1 Working of decision function 21
4.6 List of modules 22
4.6.1 List of modules of application 22
4.6.2 List of modules of service provider 22
5. IMPLEMENTATION23
5.3 DES 24
5.5 Blowfish 28
6. SCREEN SHOTS 31
8. CONCLUSION 48
9. REFERENCES 49
APPENDIX 50
7
Chapter 1
INTRODUCTION
In today's complex food landscape, making healthy choices can be a daunting task. The journey
towards a healthier lifestyle is often hindered by various challenges, ranging from ambiguous
food classification to the influence of processing and packaging on nutritional value. In this
project, we aim to address these challenges head-on through the development of a robust healthy
food classifier.
Our classifier doesn't just stop at identifying foods; it delves deeper into key issues such as
ambiguity in food classification, consideration of portion sizes, ingredient transparency, catering
to special dietary needs, and understanding the influence of processing and packaging on food
quality. By tackling these critical factors, our classifier strives to empower individuals to make
informed decisions about their dietary choices, ultimately promoting healthier lifestyles.
Join us as we explore the intricacies of food classification, dissect the impact of portion sizes,
unravel the mysteries of ingredient transparency, accommodate diverse dietary needs, and
navigate through the labyrinth of processing and packaging influences. Together, let's embark on
a journey towards a healthier future, one bite at a time.
1.1 Objective
The objective of this project is to develop a comprehensive healthy food classifier that
addresses the multifaceted challenges inherent in food classification. By focusing on issues
such as ambiguity in classification, portion size considerations, ingredient transparency,
special dietary needs, and the influence of processing and packaging, our aim is to provide
consumers with a reliable tool to make informed and nutritious food choices. Through this
8
classifier, we seek to promote healthier eating habits and empower individuals to take control
of their dietary intake for improved well-being.
Provide a reliable tool for making informed and nutritious food choices.
Promote healthier eating habits and empower individuals for improved well-being.
The current system of food classification often lacks the necessary granularity to effectively
guide consumers towards healthier choices. While broad categories such as "healthy" or
"unhealthy" exist, they often fail to provide the nuanced information needed to make informed
decisions. Additionally, the current system may not adequately address the diverse dietary needs
and preferences of individuals, leading to confusion and frustration among consumers.
Furthermore, limited transparency regarding ingredients and processing methods can hinder
efforts to make healthier choices.
As a result, there is a growing recognition of the need for a more sophisticated and
comprehensive approach to food classification—one that considers the various factors that
influence the nutritional quality of food and provides consumers with clear and actionable
information. This has led to calls for the development of a new and improved system that
addresses the shortcomings of the current model and empowers individuals to make choices that
support their health and well-being.
The proposed system aims to address these challenges by introducing a comprehensive healthy
food classifier that integrates various elements crucial for promoting healthier eating habits. This
9
system will not only classify foods based on their nutritional content but will also consider
portion size, provide transparent information about ingredients, and evaluate the influence of
processing and packaging on the overall healthfulness of food products.
By incorporating these components into the classification framework, the proposed system seeks
to empower consumers to make informed choices that align with their health goals and dietary
preferences. Additionally, it will serve as a valuable tool for educators, healthcare professionals,
and policymakers in promoting public health initiatives and fostering a culture of wellness and
nutrition awareness.
Through the implementation of the proposed system, we aim to bridge the gap between the
current ambiguity in food classification and the need for accurate, transparent, and actionable
information to support healthier eating habits. Ultimately, our goal is to contribute to the creation
of a healthier society by providing individuals with the resources they need to make nutritious
choices that nourish both their bodies and minds.
Holistic approach: Considers nutritional content, portion sizes, ingredient transparency,
dietary needs, and processing/packaging influence.
Support for public health initiatives: Assists educators, healthcare professionals, and
policymakers in promoting healthier lifestyles.
10
Chapter 2
BACKGROUND OF PROJECT
Healthy eating habits are paramount for overall well-being, offering a multitude of benefits such
as disease prevention, weight management, sustained energy levels, improved digestion, a strong
immune system, and enhanced longevity. By prioritizing nutrient-dense foods and balanced
meals, individuals can optimize their health, promote proper bodily function, and enjoy a higher
quality of life.
Food classification presents challenges due to the subjective nature of categorization, variability
in nutritional composition, and the vast array of food products available. Automated systems,
utilizing machine learning algorithms, offer a solution by analyzing large datasets to recognize
patterns and characteristics of different foods accurately. These systems streamline classification
processes, improve accuracy, and provide valuable insights for dietary assessment and public
health interventions, ultimately contributing to better health outcomes and informed food policy
decisions.
AI offers several advantages, including scalability, efficiency, and adaptability to complex data
patterns. With its ability to process vast amounts of data quickly and accurately, AI systems can
scale to handle large datasets and complex tasks with ease. Through machine learning algorithms,
AI can continuously learn from new data, making it adaptable to evolving patterns and changes in
various domains. This adaptability, coupled with its efficiency in processing and analyzing data,
11
empowers AI to drive innovation, optimize processes, and deliver valuable insights across
diverse applications, from healthcare and finance to manufacturing and beyond.
12
The current project aims to develop a robust healthy food classifier utilizing AI techniques,
particularly Support Vector Machines (SVM) and Exploratory Data Analysis (EDA). The
primary objectives include accurately categorizing food items based on their nutritional profiles,
ingredients, and overall healthiness, and providing users with personalized dietary
recommendations. Additionally, the project seeks to leverage SVM's ability to handle high-
dimensional data and nonlinear relationships, along with EDA techniques, to gain insights into
the underlying patterns and characteristics of healthy foods. Ultimately, the goal is to empower
individuals to make informed dietary choices, promote healthier eating habits, and contribute to
improved public health outcomes.
With the objectives and goals of the project established, the next chapter will delve into the
methodology employed to develop the healthy food classifier using AI techniques such as
Support Vector Machines (SVM) and Exploratory Data Analysis (EDA). This chapter will
provide a detailed overview of the steps involved in data collection, preprocessing, feature
engineering, model selection, training, and evaluation. Additionally, it will discuss the rationale
behind the chosen methodologies and the considerations considered to ensure the accuracy and
reliability of the classifier.
13
CHAPTER 3
TECHNOLOGIES USED
3.1 Python : Python is a versatile and widely used programming language renowned for its
simplicity, readability, and extensive libraries, making it a popular choice for various
applications, including data analysis, machine learning, web development, and scientific
computing. Its rich ecosystem, with libraries like NumPy, pandas, scikit-learn, and TensorFlow,
provides powerful tools for tasks ranging from data manipulation and visualization to advanced
machine learning and deep learning techniques, making Python an indispensable tool for
developers and data scientists alike.
3.1.1 Syntax Clarity: Python's syntax is designed to prioritize readability and simplicity. It
uses indentation to denote blocks of code, eliminating the need for braces or semicolons
commonly found in other programming languages. This clear and intuitive syntax makes Python
code easy to write, understand, and maintain, promoting code consistency and reducing the
likelihood of errors.
3.1.2 Dynamic Typing: Python is dynamically typed, meaning variables are not bound to a
specific data type during declaration. Instead, the type of a variable is inferred at runtime based
on the value assigned to it. This flexibility allows developers to write code more quickly without
worrying about explicit type declarations, enhancing productivity and code readability.
3.1.3 Rich Standard Library: Python comes with an extensive standard library that
provides modules and functions for performing a wide range of tasks without requiring additional
installation or configuration. The standard library includes modules for tasks such as file I/O,
networking, regular expressions, data compression, and more. This wealth of built-in
functionality saves developers time and effort by providing readily available tools for common
programming tasks.
3.1.4 Interpreted Nature: Python is an interpreted language, which means that code is
executed line by line by an interpreter without the need for compilation. This immediate feedback
loop makes Python ideal for rapid prototyping, debugging, and iterative development. Developers
can quickly test and experiment with code changes, making the development process more
interactive and efficient.
14
3.1.5 Extensive Third-party Libraries: Python boasts a vibrant ecosystem of third-party
libraries and frameworks that extend its capabilities for various domains and applications.
Libraries such as NumPy for numerical computing, pandas for data manipulation and analysis,
scikit-learn for machine learning, TensorFlow for deep learning, and Django for web
development are just a few examples. These libraries provide powerful tools and functionalities
that enable developers to tackle complex problems and build sophisticated applications more
efficiently.
scikit-learn.
Pandas
Matplotlib
NumPy
Metrices
3.1.6 Object-Oriented Programming (OOP): Python supports object-oriented
programming principles, allowing developers to create reusable and modular code using classes
and objects. Python's OOP features include inheritance, encapsulation, and polymorphism, which
promote code organization, reusability, and maintainability. Object-oriented design encourages a
modular approach to software development, making it easier to manage and scale projects as they
grow in complexity.
3.1.7 Platform Independence: Python is platform-independent, meaning that Python code
can run on various operating systems, including Windows, macOS, and Linux, without requiring
modification. This platform independence ensures code portability and compatibility across
different environments, making Python an attractive choice for cross-platform development and
deployment. Developers can write code once and run it anywhere, simplifying the development
and deployment process.
3.1.8 Community Support: Python has a large and active community of developers,
enthusiasts, and contributors who provide support, share knowledge, and contribute to the growth
and evolution of the language and its ecosystem. The Python community encompasses online
forums, mailing lists, user groups, conferences, and open-source projects where developers can
collaborate, learn from each other, and contribute to the improvement of Python and its
associated tools and libraries. This vibrant community support network ensures that Python
15
remains a dynamic and thriving language that continues to evolve and adapt to the changing
needs of developers and users alike.
3.2 scikit-learn.
scikit-learn is a popular open-source machine learning library for Python that provides a simple
and efficient toolset for data mining and data analysis tasks. It features various supervised and
unsupervised learning algorithms, including classification, regression, clustering, dimensionality
reduction, and model selection. scikit-learn is built on top of other scientific computing libraries
such as NumPy, SciPy, and matplotlib, making it easy to integrate into existing Python data
analysis workflows. It is widely used in academia, industry, and research for building machine
learning models, performing data preprocessing and feature engineering, and evaluating model
performance through cross-validation and other techniques.
3.2.1 Simple and Consistent API: scikit-learn provides a simple and consistent API that
makes it easy to use and understand, even for users new to machine learning. This consistent
interface allows developers to seamlessly switch between different algorithms and techniques
without needing to learn new syntax or conventions.
3.2.2 Wide Range of Algorithms: scikit-learn offers a wide range of supervised and
unsupervised learning algorithms, including support for classification, regression, clustering,
dimensionality reduction, and more. These algorithms are implemented efficiently and are well-
documented, making it easy to apply them to various machine learning tasks.
3.2.3 Integration with Other Python Libraries: scikit-learn is built on top of other
popular scientific computing libraries in Python, such as NumPy, SciPy, and matplotlib. This
integration allows users to leverage the capabilities of these libraries seamlessly, enabling
efficient data manipulation, numerical computation, and visualization within scikit-learn
workflows.
3.2.4 Flexibility and Customization: While scikit-learn provides a rich set of pre-built
algorithms and tools, it also offers flexibility and customization options for advanced users.
Developers can easily extend scikit-learn's functionality by implementing custom estimators,
transformers, and metric functions, allowing for tailored solutions to specific machine learning
problems.
16
3.2.5 Model Evaluation and Selection: scikit-learn includes utilities for model evaluation
and selection, such as cross-validation, hyperparameter tuning, and model comparison. These
tools help users assess the performance of their machine learning models, optimize model
parameters, and select the best-performing model for a given task.
3.2.6 Active Development and Community Support: scikit-learn is actively
developed and maintained by a dedicated community of developers and contributors. Regular
updates and releases ensure that the library remains up to date with the latest advancements in
machine learning research and best practices. Additionally, the scikit-learn community provides
support through documentation, tutorials, forums, and mailing lists, making it easy for users to
get help and guidance when needed.
3.3 Matplotlib: Matplotlib is a comprehensive plotting library for Python that enables users to
create a wide variety of high-quality static, animated, and interactive visualizations. It provides a
flexible and intuitive interface for generating plots, charts, histograms, scatter plots, and more,
making it an indispensable tool for data visualization and analysis in fields such as data science,
scientific computing, engineering, and finance.
3.3.1 Simple and Intuitive Syntax: Matplotlib offers a simple and intuitive API for
creating plots, allowing users to generate complex visualizations with just a few lines of code. Its
syntax is designed to be like MATLAB, making it familiar to users who are transitioning from
MATLAB to Python.
3.3.2 Wide Range of Plotting Functions: Matplotlib provides a wide range of plotting
functions and customization options for creating different types of plots, including line plots, bar
plots, pie charts, histograms, scatter plots, 3D plots, and more. Users can customize various
aspects of their plots, such as colors, labels, markers, axes, and legends, to suit their specific
needs and preferences.
3.3.3 Publication-Quality Output: Matplotlib produces high-quality plots suitable for
publication and presentation purposes. It offers fine-grained control over plot aesthetics and
formatting, allowing users to create professional-looking visualizations with precise control over
details such as font sizes, line widths, and plot dimensions.
3.3.4 Support for Multiple Output Formats: Matplotlib supports multiple output
formats, including PNG, PDF, SVG, and EPS, allowing users to save their plots in various file
17
formats for use in documents, reports, presentations, and publications. Additionally, Matplotlib
can generate plots directly within Jupyter notebooks, facilitating interactive data exploration and
analysis.
3.3.5 Integration with NumPy and Pandas: Matplotlib seamlessly integrates with other
popular Python libraries such as NumPy and pandas, enabling users to visualize data stored in
NumPy arrays, pandas Data Frames, and other data structures. This integration simplifies the
process of creating plots from data and enhances interoperability with existing data analysis
workflows.
3.3.6 Extensibility and Customization: Matplotlib is highly extensible and customizable,
allowing users to create custom plot types, styles, and interactive features using its object-
oriented interface. Advanced users can subclass Matplotlib's plotting objects to implement
custom plotting functions and visualization techniques tailored to specific use cases.
Overall, Matplotlib is a powerful and versatile plotting library that enables users to create
visually appealing and informative plots for exploring, analyzing, and communicating data
effectively. Its rich feature set, flexible customization options, and extensive documentation make
it a valuable tool for data visualization in Python.
3.4 JavaScript
JavaScript is a versatile and widely used programming language primarily used for building
dynamic and interactive web applications. It is a core technology of the World Wide Web and is
supported by all modern web browsers without the need for plugins.
3.4.1 Client-Side Scripting: JavaScript is primarily used for client-side scripting, meaning
it runs in the user's web browser rather than on a web server. It enables developers to create
interactive user interfaces, respond to user actions, and manipulate the content and behavior of
web pages in real-time.
3.4.2 Event-Driven Programming: JavaScript is event-driven, meaning it responds to
user actions and events such as mouse clicks, keyboard inputs, and page load events. Developers
can define event handlers to execute specific code in response to these events, enabling
interactivity and user engagement in web applications.
3.4.3 Dynamic Typing: JavaScript is dynamically typed, allowing variables to hold values
of any data type and to be reassigned to different types at runtime. This flexibility simplifies
18
coding and enables rapid prototyping, but it can also lead to unexpected behavior if not managed
carefully.
3.4.4 Prototypal Inheritance: JavaScript uses prototypal inheritance to define object
relationships, allowing objects to inherit properties and methods from other objects. This
prototype-based approach differs from classical inheritance found in languages like Java and C+
+, providing a flexible and lightweight mechanism for object-oriented programming in
JavaScript.
3.4.5 Functional Programming: JavaScript supports functional programming paradigms,
allowing functions to be treated as first-class citizens and supporting features such as higher-
order functions, closures, and anonymous functions. This functional programming support
enables developers to write concise and expressive code and to implement powerful
programming patterns and techniques.
3.4.6 Asynchronous Programming: JavaScript supports asynchronous programming
through mechanisms such as callbacks, promises, and async/await syntax. Asynchronous
programming allows developers to execute non-blocking code and handle tasks such as fetching
data from servers, processing user input, and performing I/O operations without blocking the
main execution thread, improving responsiveness and performance in web applications.
JavaScript is also increasingly used beyond web development, with frameworks such as Node.js
enabling server-side and backend development, and libraries like React Native and Electron
enabling cross-platform mobile and desktop application development. Its versatility, ubiquity,
and rich ecosystem of tools and libraries make JavaScript a fundamental technology for building
modern web and software applications.
3.5 React JS
React.js, commonly referred to as React, is a JavaScript library for building user interfaces,
primarily for web applications. Developed by Facebook, React allows developers to create
interactive and dynamic UI components that efficiently update in response to changes in data.
3.5.1 Component-Based Architecture: React follows a component-based architecture,
where UI elements are encapsulated into reusable components. These components can be
composed together to build complex user interfaces, promoting code reusability and
maintainability.
19
3.5.2 Declarative Syntax: React promotes a declarative approach to building UIs, where
developers describe how the UI should look at any given point in time, and React takes care of
updating the Document Object Model (DOM) to match this desired state. This simplifies the
development process and makes it easier to reason about the behavior of the UI.
3.5.3 Virtual DOM: React utilizes a virtual DOM (Document Object Model) to optimize
rendering performance. Instead of directly manipulating the browser's DOM, React creates a
lightweight in-memory representation of the DOM, known as the virtual DOM. When data
changes, React reconciles the virtual DOM with the actual DOM, efficiently updating only the
parts of the UI that have changed. This approach minimizes unnecessary DOM manipulation and
improves application performance.
3.5.4 One-Way Data Binding: React uses one-way data binding, were data flows
downward from parent components to child components. This unidirectional data flow simplifies
the management of application state and makes it easier to track data changes and debug issues in
the application.
3.5.5 JSX: React introduces JSX (JavaScript XML), a syntax extension that allows developers
to write HTML-like code directly within JavaScript. JSX enables developers to define UI
components and their structure in a familiar and expressive manner, enhancing readability and
maintainability of the code.
3.5.6 Rich Ecosystem: React has a vibrant ecosystem of tools, libraries, and frameworks that
complement its functionality and extend its capabilities. These include tools for state
management (e.g., Redux), routing (e.g., React Router), server-side rendering (e.g., Next.js), and
mobile app development (e.g., React Native).
Overall, React is widely regarded for its simplicity, performance, and flexibility, making it a
popular choice for building modern, interactive, and scalable user interfaces for web applications.
20
CHAPTER 4
Software requirement:
Python 3.0
Node js (Runtime environment)
Jupyter notebook
SkLearn library
21
4.2 DATA FLOW DIAGRAM
4.2.1 0 LEVEL
22
4.2.2 LEVEL 1:
23
4.2.3 2 LEVELS:
24
1.2 Entity relationship diagram:
25
4.5Working structure of decision function:
26
Fig
ure 4.6: Working structure of decision function
1. User interface.
Login
Registration.
2. Manual mode.
3. Dynamic mode.
4. Message Digest.
5. Crypt information.
Algorithms used:
DES.
3DES.
Blow fish
1. Registration
27
2. Purchase key
3. Purchase AET
28
Chapter 5
IMPLEMENTATION
29
Triple DES:
Triple DES is another mode of DES operation. It takes three 64-bit keys, for an overall key
length of 192 bits. In Stealth, you simply type in the entire 192-bit (24 character) key rather than
entering each of the three keys individually. The Triple DES DLL then breaks the user-provided
key into three sub keys, padding the keys if necessary so they are each 64 bits long. The
procedure for encryption is exactly the same as regular DES, but it is repeated three times, hence
the name Triple DES. The data is encrypted with the first key, decrypted with the second key,
and finally encrypted again with the third key.
Triple DES runs three times slower than DES, but is much more secure if used properly. The
procedure for decrypting something is the same as the procedure for encryption, except it is
executed in reverse. Like DES, data is encrypted and decrypted in 64-bit chunks. Although the
input key for DES is 64 bits long, the actual key used by DES is only 56 bits in length. The least
significant (right-most) bit in each byte is a parity bit, and should be set so that there are always
an odd number of 1s in every byte. These parity bits are ignored, so only the seven most
significant bits of each byte are used, resulting in a key length of 56 bits. This means that the
effective key strength for Triple DES is actually 168 bits because each of the three keys contains
8 parity bits that are not used during the encryption process
30
Figure 6.2 : Block diagram of TDES
31
Chapter 7
SCREEN SHOTS
32
Figure 7.2: Screenshot for Registration form
33
Figure 7.3(a): Screenshot for purchase page
34
Figure 7.3(b): Screenshot for purchase page
35
Figure 7.4: Screenshot for credit card information
36
Figure 7.5: Screenshot for download link of software
37
Figure 7.6: Screenshot for purchase key
38
Chapter 8
FUTURE SCOPE OF PROJECT
“Advance encryption technique” is a system application which fulfills the basic security issue of
encryption/decryption with the more complex approach of encryption...
Project helps in overcoming from the static encryption approach as this project enhanced with the decision function.
Cryptanalysis of this encryption system becomes more complex as the primary task of cryptanalysis is to find the
selected or working algorithm.
In future prospective system can be used for encrypting the real world data as it has an automated feature of
algorithm selection. Key feature of the system is the random selection.
CONCLUSION
Encryption is the basic security need for making a secure communication happen. Number of implemented
algorithms makes the encryption more complex.
Advance encryption technique boosts the security needs of any communication channel. As this project implements
the several numbers of algorithms, with a dynamic approach.
And decision function implementation makes the system more effective and secure. As cryptanalysis is not limited
till the guessing of the key or the plain text.
“Advance encryption technique” is not just a simulation of algorithms it can be adopted for real world data
encryption. Which is supported by fully automation of algorithm selection with randomization approach?
System is quite compatible for working with real world encryption schemes. Automation is dynamic in its own class
of application, as user just only responsible for inputs and expect for encrypted text, selection of is not over to the
user.
The project can serve to be useful system for any of the, individual or organizational networks for the security of
data.
39
REFERENCES
Books referred:
1. “Computer and networks security” by William Stallings.
40
APPENDIX
TABLE STRUCTURE
Table 4:USERS_DETAIL:
Field name Data type Validation
Name Text Not null
Password Text Not null
Country Text Not null
e-mail Text Not null
Table 5: KEY:
Field name Data type
S_no Number
41
Key Text
42