Food Quality Detection And Calorie Estimation Using Machine Learning

Page 1

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056

Volume: 09 Issue: 08 | Aug 2022 www.irjet.net p-ISSN:2395-0072

Food Quality Detection And Calorie Estimation Using Machine Learning

Prakash R1 , Vadlapatla Sathvik2 , Potru Teja Sri Venkata Satya Sai3 , Pothireddy Gopichand Reddy4

1Assitant Professor Sr.Grade1, SENSE, Vellore Institute Of Technology, Katpadi, Tamil Nadu-632014 2,3,4 Student, SENSE, Vellore Institute Of Technology, Katpadi, Tamil Nadu-632014 ***

Abstract - Many states in India lack proper food supply to the poor. Many NGOs and non-profitable organizations work towards feeding the homeless and needy. But they lack funding and hence proper food storage facilities and maintenance is scarce. This project mainly focuses on helping these organizations to keep the food in check and serve unspoiled food. It also keeps track of the calories so a well-balanced diet food is given.

Key Words: food safety, calorie estimation, machine learning, oxygen sensor, MQ3 sensor, IOT.

1. INTRODUCTION

In this modern era of science of technology, the food sector is facing one of the major problems that is food spoilage. food items such as fruits, vegetables and meat are going stale .The bigger problem is these spoiled items going undetected and onto the hands of the consumer . Hence, there is a need for an automated process that would not only increase the accuracy of spoiled food detection,butalsoestimatingcaloriespresentinit

This project mainly focuses on helping NGO’s and organizations to keep their food in check and serve unspoiledfood.Italsoaimsatkeepingtrackofthecalories soawellbalanceddietfoodisgiven.Wearealsodesigning a mobile app which can be used to fetch data about calories of different vegetables and fruits for the users by uploading the image of any vegetables or fruits so as to keep track of their calories and maintain a healthy balanceddiet.

In details, to automate this process, we are planning on using a collection of smart sensors like temperature sensor, MQ3 sensor with microcontroller like the Node MCU.Ondetectionofaspoiledor stalefooditem,asound buzzerwillringanda

LED light will glow to draw attention, we developed an app, as an application of IoT. This enables consumers to viewthenameoffruitorvegetableandalsowiththehelp ofdevelopingappwecanestimatetheamountofcalories presentinit.

In addition, the app classifies the image, predicts the name of the fruit or the vegetable and gives the calories associatedwithit.Thefrontend-backendishandledbythe

Streamlit. The user can visit the application by URL. The user can use the upload button upload button to upload theimage.

2. LITERAUTRE SURVEY

There have been previous papers on different fields on food spoilage and calorie estimation.[1] An Arduino sensor-based approach for detecting the food spoilage A projectonmonitoringtemperatureinasmallserverroom havebeenimplementedpreviously.Thedataissentonline and if the values exceed a limit, the system turns the conditioningsystemsonandmakesthetemperatureinthe thresholdvaluesThispaperisanIOTbasedconsistingofa microcontrollerArduinoUno,Bluetoothmodule,electrical and biosensor like pH sensor, dampness sensor, and gas sensors. DHT- 11 is used to measure temperature and moistness,MQ2todistinguishliquorcontentislinkedwith Arduino board. This is an IoT based system, sends necessary information to user through ESP8266 Wi-Fi. Here they focus on keeping the food storage surrounding to the optimal conditions [2] Iot based smart weighing system for crate in agriculture. [3] A new deep learning based food recognition system for dietary assessment on anedgecomputingserviceinfrastructure.

