To analyze whether or not the food served to us is fresh or otherwise is a challenging task. There have been occasions where we have been exposed to unhealthy food that resulted in some medical ailments. So, the general idea of the project is to develop an android application through which a user ca
Detecting Food Freshness through Machine Learning and Image Processing
To analyze whether or not the food served to us is fresh or otherwise is a challenging task. There have been occasions where we have been exposed to unhealthy food that resulted in some medical ailments. So, the general idea of the project is to develop an android application through which a user can capture a food image and it gives back a prediction that whether the food is fresh or expired. For this purpose, the things our project depends upon are
First of all, around 600 images of both fresh and expired food were collected to train and test our deep learning model. After collecting the images, we applied Data Augmentation technique on those images to increase our dataset to 8200 images. Then all the images were resized to 400 x 400 size for better resolution. As far as the deep learning model is concerned pre trained models such as Resnet50 and MobileNet were preferred to perform this project. The deep learning model was trained with highest possible accuracy. Secondly, this model was deployed on to a local server using Flask web service. Thirdly, an android application was developed using Flutter framework. Through this application the user can take a picture of the food and a prediction is given back that either the food is fresh or expired. This whole project can benefit different food authorities which raid different food places now and then and even the common people in consuming healthy food.
We aim at launching an android application in the market specifically for the food authorities in the country which would make their work efficient and time saving and also for common people in consuming healthy food. Following are the project objectives:
The project was implemented in eight phases which are as follow:
1- Data Collection:
In this phase around 600 images were collected. Three hundred were of fresh food and the remaining of expired food. Images were captured using mobile phone's camera.
2- Data Preprocessing:
As a deep learning model requires a lot of data to train upon so, during the preprocessing phase we applied different Data Augmentation techniques to increase our dataset from 600 images to 8200 images. Moreover all the raw images of higher dimensions were resized to 400 x 400 size.
3- Transfer Learning:
During this phase we chose two pretrained models (Resnet50 and MobileNet) to use for training purpose. The weights of the pretrained models were used and retrained according to the problem we are dealing with using our dataset. Plus the fully connected layer of the models were also changed. Resnet50 gave us better results so it was used in this project.
4- Training of the Model:
In this phase after applying transfer learning and changing the fully connected layers of our Resnet50 model, we trained it with 6000 training images out of which 3000 were of fresh food and remaining 3000 were of expired food and 1000 validation images containing 500 images for each class. Resnet50 gave us good results.
5- Testing of the Model:
In the testing phase we tested our Resnet50 model with 1200 images containing 600 images for each class. These images were new to the model and were not used in the training phase. We got a testing accuracy of about 83.5%. Later on the model was tested using different metrics such as precision, recall and F1 scores which also showed good results.
6- Creating Server:
After training and testing our model we created local server on our laptop using Flask web service.
7- Deploying the Model:
Once the server was created we deployed our model over it.
8- Developing Android Application:
We developed an android application using flutter framework and linked it with the server using IP address of the laptop. The application simply captures an image and sends the image to the server from where the prediction is displayed back on the application.
There have been a lot of occasions were we have been served with unhealthy and expired food which after consuming leads to a number of health related issues. We often hear now and then that many people die due to food poisoning and if not they become severely ill which also leads to spending a lot of money on recovering and affording medicines. So, this project can help minimize all of this by providing the users an application through which they can access the quality of the food that they are eating before consuming it. This can also help everyone in consuming healthy food and living a healthy life. Moreover, different food authorities can also use this application in analyzing the quality of the food items of a place which they raid without tasting them.
The final deliverable of the project will be an android application which would basically run on any mobile phone using the android operating system. Following is the detail of the application:
| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| SSD hard drive | Equipment | 1 | 6500 | 6500 |
| Android Phone | Equipment | 1 | 20000 | 20000 |
| Online Course | Miscellaneous | 1 | 1800 | 1800 |
| Documentation | Miscellaneous | 2 | 850 | 1700 |
| Total in (Rs) | 30000 |
Limb loss is very common among army veterans and it renders the capability of the affected...
In this busy era of life, we do not have time to do lots of things at one time. But we wan...
Nagaban is an online COVID-19 awareness platform which will be accessible to everyday user...
Coronaviruses are enveloped RNA viruses prevalent in birds and mammals including&nbs...