AI-Powered Apple Weight Estimation and Quality Grading System with Disease Detection

AI-Powered Apple Weight Estimation and Quality Grading System with Disease Detection

Advanced machine learning system for automated apple weight prediction, quality classification, and disease detection using computer vision and ensemble ML models. Built with Flask, XGBoost, and OpenCV for agricultural quality control.

Technology Used

Flask | Python | scikit-learn | XGBoost | OpenCV | Bootstrap 5 | JavaScript | Random Forest | Ridge Regression | Matplotlib | Seaborn | Pillow | NumPy | Pandas

codeAj
βœ“
codeAjVerified
πŸ†1K+ Projects Sold
Google Review

β‚Ή599

β‚Ή1999

Get complete project source code + Installation guide + chat support

Project Files

Get Project Files

Project Overview

The AI-Powered Apple Weight Estimation and Quality Grading System represents a cutting-edge solution in agricultural technology, combining computer vision and machine learning to revolutionize apple quality assessment. This comprehensive final year project demonstrates practical applications of artificial intelligence in the agricultural sector, making it an ideal choice for students pursuing AI and ML specializations.

This system leverages advanced image processing techniques and ensemble machine learning algorithms to simultaneously predict apple weight in grams, classify quality levels (Fresh, Average, Bad), and detect common apple diseases including Scab, Bitter Rot, and Sooty Blotch & Flyspeck. The multi-faceted approach ensures comprehensive quality assessment, making it valuable for commercial orchards, fruit processing facilities, and quality control laboratories.

Key Features and Functionalities

1. Multi-Model Weight Prediction

The system employs three distinct machine learning algorithms - Random Forest, XGBoost, and Ridge Regression - to predict apple weight with high accuracy. Through comprehensive feature selection methods including Boruta, RFE (Recursive Feature Elimination), and Random Forest Importance, the model achieves optimal performance by identifying the most relevant features from image data and quality metrics.

2. Quality Classification System

Advanced classification algorithms categorize apples into three quality grades based on multiple parameters extracted from images and CSV data. The quality grading system considers factors such as color consistency, size uniformity, surface texture, and other visual indicators to provide reliable quality assessments.

3. Disease Detection Module

Utilizing computer vision techniques powered by OpenCV, the system identifies three major apple diseases:

  • Scab: Fungal disease causing dark, scabby lesions
  • Bitter Rot: Circular brown spots with distinct patterns
  • Sooty Blotch & Flyspeck: Superficial blemishes affecting appearance
Early detection enables timely intervention and reduces crop losses.

4. Interactive Web Interface

Built with Flask and Bootstrap 5, the responsive web application provides an intuitive user experience. Users can upload apple images through file upload or camera capture, receiving instant predictions with detailed metrics including R-squared scores, MSE, RMSE, MAE, and MAPE values.

5. Comprehensive Feature Engineering

The feature extraction pipeline processes both image data from the Fruits-360 dataset and tabular data from apple_quality.csv, creating a rich feature set that captures color histograms, texture features, morphological characteristics, and quality indicators.

6. Multiple Train-Test Split Analysis

The system evaluates models across three different split ratios (80-20, 70-30, 60-40) to ensure robustness and detect overfitting. This comprehensive evaluation approach provides confidence in model generalization.

7. Automated Results Generation

Each training session produces detailed outputs including feature selection reports, model comparison charts, actual vs predicted plots, residual analysis, correlation heatmaps, and R-squared performance across splits.

Real-World Applications

Commercial Agriculture

Orchard owners and fruit distributors can implement this system for automated quality sorting, reducing manual labor costs while improving consistency and accuracy in grading operations. The disease detection capability enables early intervention, minimizing crop losses and optimizing harvest timing.

Food Processing Industry

Processing facilities can utilize the weight estimation feature for portion control, inventory management, and pricing optimization. Quality classification ensures only premium-grade apples reach high-value markets.

Research and Development

Agricultural research institutions can leverage this AI and ML project for studying fruit development patterns, disease progression, and quality factors. The comprehensive data analytics provide insights for breeding programs and cultivation optimization.

Supply Chain Management

Logistics companies handling fruit transportation can use quality predictions to optimize storage conditions, shelf-life estimation, and market allocation decisions.

Educational Purpose

This project serves as an excellent final year project for computer science and engineering students, demonstrating integration of machine learning, computer vision, and web development technologies in solving real-world agricultural challenges.

Technical Architecture and Implementation

Backend Framework

The Flask-based backend handles image processing, feature extraction, model inference, and API endpoints. The modular architecture separates concerns between data processing, model training, and web serving components.

Machine Learning Pipeline

The ML pipeline implements a sophisticated workflow:

  1. Feature Extraction: Processes images using OpenCV and combines with CSV data
  2. Feature Selection: Applies three methods (Boruta, RFE, RF Importance) to identify optimal features
  3. Model Training: Trains multiple algorithms with hyperparameter tuning
  4. Evaluation: Generates comprehensive metrics and visualizations
  5. Deployment: Exports production-ready models with scalers and configurations

