Rice-Classifier-CNN / README.md
EnYa32's picture
Update README.md
1d704a3 verified
|
Raw History Blame Contribute Delete
2.25 kB

A newer version of the Streamlit SDK is available: 1.67.0

Upgrade
metadata
title: Rice Classification CNN
emoji: 🌾
colorFrom: green
colorTo: yellow
sdk: streamlit
app_file: src/streamlit_app.py
pinned: false
short_description: Rice image classifier CNN.
license: mit

Rice Classification using CNN (From Scratch)

This project implements a Convolutional Neural Network (CNN) from scratch to classify rice grain images into five different types:

  • Arborio
  • Basmati
  • Ipsala
  • Jasmine
  • Karacadag

The model was trained without transfer learning and achieves very high accuracy on the validation dataset.


πŸ“ Dataset

  • Total images: 75,000
  • Classes: 5
  • Train / Validation Split: 80% / 20%
  • Image size: 160 Γ— 160
  • Batch size: 16
  • Background: Black (single rice grain per image)

🧠 Model Overview

The CNN architecture includes:

  • 5 Convolutional Layers
  • 3 MaxPooling Layers
  • Batch Normalization
  • L2 Regularization
  • Data Augmentation (Flip, Rotation, Zoom)
  • Global Average Pooling
  • Dense Layer with Dropout
  • Softmax Output Layer (5 classes)

βš™οΈ Training Setup

  • Loss Function: Sparse Categorical Crossentropy
  • Optimizer: Adam (learning rate = 0.0001)
  • Metrics: Accuracy
  • Epochs: 40
  • Callbacks:
    • EarlyStopping
    • ReduceLROnPlateau
    • ModelCheckpoint

πŸ“Š Results

  • βœ… Validation Accuracy: 99.94%
  • βœ… Validation Loss: 0.0179
  • βœ… Precision, Recall, F1-Score: 1.00 for all classes
  • βœ… Only 9 misclassifications out of 75,000 images

The confusion matrix shows nearly perfect classification performance.


πŸš€ Future Work

  • Test the model on real-world images
  • Apply stronger data augmentation
  • Compare with a Transfer Learning model (e.g. ResNet50)
  • Deploy as a Streamlit Web App

πŸ‘€ Author

Name: Enes Yamac
Date: 05.12.2025
Project Type: Deep Learning – CNN Image Classification


πŸ“„ Files in this Project

  • best_rice_cnn.keras β†’ Trained CNN model
  • rice_cnn_training.ipynb β†’ Jupyter Notebook (training & evaluation)
  • Rice_CNN_Report_Enes_Yamac.pdf β†’ Technical Report
  • README.md β†’ Project description

βœ… Status: Project completed successfully.