Yusuf Musa
Deep Learning

Rice Variety Classification

99.82%Test Accuracy
7,500Training Images
5Rice Varieties
1Misclassification
By Yusuf Musa

1. Overview

This deep learning project leverages transfer learning with MobileNet to classify five distinct rice varieties from image data: Arborio, Basmati, Ipsala, Jasmine, and Karacadag. The model achieves 99.82% test accuracy with only 1 misclassification across 562 test samples.

Transfer Learning Pipeline

1

ImageNet

Pre-trained MobileNet weights

2

Freeze

Lock early layers preserve features

3

Fine-Tune

Unfreeze last 20 layers for rice

4

Classify

Custom head 5 varieties

2. Model Architecture

The model uses MobileNet pre-trained on ImageNet as a base, with a custom classification head added on top. The final 20 layers of MobileNet undergo fine-tuning to learn rice-specific visual characteristics.

Network Architecture

Input Image (224 x 224 x 3)

Frozen Layers

MobileNet Conv Blocks 1–N

General visual features preserved

Fine-Tuned (Last 20 Layers)

Rice-Specific Feature Learning

Grain edges, morphology, surface texture

Custom Classification Head → 5 Classes
ArborioBasmatiIpsalaJasmineKaracadag

Data Augmentation Techniques

R

Rotation

Random angle rotation

H

H-Flip

Horizontal mirror

V

V-Flip

Vertical mirror

Z

Zoom

Random zoom & shift

3. Dataset

The dataset contains 1,500 images per category with stratified division into training, validation, and test subsets.

A

Arborio

Short, round

1,500 imgs

B

Basmati

Long, slender

1,500 imgs

I

Ipsala

Medium

1,500 imgs

J

Jasmine

Long

1,500 imgs

K

Karacadag

Short, round

1,500 imgs

Morphological Challenge: Karacadag and Arborio share similar short, round grain profiles, making them the most common confusion pair. Jasmine shows the most feature-space overlap across all varieties.

4. Results

Classification Accuracy

99.82%

Accuracy

561

Correct

out of 562 test samples

1

Misclassified

single error across all varieties

5. Extended Analysis

The project includes a comprehensive evaluation beyond standard accuracy metrics:

Grad-CAM Heatmaps

Model focuses on grain edges, morphology, and surface characteristics

t-SNE / PCA Projections

Five well-separated clusters in learned feature space

Morphological Comparison

Contour analysis of grain area, perimeter, and aspect ratios

Error Analysis

Misclassified images with high certainty identifying model blind spots

Low-Confidence Predictions

Ambiguous outputs predominantly from Jasmine varieties

Architecture Benchmarks

EfficientNet and ResNet50 compared against MobileNet baseline

6. Key Insights

1

Transfer learning achieves near-perfect classification with modest training data

2

Jasmine variety presents classification challenges with overlapping learned representations

3

Round-grain morphologies (Karacadag, Arborio) occasionally conflate in model predictions

4

Model attention concentrates on grain boundary geometry rather than background elements

5

Learned feature representations demonstrate excellent inter-class separability