The best way to estimate Food calories with the reference object(research Base)
Nowadays, diet has become part of life. Eating a healthy balanced diet accompanied by regular exercise is essential in maintaining physical and mental health and well-being. These effectively prevent excess weight gain or maintain weight loss, but healthier lifestyles are also associated with improved sleep and mood. I was wondering what if we can get the value of food calories. So, I started researching how we can get accurate calories of food from an image.
I know you may have seen many methods for Food calories estimation. But I Found a unique technique to get Food calories. In this article, I will discuss with you only about apple calories estimation.
As you all know, there are many deep learning models to estimate apple calories.
What is the Problem with deep learning models?
We know that if we use any deep learning models, the model will be overfitting or underfitting. Let’s see how to avoid it and get accurate calories from an image.
First, I had created a K-Mean clustering model. I trained it to cluster the unique pixel in the image or prepare it for only apple’s pixel. We will use a coin as a reference with apple.
After that, we will use an API to remove the background of an image and set any background colour, which will help us identify the image’s contour. Now it’s time to find contour using our K-Mean Clustering model and OpenCV. The output should like this:-
As we all know that an apple is a 3D object, we can use two images: Top View and Side View with coin as a reference(Note down the height and width of coin).
Now we can get the shape for both apple and coin. After getting the dimensions of apple and coin, convert them into either inch, meter, or centimeter (Take Average For top view height and width and side view height and width). The dimension we got after converting into a particular scale is just the image’s object dimension; what we want is the actual height and width of the apple. So we will compare the real coin’s height and width with the image’s coin height width. It’s just simple math. After comparison, we will get a ratio of the coin. After that, multiply the ratio with the image’s apple height and width, and we will have our actual height and width.
It’s so accessible from Now. We know how to find the volume of the sphere(use the Average value we saw before and take it as radius).
From the above equation(I was using this formula because it’s fit the best for the apple’s shape), We can get the Volume of the apple with the help of actual measurements. We know the standard density of apple, from that we will have apple’s weight. The value of an apple’s calories per 100gm is around 0.52. From the calories formula, we can quickly get the actual calories of an apple. Isn’t it relatively easy from other methods?
We can also check how accurate our method works; we can take the dimensions of apples we have and then apply the technique to the image and compare the weight of both results.
Here You can see what result I find from the method. In this sheet, I am sharing only a few marks.
Experiment Result: — https://cutt.ly/Inw4U05
The method we use is relatively easy from others, but it’s only possible with a reference object. It’s the only limitation of this method. We can improve this method, adding an artificial object with an apple in the real world. It will work handier.