0% found this document useful (0 votes)
21 views

Rice Grain Project

This document discusses classifying and grading rice using machine learning techniques. It describes preprocessing rice image data, extracting shape features, and using a support vector machine model to classify rice into different grades based on attributes like color, size and broken kernels.

Uploaded by

rajasekharkavuru
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Rice Grain Project

This document discusses classifying and grading rice using machine learning techniques. It describes preprocessing rice image data, extracting shape features, and using a support vector machine model to classify rice into different grades based on attributes like color, size and broken kernels.

Uploaded by

rajasekharkavuru
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Classification of Rice scrap and grading using a

multiple-class Machine Learning Technique


Mullangi Pradeep1, Md Hayath Rajvee2, P Sreekanth3, M V Subba Rao4,K Asha Deepthi5
1
Electronics and Communications Engineering
1
Shri Vishnu Engineering College for Women
1
Bhimavaram,India
1
[email protected]
2
Electronics and Communications Engineering
2
P B R Visvodaya Institute of Technology
1
Kavali,India
2
[email protected]
3
ComputerScience and Engineering
3
Shri Vishnu Engineering College for Women
3
Bhimavaram,India
3
[email protected]
4
Electronics and Communications Engineering
4
Shri Vishnu Engineering College for Women
4
Bhimavaram,India
4
[email protected]
5
Electronics and Communications Engineering
5
Shri Vishnu Engineering College for Women
5
Bhimavaram,India
5
[email protected]

Abstract - Currently, the demand for rice is growing. Rice grading Machine vision (MV) is a fast, commercial, reliable and impartial
remains important now-defining the value and his rate in the review and assessment system [1]. There are many examines
marketplace. However, the physical rice arrangement and grading functional MV to asses rice presence value examination.
by unclothed tastes are not precise and only specialists can do it. Sapirstein et al. (1987) hired the image processing to categorize
Machine learning found to be a appropriate method for rice grains as wheat, by the constraints such as capacity, size, breadth,
arrangement in making an precise outcome and quicker result. Thus, edge, color and figure [2]. J.Aulakh et al.(2012) find the
a learning on the ordering of rice particle can be done using an proportion pureness of hulled rice model by processing
image dispensation practice. Around ten shape attributes of the rice technique[3]. K.Ding et al., 1994 realistic the rear circulation
will be take out from each rice scrap image. On alternative message, neural classifier aimed at food profile arrangement [4]. J.A.
a Multi-class Support Vector Machine (SVM) will be castoff to grade Patindol, 2000 recommended classifying standards for rice in
rice into 4 different grades namely Premium, A, B, and C. terms of faults initiate in rice models such as pale, cracked, small
and spoiled grains [5]. T.Brosnan et al., 2003 stated that
excellence of rice founded on variation of things such as
Keywords - Support Vector Machine, Binarization, Kernel, Threshold,
dimension, profile, color, sharpness and number of wrecked rice
Machine Vision, Segmentation.
grains [6]. Guzman et al., 2008 examined the practice of machine
vision structure and multilayer neural systems to categorize rice
I.INTRODUCTION ounces with nature and extent strictures [7]. C.Agustin et al., 2008
recommended neural grid to kind rice grains into bonce rice,
Rice is full-grown in numerous areas throughout India. India is cracked rice[8]. Q.Yao et al., 2009 established an reflex structure
the important manufacturer of rice in the whole domain, headed to check the rice presence superiority with rice sharpness and
one by China. As republics spread independence in rice making, form [9]. L.Guangrong, 2011 planned a technique to estimate the
the mandate by the customer for improved worth rice has deathly part proportion and deathly grain proportion and then
augmented. The Class of rice is created by numerous constraints involuntary finding of scribble grade has been recognised [10].
such as color, size, shape and number of broken kernels. Rice S.Shantaiya et al., 2010 castoff the morphological and color
Class review by individuals is neither neutral nor competent. In structures to find changes of rice by feed onward neural system
sight of this robotic rice superiority check using machine vision is [11]. B.Verma, 2010 recycled the rear circulation through period
needed. Newly, machine vision and image processing are broadly neural to kind the rice into pale, rigorous, and wrecked kernels
castoff in biotic and agronomic study with enhancement of skill a [12]. M. Yao et al., 2010 change an examination scheme of rice
noteworthy decrease of price of hardware and software of external class based on computer vision [13]. Burges et al.,1998
numeral imaging. Several trainings need functional image stated that the Support Vector Machine (SVM) is a novel design
processing to scrap excellence examination. classifier, usual of controlled widespread linear classifiers that
must frequently remained to deliver advanced sorting precisions
than further broadly used design classification systems, such as Pre-processing: This is the stage engaged earlier the main image
recursive layer perceptron neural systems[14]. These investigate processing job. The difficult now is to achieve certain simple jobs
providing certain novel thoughts and image processing in order to reduce the resultant image appropriate for the work to
approaches for assessing rice presence superiority. The efficiency monitor. In this circumstance it may contain attractive the
and correctness of examination must remained better over these contrast, eliminating noise, or recognizing areas probable to hold
procedures[16]. The impartial of this training is to grow process the postcode.
to mark the rice particles into Best Class like Grade A, Grade B
and Grade C, with help of machine learning algoritms[17]. 1.1 Gray Scaling