Chang Liu, Yu Cao , Senior Member, IEEE, Yan Luo, Member, IEEE, Guanling Chen, Member, IEEE, Vinod Vokkarane,SeniorMember, IEEE,Ma Yunsheng,Songqing Chen, Member, IEEE, This paper focuses on nutritional estimation of food using the visual based food recognition algorithmsusingedgecomputing.Theprojectusesavisual sensor for capturing the food image, the mobile phone for the image preprocessing and segmentation and the server (cloud layer) with the pre trained CNN model and image classification. The multiple-stage food recognition system includes Image preprocessing in the front-end component and the Image segmentation in the front-end component (CNN based food image analysis) Every living being on earth is essentially dependent on nutrition to stay alive. Each individual cell needs energy to continue its vital activities such as growth, development and renewal of damages. Environmental conditions, for instance humidity and temperature allow organisms to spread inside food, these bacterial activities cause unwanted food spoilage which may be harmful for human health. [1].In India Data analysis showed that states of West Bengal (31.22),

©
2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page1247

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056

Volume: 09 Issue: 08 | Aug 2022 www.irjet.net p-ISSN:2395-0072

Karnataka(29.11)andGujarat(22.67)reportedmaximum average outbreaks and contributed to 31.5% illnesses and 8.7% deaths. Detecting food spoilage from production to consumption stages is very crucial. There is indeed an urgent need for fast and accurate systems, while conventional spoilage detection techniques are slow and time consuming [2]. As a result, new vision based techniques and algorithmic approaches have been proposedinthelastdecades.Themostrecentlydeveloped methods for detecting. Food spoilage are based on digital image processing, by using nano technology and state-ofthe-artmachinelearning,whichhavealreadyproventheir high potential in the food industry. Here for food spoilage detection we are using nanotechnology,[3]. Nanotechnology based sensing approaches are capable of providing selective and specific information on the presence and amount of pathogens and toxins.in this projectweareusingMQ3sensor[4].ThisMQ3sensorthat is used to detect the presence of toxic gas acetone and ethanol in the spoiled food. And also we are using oxygen sensor which tells us that [5] if food item is inhabited by germs ,the oxygen levels in the immediate surrounding is going to be lower than it normally is .The introduction of thesesensorsintofooddetectiontechnologyhaspavedthe way for smart food detection. These sensors will be integrated with [6]Arduino uno board which is a popular prototyping board measures and sends data to iot platform.

3. PROPOSED MODEL DESCRIPTION

In our proposed work, weaim at detecting spoilage in fooditemsasapartofhardwareandestimatingcaloriesin food as a part of software. With the help of sensor nodes placed near food items methane range and temperature data can be collected at regular intervals. In this project we have used industrial MQ3 and temperature sensors. NodeMCUis withArduinoUnoboards.

In the block diagram, MQ3 and oxygen/temperature sensorisconnectedtotheArduinoboardsandhencegets connected to the Node MCU. Finally the data is shown on theblynkappandatthesametimethebuzzersareturned on to indicate spoilage of food if the values exceed the threshold.

For the software part, it is a simple web application in which the user needs to upload the Image of any fruit or vegetable. The system next automatically classifies the Imageandgivesthepredictionaboutthenameofthefruit orvegetable,andalsogives thecalories oftheobject. The frontend-backend will be handled by the Streamlit. The usercanvisittheapplicationbyURL.Therewillbeupload buttonfortheusertouploadtheimage

Fig -1:ProcessFlowchart

4. TECHINCAL SPECIFICATIONS

Our proposed work consists of 2 parts – hardware and software The hardware consists of a MQ3 sensor along with temperature for methane extent and temperature measurement respectively, Arduino UNO and nodeMCU for acquiring data from sensors and sending to the ArduinoIDE.AbuzzerandtwoLED,sareconnectedtothe Arduino UNO for indicating the spoilage of the food and blynk app for displaying the methane and temperature data.

The frontend and backend of the web app is handled by theStreamLit.Itisa simple webapplicationin which the user needs to upload the Image of any fruit or vegetable. The system next automatically classifies the Image and gives the prediction about the name of the fruit or vegetable,andalsoabouttheirrespectivecalories.

The user will first upload the Image. That image Will be stored into the local system. Then pillow will resize the image according to our model shape, it will convert into vector. Now this vector will be passed to our model, our modelwillclassifytheclassofcategory.WewillgettheID of category, now we need to map the labels according to theID.Nowoursystemwill doweb-scrapthecaloriesfor predicted object. Our application will display the Result andCaloriesintoourapplication

