Enhancing Rice Quality with Neural Networks
Enhancing Rice Quality with Neural Networks
BACHELOR OF TECHNOLOGY
in
M. ANITHA (214G5A0503)
2023-2024
SRINIVASA RAMANUJAN INSTITUTE OF TECHNOLOGY
(AUTONOMOUS)
(Affiliated to JNTUA, Accredited by NAAC with ‘A’ Grade, Approved by AICTE, New Delhi &
Accredited by NBA (EEE, ECE & CSE)
Rotarypuram Village, BK Samudram Mandal, Ananthapuramu-515701
Certificate
This is to certify that the Project report entitled ENHANCING RICE QUALITY
ASSESSMENT THROUGH INTEGRATED NEURAL NETWORKS: A
SYNERGISTIC APPROACH WITH CNN AND CAEs is the bonafide work carried
out by M. Anitha bearing Roll Number 214G5A0503 in partial fulfilment of the
requirements for the award of the degree of Bachelor of Technology in Computer
Science & Engineering during the academic year 2023 - 2024.
Place: Rotarypuram
DECLARATION
The results embodied in this project have not been submitted to any other
University of Institute for the award of any Degree or Diploma.
Mission:
Provide comprehensive learning experiences that are conducive for the students
to acquire professional competences, ethical values, life-long learning abilities
and understanding of the technology, environment and society.
Continually enhance the quality of the relationship between students and faculty
which is a key to the development of an exciting and rewarding learning
environment in the college.
Vision:
To evolve as a leading department by offering best comprehensive teaching and
learning practices for students to be self-competent technocrats with professional
ethics and social responsibilities.
Mission:
DM 1: Continuous enhancement of the teaching-learning practices to gain
profound knowledge in theoretical & practical aspects of computer science
applications.
DM 2: Administer training on emerging technologies and motivate the students
to inculcate self-learning abilities, ethical values and social consciousness to
become competent professionals.
DM 3: Perpetual elevation of Industry-Institute interactions to facilitate the
students to work on real-time problems to serve the needs of the society.
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of
any task would be incomplete without the mention of people who made it possible,
whose constant guidance and encouragement crowned our efforts with success. It is a
pleasant aspect that I have now the opportunity to express my gratitude for all of
them.
It is with immense pleasure that I would like to express my in debted gratitude
to my Guide Mr. P. Veera Prakash, Assistant Professor, Computer Science &
Engineering, who has guided me a lot and encouraged me in every step of the project
work. I thank him for the stimulating guidance, constant encouragement and
constructive criticism which have made possible to bring out this project work.
I express my deep felt gratitude to Mr. C. Lakshminatha Reddy, Assistant
Professor and Mr. M. Narasimhulu, Assistant Professor, Project Coordinators
for their valuable guidance and unstinting encouragement enabled me to accomplish
my project successfully in time.
I am very much thankful to Mr. P. Veera Prakash, Assistant Professor &
Head of the Department, Computer Science & Engineering, for his kind support
and for providing necessary facilities to carry out the work.
I wish to convey my special thanks to Dr. G. Bala Krishna, Principal of
Srinivasa Ramanujan Institute of Technology for giving the required information
in doing my project work. Not to forget, I thank all other faculty and non- teaching
staff, and my friends who had directly or indirectly helped and supported me in
completing my project in time.
I also express my sincere thanks to the Management for providing excellent
facilities.
Finally, I wish to convey my gratitude to my family who fostered all the
requirements and facilities that I need.
Anitha M
(214G5A0503)
ABSTRACT
In the realm of food crops, rice stands as a pivotal staple, and ensuring high-
quality rice is vital for consistent standards in the industry. Traditional methods for
assessing rice quality lack precision, emphasizing the necessity for advanced
techniques. The application of neural networks like MobileNet, specifically CNN
(Convolutional Neural Networks), offers a promising solution to enhance accuracy and
automation in classifying rice grain quality.
Abbreviations xiii
Chapter 1 Introduction 1-4
1.1 Problem Statement 1
1.2 Objectives 2
1.3 Machine Learning 2
1.4 Deep Learning 2
1.5 Introduction to CAE 3
1.6 CAE Essential Elements for reconstruction 3-4
Chapter 2 Literature Survey 5-16
Chapter 3 Methodology 17-21
3.1 Loading Rice image Dataset 17
3.2 Preprocessing 17
3.3 Image Reconstruction 17-18
3.4 Feature Extraction 18-19
3.4.1 Size 18
3.4.2 L/B ratio 18
3.4.3 Color 18
3.4.4 Chalkiness 19
3.4.5 Whiteness 19
3.5 Convolutional Neural Network 20-21
3.5.1 Conv2D Layer 20
3.5.2 Filters 21
3.5.3 Kernel Size 21
3.5.4 Activation Function 21
Chapter 4 Planning 22-26
4.1 Existing System 22
4.1.1 Disadvantages of the Existing System 22
4.2 Proposed System 22-23
4.2.1 Advantages of Proposed System 22
4.3 Convolutional Neural Network Model 23
4.3.1 Pooling Layers 23
4.3.2 Convolutional Layers 23
4.4 Objectives of Planning 24-25
4.4.1 Scope 24
4.4.2 Performance 24
4.4.3 Cost 24
4.4.4 Time 24
4.5 Modules 25
4.6 Functional and Non-Functional Requirements 25
4.6.1 Functional Requirements 25
4.6.2 Non-Functional Requirements 25
4.7 System Requirements 25
4.7.1 Software Requirements 25
4.7.2 Hardware Requirements 25
4.8 Test case 26
Chapter 5 Design 27-30
5.1 Architecture Diagrams 27-28
5.2 Data Flow Diagrams 29
5.2.1 Rules for creating DFD 29
5.2.2 Levels of DFD 29
x
7.9 Chalkiness Feature comparison between original and 45
real time images
7.10 Whiteness Feature comparison between original and 45
real time images
7.11 Color Feature comparison between original and real 45
time images
7.12 Home page 46
7.13 Contact us page 46
7.14 About us page 47
7.15 Upload image 48
7.16 Classification result 48
xi
LIST OF TABLES
xii
LIST OF ABBREVIATIONS
DL Deep learning
MAE Mean Absolute Error
xiii
Enhancing Rice Quality Assessment through Integrated Neural Networks: A Synergistic Approach with
CNN and CAEs
CHAPTER 1
INTRODUCTION
The pivotal role of CNN lies in its adeptness at object identification, specifically
tailored to discern and classify various characteristics associated with rice grains.
Simultaneously, the integration of Convolutional Autoencoders contributes to the
project's depth by facilitating the extraction of intricate features and patterns relevant to
rice quality. This combination of CNN and CAEs creates a robust and comprehensive
framework for the precise identification of subtle variations in rice quality.
Our project seeks not only to address the shortcomings of conventional methods
but also to set a new standard for accuracy and efficiency in rice quality assessment. By
capitalizing on the synergies between CAEs and CNN, MobileNet model we aim to
surpass the limitations of individual techniques, offering a sophisticated and automated
solution for the rice industry. This endeavor aligns with our broader goal of ensuring
the consistency of high-quality rice products, thereby contributing to improved
standards in the food sector and, ultimately, to the well-being of consumers.
1.2 Objectives
To accomplish the project's purpose, the following particular objectives have been
established.
i. To create a Convolutional Autoencoder (CAE)-based solution for rice quality
detection, which aims to capture more complex, abstract features from data and
offers better feature learning capabilities and potential for improved
performance.
ii. To develop an automated rice quality detection system using Convolutional
Neural Networks(CNN) to accurately identify and classify quality attributes
within rice grains.
The CAE architecture consists of an encoder network that progressively reduces the
spatial dimensions of the input image, capturing essential features. The decoder network
then reconstructs the original image from this compressed representation. The use of
convolutional layers allows the network to learn spatial hierarchies in a more adaptive
manner compared to fully connected layers. This iterative process enhances the
network's ability to capture and represent essential features within the images.
In Convolutional Autoencoders (CAEs), as shown in Fig. 1.1, both the encoder and
decoder utilize convolutional layers to capture spatial dependencies and recognize
patterns in input data. The convolutional filters within these layers detect features such
as edges and textures, forming a hierarchical arrangement that enables the network to
learn progressively abstract representations from the input images.
CHAPTER 2
LITERATURE SURVEY
Summary: This research proposes an image processing system for rice grading and
tests its effectiveness using Paw-San rice. KNN classifier is used for classification.
Global Thresholding method is used in this work for image segmentation. Then, a series
of measurements were done using image processing techniques on three classes of Paw-
San rice in Myanmar. The real-field feature of Paw-San rice is percentage of broken
rice contained in the batch. Also the classification of rice can be improved by using for
using more distinct features. The results confirm that the feature extraction and
classification of rice kernel based on image processing for Myanmar Rice. From this
we get accuracy in their range of 83-100%.
Dataset: The dataset used for this study is 3 types of Paw-San Rice, they have taken
data from google.
Author: S. Wentao
Summary: In this study, Deep learning has been used in speech recognition, image
search, image recognition. In the wheat particle database, this model is used by deep
learning (DL) models like autoencoders to categorize and identify photos of damaged
wheat. Deep Learning learning toolbox. It has 2 hidden layers, each of which has 100
nodes. Deep learning highlights the importance of feature learning, Each layer in the
model is transformed by features, and finally gets more abstract features at the top layer,
which solves artificial design problem levy consumption of time and resources. This
Dataset: The data set contains 4 files, which are the images of the training samples, the
labels of the training samples, the images of the test samples, and the labels of the test
samples.
Summary: In this work, two categories of rice (whole rice and broken rice) were
recognized using image processing algorithms and machine learning techniques. This
work proposes an approach for rice quality classification. In this approach, image
processing algorithms and machine learning methods were used to recognize and
classify two difference categories of rice (whole rice and broken rice) based on the rice's
size of the national standard of rice quality evaluation, using Convolutional Neural
Network (CNN). Experimental results for 2000 real images give 93.85% accuracy. The
system also used Support Vector Machines method with HOG features and k-Nearest
Neighbors methods in order to classify and compare the accuracy of those algorithms
which show the results of 85.06% and 84.30% accuracy, respectively. These results
show that rice quality evaluation and classification could be automatically done using
Deep Learning approach.
Dataset: In this study the Datasets are self-collected images about the rice pattern of
Loc Troi 20 breed and captured by 20.7 MP camera of Sony Z1 smartphone.
Extensions Proposed: As a future challenge ,we can try another edge detection
technique that detects in less time, increasing the mentioned accuracy while decreasing
analysis time.
[4] An automated inspection system for rice seed quality based on deep
learning.
Author: Gao, Y., Wang, W., Zhang, W., & Gao, X.
Summary: This presents an automated inspection system for rice seed quality based on
deep learning techniques. The study aims to address the limitations of traditional rice
seed quality inspection methods, which are time-consuming, labour-intensive, and
subjective. The proposed system uses deep learning algorithms to automatically classify
rice seeds based on their appearance features. The authors collected a dataset of 18,000
rice seed images from different varieties and manually labelled them with their
corresponding quality levels. The study aims to address the limitations of traditional
rice seed quality inspection methods, which are time-consuming, labour-intensive, and
subjective. The proposed system uses deep learning algorithms to automatically classify
rice seeds based on their appearance features.
Dataset: The dataset used for this study is taken from google, kaggle.
Methodology: Convolutional Neural Networks(CNN) for finding the quality of the rice
seeds.
Summary: In this, discusses the importance of rice quality analysis in the food industry
and the limitations of traditional methods . It then provides an overview of deep learning
techniques, including convolutional neural networks (CNNs), recurrent neural networks
(RNNs), and deep belief networks (DBNs), and their applications in rice quality
analysis. The authors discuss various aspects of rice quality analysis, including size and
shape, texture, and composition, and review the deep learning-based methods that have
been developed for each of these aspects. They also discuss the challenges and future
directions for deep learning-based rice quality analysis, including the need for larger
and more diverse datasets, more robust and interpretable models, and the integration of
multiple modalities.
Dataset: The dataset used for this study is taken from google, kaggle.
Summary: In this study, this algorithm used simple morphological images processing
methods and it can be used to perform various images based analysis. In machine vision
based testing, we take both physical (grain shape and size) and chemical characteristics
(amylose content, gel consistency) for evaluation and grading of rice grains. Quality
assessment is done by finding 1) the region of boundary and 2) the end points of each
grain by measuring the length, breadth and diagonal size of grain. Majority of the
operations used in this algorithm are based on Matlab commands. In an embedded
imaging based system, images are acquired using CMOS/ CCD based image sensors.
This algorithm is suitable to grade large number of grains efficiently and results were
compared with manual work which provided the percentage of accuracy greater or
much equally to the manual work.
Dataset: The dataset used for this study is taken from google.
Methodology: Get input image -> Binary conversion -> Edge detection -> Finding
dimensions -> Sorting and labelling -> Grading.
Extensions Proposed: As a future challenge , the rice grains are identified with diverse
varieties by extracting the features like length, shape, color and texture properties with
different Machine learning and deep learning methodologies.
Summary: In this work, it is applied to create a useful model that facilitates rice grain
grading without requiring more effort. This paved the way for development of
computerized vision in rice quality inspection. In the proposed method both image
processing and machine learning techniques are clubbed to analyze and grade the
quality of rice kernels with the help of Support Vector Machine (SVM) classifier in
python platform. Quality of rice is determined based on the physical and chemical
characteristics like area, length, width, moisture content, whiteness, milling degree etc,.
Segmentation is acquired by many techniques like based segmentation, and
segmentation by clustering. From the results obtained we can conclude that this system
is efficient and cost-effective.
Dataset: In this study the Datasets are self-collected images contains multiple rice
grains in a single image.
Methodology: The model used Support Vector Machine (SVM) for identifying the rice
grains in the taken image.
Dataset: The dataset used for this study is taken from PlantVillage, google.
Author: Anam Islam, Redoun Islam, S. M. Rafizul Haque, S.M. Mohidul Islam,
Mohammad Ashik Iqbal Khan
Summary: The method uses local threshold-based segmentation and the Convolutional
Neural Network (CNN) to segment disease-affected regions of rice leaves. The
proposed method has been applied on three different datasets, including the one created
by the authors, which consists of rice leaf images collected from the Bangladesh Rice
Research Institute (BRRI). Three state-of-the-art CNN architectures, VGG, ResNet, and
DenseNet, have been trained with these three datasets for classifying the diseases. This
study used 4500 images for the experiment. The images were preprocessed by cropping
manually and resized to reduce the time for training. The authors used transfer learning
on AlexNet which is a relatively small scale and old CNN model. They used various
image augmentation techniques on these collected images and managed to get test
accuracy of 91.23%. The classification performance of the proposed method using the
said three CNN architectures for the three datasets has been analyzed and compared.
Dataset: In this study the Datasets are self-collected images, contains three datasets of
Rice Leaf blast, Bacterial Leaf Blight, Sheath Blight.
[10] Convolutional neural network with transfer learning for rice type
classification.
Summary: This paper proposes a deep learning-based method for identifying rice
types, reducing manual labor and error. Two methods are proposed: one uses a deep
convolutional neural network (CNN) trained on segmented rice images, and the other
uses a combination of a pretrained VGG16 network and the proposed method, using
transfer learning for improved accuracy. We have proposed a transfer learning based
approach for Basmati rice type classification. Though the rice type classification for
Basmati rice group is a harder task than classification of rice types in general or rice
groups, our proposed network with pretrained weights of VGG16 perform better than
the other approaches. The approach can also classify rice grains as broken or fine. The
architecture, pretrained on ImageNet data, significantly improves classification
accuracy despite distinct rice images.
Dataset: The dataset used for this study is taken from google, contains 5 types of rice
Basmati, Arborio, Jasmine, Ipsala, Karacadag.
Author: Jana, Debasish & Patil, Jayant & Herkal, Sudheendra & Nagarajaiah, Satish
& Dueñas-Osorio, Leonardo.
Summary: In order to detect, classify, and reconstruct faults in sensor data, the study
introduces a novel deep learning framework for linear systems with time-invariant
parameters. The Convolutional Neural Network (CNN) in the framework is used to
identify the type and existence of faults. For reconstruction, a set of separately trained
Convolutional Autoencoder (CAE) networks is used for each type of fault. The models
demonstrated strong performance for both simulated and experimental datasets with a
single failure. The study empirically proves that the proposed framework performs
better than other state-of-the-art techniques in terms of computational efficiency with
comparable accuracy. Adoption of this framework in online structural health
monitoring applications can lead to minimal disruption to monitoring processes,
reduced downtime for structures and infrastructure, while simultaneously reducing
uncertainty and improving the quality of sensor data for historical records. They
achieved 100% accuracy in faulty sensor localization, over 98.7% accuracy in fault type
classification, and over 98% accuracy in reconstruction.
Dataset: The dataset used for this study is taken from google, contains 50000 images
of 5 types Normal, Missing, Random, Drift, Spiky.
Dataset: In this study the Datasets are self-collected images, the dataset contains
multiple rice grains in a image.
a bacterium named Xanthomonas Campestris. This model can be used to detect other
plant diseases, as well.
Dataset: In this study the Datasets are self-collected images contains different leaf
images of different plants.
Summary: Four types of rice seed were imaged hyperspectrally at two distinct spectral
bands (380–1030 nm and 874–1734 nm). The spectral data were retrieved between 441
and 948 nm (Spectral range 1) and 975 and 1646 nm (Spectral range 2). Different
numbers of training samples were used to build CNN, SVM, and K nearest neighbors
(KNN) models. Models in the Spectral range 2 of KNN, SVM, and CNN outperformed
those in the Spectral range 1 by a little [Link] modified the VGGNet architecture
to handle inputs of one-dimensional spectra. Spectral curve patterns and picture patterns
are similar in a few ways. VGGNet's modular design facilitates easy modification and
extension, and it is chosen because to its outstanding performance in image
classification [Link] model's functionality increased.
Dataset: In this study the Datasets are self-collected images, the rice grain images are
arranged in the form rectangle box and taken as input.
model performs better under various light intensity settings. Using a modified softmax,
the deep network may learn angularly discriminative features.
Dataset: In this study the Datasets are self-collected images, they are captured using
different cameras and using different angles. Every sample is photographed in three
distinct lighting scenarios
Summary: Computer-aided methods are used to process results from disease detection
quickly and accurately. Convolutional neural networks (CNNs), which automatically
extract characteristics and classify images using fully linked networks, are used by the
deep learning models. We have classified images using CNN architecture. We are
utilizing input photos with the labels "healthy" and "leaf_blast" from the Kaggle dataset.
In this study, 1000 samples of rice crops were used to train CNN using an RGB color
model. We have used CNN model to process the images with the labeled class such as
healthy & leaf blast. Weights are updated automatically in the training process of CNN
that will be able to extract the features of the image. In our proposed architecture CNN
model is having 2 layers. The suggested architectural design for differentiating between
leaf-blast and healthy rice crops. OpenCV, Numpy, and Keras are the deep learning
packages used in the Python development of this model. We employed a batch size of
32, which is a hyper-parameter in deep learning that may be changed. In this paper, we
have trained a Sequential convolutional neural network and obtained a prediction
accuracy of up to 99.61%.
Dataset: In this study the Datasets are collected from kaggle, it contains leaf_blast
images.
Summary: This study uses Convolutional Neural Network (CNN) and Artificial Neural
Network (ANN) models to classify 17 rice grain kinds that are commonly cultivated in
Vietnam. Seventeen rice varieties commonly planted in Vietnam were used in this study
include DT8, HT1, IR4625, IR50404, IR6976, ML48, MO6162, OM108, OM3673,
OM4218, OM429, OM4900, OM5451, OM6976, OM8108, OMCS2012, and RVT.
There were five rice grains in each image. Each variety was represented by 200 images,
from which 100 images were used for training, with the other 100 for testing. The
images for training and testing were fixed for all experiments in this study. Pre-trained
VGG16 and Resnet50 models serve as the foundation for the two CNN models—
modified VGG16 and modified ResNet50. The CNN models were fed the image
dataset, while the ANN was fed the feature dataset. The findings demonstrate that the
classification accuracy of the 17 types of rice was considerably increased by the updated
VGG16 and ResNet50 models. The findings demonstrated that, in comparison to the
SVM, the classification accuracy of a CNN model was much higher. Using the feature
dataset as a model, the ANN produced a 92.82% classification accuracy.
Dataset: In this study the Datasets are self-collected images, the rice grain images were
scanned at a resolution of 2400 dpi. There were five rice grains in each image.
CHAPTER 3
METHODOLOGY
3.2 Preprocessing
3.4.1 Size: The size of feature extraction is a crucial factor impacting both model
performance and computational efficiency in machine learning as shown in Table 3.1,
a compact feature representation is essential for reducing memory requirements and
speeding up computations during training and inference. Efficient feature extraction not
only enhances the scalability of models but also facilitates deployment on resource-
constrained devices, contributing to the overall effectiveness of the machine learning
system.
3.4.2 L/B Ratio: The aspect ratio (l/b ratio) in feature extraction plays a pivotal role in
maintaining a balance between capturing long-range and short-range patterns, thereby
influencing the model's capability to learn diverse spatial information as shown in Table
3.1, a higher aspect ratio tends to emphasize long-range dependencies, enabling the
model to grasp broader contextual relationships, while a lower aspect ratio focuses on
finer details and short-range patterns.
3.4.3 Color: The mean color in feature extraction serves as a representative measure of
the average RGB color values within an image, offering valuable insights into color-
based information for machine learning tasks as shown in Table 3.1, analyzing the mean
color enables the model to discern dominant hues and variations, facilitating tasks such
Training and Testing datasets were created from the data after the reconstructed images
were gathered and features were retrieved using convolutional Autoencoders.
Convolutional Neural Networks (CNN) and MobileNet are the algorithms we utilized
to train the model. For training and testing sets, arrange image data into the proper
directories. Here, we utilized an unlabeled dataset consisting of 75,000 images divided
into five varieties: Arborio, Basmati, Jasmine, Ipsala and Karacadag. Each rice variety
comprises 15,000 images, and the dataset has been split into three classes - High, Low
and Medium - for each variety. These classes are divided based on the features that were
extracted from the CAEs. For the training and testing datasets, the data is also divided
into three classes.
When loading and preprocessing your image data, you would typically ensure that all
images are resized to these specified dimensions before being fed into the neural
network for training. Image height and Image width, these dimensions are crucial
because they determine the size of the input tensor that the neural network expects. The
values are often chosen based on the characteristics of the dataset and the requirements
of the neural network architecture.
3.5.2 Filters: The filters parameter is a critical aspect of Conv2D layers in a neural
network, defining the number of individual filters or kernels that the layer will learn
during training. Each filter specializes in detecting specific patterns or features within
the input data, contributing to the network's ability to capture hierarchical
representations of the input information.
3.5.3 Kernel Size: The kernel size parameter in a Conv2D layer specifies the
dimensions of the convolutional window or filter applied to the input data.A smaller
kernel size captures fine-grained details, while larger sizes help capture broader
patterns, providing a crucial mechanism for controlling the scale and scope of feature
extraction in convolutional neural networks for tasks like image processing and pattern
recognition.
3.5.4 Activation Function: The activation parameter in a Conv2D layer defines the
activation function applied element-wise to the output produced by the convolution
operation. This function introduces non-linearity, enabling the neural network to model
complex relationships and patterns within the input data. Common activation functions
include Rectified Linear Unit (ReLU) for introducing non-linearity and improving
convergence during training. The choice of activation function is crucial for shaping the
model's capacity to capture and represent intricate features in tasks such as image
recognition or object detection.
When building and training a neural network, tuning these hyper parameters often
involves experimentation and iterative refinement to achieve optimal performance on
the specific task at hand. Epochs refer to the number of times the entire training dataset
is processed by the model. Each pass through the entire training dataset is called one
epoch.
CHAPTER 4
PLANNING
The existing system performs the classification of rice grains into their respective
divided classes based on the quality taken by the features of its images.
4.3.1 Pooling Layers: As shown in Fig. 4.1, Pooling layers in a Convolutional Neural
Network (CNN) play a pivotal role in downsampling spatial dimensions while
preserving essential features. Max pooling, a common technique, extracts the maximum
value from a set of neighboring elements, effectively reducing the resolution of feature
maps. This process aids in enhancing computational efficiency, decreasing model
sensitivity to spatial translations, and promoting the extraction of dominant features for
robust pattern recognition in tasks like image classification.
4.4.1 Scope: This project is applicable for the Quality detection of Arborio,
Basmati, Ipsala, and Jasmine Rice images a n d analyzing their Features. It is used
by agricultural practitioners or farmers or anyone user can access our application.
4.4.3 Cost :
Mode = Organic
Effort = 16 Person-Month Development
Time = 4 Months
Average Staff Required = 4 Persons
4.4.4 Time: On a whole this project takes about 4 months (16 person-months) of
time period for development and testing.
4.5 Modules:
Data Pre-processing
Building CNN model
Classification, Detection, and Comparison
Google Colaboratory
Visual Studio App
Output:
As shown in Fig. 4.3, the output image describes whether the given rice image is of high
quality, low quality, or medium quality based on the training data. In addition, the output
image includes a probability score, which indicates how accurately the model classified
the quality of the rice image.
CHAPTER 5
DESIGN
In the proposed system, as shown in Fig. 5.1, the input data undergoes a series of
preprocessing steps to prepare it for analysis. Initially, raw data, often in the form of
images, is fed into the system. Subsequently, image reconstruction and feature
extraction are performed using Convolutional Autoencoders (CAEs). This process
enables the extraction of meaningful features from the input data, facilitating the
subsequent analysis stages. Following feature extraction, the dataset is split into training
and testing sets to ensure the robustness and generalization of the model.
Once the data is prepared, the training phase begins, wherein deep learning algorithms
such as Convolutional Neural Networks (CNNs) and MobileNets are employed. These
algorithms learn from the extracted features to recognize patterns and make predictions.
During training, the model iteratively adjusts its parameters to minimize the difference
between predicted and actual outputs. After training, the model undergoes testing to
evaluate its performance on unseen data. This evaluation phase involves assessing the
model's accuracy, precision, recall, and other relevant metrics. Finally, the trained
model is ready for deployment, where it can be used for prediction and classification
tasks on new input data.
0-level DFD
1-level DFD
Fig. 5.3: DFD-0
As shown in Fig. 5.5, When a user uploads an image, the system promptly displays the
rice grain quality, categorized as high, medium, or low.
CHAPTER 6
IMPLEMENTATION
6.3.3 Pandas:
‘Pandas’ is a popular data manipulation library in Python that provides data
structures such as Data Frame and Series, making it easy to manipulate, analyze, and
visualize data. It provides powerful tools for data cleaning, aggregation, filtering, and
transformation, making it a go-to library for data analysis and data wrangling tasks.
6.3.4 Numpy:
NumPy is a library for the Python programming language, adding support for
large, multi-dimensional arrays and matrices, along with a collection of mathematical
functions. It is extensively used in the code for array manipulation, mathematical
computations, and data handling.
6.3.5 CV2:
OpenCV is a library of programming functions mainly aimed at real-time
computer vision. It is used in the code for image processing tasks such as loading images
and manipulating them.
6.3.7 Matplotlib:
Matplotlib is a plotting library for the Python programming language. It is used
to visualize images, model training/validation metrics, and confusion matrices.
Matplotlib is a widely used plotting library in Python that provides a flexible and
comprehensive API for creating visualizations. It supports a wide range of plots,
including line plots, scatter plots, bar plots, histograms, and more, making it suitable
for data visualization and exploration tasks.
6.3.9 Sklearn(scikit-learn):
Scikit-learn is a machine learning library for Python. It is used for computing
metrics like confusion matrices and classification reports for evaluating model
performance.
6.4.4 Visualization:
MSE and PSNR values are displayed alongside the original and reconstructed
images for visual comparison. This implementation theory outlines the steps involved
in loading, preprocessing, training, and evaluating the CAE model for image
reconstruction. It also includes visualizations to assess the quality of the reconstructed
images.
As shown in Fig. 6.1, the code lines represents the CAE model which contains encoder
and decoder with their layers respectively with parameters .Here it is used to reconstruct
the images for further feature extraction.
As shown in Fig. 6.2, the code lines represents pre train model which comes before the
main model . Using pre trained model helps main model to grasp the features effectively
and trained well.
As shown in Fig. 6.3, the code lines represents the Main CNN model (Sequential). Layers
are included with their respective parameters and model is created.
As shown in Fig. 6.5, 6.6, and 6.7, the code lines represents the Classification metrics i.e.,
(Accuracy , Precision and Recall). These are graph plottings between Training images
and validation images. This is for CNN Model Compilation model.
As shown in Fig. 6.8, the code lines represents the MobileNet model which contains their
layers respectively with parameters . It is another main model which is especially used
for mobile embedded applications and for classification tasks.
As shown in Fig. 6.10, 6.11, and 6.12, the code lines represents the Classification metrics
i.e., (Accuracy , Precision and Recall). These are graph plottings between Training images
and validation images for this MobileNet Model.
CHAPTER 7
RESULTS
(a) (b)
(c) (d)
Fig. 7.1: The graphs (a), (b), (c), and (d) represent the MSE, SSIM, PSNR, and MAE respectively,
indicating the differences between the original and reconstructed images.
7.1.1 MSE:
As shown in Fig. 7.1 (a), a popular metric for evaluating the average squared
difference between comparable elements of two sets, such as projected and actual
values, is mean squared error, or MSE. It is computed by averaging the squared
differences between predicted and true values. MSE offers a measure of the average
magnitude of errors, where higher values indicate greater overall error in prediction or
reconstruction tasks.
7.1.2 SSIM:
As shown in Fig. 7.1 (b), a metric for comparing two images similarity is called the
Structural Similarity Index (SSIM).It takes into account luminance, contrast, and
structure, providing a more comprehensive measure of perceptual image quality than
some traditional metrics. A higher SSIM value indicates greater similarity between the
original and distorted images, with 1 representing perfect similarity.
7.1.3 PSNR:
As shown in Fig. 7.1 (c), a typical metric used in image and video compression is
the Peak Signal-to-Noise Ratio (PSNR), which measures the quality of reconstructed
signals. It will be calculated in Decibels. It calculates the ratio of the mean squared error
of the original and reconstructed signals to the highest feasible signal value. Greater
faithfulness and less distortion in the reconstruction are indicated by a higher PSNR.
7.1.4 MAE:
As shown in Fig. 7.1 (d), one statistic used to quantify the average size of deviations
between expected and actual values is mean absolute error (MAE). By averaging the
absolute disparities between the true and anticipated values, it is calculated. MAE offers
a straightforward assessment of the average error magnitude, rendering it especially
valuable in regression and prediction endeavours.
These graphs are used to calculate the loss between original and reconstructed images
after performing the reconstruction using Convolutional Autoencoders.
7.2 Graphs:
7.2.1 CNN Graphs:
These graphs shows that how well the model is performing with CNN and MobileNet.
It shows how well the model is trained on the given images as input and how well the
model is performing on the given images.
In a neural network model, the optimizer is a mathematical algorithm that adjusts the
weights and biases during training to minimize the chosen loss function, guiding the
model towards better performance. The specified metrics during training provide
performance measures for evaluating the model's classification abilities: Accuracy,
Precision, Recall.
Recall: This metric is crucial in evaluating its performance on both training and testing
data. High recall values indicate the model's effectiveness in identifying actual positive
instances and minimizing false negatives. As shown in Fig. 7.4 and 7.7, depicting recall
values across datasets, offer valuable insights into the model's ability to accurately
identify relevant instances, enhancing its overall performance.
Fig. 7.8: Size Feature comparison between original and real time images
As shown in Fig. 7.8, this graph shows the size feature comparison. As it can be seen that
the difference between orange bar and blue bar is low in most of the cases , hence we can
say the model performance is good and giving accurate results. Here Blue Bar indicates
the size features of original images and Orange bar indicates size features of Real time
images .
Fig. 7.9: Chalkiness Feature comparison between original and real time images
Fig. 7.10: Whiteness Feature comparison between original and real time images
Fig. 7.11: Mean color Feature comparison between original and real time images
The graphs as shown in Fig. 7.8, 7.9, 7.10, and 7.11 illustrate the comparison of features.
These graphs show that even when real-time images are provided to the model by the
user, it can still produce and categorize the images based on how closely the features of
the original and real-time images differ.
The main page layout of the interface for our project is displayed as shown in Fig. 7.12,
as seen in the images below, three primary modules have been built, each with
corresponding buttons.
The contact page layout of our project's interface is displayed as shown in Fig. 7.13, as
can be seen, this is the page where users register and establish an account using their
email address and password. On the other side, this is the login page, where users who
already have an account can log in using their credentials.
As shown in Fig. 7.14, the user is provided with an overview of our application and
page. This includes a description and an illustration of the project's scope.
As shown in Fig. 7.15, user can upload their respective rice image and click the upload
image button.
As shown in Fig. 7.16, where the rice image is classified into one of three classes. High,
Low, or Medium. In order to show how accurately the image has been anticipated and
identified, a probability score is also provided.
Future enhancements to our integrated neural network approach for rice quality
assessment could involve the incorporation of advanced sensor technologies and real-
time data collection during the rice cultivation and processing stages. Implementing a
more dynamic system that adapts to changing environmental conditions and crop
variations could further improve the model's accuracy and robustness. Additionally,
exploring the integration of explainable AI techniques can enhance the interpretability
of the model's decisions, providing valuable insights for stakeholders. Continuous
updates to the dataset and model architecture will ensure adaptability to emerging rice
varieties and quality parameters.
REFERENCES
[1]. Thae Nu Wah, Pann Ei San, Thandar Hlaing (2018); “Analysis on Feature
Extraction and Classification of Rice Kernels for Myanmar Rice Using Image
Processing Techniques”; International Journal of Scientific and Research Publications
(IJSRP) 8(8) (ISSN: 2250-3153).
[3]. N. Hong Son and N. Thai-Nghe, “Deep Learning for Rice Quality Classification”,
2019 International Conference on Advanced Computing and Applications (ACOMP),
Nha Trang, Vietnam, 2019, pp. 92-96.
[4]. Gao, Y., Wang, W., Zhang, W., & Gao, X. (2020). “An automated inspection system
for rice seed quality based on deep learning”, Journal of Food Process Engineering,
43(6), e13396.
[5]. Latha, M. N., & Nandhini, R. (2020). “Rice quality analysis using deep learning
techniques: A review”. Computers and Electronics in Agriculture, 174, 105404.
[6]. T. G. Devi, P. Neelamegam and S. Sudha, “Machine vision based quality analysis
of rice grains”, 2017 IEEE International Conference on Power, Control, Signals and
Instrumentation Engineering (ICPCSI), Chennai, India, 2017, pp. 1052-1055.
[7]. Annadasu, P. and Jaisharma, K., 2020. “Rice Quality Analysis Using Machine
Learning”, (No. 4761). EasyChair.
[8]. Md Taimur Ahad, Yan Li, Bo Song, Touhid Bhuiyan, “Comparison of CNN-based
deep learning architectures for rice diseases classification”,Artificial Intelligence in
Agriculture,Volume 9,2023, ISSN 2589-7217.
[9]. Anam Islam, Redoun Islam, S. M. Rafizul Haque, S.M. Mohidul Islam, Mohammad
Ashik Iqbal Khan, “Rice Leaf Disease Recognition using Local Threshold Based
Segmentation and Deep CNN”, International Journal of Intelligent Systems and
Applications(IJISA), Vol.13, No.5, pp.35-45, 2021.
[10]. Patel, Vaibhav. (2017). “Convolutional neural network with transfer learning for
rice type classification”.
[11]. Jana, Debasish & Patil, Jayant & Herkal, Sudheendra & Nagarajaiah, Satish &
Dueñas-Osorio, Leonardo. (2022). “CNN and Convolutional Autoencoder (CAE) based
real-time sensor fault detection, localization, and correction”. Mechanical Systems and
Signal Processing. 169. 108723.
[12]. Pu, Hongbin, et al. “Terahertz spectra reconstructed using convolutional denoising
autoencoder for identification of rice grains infested with Sitophilus oryzae at different
growth stages”. Spectrochimica Acta Part A: Molecular and Biomolecular Spectroscopy
(2024): 124015.
[13]. Bedi, Punam, and Pushkar Gole. “Plant disease detection using hybrid model
based on convolutional autoencoder and convolutional neural network”. Artificial
Intelligence in Agriculture 5 (2021): 90-101.
[14]. Qiu, Zhengjun, et al. “Variety identification of single rice seed using hyperspectral
imaging combined with convolutional neural network”. Applied Sciences 8.2 (2018):
212.
[15]. Wu, Yiqiang, et al. “Deep-rice: Deep multi-sensor image recognition for grading
rice”. 2018 IEEE International Conference on Information and Automation (ICIA).
IEEE, 2018.
[16]. Rathore, Narendra Pal Singh, and Lalji Prasad. “Automatic rice plant disease
recognition and identification using convolutional neural network”. Journal of critical
reviews 7.15 (2020): 6076-6086.
[17]. Tran-Thi-Kim, Nga, et al. “Enhancing the Classification Accuracy of Rice
Varieties by Using Convolutional Neural Networks”. International Journal of Electrical
and Electronic Engineering & Telecommunications 12.2 (2023): 150-160.