Skip to content

Abosteet/Fruits360-CNN-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Fruits360 CNN Classification 🍎

A deep learning project that classifies fruits and vegetables images using custom CNN architectures, comparing model performance across two dataset configurations: 131 classes with 100 epochs and 81 classes with 200 epochs.


📌 Overview

Automated fruit and vegetable recognition has practical applications in quality control, retail automation, and dietary monitoring systems. This project builds and evaluates custom Convolutional Neural Network architectures on the Fruits360 dataset to classify images across a large number of fruit and vegetable categories.

The project is structured as two progressive experiments: the first trains two CNN models on the full 131-class dataset, and the second refines the approach by reducing the class count to 81 and doubling the number of training epochs, providing a direct comparison of how dataset scope and training duration affect model performance.


⚙️ Project Pipeline

1. Data Loading and Exploration

  • Loaded Training and Test image folders using os and glob
  • Counted images per class in both training and test sets
  • Visualized class distribution using bar charts
  • Displayed sample images from the 15 most common fruit categories
  • Inspected image shapes across the dataset

2. Data Preparation

  • Loaded images using Keras load_img and converted to arrays using img_to_array
  • Resized all images to 100x100 pixels
  • Applied ImageDataGenerator with rescaling, shear, horizontal flip, and zoom augmentation for training
  • Applied rescaling only for test data

3. Model Architecture

  • Model 1: CNN with four Conv2D layers (16, 32, 64, and 128 filters), MaxPooling, Dropout, Flatten, and Dense layers using RMSprop optimizer
  • Model 2: Deeper CNN with Conv2D layers (32 and 64 filters), MaxPooling, Flatten, Dense (1024 units), and Dropout layers using RMSprop optimizer

4. Model Training

  • Trained both models using fit_generator with steps_per_epoch and validation_steps for memory-efficient training

5. Model Evaluation and Visualization

  • Evaluated both models on the test set using loss and accuracy
  • Plotted training vs validation loss and accuracy curves for each model

🛠️ Tools and Libraries

Tool Usage
TensorFlow / Keras CNN model building, training, evaluation, data augmentation, and batch loading
numpy / pandas Data manipulation and array operations
matplotlib / seaborn Training curves and data distribution visualization
glob / os File system navigation and image path management

📂 Dataset

This project uses the Fruits360 dataset from Kaggle.

🔗 View Dataset on Kaggle

About

A deep learning project classifying fruits and vegetables using custom CNN architectures across two dataset configurations: 131 classes and 81 classes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors