How ierolsen/bachelor-thesis-project-ml-based-conveyor-belt-for-detecting-separating-rotten-fruits works
Main Components of the System
• Camera & Image Acquisition: The system uses a camera (e.g., Logitech C270) to stream real-time footage of fruits on the conveyor belt.
• Image Processing & Prediction Module: This includes the code that utilizes OpenCV and PIL to process images and the ML models (Xception in model/xception.py and possibly VGG16 from model/vgg16.py) to perform classification (fresh vs rotten).
• Data Management & Communication: Integration with Firebase for real-time updates of prediction results. Update operations for fruit counts and status are central to the system.
• Motor Control Module: Involves the Raspberry Pi integration and motor control code (files like motor/motor.py and motor/motor_control_db.py, along with motor-run.py) that act on Firebase updates to operate the DC-motor for separating rotten fruit.
• Graphical User Interface (GUI): The GUI (app.py and gui/main_gui.py along with gui/resources.py) displays real-time fruit counts from Firebase. It’s built using Qt Designer, indicating a clear separation of presentation from back-end processing.
• Training/Development Environment: The presence of train.py and a Jupyter notebook (in notebook/editing_dataset.ipynb) suggest environments to train the model and work with the dataset.
• Helper & Utility Code: helper.py likely contains various utility functions used across the processing.
Relationships and Interactions
• Data Flow: Begin with the Camera providing real-time images that move into an Image Processing module. After preprocessing, the images are classified via the ML model.
• Decision Making: Based on the classification outcome, the system updates the Firebase database with the current count of rotten vs. fresh fruits.
• Actuation: The Raspberry Pi monitors the Firebase database, triggering the motor control module to activate the motor if a rotten fruit is detected.
• User Interface: The GUI application polls or subscribes to Firebase updates to reflect the updated counts and statuses to the user.
• Training Pipeline: Separately, a training component (using train.py and the notebook) manages the machine learning model updates and validations, ensuring robust performance.
Architectural Patterns and Design Principles
• Separation of Concerns: Divide the system into distinct modules (processing, database, motor control, GUI) to ensure each component can be maintained independently.
• Real-time Data Flow: Employ a streamlined data pipeline from image capture → processing → decision → motor actuation → user update.
• Integration with External Services: Emphasize dependency on Firebase for real-time data communication, and note the separate environmental requirements for Raspberry Pi.
Steps for Construction
• Drill down into each component showing internal modules (e.g., model files within ML engine, firebase_secrets requirement inside motor for secure database configuration).
• Every connection is clear: for instance, the motor module’s dependency on configuration from firebase_secrets, the GUI’s continuous data retrieval from Firebase, and so on.
• Asynchronous communications where relevant (e.g., real-time updates and continuous monitoring loops on Raspberry Pi).