Skip to content

Rice Species Classification using ResNet-18 and a Custom defined CNN, both using PyTorch. If you are getting started with PyTorch, then you may consider cloning this repo and start learning :)

Notifications You must be signed in to change notification settings

ayan-cs/rice-classification-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rice Classification using CNN in PyTorch

Dataset

The Original Dataset contains 75000 images of 5 different Rice species. Each of the species has 15000 images each. The basic task is to develop a CNN model to classify a rice grain image into one of these 5 categories correctly.

I have prepared a Pre-processed Dataset from the original dataset so as to make it easily usable in PyTorch for preparing the DataLoader using torchvision.datasets.ImageFolder() and then using torch.utils.data.dataloader.DataLoader(). The directory tree is as follows,

Rice_Image_Classification
|
|--- Train
|     |---Arborio (12000 images)
|     |---Basmati (12000 images)
|     |---Ipsala (12000 images)
|     |---Jasmine (12000 images)
|     |---Karacadag (12000 images)
|
|--- Test/Validation
      |---Arborio (3000 images)
      |---Basmati (3000 images)
      |---Ipsala (3000 images)
      |---Jasmine (3000 images)
      |---Karacadag (3000 images)

Clone this repository and extract the .zip file inside the Repo folder. Rest will be taken care of by the code. Don't forget to reverify the paths and other attributes inside the config.yaml file(s).

Config File

You can change the entries in the config.yaml file according to the configuration you want the code to run. I have used 1 configuration, which uses ResNet-18 architecture. For other details, refer to the config file.

Results

  • Performed prediction using Pre-trained ResNet-18. Accuracy on Training data = 17.805 % and that on Validation/Test data = 19.793 %
  • Trained ResNet-18 from scratch using Training dataset for 20 epochs. Train Accuracy = 99.95 % and Validation/Test Accuracy = 99.88 %

Accuracy and Loss Curves

  • ResNet-18

Accuracy Curve

Loss Curve

  • Rice CNN

Accuracy Curve

Loss Curve

About

Rice Species Classification using ResNet-18 and a Custom defined CNN, both using PyTorch. If you are getting started with PyTorch, then you may consider cloning this repo and start learning :)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published