Frontend Design

The responsive frontend built with HTML5, Bootstrap 5, and modern JavaScript provides a seamless user experience across devices. Features include drag-and-drop image upload, real-time camera capture, and dynamic result visualization.

Model Persistence

Trained models are serialized using pickle, ensuring fast loading times and consistent predictions. Configuration files maintain model versioning and feature sets for reproducibility.

Learning Outcomes for Students

Students implementing this project will gain hands-on experience in:

  • Implementing ensemble machine learning algorithms for regression and classification tasks
  • Working with computer vision libraries like OpenCV for image processing
  • Building RESTful APIs with Flask framework
  • Performing comprehensive feature engineering and selection
  • Creating responsive web interfaces with Bootstrap
  • Evaluating model performance using multiple metrics
  • Implementing production-ready ML systems with proper serialization
  • Handling multipart file uploads and base64 image encoding
  • Visualizing data and results using matplotlib and seaborn
  • Managing project structure and dependencies

Dataset and Training Data

The project utilizes two data sources:

  • Fruits-360 Original Size Dataset: High-quality apple images from various angles and conditions
  • Apple Quality CSV: Tabular data containing quality metrics, measurements, and classifications
The combination of image and structured data enables robust feature extraction and model training.

API Endpoints and Integration

The system exposes four RESTful endpoints:

  • POST /predict: Accepts multipart/form-data image uploads
  • POST /predict/camera: Processes base64 encoded images from camera
  • GET /health: Returns server status and uptime
  • GET /model/info: Provides model version, metrics, and configuration
These endpoints enable easy integration with mobile applications, IoT devices, or other web services.

Why Choose This Project?

This project stands out as an exceptional AI final year project because it:

  • Addresses real-world agricultural challenges with practical solutions
  • Demonstrates mastery of multiple ML algorithms and techniques
  • Includes complete implementation from data processing to deployment
  • Provides comprehensive documentation and reproducible results
  • Offers scope for extension and customization
  • Showcases industry-relevant skills in AI, ML, and web development
  • Includes ready-to-use source code with proper structure
  • Can be adapted for other fruit varieties or agricultural products

Extension and Customization Opportunities

Students can enhance this project by:

  • Implementing deep learning models (CNN, ResNet) for improved accuracy
  • Adding real-time video stream processing for conveyor belt systems
  • Integrating mobile applications for field-based assessment
  • Incorporating additional fruit varieties and diseases
  • Developing a dashboard for batch processing and analytics
  • Adding export functionality for reports and predictions
  • Implementing user authentication and multi-user support
  • Creating a recommendation system for optimal storage conditions

Project Deliverables

Complete package includes:

  • Fully functional Flask web application
  • Trained machine learning models (pkl files)
  • Source code with detailed comments
  • Feature extraction and selection scripts
  • Model training and comparison utilities
  • Comprehensive results and visualizations
  • Requirements.txt for dependency management
  • Step-by-step setup documentation
  • API documentation and usage examples

Ideal For

This project is perfect for:

  • Computer Science and Engineering final year students
  • AI and Machine Learning specialization students
  • Students interested in agricultural technology
  • Those looking for Python final year projects with practical applications
  • Projects requiring multiple ML algorithms comparison
  • Students wanting to showcase computer vision skills
  • Academic presentations and demonstrations

Additional Services Available

At CodeAj, we provide comprehensive support beyond just the project code:

  • Project Setup Assistance: Complete guidance on environment setup, dependency installation, and initial configuration
  • Source Code Explanation: Detailed walkthrough of code architecture, algorithms implementation, and design decisions
  • Custom Project Report: Professional documentation tailored to your institution's requirements
  • Research Paper Writing: Academic-quality research paper highlighting methodology, results, and contributions
  • PPT Presentation: Visually appealing slides for effective project demonstration
  • Custom Modifications: Adaptation of the project to specific requirements or different datasets
  • Idea Implementation: If you have a unique concept, we can help bring it to life

For students seeking related projects, explore our extensive collection of web development projects and ready-to-use final year projects with source code.

Extra Add-Ons Available – Elevate Your Project

Add any of these professional upgrades to save time and impress your evaluators.

Project Setup

We'll install and configure the project on your PC via remote session (Google Meet, Zoom, or AnyDesk).

Source Code Explanation

1-hour live session to explain logic, flow, database design, and key features.

Want to know exactly how the setup works? Review our detailed step-by-step process before scheduling your session.

β‚Ή1499

Custom Documents (College-Tailored)

  • Custom Project Report: β‚Ή1,200
  • Custom Research Paper: β‚Ή1000
  • Custom PPT: β‚Ή500

Fully customized to match your college format, guidelines, and submission standards.

Project Modification

Need feature changes, UI updates, or new features added?

Charges vary based on complexity.

We'll review your request and provide a clear quote before starting work.

Project Files

⭐ 98% SUCCESS RATE
  • βœ“ Full Development
  • βœ“ Documentation
  • βœ“ Presentation Prep
  • βœ“ 24/7 Support
Chat with us