Friday, March 31, 2023

Fresh and Rotten Fruit Detection Using Raspberry Pi

Ashwini Kumar SInha

- Advertisement -
 

Hand-sorting rotten fruits from fresh ones in a batch of mixed fruits is a tedious and tiring job. Despite being time-consuming, most food processing factories carry out this method for making jams and other fruit-based products.

So to provide a much less demanding solution, today’s project focuses on creating a smart AI camera using a Raspberry Pi Development Board for Fresh and Rotten Fruit Detection and automatically sort it out.

Bill Of Materials for Fresh and Rotten Fruit Detection

- Advertisement -

Note:- Servo Motor / actuator is optional if you want to do any action like sorting then you can that function in code.

Creating ML model 

Before creating an ML model, different datasets need to be collected. You can do so by either capturing pictures of different rotten and fresh fruits or by downloading any online datasets having similar differentiating pictures. 

Next, create an ML model using various available options. To demonstrate this, I am using Lobe and Google Teachable Machine. After creating a new project and uploading the datasets into the ML model with correct labels, train it. Now download the trained ML model of TensorFlow and create a Python code for deploying it.

Fig 1.
Fig 2.

Coding 

Include OpenCV and other libraries in the code. Then capture a video with a webcam, cut the selected frame and save it. On passing the saved frame to the ML model for processing, the freshness/rottenness of the desired fruit will be detected and give the final result.

Fig 3.
Fig 4.

Testing 

Connect the camera and run the code. Put fruit in front of the camera to estimate its freshness/rottenness percentage so that sorting occurs. You can also modify the code for adding a servo motor or an actuator to move and sort out the fruits.

Fig 5

Note you can also make ML mode using different Tool like Google Teachable the Code folder contains ML model and python code and is also attached with ML model made from Google Teachable.

Download ML Model and Code

SHARE YOUR THOUGHTS & COMMENTS

 
 

What's New @ Electronicsforu.com?

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Tech Contests