Fig -2:Flowchart

© 2022,
|
Certified Journal | Page1248
IRJET
Impact Factor value: 7.529 | ISO 9001:2008

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056

Volume: 09 Issue: 08 | Aug 2022 www.irjet.net p-ISSN:2395-0072

5.HARDWARE

5.1. Arduino UNO

Arduino is an open source platform used for building electronic projects.it is a company.it is basically a microcontroller. generally a microcontroller is difficult to use and programming needs some experience. whereas it comes as module with necessary pins and sockets connected with microcontroller along with IDE in easy programming language making it easier for small project applications.

5.2. MQ3 sensor

MQ standards for having sensitivity towards gas. It is made up of metal oxide semiconductors. MQ sensor are called chemo resistor because sensor values change according to change in resistance of gas. Specifications of MQ3 sensor are it operates 5V dc and draw 800 Mw, sensor resistance from 1M to 8MΩ, load resistance is 200kΩ.Thismodulehas4pinsAnalogOutput(A0),Digital Output (D0), VCC, GND pins. The A0 pin output will be varied according to concentration of gas, when concentration of gas is high, output of A0 pin is high and viceversaforlowconcentrationofgas.

5.3. ESP8266 Node MCU

NodeMCU is a low-cost open source IoT platform. It initially included firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which was based on the ESP-12 module. Later, support for the ESP3232bitMCUwasadded

5.4. Piezoelectric Buzzer

A piezoelectric speaker is a loudspeaker that uses the piezoelectric effect for generating sound. The initial mechanical motion is created by applying a voltage to a piezoelectricmaterial.

5.5. Temperature sensor

A temperature sensor is a device used to measure temperature. This can be air temperature, liquid temperatureorThetemperatureofsolidmatter.Thebasic principle of working of the temp. sensors is the voltage across the diode terminals. If the voltage increases, the temperature also rises, followed by a voltage drop between the transistor terminals of base and emitter in a diode. Here we have used a thermistor in this project model.

6.SOFTWARE

6.1.PyCharm

Fig -3:HardwareCircuit

PyCharm is an integrated development environment used in computer programming, specifically for the Python programming language. It provides code analysis, a graphical debugger, an integrated unit tester, integration withversion,andsupportswebdevelopmentwithDjango aswellasdatascience

6.2.Kaggle

Kaggleisworld’slargestdatasetcommunitywithpowerful tools and resources to help to achieve one’s data science goals.Itallowsuserstofindandpublishdatasets,explore and build models in a web-based data-science environment,workwithotherdatascientistsandmachine learningengineers,andenter

6.3.Web App

The web app contains a signup, login and main webpage. which the user needs to upload the Image of any fruit or vegetable. The system next automatically classifies the the Image and gives the prediction about the name of the competitions to solve data science challenges. Fruit or vegetableandalsoabouttheirrespectivecalories

Fig -4:CalorieestimationWebApp

© 2022, IRJET | Impact
7.529 | ISO 9001:2008 Certified Journal | Page1249
Factor value:

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056

Volume: 09 Issue: 08 | Aug 2022 www.irjet.net p-ISSN:2395-0072

7. RESULTS

7.1.Hardware

AlltheconnectionsaresuccessfullymadeandArduinoand nodeMCUisturnedon.Thesensorsarebroughtclosetoa sample of food. The sensors connected to the Arduino polls data from both the sensors. This data is sent to the nodeMCU which the sends the data to the blynk app via IDE code. On detection of a spoiled or stale food item a buzzer sound will ring and a LED light will glow, notified throughblynkappviatheArduino.

Fig -8:BlynkAppoutputreading

Fig -5:ArduinoIDEcode

7.2.Software

