Wednesday, November 13, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

Fresh and Rotten Fruit Detection Using Raspberry Pi

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 sorting it out.

- Advertisement -

Bill of Materials for Fresh and Rotten Fruit Detection

Fresh and Rotten Fruit Detection System Parts

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

- Advertisement -

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.

Rotten Fruit Detection ML Model
Fig 1.
Rotten Fruit Detection using Tensorflow
Fig.2: Rotten Fruit Detection using Tensorflow

Rotten Fruit Detection System – Code 

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.

Code for Rotten Fruit Detection System
Fig 3.
Rotten Fruit Detection System Code
Fig. 4: Rotten Fruit Detection System Code

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.

Rotten Fruit Detection using Machine Learning
Fig 5: Rotten Fruit Detection using Machine Learning

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

Download ML Model and Code

Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics