Inspection and Grading of Dried Coconut – an Automatic Method Using SVM Classification

Coconut production and consumption rate of India being very high, contributes significantly towards the Indian economy; thus, ensuring the quality of allied products proves to be a necessity. Intelligent quality evaluation and grading system for copra images is proposed to classify copra, the dried coconut kernel into various categories using an image processing approach. The proposed method is useful in the current scenario, as quality deterioration during drying and storing of copra is a challenging task. Inferior quality of copra due to the presence of moisture, mold, fungi, bacteria and sulphur may adversely affect the shelf life thus deteriorating the quality of final products and human health. The grading system automatically segments the region of interest of copra images using SUSAN filter and classifies them into usable and unusa-ble categories. The unusable categories of copra considered in the proposed method include copra with moisture, mold, wrinkles and sulphur. Various features of copra images were collected and analyzed. The selected features of copra images were used for training and classification using SVM classifier. The proposed method has been evaluated using a real database and the results are promising.


Introduction
One of the major economic sectors of India is agriculture.Coconut, otherwise known as "Tree of life" is one of the major crops of Asia, with three-fourth of its global production is from India (34.2%),Indonesia (21%) and Philippines (20.8%).Indian Open Access dirt incorporation [4].All these factors lead to the spoilage of the white kernel of the coconut.The major properties of supreme quality copra include 6% moisture, 71% oil content, 2.5% acid value, 0.5% foreign matter, 5% moldy cups, 1% black copra and 5% wrinkled copra [5].
If the quality of every sample that goes into the production of coconut oil meets certain quality standards, there is no need for adding preservatives or adulterants to extent the shelf life of the oil, says the quality experts at the Coconut Development Board under the Ministry of Agriculture [2].Farmers use sulphur as a preservative for copra to safeguard it from spoiling but its residues are dangerous for health which may in turn lead to death.Excess inhalation of sulphur leads to Asthma, Emphysema, Chronic Bronchitis, and respiratory diseases.Improper storage practices also lead to quality deterioration.
Dried coconut can be beneficially separated, analyzed and graded with the help of digital image processing technology.
The proposed methodology aims to provide support to assess the quality of copra samples.A segmentation operation on enhanced image is applied to isolate the required area of copra samples from the background.The features of independent samples were studied.As part of training process, the distinctive features of individual samples of copra are utilized.It is possible to distinguish good and damaged copra with the help of a classification algorithm.The moisture level of copra, the existence of sulphur deposits, fungus and discoloration on its surface are the key characteristics used to assess the quality.These characteristics can aid in assessing whether each specimen of copra meets the quality standards and should be rejecte d or not.By employing such an effective mechanism for quality checking, the availability of good quality copra can be ensured.

Related Works
This section expands on some of the relevant works that have been mentioned in the literature.In the review paper proposed by Anuja et. al.,[6], around 15 papers on an average basis were published during 2010 to 2018.According to a survey of agricultural goods, size, colour, form, and texture are some of the most important aspects to consider while checking the quality of fruits and vegetables.A Stephen Sagayaraj et.al. [7] studied the various characteristics of copra to extract various features such as GLCM, intensity and shape.The study showed that the accuracy of normal and unusable images by ANFIS classifier and K-NN classifier is 35% and 75% respectively.A Stephen Sagayaraj et al.,[5], examined the sulphur content in copra and explored the possible repercussions of sulphur fumigation over copra and method to differentiate normal copra from sulphur fumigated copra.The copra is classified at varying scales with 86 percent accuracy using the k-means clustering approach.A. Stephen Sagayaraj et. al.,[8] carried out a survey on fruits based on moisture content, an important feature that influence on storability of fruits.ANN models were employed to predict the moisture content.Review on the use of computer vision techniques in the field of quality inspection of agricultural goods was done by Mahendran R et al.,[9].The study by ISSN (Online) : 2582-7006 AISD-2023 3 Journal of Informatics Electrical and Electronics Engineering (JIEEE) A2Z Journals Patel KK et. al.,[10][11] outlined how machine vision can be used for quality assurance of food and agricultural products.In their study, Ms. Rupali S. Jadhav et. al.,[12] focused on diverse parameters such as color and size with the aim of developing a fruit quality assurance system.
Santosh Kumar Sahoo et al.,[13], offer an efficient quality inspection system that uses image processing techniques to simplify the examination of a cylindrical item utilizing coordinate conversion and pattern matching, which is then validated by machine vision for optimal efficiency.According to Sebahattin Serhat Targut et al., [14], computer-aided image processing systems have a lot of promise in food quality evaluations and classifications for a wide range of food and farm goods.
Containment or reabsorbed moisture is the major mechanism that controls the onset and progression of the degradation process in copra.Moisture is generally indicated by bacterial fermentation or fungal activity on copra.However, the severity of such assaults would vary depending on the exact moisture content.Bacterial activity is highest when the moisture concentration is greater than 10%, however fungal moulds have been reported to be active at moisture levels as low as 6%.
Sulphur fumigation is another process in which sulphur is added as a preservative in copra.But it is a toxic chemical that restricts lung performance and cause allergenic reactions.Sulphur patch is formed on the copra during sulphur fumigation.It is difficult to segregate sulphur added copra from normal copra.Sulphur added copra will have a yellow coating on the surface.Other major types of deteriorated copra include copra with molds and copra with ruptured tissues/wrinkles.
The related works point out the necessity of automated image processing techniques in copra grading.Detailed study of the related work assisted to finalize the features that need to be analyzed to study the distinguishing characteristics of different classes of copra and produce desired results.

Proposed Method
The proposed methodology aims to develop an image processing technique to assess the quality of edible or milling copra samples.The moisture level of the copra, the presence of mould, wrinkles, sulphur in the copra, and surface discoloration are the major factors against which the quality is judged.The primary goal is to examine a sample copra input image, determine whether it meets quality standards for coconut oil production, and predict which class it belongs to.

Image Aquisition
Copra is a perishable food product, and the amount of degradation that can occur in the finished product is significantly

Image Preprocessing and segmentation
The major steps involved in preprocessing and segmentation is as shown in figure 3.
where  is the morphological erosion operator, f is the copra image and g is the resultant copra image.Erosion is defined as the position of all pixel B in f, such that B is included in f when origin of B is at x.The structuring element used here is of disc shape with radius 2mm.Small anomalies are removed by eliminating objects having a radius less than the structuring element's radius.
SUSAN (Smallest Univalve Segment Assimilating Nucleus) filtering algorithm [18] is used to extract the region of interest in

Feature extraction, reduction and Classification
Various features in ROI of images were studied and analyzed to identify the characteristics of different categories of copra.The major features included are mean, standard deviation, variance, Otsu threshold value, correlation coefficient etc in various color planes.The above mentioned features for different copra samples were used for training and classification process [20], [21].The original image is transformed into various color planes such as RGB (Red, Green, and Blue) and HSV (Hue Saturation Value).The major colour qualities that allow us to differentiate between various colours are hue, saturation, and value.The three main colours (red, blue, and yellow) and three secondary colours (orange, green, and violet) that appear on the colour wheel or colour circle are known as hues.The purity and intensity of a colour as shown in an image is referred to as colour saturation.A color's saturation determines how vibrant and strong it is.On the grey scale, the lower the saturation (or chroma) of a colour, the closer it is to pure grey.The relative lightness or darkness of a colour is referred to as its colour value.The amount of light reflected off a surface and absorbed determines the colour value we perceive.For different categories of copra, the above said feature may differ extremely or slightly.Some of the features used in the proposed method for differentiating good and bad copra images are shown in Table 1 and Table II.the label is 1, then image is considered to be in the category of sulphur added copra and the program terminates after displaying a message regarding the class.If the label value comes out to be zero then it is expected to belong in the good copra category and the next level of classification will take place.
For quality millable copra and copra with a high moisture content, the mean and variance of the original image, as well as the mean of the red, green, and blue planes, as well as the standard deviation of the red plane, changed substantially.After conversing to HSV format, the value of mean of H and V and standard deviation of S and V also showed sufficient distinction.
This forms the next level of classification.If the copra is found to have high moisture content from the label of the classifier, a message will be displayed stating that the copra has high moisture content.Otherwise, further classification will follow.For copra with wrinkled/ ruptured tissues, the value of mean standard deviation and variance of the image and the mean of the red and green planes will be different from those feature values of good copra.If the copra still has a label suggesting that it belongs to the good category after classification at this level, the classification continues by evaluating feature values such as the mean of the red, green, and blue planes of the original image and the mean of V of the HSV image.This level classifies good copra and copra with mold.After passing through all the levels and the label value outputted by the classifier denotes that the copra belongs to the good category, then only it is labeled as good millable copra.The suggested methodology's primary goal is to forecast the class of the related copra image input.For the grading of good and highly substandard useless copra, the classification learner app takes the input data set and tests it with all the available classifiers.The classifier uses this dataset to learn the difference between the different classes of copra and use this for classification/prediction. Linear Regression, which is the most commonly used form of regression analysis showed the highest accuracy of 90.4%.Regression analysis is a collection of statistical methods used in statistical modelling to estimate the associations between a dependent variable and one or more independent variables [19].

Conclusion
An automated intelligent method for grading of copra image using image processing is presented.The proposed system is capable to automatically identify the quality of copra images in order to categorize them as usable or non-usable during selection process.The major reason for copra deterioration occurs while drying and storing.This is, due to the presence of moisture, sulphur residues, molds, wrinkles and discoloration.The proposed automated system with high accuracy is capable of extracting the ROI of copra and classifying the categories of copra into various levels.As a future scope, the proposed idea can be enhanced with some advanced and extra features to develop a real time grading machine which can be utilized by oil manufacturing units and copra wholesale dealers.This system can be designed in such a way that the copra sample images are captured while passing through a conveyor belt.At some point while the decisions are made by the system to redirect the path by which unusable and usable milling copra traverses to move into the next phase of coconut oil production.
Figure 1 demonstrates the major components of the proposed system including image acquisition, preprocessing, segmentation, feature extraction, feature reduction and classification.

Figure 3 .
Figure 3. Preprocessing and Segmentation eroded copra images.Various homogeneous segments having some form of similarity in intensity or texture variations are grouped together in SUSAN filtering operation.In SUSAN filtering, a circular mask is moved over the entire image.While mov-over the image, the image pixel which overlaps with the centre pixel of the mask is known as the nucleus and the image region overlies on the mask area is called Univalve Segment Assimilating Nucleus (USAN).The contour of each region represents the border of the confined area within that region.One of the regions among the homogeneous groups obtained through filtering method belongs to the region of interest (ROI) in copra images.The homogeneous region with largest area represents ROI.The contour coordinates of ROI are then used in the suggested approach for extracting its boundary.Thus SUSAN filter employed in the proposed method helps to segment the ROI from the unwanted background.The detailed process of SUSAN filtering to extract ROI of a copra image is depicted in figure5.acopra image with moisture content, is shown in figure5(a).The contour of copra image after thresholding, smoothening, eroding and filtering is displayed in figure 5(b).Contour with largest area is highlighted using red color as represented in figure 5(c).Region of interest is obtained by extracting the area confined in contour with largest area is depicted in figure 5(d).

Figure 4 .
Figure 4. Susan Filtering algorithm for segmenting copra image.(a) original copra image, (b) contour of susan filtered copra image, (d) largest contour of filtered image is marked red and (f) segmented copra.
Classification process will yield a good result if the different categories of copra are having sufficient distinction in their values of features.Process of classification as shown in figure4begins by checking whether the input image belongs to the category of bad copra or good milling copra.Out of the various features discussed in the previous section the features that showed sufficient distinction in their feature values to differentiate between the above said classes include mean of the original image and mean of the red green and blue planes.Another feature that showed variation in the value was the value of mean of color value or brightness (V) after the conversion into HSV image.

Figure 5 .
Figure 5. Flowchart on classification The above-mentioned feature values are retrieved from the image and fed into the classifier during classification.The classifier uses the training dataset to learn and give a label to the input image based on the feature values.The output we obtain from this step is the label value.If the label value is 1, that is, if the copra is considered to be in the bad category a

Figure 6 .
Figure 6.Flowchart on classification.The next level of classification is between sulphur added copra and good milling copra.Features values of mean, standard deviation and variance of the original image along with the mean of red, and green plane differed greatly between good copra and sulphur added copra.Other features taken into consideration for classification between the above said categories was the mean of H, S and V values of the image after its conversion to HSV image.The process of classification is similar in all the levels.The above said feature values are fed into the classifier and the classifier labels the image with the numeric value.If

Table 2 .
Feature values of degraded copra images