The user will first upload the Image. That image Will be stored into the local system. Then pillow will resize the image according to our model shape, it will convert into vector. Now this vector will be passed to our model, our modelwillclassifytheclassofcategory.WewillgettheID of category, now we need to map the labels according to theID. Now our systemwill do web-scrapthecaloriesfor predicted object. Our application will display the Result andCaloriesintoourwebsite.

Fig -6:MethaneAndTemperaturedatavalues

Fig -9:Predictionandcaloriesestimationofbanana

The user will first upload the Image. That image Will be stored into the local system. Then pillow will resize the

Fig -7:FoodSpoilAlert

©
2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page1250

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056

Volume: 09 Issue: 08 | Aug 2022 www.irjet.net p-ISSN:2395-0072

image according to our model shape, it will convert into vector. Now this vector will be passed to our model, our modelwillclassifytheclassofcategory.WewillgettheID of category, now we need to map the labels according to the ID. Now our system will do web-scrap the calories for predicted object. Our application will display the Result andCaloriesintoourapplication.

[5]&Papkovsky,Dmitri.(2019).OxygenSensorsforFood Packaging. 10.1016/B978-0-12-815781- 7.22944https://www.researchgate.net/publication/34402033 5_Oxygen_Sensors_for_Food_Packaging

[6]“FOOD QUALITY SYSTEM BY USING ARDUINO”, St.Martin’s Engineering college, B.Ravi Chander, https://jespublication.com/upload/2020-110485.pdf

[7]Hu, H., Zhang, Z., & Song, Y. (2020), Image based food caloriesestimation https://arxiv.org/pdf/2106.11776.pdf

[8]Y. Liang and J. Li, (2017). “Deep learning-based food calorie estimation method in dietary assessment”, [online]Available:https://arxiv.org/abs/1706.04062.

Fig -10:Predictionandcaloriesestimationofcarrot

8. CONCLUSION AND FUTURE SCOPE

We were able to detect spoilt food with the help of the proposed hardware model and also able to predict and calculate calories of different fruits and vegetables with the help of the software model. We can further detect spoilage of food for wider range of food items by increasing the number and types of sensors used in the project. For the software model we can further make it accurate for detection spoilage of food when uploaded a realtimepictureofaspoiltorstalefood.

9. REFERENCES

[1] A surveillance of food borne disease outbreaks in India https://www.sciencedirect.com/science/article/abs/p ii/S0956713520305466?via%3Dihub

[2]B. Fletcher and et al., “Advances in meat spoilage detection: A short focus on rapid methods and technologies,” J. Food, vol. 16(1), pp. 1037– 1044, 2018. https://doi.org/10.1080/19476337.2018.1525432

[3]Mustafa F., Hassan R.Y., Andreescu S. Multifunctional nanotechnology- enabled sensors for rapid capture and detection of pathogens. Sensors. 2017;17:2121. https://doi.org/10.3390/s17092121

[4] “Automatic Food Spoilage Detection”, International Journal of Emerging Technologies and Innovative Research UG C and issn Approved), March 2018, http://www.jetir.org/papers/JETIREP06022.pdf

Cruz-Romero,Malco&Santovito,Elisa&Kerry,Joe

[9]Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2017). ImageNetclassificationwithdeepconvolutionalneural networks. Communications of the ACM, 60(6), pp. 84–90 https://doi.org/10.1145/3065386

[10]Simonyan, K., & Zisserman, A. (2015). “Very Deep Convolutional Networks for Large-Scale Image Recognition”, CoRR, abs/1409.1556. Retrieved from http://arxiv.org/abs/1409.1556

[11]World Health Organization (2020). “Obesity and overweight.” Accessed: April 1, 2020. [Online]. Available: https://www.who.int/newsroom/facthttps://www.who.int/news-room/factsheets/detail/obesityandoverweightsheets/detail/obesity-andoverweight

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page1251

Turn static files into dynamic content formats.

Create a flipbook
Food Quality Detection And Calorie Estimation Using Machine Learning by IRJET Journal - Issuu