Skip to content

This repo contains my bachelor thesis project which is a conveyor belt system that detects and separates rotten fruits using machine learning.

License

Notifications You must be signed in to change notification settings

ierolsen/Bachelor-Thesis-Project-ML-Based-Conveyor-Belt-for-Detecting-Separating-Rotten-Fruits

Repository files navigation

Bachelor Thesis Project: Conveyor Belt System for Detecting and Separating Rotten Fruits

This repository contains my Bachelor Thesis Project that is a conveyor belt system which detects and separates rotten fruits. The project combines machine learning and mechanical engineering to achieve the goal of reducing food waste in the food industry.

ayırma_GIF


Youtube Video

By clicking the thumbnail below, you can watch the video on Youtube.

The Youtube Video


Project Overview

The conveyor belt system has been designed using SolidWorks, the 3D CAD file can be found in this repository (note: some parts may have been changed during assembly).

diagram2

kod_sema

The system uses a camera to stream real-time video of fruits passing along the conveyor belt, and the images are processed using PIL and OpenCV to predict the freshness of each fruit.

VIDEO_SCREEN_JPG

The prediction model is based on the transfer learning model Xception, which has been trained using Keras. The model has achieved a validation loss of 0.00265.

080223_training

If a fruit is detected as rotten, the real-time database on Firebase is updated. A Raspberry Pi continuously receives the data from Firebase, and if the value of run is True, a DC motor is activated to separate the rotten fruit. The numbers of rotten and fresh fruits are updated in the database.

motor_gif1 motor_gif2

Using Qt Designer, a GUI has been designed to display the numbers of fresh and rotten fruits, which continuously receives data from the Firebase database.

GUI_


Dataset

The dataset used for this project can be found on Kaggle: https://www.kaggle.com/datasets/sriramr/fruits-fresh-and-rotten-for-classification

The dataset contains six classes: "rotten apple", "rotten banana", "rotten orange", "fresh apple", "fresh banana", and "fresh orange". Although the dataset only contains these specific fruits, the model is able to recognize other types of fruits, such as quince, outside of the dataset after combining all classes together as rotten and fresh.


Requirements

The required libraries for this project are listed in the requirements.txt file. Please note that the file is only intended for Windows OS.

For Raspberry Pi, the following libraries are required:

  • rpi.gpio
  • Pyrebase

Please note that Pyrebase only works on Python 3.6. It does not work on newer versions of Python.

Installation

To install the required libraries for Windows OS, run the following command:

conda create -n env_name python=3.6
activate env_name
pip install -r requirements.txt

NOTE: In order to create the Database on Firabase, first create a python file named firebase_secrets inside of the motor folder. This created python file must contain the configuration keys that you can get on Firebase. Then the code will be ready to create a Database on Firebase.

Running the Codes

Be sure that you have already installed the requirements into the environment that existed.

GUI:

python app.py

Main Code:

python run.py

Raspberry Pi

Be sure that you have already installed necessary libraries into Raspberry Pi too.

python motor-run.py

Materials Used

Mechanical Parts

In the frame of the conveyor belt, I have chosen Sigma Profile for easy assembling.

  • 5 Meters 30x30 Sigma Profile Slot:8
  • 2 Meters 30x60 Sigma Profile Slot:8
  • 50 pieces Hidden Corner Bracket 30x30 Slot:8
  • 35 pieces T Slot Nut M8 30x30 Slot:8
  • 15 pieces T Slot Nut M6 30x30 Slot:8
  • 4 pieces 6203 Bearing
  • 2 Meters Belt

mechanical parts

Electrical Parts

  • Logitech C270 HD WebCam
  • DC-Motor
  • Gear Motor (1405 rpm, 0,18kW)
  • Raspberry Pi Model 3 A+
  • L298N DC Motor Driver

electrical  parts


Conclusion

This project showcases my skills in machine learning, mechanical engineering, and GUI design, and has the potential to make a positive impact in the food industry by helping to reduce food waste.


Releases

No releases published

Packages

No packages published