SHEELA
SHEELA
Body mass index (BMI) is a person’s weight in kilograms divided by the square of
height in meters. Body mass index is a measurement of obesity based on measured
height and weight. Traditional method of calculating BMI is inconvenient and requires
physical measuring of a person and particular instruments. A proposed healthcare
system to predict BMI using Kinect and data mining techniques so that everybody can
easily predict their BMI values using Facial images.Face detection and feature
extraction component using haar cascade to detect useful face information. Framework
by using facial images that uses machine learning algorithms for data mining namely,
Data Preprocessing, Data Extraction, data evaluation and presentation to train models
that would help predict obesity levels (Classification), Bodyweight, and fat percentage
levels (Regression) using various parameters. System helps to advance the study aspect
based on body weights and patients that are paralyzed or severely ill patient who unable
to undergo basic measurement for emergency medical service.
CONTENTS
Declaration i
Abstract ii
Acknowledgement iii
Contents iv
List of Figures
vii
List of Tables
viii
Overview
Problem Statement
Significance and Relevance of Work
Objectives
Methodology
Organization of the
Report
2 LITERATURE SURVEY
iv
Existing System
4.1.1Limitation
v
Proposed System
Advantages
5 SYSTEM DESIGN
5.1Project Modules
5.2Activity Diagram
5.3Use Case Diagram
5.4Data flow Diagram
5.5Sequence Diagram
6 IMPLEMENTATION
6.1 Algorithm/Pseudo code module wise
TESTING
BIBLIOGRAPHY
APPENDIX
vi
LIST OF FIGURES
vii
LIST OF TABLES
Table No. Name of the Table Page No.
Table 7.1.3 Functional Testing 22
Table 7.1.7 Unit Testing 23
Table 7.1.9 Integration Testing 24
Table B.1 Abbreviations 30
viii
CHAPTER -I
INTRODUCTION
CHAPTER - I
INTRODUCTION
1.1 Overview
According to an article published in GBD 2017 Obesity Collaborators, over 4
million people die each year due to excessive weight. From 1975 to 2016, the
number of children and adults experiencing obesity had increased from 4% to
18%. The problem of overweight and obesity is not only a problem of developed
countries, even low- income and developing countries are overtaking the total
number which is 30% excess than the total cases in developed countries.
To overcome this problem, a BMI prediction system using Kinect and data
mining techniques will be implemented so that individual can easily monitor
their BMI values by taking a snapshot of their face.
The scope of the project is, it is user friendly for aged, severely ill
patients and physically challenged people.
The traditional method of calculating BMI is inconvenient and requires
physical measuring of a person and particular instruments.
The system is useful for society to overcome the traditional method and
predict the BMI using facial images.
1.4 Objectives
Face detection and feature extraction component using Kinect to detect
useful face outline information.
Recognition of Useful Facial Information, not only detect the face position
but also obtain face outline information that is useful for BMI prediction.
Features Extractions from recognised facial information then data
will be normalized for extracting features of good quality for the
BMI prediction.
1.5 Methodology
Random Forest Algorithm: Random forest is a Supervised Machine Learning
Algorithm that is used widely in Classification and Regression problems. It
builds decision trees on different samples and takes their majority vote for
classification and average in case of regression.
6
CHAPTER -II
LITERATURE SURVEY
CHAPTER – II
LITERATURE SURVEY
Disadvantages
Authors: Hera Siddiqui, Ajita Rattani, Dakshina Ranjan Kisku, Tanner Dean
Disadvantages
2.3 “Investigation on Body Mass Index Prediction from Face Images”, 2020
IEEE- EMBS Conference on Biomedical Engineering and Sciences
(IECBES), March 2021. Authors : Chong Yen Fook, Cheechin Lim,
Vikneswaran Vijean
Disadvantages
Disadvantages
Disadvantages
Disadvantages
• System is unstable
• Redundancy
• Complex Algorithms
CHAPTER -III
SYSTEM REQUIREMENTS AND
SPECIFICATIONS
CHAPTER – III
SYSTEM REQUIREMENTS AND SPECIFICATION
The process of breaking down a complex topic or substance into smaller bits in order to
get a better knowledge of it is known as analysis. The Analysis Phase's main draw is
gathering requirements. In most cases, obtaining requirements entails more than merely
asking consumers what they require and writing down their responses. The method for
gathering requirements has its own clearly defined process, depending on the
complexity of the application.
CHAPTER -IV
SYSTEM ANALYSIS
CHAPTER -IV
SYSTEM ANALYSIS
4.1 Existing System
• we used python face recognition library which is based on ResNet-34 from the Deep
Residual Learning for Image Recognition .
• The fewer layers and the number of filters reduced by half. It maps a “face” into
a feature vector of 128-d which can comprise various features like:
a. Height of face (cm)
b. Width of face (cm)
c. Average color of face (R, G, B)
d. Width of lips (cm) e. Height of nose (cm)
• We trained various regression models like simple linear regression model, ridge
linear regression model, random forest regressor and kernel ridge regression on
images from the given dataset and calculated the goodness metric for each
model.
• Goodness metric consists of mean square error, variance score i.e., r2 score,
mean absolute error and accuracy of the model. We compared models based on
this criterion and used the best one for final prediction.
• Data Preprocessing, Data Extraction, data evaluation and presentation is carried
out in the mining phase, mining is done to gather the relevant information of the
image features.
• The term "normalization" refers to a process that alters the range of pixel
intensity levels to make the image more familiar or normal to the eyes.
• Image Normalization may be used to remove high-frequency noise and
extremely low noise from an image, which is highly valuable, Our objective is to
restore an image's contrast such that it is normal to our senses when it has low
contrast.
4.2.1 Advantages
• Considered large number of facial features.
• Huge dataset about thousand subjects.
• The scope of the project is, it is user friendly for aged, severely ill
patients and physically challenged people, The system is useful for
society to overcome the traditional method and predict the BMI using
facial images.
CHAPTER -V
SYSTEM DESIGN
CHAPTER -V
SYSTEM DESIGN
BMI prediction system consists of two parts as shown in Fig 4.1. The first part is a face
detection and feature extraction component using Harr Cascade to grab useful face
outline information. Here Harr Cascade is chosen because they are very fast at
computing Haar-like features due to the use of integral images (also called summed
area tables). They are also very efficient for feature selection through the use of the
AdaBoost algorithm. The second part of the system is the BMI predictor. The
predictor responses for extracting facial features related to the BMI values and perform
the prediction using keras model, which uses CNN algorithm.
The angles and distances from which photographs are taken can have a significant
impact on the face features captured. To obtain relevant facial features, we must first
identify valuable images, such as the frontal face, and then do normalization, such as
rectification of the slanting face. Many other characteristics, including gender, age, and
human DNA, will have an impact on the relationship between facial curves and BMIs.
As a first step, we want to create a basic BMI prediction system so that we can collect
additional data. We used Keras Application Programming Interface (Keras API) to
create this BMI prediction model. Keras is a Python- based neural network Application
Programming Interface (API) that is tightly linked with TensorFlow (a machine
learning framework). This model provides a straightforward, user- friendly method of
defining a neural network, which TensorFlow will subsequently construct for the user.
TensorFlow is a set of open-source frameworks for developing and dealing with neural
networks, such as those used in ML and Deep Learning applications. Convolutional
Neural Network(CNN) is the algorithm utilized in this research. CNN is a Deep
Learning system that can take an input picture, give relevance (learnable weights and
biases) to various aspects/objects in the image, and distinguish between them.
A use case is a collection of interactions between external entities and the system under
examination that has a specific aim. Actors are the external entities that interact with
the system.
1) Actors
2) System
3) services
A set of use cases describes the system's whole functionality at a specific level of
detail, and it can be represented graphically using a use case diagram. Fig 4.4 depicts
the proposed system's use case diagram.
A use case model is made up of several model parts. The use case, actors, and their
relationships are the most significant model pieces. To simplify communications, a use
case diagram is used to graphically describe a portion of the model. One of them is the
use case diagram, which is used to collect system needs and actors. Use case diagrams
show how a system's events and flows are represented. However, the use case graph
does not explain how they are implemented.
Fig 5.3.1 Use case model
5.4 Data Flow Diagram
Data flow diagrams depict the flow of data in a corporate information system
graphically. Data Flow Diagram symbols are standardized notations, like rectangles,
circles, arrows, and short- text labels, that describe a system or process’ data flow
direction, data inputs, data outputs, data storage points, and its various sub-processes.
DFD denotes the steps involved in transferring data from the input to file storage and
report production in a system. There are two types of data flow diagrams: logical and
physical. The logical data flow diagram depicts the movement of data through a system
in order to fullfil specific business functions. The physical data flow graphic depicts
how the logical data flow is implemented.
• Face Recognition:
python face recognition library based on ResNet-34 from the Deep
Residual Learning for Image Recognition .
Haar Cascade is an Object Detection Algorithm, used for faces
recognition in images it is used to overcome rough estimation and provide
precise information.
• BMI Prediction:
The angle and distance at which photo is taken can have a big impact on the
facial features that are captured
normal front face is taken and normalization is performed such as
rectification of the slanting face in order to get relevant facial features.
This BMI prediction model was built using the Keras Application
Programming Interface (Keras API), it is a neural network API written in
Python that is closely tied to TensorFlow, a machine learning framework.
The algorithm used is Convolutional Neural Network (CNN), which is a
Deep Learning system that can take an input image and assign learnable
weights to various objects in the image.
Pseudo Code:
(i) BMI Prediction Code
from email.mime import
image from tkinter import *
import tkinter
from tkinter import
filedialog import numpy as
np
from tkinter.filedialog import
askopenfilename import pandas as pd
from tkinter import
simpledialog import numpy as
np
import cv2
import os
from Model import get_model
main = tkinter.Tk()
main.title("FACE TO BMI") #designing main screen
main.geometry("800x700")
global filename
global image
global Model
global
faceCascade
def loadModel():
global model
global
faceCascade
textarea.delete('1.0', END)
cascPath = "model/haarcascade_frontalface_default.xml"
faceCascade =
cv2.CascadeClassifier(cascPath) model =
get_model(ignore_age_weights=True)
model.load_weights('model/bmi_model_weig
hts.h5')
textarea.insert(END,"BMI Prediction & Face Detection Models loaded\n")
def upload():
global filename
textarea.delete('1.0', END)
filename = filedialog.askopenfilename(initialdir="images")
textarea.insert(END,filename+" image loaded")
def predictBMI():
global model
global
faceCascade
global filename
textarea.delete('1.0',
END) frame =
cv2.imread(filename)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(gray,scaleFactor=1.1, minNeighbors=5, minSize=(30,
30),
flags =
cv2.CASCADE_SCALE_IMAGE)
print("Found {0}
faces!".format(len(faces))) img =
None
for (x, y, w, h) in faces:
img = frame[y:y + (h+10), x:x +
(w+10)] if img is not None:
img = cv2.resize(img,(224,224))
temp = []
temp.append(im
g)
temp = np.asarray(temp)
prediction =
model.predict(temp) bmi =
prediction[0][0]
bmi = bmi / 20
result = ''
if bmi <19.5:
textarea.insert(END,"Your BMI predicted as : "+str(bmi)+"\n")
textarea.insert(END,"The Person is underweight \n")
result = " The Person is Underweight "
def exit():
global
main
main.destroy()
main.config(bg='light coral')
main.mainloop()
(ii) Model
age_model =
ResNet50( include_to
p=False,
weights='imagenet',
input_shape=(224,22
4, 3), pooling='avg'
)
prediction = Dense(units=101,
kernel_initializer='he_normal',
use_bias=False,
activation='softmax',
name='pred_age')
(age_model.output)
def get_model(ignore_age_weights=False):
base_model =
get_age_model() if not
ignore_age_weights:
base_model.load_weights('age_only_resnet50_weights.061-3.300-4.410.hdf5')
print('Loaded weights from age
classifier') else:
print("not require")
last_hidden_layer = base_model.get_layer(index=-2)
base_model = Model(
inputs=base_model.input,
outputs=last_hidden_layer.o
utput)
prediction = Dense(1, kernel_initializer='normal')(base_model.output)
TESTING
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, subassemblies, assemblies and/or a finished product It is
the process of exercising software with the intent of ensuring that the Software system
meets its requirements and user expectations and does not fail in an unacceptable
manner. There are various types of test. Each test type addresses a specific testing
requirement.
invoked.
Unit testing is usually conducted as part of a combined code and unit test phase
of the software lifecycle, although it is not uncommon for coding and unit testing to be
conducted as two distinct phases.
Table 7.1.7 Unit Testing
Test objectives
• All field entries must work properly.
• Pages must be activated from the identified link.
• The entry screen, messages and responses must not be delayed.
Features to be tested
• Verify that the entries are of the correct format
• No duplicate entries should be allowed
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
CHAPTER – VIII
PERFORMANCE ANALYSIS
CHAPTER -VII
PERFORMANCE ANALYSIS
Process Of Execution
We will use the python CNN (convolution neural networks) technique to estimate BMI
by evaluating face characteristics in this project. CNN will take a picture as input,
extract face characteristics from the image, then estimate BMI based on the facial
features. We created the following modules to implement this project.
This module will load the CV2 library for face detection and the CNN model for BMI
detection. The facial detection library assists us in detecting a human face from an
uploaded image, which is subsequently fed into the CNN model to estimate BMI.
2) Upload Image:
We will use this module to upload an image to the application and the Dashboard shows
the address of the uploaded image.
This model extracts a face from an input picture and analyses facial characteristics to
estimate BMI value. Based on the BMI Value one can check the health status, Users
may also be given insurance quotes based on their estimated BMI.
CHAPTER – IX
CONCLUSION AND FUTURE SCOPE
CHAPTER-IX
Conclusion
The System provides the BMI values using data mining technique’s. This system
used data to assess any participants BMI-related facial traits, as well as visualization
to guarantee that human judgements matched intuitions. This BMI values gives a
understanding about the person’s health based on the values person should take care
of his health. This work deve loped a BMI prediction system using data mining
approaches. Our technology ensures the use of front-facing photos using Harr
Cascade object detection algorithm and calculates BMI by creating a model using
inbuilt Tensorflow, Keras modules where we use CNN algorithm. This study
employed data to determine the BMI-related face characteristics of any participants,
and visualization to ensure that human judgments were consistent with intuitions and
it also classifies the person into given categories such as under-weight (BMI value
below 18), healthy (BMI value between 18.1 to 30), over-weight (BMI value between
30.1 to 40), obesity (BMI value above 40).
Future Enhancement
➢ The efficient future enhancement could be the BMI detection system in a mobile
as a application.
➢ The mobile app is more user friendly than a PC/Laptop as vast number of
users uses smart phone’s.
➢ The Enhanced Application may also generate a typical health report based
on the prediction.
BIBILOGRAPHY
BIBILOGRAPHY
[2] T. Leyvand, C. Meekhof, Y.-C. Wei, J. Sun, and B. Guo, “Kinect identity:
technology and experience,” Computer, 44(4), 2011. DOI: 10.1007/978-81-322-0740-
5_21.
[3] L. Wen, and G. Guo, “A Computational Approach to Body Mass Index Prediction
from Face Images,” Image and Vision Computing, Lane Department of Computer
Science and Electrical Engineering, West Virginia University, Morgantown, WV,
26506, United States, 31: 392-400, 2013.
[4] V. Coetzee, D.I. Perrett, L.D. Stephen, “Facial Adiposity: a Cue to Health?”
Perception, 38: 1700–1711, 2009. PMID: 20120267 DOI: 10.1068/p6423.
[5] V. Coetzee, D.I. Perrett, L.D. Stephen, “Deciphering Faces: Quantifiable Visual
Cues to Weight,” Perception, 39: 51–61, 2010;39(1):51-61. DOI: 10.1068/p6560.
[6] D. D. Pham, J.-H. Do, B. Ku, H. J. Lee, H. Kim, and J. Y. Kim, “Body Mass Index
and Facial Cues in Sasang Typology for Young and Elderly Persons,” Evidence- Based
Complementary and Alternative Medicine, 2011. Integr Med Res. 2015 Dec; 4(4): 189–
194. Published online 2015 Aug 17. doi: 10.1016/j.imr.2015.08.001.
[7] B.-J. Lee, J.-S. Jang and J.-Y. Kim, “Prediction of Body Mass Index from Facial
Features of Females and Males,” International Journal of BioScience and Bio-
Technology, 4(3), 2012.
APPENDIX
APPENDIX A: Screen Shots
Figure A.4: Predicted BMI Value and Health Status of Obese Person
APPENDIX B: Abbreviations