This is the stage occupied formerly the main image


II.METHODOLOGY processing job. Gray-scaling is the development of altering a
continuous-tone image to that a processer can operate.
Rice grain trials remained taken up for classifying and
arrangement. The simple phases now the ordering and sorting of
rice remain by means of:
 Gray scaling.
 Image smoothening
 Image Separation
 Image Binarisation
 Design of chalk Capacity
 Shape feature Extraction
 Classification Module Figure 3. Original Image vs Gray Scale image
 Performance Metrics 1.2 Image Smoothening

The following figure shows the complete implementation of the As Images contain various types of noises which reduces
system. Starting with the images, and then processing the images, superiority of the appearance, the image smoothing is done
extracting the features and building a machine learning model which is used to remove noise and also remove clutter in the
using the data acquired to classify the images into different image. Here the median filter is a non-linear digital filtering
grades. method, used to eradicate noise from an image. Such noise
decrease is a classic pre-processing stage to progress the
outcomes of future processing.

Figure 4: Median Filter - Replacing current pixel from 3×3 filter sliding window

Figure 1: Block diagram of the system


Image will be transformed into grayscale image[0,256] and the
copy will be pre-processed using a smoothing filter that involved
processes which can improve and flat pictures, emphasizing
image boundaries and eliminate noise from an image.

1.3 Image Segmentation

Image segmentation is the stage of image examination. A


copy is split into its essential portions or matters. There are
numerous methods for segmentation procedures. In this paper,
key aim is to cutting the rice from the contextual. Maximum
variance method is used to slice the image into focal point and
related regions.

Figure 2. Flowchart
2.4 Image Binarization benefits to discovery the structures of the many items existing in
the image as boundaries cover a lot of evidence you can use. Edge
The result of separation is typically a binary image. A detection is extensively popular since it aids you in eliminating
binary image covers only dual kinds of pixels: the pixels uninvited and needless information from the image. It reduces the
consuming a gray level worth of either 0 or 1.Later division the image extent significantly, creating it informal to examine the
rice image will be converted into the binary image [0, 1]. alike.
Feature extraction is a kind of dimensionality decrease that
2.5 Calculation of Chalky Volume of Rice Grain professionally signifies stimulating portions of an image as a
dense feature course.
Chalkiness a main worry in rice since it is unique of the
important issues in defining quality and price. Incidence of
chalkiness in rice is qualified to heritable and ecological issues,
particularly high temperature (HT). The HT induces warmth
pressure, which in turn concessions many grain makings,
particularly clearness. It denotes to the white dense portion of the
grain endosperm and can be secret as white-belly, white-core and
white-back and further kinds by its incidence position, which is
slackly organized mostly due to imperfect build-up of thickener Table 1: Classification of rice grains based on size, shape and endosperm
during grain satisfying period. chalkiness
Chalk capacity is well-defined as the impervious capacity in the All restrained morphological possessions such as surface part,
rice grain. The process to compute the chalky capacity of rice is edge, width, distance, length-to-width proportion, plumpness and
as follows: chunkiness and grain heaviness meaningfully linked with fraction
of chalky (%C) scrap and chalkiness (%C x% area with chalk) for
pounded grains.

2.7 Classification Module

A SVM a novel design classifier was skilled for


organization of the models into the marks (Premium, Grade A,
Grade B and Grade C). It achieves arrangement by planning input
paths into a higher-dimensional space and making a hyper-plane
Figure 5: Visual representation of rice grains according to its chalkiness that optimally splits the files in to the higher space.
Representations are carefully linked using a kernel task; SVMs
 The amount of associated areas in the image is found afterward
are other working out approaches for polynomial, circular source
the segmented dual image of rice is reckoned.
purpose, and multi-layer perceptron classifiers in which the loads
 Calculate the greatest chalky division threshold value. of the system are initiate by resolving a quadratic design problem
 Practice the related area of rice with threshold to slice the with linear restraints, rather than by unravelling a non-convex,
chalky rice grain. unimpeded minimization method as in normal neural network
Chalk degree is well-defined as the ratio of chalky volume of rice training.
and capacity of rice grains is calculated as: Assumed a working out set of instance-label pairs, xi yi , i =1,
2,3….
Chalk Degree (%) = xi Rn , yi  -1,1 ,the SVM require the solution of the
following optimization problem:

 One-vs-rest for Multi-Class Classification


One-vs-rest (OvR for small, also referred to as One-vs-All or
OvA) is a experiential technique by means of binary sorting
processes for multi-class arrangement. It includes excruciating the
Figure 6. Masked Image and its chalky part after segmentation multi-class dataset into multiple binary sorting glitches. A binary
classifier is then skilled on each binary arrangement problem and
estimates are ended using the model that is the maximum self-
2.6 Shape feature extraction of rice grain assured.
 One-Vs-One for Multi-Class Classification
Edge-based separation is one of the utmost general operations One-vs-One (OvO for small) is alternative empirical process for
of division in image processing. It emphases on classifying the multi-class organization. Similar one-vs-rest, one-vs-one splits a
limits of dissimilar substances in a copy. This is a vital phase as it multi-class organization dataset into binary classification
difficulties. Dissimilar one-vs-rest that separations it into one Pre-processing results:
binary dataset for each grade, the one-vs-one method ruptures the
dataset into one.
In this approach, 1500 rice images with around 150 kernels each
were arbitrarily nominated, with 300 images from each set of
white, wrecked, lengthy & overweight and rigorous rice trials,
which were separated into a training set with 1000 images and a
testing set with 500 images.

2.8 Performance Metrics

Sorting Metrics assess a prototype’s presentation and express Figure 7: Original Image
you decent or wicked the arrangement, but every of them assess
in a dissimilar method. In order to assess sorting models, these Image resizing is method of increasing or falling the dimension of
metrics are measured: an appearance.
 Accuracy
 Confusion Matrix
 Precision and Recall
 F1-score
 AU-ROC

Arrangement correctness maybe the humblest metric to usage and


implement and is distinct as the number of precise calculations
separated by the total number of estimates, reproduced by 100.
Confusion Matrix is a smooth conception of the ground-truth Figure 8: Resized image Figure 9: Grayscale image
markers versus typical estimates. Each row of the confusion
matrix signifies the occurrences in a expected class and each Image smoothing is a digital image processing technique that
column signifies the illustrations in an real class. reduces and suppresses image noises. Such noise decrease is a
Precision is the ratio of true positives & total positives predicted distinctive pre-processing stage to progress the outcomes of future
processing.
Precision =

A Recall is the segment of related (training-set) occurrences


which stood recall.

Recall =

The F1 score is the vocal call of a structure's precision and recall


standards. Figure 10: Median filtered Figure 11: Binarized image

F1 score = Every small part of the noise that couldn’t be smoothened out by
the filter can be removed by using the bwareaopen function and
this reduces the NaN values because of the non-existing noise.
III.RESULTS

The images acquired from the Kaggle repository are first


undergone through the image processing and then the data
obtained.

Figure 12: binary image without and with using bwareaopen


The binarized image without using bwareaopen may look fine but
once the edge detection is done, the grains look connected. To
resolve such issues, it’s an ideal way to perform the bwareaopen
function before using any edge detection method.

Figure 16: Grayscale image and its histogram with a threshold of 110 gray levels

Figure 13: edge detection without and with using bwareaopen

Image Segmentation:

Binarized image are segmented built on the region of interest. The


bounding box parameter of the regionprops function is used to
segment each and every grain. This is one of the intermediate
stages while extracting the shape features of the rice grain.

Figure 17: Binary masked image and its histogram with threshold at 220 gray
levels

The Chalkiness is first plotted in five different categories.


The SVM classifier assisted score and categorize rice kernels
correctly (improved than 94%) and that also at a minimal price.

Figure 14: Segmentation of region of interest i.e., rice grains

Plotting the Chalkiness of rice

Figure 18: Plotted chalky part in blue

Following are the data visualization images of the data points


with major axis length on x-axis and centroid on the y-axis. These
images prove that our data is not linear, rather it is nonlinear and
the length of rice grains is classified based on the smaller length
grains. The medium length grains are common in any kind of
grade of rice, the smaller grains are one of the important
considerations for grading the rice in such cases.

Figure 15: Complete flow for identifying the chalky part of the image
Figure 21: Confusion matrix of Testing data.

Figure 19: Data visualization of data points with major axis length vs centroid.

The subsequent are the confusion matrices for training and testing
data. For all the 4 classes of rice grain, according to the confusion
matrix, true positive, false positive, true negative and false
negative are calculated. Based on the TPR and FNR rates from
another confusion matrix, the performance measures are Figure 22: Confusion matrix with TPR and FNR percentages of training data and
calculated. test

Receiver Operating Characteristic curve is a diagram viewing the


presentation of an organization model at all arrangement edges.
These arc strategies dual factors: True Positive Rate. False
Positive Rate.

Figure 20:Confusion matrix of Training data.


(a) Grade - Premium (b) Grade - A

Performance Percentage for the


Measure whole model

Accuracy 94.81%

Precision 89.62%

Recall 89.65%

Specificity 96.54%

F1-score 89.63%

(c) Grade - B (d) Grade - C Table 3: Performance metrics of the whole model

Figure 23: ROC Curve and the under the Curve of each class
Parameter One vs One multiclass One vs All multiclass
method method
Performance Measures
Accuracy 94.18% 89.0%
The considered multi-class method gave a correctness of 89.6%
for the training set and a correctness of 94.5% for the testing data. Precision 89.62% 88.96%
The time taken was around 1600secs to build the model.
Recall 89.65% 89.02%

Specificity 96.54% 96.33%

F1 score 89.63% 88.99%

Total Cost 6224 6603


(Validation)

Training 1609.6 sec 3205.5 sec


Time

Table 4: Comparison of One-vs-one and One-vs-one multi-class SVMs

Figure 24: One-vs-One multi class model results.


4. IV.CONLUSION
Classification model, following performance measures are
considered. Accuracy, Precision, Recall, Specificity, and F1- This article makes use of multi-class Support Vector Machine
score. These measures were considered aimed at each class and to classify and grade the rice into several grades according to the
then the average was taken to find the metrics for the whole set standards of the market. The One-vs-One multi-class Support
model. Vector Machine model gave an accuracy of 94.5% with the
testing dataset while the One-vs-Rest multi-class Support Vector
Performance Premium Grade- Grade- Grade-C Machine model gave an 89.0% accuracy. All these parameters
measure Grade A B conclude that the One-vs-One method works the best for our
work.
Accuracy 93.26% 93.21% 95.21% 97.56%
V.ACKNOWLEDGEMENT
Precision 88.26% 85.92% 90.25 94.02%
We precise their deep sense of gratefulness to the organization of
Specificity 96.22% 95.18% 96.78% 97.98% Shri Vishnu Engineering College for Women for inspiring them
in research effort.
Recall/Sensitivity 84.48% 87.37% 90.45% 96.27%
.
Table 2: Performance metrics of each class
VI.REFERENCES

[1] Narendra V G, Hareesh K S. “Quality Inspection and Grading of Agricultural


and Food Products by Computer Vision,” International Journal of Computer
Applications, vol. 2, pp 43-65, 2010.
[2] H.D. Sapirstein, M. Neuman, E.H. Wright,E.Shwedyk,W. Bushuk . “An
instrumental system for Cereal Grain Classification using Digital Image
Analysis,”Journal of Cereal Science, vol. 6, pp 3–14, 1987.
[3] Jagdeep Singh Aulakh, Dr. V.K. Banga .“Grading of Rice Grains by Image
Processing,” International Journal of Engineering Research & Technology, vol.1,
2012.
[4] K.Ding, S.Gunasekaran. “Shape Feature Extraction and Classification of Food
Material using Computer Vision,” Transaction of the ASAE, Vol. 37(5), pp 1537-
1545, 1994.
[5] J.A. Patindol. “Methods and Standards for Rice Grain Quality Assessment in
the Philippines,”ACIAR , pp-303-315,2000.
[6] Tadhg Brosnan, Da-Wen Sun. “Improving Quality Inspection of Food Products
by Computer Vision,” Journal of Food Engineering Vol. 61(1), pp 3–16, 2004.
[7] Jose D Guzman , Engelbert K. Peralta. “Classification of Philippine rice grains
using machine vision and artificial neural networks,” World Conference on
Agricultural Information and It, pp. 41-48, 2008.
[8] Oliver C. Agustin, Byung-Joo Oh. “Automatic Milled Rice Quality Analysis,”
International Conference on Future Generation Communication and Networking,
Vol. 2, pp 112-115, 2008.
[9] Qing Yao, Jianhua Chen, Zexin Guan Chengxiao Sun, Zhiwei Zhu. “Inspection
of rice appearance quality using machine vision,” WRI Global Congress on
Intelligent Systems, Vol. 4, pp.274-279, 2009 .
[10] Liu Guangrong. “Detection of Chalk Degree of Rice Based on Image
Processing Technique,” International Conference on Intelligence Science and
Information Engineering, pp 515 – 518,2011.
[11] Sanjivani Shantaiya, Mrs.Uzma Ansari. “Identification Of Food Grains And
Its Quality Using Pattern Classification,” IJCCT, Vol.2 (2), 2010.
[12] Bhupinder Verma. “Image Processing Techniques for Grading &
Classification of Rice,” International Conference on Computer & Communication
Technology, pp 220 - 223, 2010.
[13] Mingyin Yao, Muhua Liu, Huadong Zheng. “Exterior Quality Inspection of
Rice Based on Computer Vision,” World Automation Congress, pp 369- 374,
2010.
[14] Burges, C. J. C. “A tutorial on support vector machines for pattern
recognition”. Data Mining and Knowledge Discovery :Vol. 2,pp121- 167,1998.
[15] William S Noble. “What is a support vector machine,” Nature Biotechnology,
Vol. 24(12), pp 1565-1567,2006.
[16] M. Pradeep and S. H. Rao, "Identification of Facial Expressions Using Local
Phase Quantization," 2022 International Conference on Computing,
Communication and Power Technology (IC3P), Visakhapatnam, India, 2022, pp.
161-166, doi: 10.1109/IC3P52835.2022.00041.
[17] Mullangi, P., Srinivasa Rao, Y., Kotipalli, P. (2018). Texture and Clustering-
based Skin Disease Classification. In: Urooj, S., Virmani, J. (eds) Sensors and
Image Processing. Advances in Intelligent Systems and Computing, vol 651.
Springer, Singapore. https://doi.org/10.1007/978-981-10-6614-6_11.

You might also like