Skip to content

KumarKhailendra/rice-type-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍚 Rice Type Classification using PyTorch

A deep learning project to classify rice types (Jasmine vs Gonen) using a Neural Network built with PyTorch.

Python PyTorch License

📋 Project Overview

This project implements a Binary Classification model to distinguish between two types of rice:

  • Jasmine Rice (Class 1)
  • Gonen Rice (Class 0)

The model is trained on physical characteristics of rice grains like Area, Perimeter, Eccentricity, etc.

🎯 Results

Metric Value
Test Accuracy ~92-95%
Training Epochs 50
Batch Size 32

📊 Dataset

Data Split:

Set Percentage Samples
Training 70% ~12,729
Validation 15% ~2,728
Testing 15% ~2,728

🧠 Model Architecture

Input (11 features)
      ↓
Linear(11 → 64) → ReLU → Dropout(0.2)
      ↓
Linear(64 → 32) → ReLU → Dropout(0.2)
      ↓
Linear(32 → 1) → Sigmoid
      ↓
Output (0 to 1 probability)

🛠️ Tech Stack

  • Python 3.8+
  • PyTorch - Deep Learning Framework
  • Pandas - Data Manipulation
  • NumPy - Numerical Operations
  • Matplotlib - Visualization
  • Scikit-learn - Train/Test Split & Metrics

📁 Project Structure

rice_type_classification/
│
├── code.ipynb              # Main Jupyter Notebook
├── rice_classifier.pth     # Saved Model Weights
├── README.md               # Project Documentation
└── rice-type-classification/
    └── riceClassification.csv  # Dataset

🚀 How to Run

1. Clone the Repository

git clone https://github.com/KumarKhailendra/rice_type_classification.git
cd rice_type_classification

2. Install Dependencies

pip install torch pandas numpy matplotlib scikit-learn opendatasets

3. Run the Notebook

jupyter notebook code.ipynb

4. Or Run in VS Code

  • Open code.ipynb in VS Code
  • Run all cells

💡 Key Learnings

  • Custom Dataset class in PyTorch
  • DataLoader for batch processing
  • Neural Network with Dropout for regularization
  • Binary Cross Entropy Loss for classification
  • Adam Optimizer for training
  • Model saving and loading

🔮 Future Improvements

  • Add more rice types (Multiclass Classification)
  • Implement CNN for image-based classification
  • Create a Flask/Streamlit web app
  • Add confusion matrix visualization
  • Hyperparameter tuning

👨‍💻 Author

Khailendra Prasad

GitHub LinkedIn

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

⭐ Show Your Support

Give a ⭐ if this project helped you!


Made with ❤️ by Khailendra Prasad

About

Binary classification neural network to distinguish between Jasmine and Gonen rice types using PyTorch. Trained on physical grain characteristics achieving 92-95% accuracy with 18,185 samples. Includes data preprocessing, model training, and evaluation pipeline.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors