Next Article in Journal
Silicon Improves Heat and Drought Stress Tolerance Associated with Antioxidant Enzyme Activity and Root Viability in Creeping Bentgrass (Agrostis stolonifera L.)
Previous Article in Journal
Does the Biennial Straw Return Have an Identical Characteristic of Soil Organic Carbon Sequestration as the Annual? A Case Study of Cornfield in Northeast China
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Novel Approach for Asparagus Comprehensive Classification Based on TOPSIS Evaluation and SVM Prediction

College of Engineering, Nanjing Agricultural University, Nanjing 210031, China
*
Authors to whom correspondence should be addressed.
Agronomy 2024, 14(6), 1175; https://doi.org/10.3390/agronomy14061175
Submission received: 23 March 2024 / Revised: 21 May 2024 / Accepted: 28 May 2024 / Published: 30 May 2024
(This article belongs to the Section Precision and Digital Agriculture)

Abstract

:
As a common vegetable variety, asparagus is rich in B vitamins, vitamin A, and trace elements such as folate, selenium, iron, manganese, and zinc. With the increasing market demand, China has become the world’s largest cultivated area for asparagus production and product exportation. However, traditional asparagus grading mostly relies on manual visual judgment and needs a lot of manpower input to carry out the classification operation, which cannot meet the needs of large-scale production. To address the high labor cost and labor-intensive production process resulting from the large amount of manpower input and low accuracy of existing asparagus grading devices, this study proposed an improved asparagus grading system and method based on TOPSIS (Technique for Order Preference by Similarity to an Ideal Solution) objective evaluation and SVM (support vector machine) prediction. The key structure of classification device was analyzed first, the key components were designed, and the structural parameters were determined by theoretical calculation. Through analysis of the factors affecting asparagus quality, three key attributes were determined: length, diameter, and bruises, which were used as reference attributes to conduct experimental analysis. Then, the graded control groups were set up, combining the TOPSIS principle with weighting, and a score for each asparagus sample was determined. These scores were compared with those of a graded control group to derive the grade of each asparagus, and these subsets of the dataset were used as the training set and the test set, excluding the error caused by the subjectivity of the manual judgment. Based on a comparison of the accuracies of different machine learning models, the support vector machine (SVM) was determined to be the most accurate, and four SVM methods were used to evaluate the test set: linear SVM, quadratic SVM, cubic SVM, and medium Gaussian SVM. The test results showed that the grading device was feasible for asparagus. The bruises had a large influence on asparagus quality. The training accuracy of the medium Gaussian SVM method was high (96%), whereas its test accuracy was low (86.67%). The training accuracies and test accuracy of the quadratic and cubic SVM methods were 93.34%. The quadratic SVM and cubic SVM were demonstrated to have better generalization ability than the medium Gaussian SVM method for predicting unknown grades of asparagus and meeting the operational requirements of the asparagus grading.

1. Introduction

The demand for asparagus, a common vegetable variety, is increasing in the market, and China has become the world’s largest cultivated area for asparagus production and the largest product-exporting country [1,2]. However, traditional asparagus grading mostly relies on manual visual judgment, which requires significant manpower, resulting in high labor costs and a labor-intensive production process [3,4]. Moreover, the traditional manual visual grading process requires a certain amount of time and energy, which reduces the production efficiency of asparagus grading. The speed of manual operation is limited and cannot meet the requirements of mass production [5,6]. Although there are currently some classification technologies that use mechanical equipment, which mainly focus on fruits with regular shapes, there is no corresponding report on this special attribute of asparagus. Moreover, the applicability of the existing classification system and equipment needs to be improved, and the classification accuracy can only be higher for a specific detection object [4,7].
Several countries began to develop agricultural product classification technology in the 1970s [8,9,10,11,12]. A machine learning algorithm was proposed for fruit classification to attain more standardized and reliable results [13]. Color structure and scale-invariant feature transformation operators were used to describe fruit features, making the external features of fruits more obvious. By combining an SVM and the K-nearest neighbors algorithm (K-NN), the recognition accuracy of fruits was greatly improved [14]. Fruit-grading technology in China began later than in some other countries and was initially used to evaluate the external quality of fruit [15,16,17,18,19,20]. In research on the external quality of apples, an SVM optimization based on particle swarm optimization was compared, and a backpropagation (BP) neural network optimized by a genetic algorithm was used for apple classification [21]. Cai proposed an automatic classification based on a convolutional neural network (CNN) SVM model for apple classification, with a classification accuracy of 97.06% [22]. First, the shape, texture, color, roundness, and other features of the apples were extracted using a CNN, and the apples were then graded using an SVM, SNN (spiking neural network), K-NN, and CNN-SVM. In this study, SVM has high training accuracy and test accuracy. Machine vision and machine learning technologies have achieved good research results in the classification of many agricultural products; however, most of the grading equipment is utilized during the harvest [23], and there are few fast, accurate, and online post-harvest classification techniques and methods for asparagus. Therefore, there is an urgent need to design an affordable, accurate, and automated online asparagus grading device and methods to overcome the deficiencies of traditional manual grading and meet current production needs.
To solve the above-mentioned pressing problems, this study developed a comprehensive classification method for asparagus based on TOPSIS objective evaluation and SVM prediction. The length, diameter, and bruises of asparagus were identified using a camera, and the asparagus was divided into three grades. The key structure was designed and analyzed, and asparagus was scored using TOPSIS and weighting methods for grading. Based on a comparison of different machine learning methods, the SVM method was selected to verify the accuracy and improve the grading precision.

2. Materials and Methods

2.1. Complete Machine Structure

The overall structure of the designed online classification cutting and bundling device for asparagus is shown in Figure 1, with a final size of 1 m × 0.4 m × 1 m in length, width, and height. It is composed of an image acquisition device, conveying device, guiding device, cutting device, bundling device, movable baffle, and other components.

2.2. Working Principle

As shown in Figure 1, the conveying device uses a DC motor as the power source to drive the conveyor belt and transport asparagus to the photoelectric sensor. After a pulse signal is obtained from the sensor, the acquisition device takes the asparagus images and sends them to a computer using serial data communication, where image processing and execution of the classification algorithm take place. The grading device sends control instructions according to the decision result and controls the corners of the two guide baffles installed on the support plates on both sides of the conveyor belt bracket through symmetrical electric push rods, guiding the asparagus to move on the conveyor belt to the entrance of the corresponding grade, separating the asparagus of different grades and making them enter different blanking channels behind the conveyor belt, realizing the automatic online grading of asparagus.

2.3. Movement Analysis of Asparagus Grading Process

The guide device is an important component of the online classification system for asparagus. After intelligent decision making by the computer, the graded asparagus enters the channel of the corresponding grade through the guide device on the conveyor belt. The movement process and stress analysis of asparagus directly affect the grading effect, accuracy, and stability.

2.3.1. Movement Analysis of Asparagus Grading Process

During the grading process, the conveyor belt speed is adjusted by controlling the motor speed. When the asparagus is consistent with the conveyor belt speed, one end is analyzed for motion, as shown in Figure 2.
In the experiment, before the asparagus reaches the baffle, the baffle must be pushed to the specified position by the guide rod:
M + ( N P ) C O S θ = v t 1
t 1 M A X t 2 , t 3
and can then achieve the proper position for classification:
( N P ) sin θ = D / 2
where M is the distance between the sensor and the hinged position of the baffle, N is the length of the guide plate, P is the length extended relative to the center line of the conveyor belt, θ is the angle of the guide plate, v is the speed of the conveyor belt, t 1 is the time required for the asparagus to reach the guide plate, t 2 is the time required for the camera and the computer to respond, t 3 is the time required for the sensor and the guide rod to respond, and D is the width of the conveyor belt.
A large number of trials in the experiment showed that when the width of the conveyor belt was approximately 0.4 m, the distance between the sensor and the hinge was 0.5 m, θ was 60°, and the length of the guide plate in half of the conveyor belt position was calculated to be 0.24 m, and then the time required for the response of the camera and the computer was 0.28 s, and the time required for the response of the sensor and the guide rod was 0.40 s. It can be calculated that
v 1.55   m / s
Therefore, the conveyor belt speed during the experiment should be less than or equal to 1.55 m/s.

2.3.2. Stress Analysis of Asparagus in Grading Process

When the asparagus reached the guide plate, it was parallel to the guide plate under the drive of the conveyor belt, and force analysis was performed on the asparagus, as illustrated in Figure 3.
In order to ensure the movement of asparagus, we have the following:
F n 1 F n 4
F n 1 = F n cos θ
F n 4 = F 2 sin θ
F 2 = f 1 ( F n F 1 / sin θ )
F 1 = m g f 2
I = m v
I = F n t 4
where m is the mass of asparagus, Fn is the positive pressure of asparagus on the guide plate, F2 is the friction force between asparagus and the guide plate, F1 is the friction force between asparagus and the conveyor belt, f2 is the dynamic friction coefficient between asparagus and the conveyor belt, f1 is the dynamic friction coefficient between asparagus and the guide plate, I is the impulse of asparagus on the guide plate, and t4 is the action time of force Fn.
When the asparagus reached the end of the baffle, because some of the asparagus was not affected by the baffle, it rotated around the tail part of the baffle and smoothly entered the blanking part under the drive of the conveyor belt.
Medium-sized asparagus is typically 50–100 g. In the experiment, the mass of asparagus was 50 g, the time of force Fn was 0.2 s, the dynamic friction factor between asparagus and the guide plate was 0.5, the dynamic friction factor between the conveyor belt and asparagus was 0.24, θ was 60°, and the gravitational acceleration was 10 m/s2. It can then be calculated that
v 0.86   m / s
In summary, the conveyor belt speed can be expressed as 0.86 m/s ≤ v ≤ 1.55 m/s.

2.4. Material Preparation

The asparagus quality is primarily related to its length and diameter. We used this grading method to assess asparagus quality. Because the length and diameter of asparagus are within a certain range, the asparagus was divided into three levels according to the differences in length and diameter: Grade 1, excellent asparagus; Grade 2, good asparagus; and Grade 3, poor asparagus. Asparagus with a length of 20–25 cm and a diameter of 0–0.8 cm is Grade 3. Asparagus with a length of 25–30 cm and a diameter of 0.8–1.0 cm is Grade 2. Asparagus with a length greater than 30 cm and a diameter greater than 1.0 cm is Grade 1.
Ninety-eight asparagus spears were purchased randomly from a market and numbered. The length and diameter of the asparagus were measured. For the control group, the 99th sample was recorded as 25 cm in length and 0.8 cm in diameter, and that of the 100th sample was recorded as 30 cm in length and 1.0 cm in diameter.

2.5. Grading Method

To accurately assess these grades, we employed the TOPSIS method, first proposed by Hwang and Yoon in 1981. The TOPSIS method has been used to solve practical problems in a series of studies [24,25,26,27,28,29,30,31]. TOPSIS is a commonly used comprehensive evaluation method that can make full use of the information in the original data, and the results can accurately reflect the gap between the evaluation schemes. The basic process is to first unify the index types of the original data matrix (normalization processing) to obtain a normalized matrix and then standardize the normalized matrix to eliminate the influence of each index dimension, find the optimal scheme and worst scheme in the limited scheme, and then calculate the distance between each evaluation object and the optimal and worst schemes. The relative proximity between each evaluation object and the optimal scheme is obtained and used as the basis for evaluating the merits and disadvantages. This method has no restrictions on data distribution and sample content, and the data calculation is simple and easy. The TOPSIS-based method represents the grade of asparagus based on a score. According to experts’ previous research and market experience, asparagus with a score greater than 100 is considered to be Grade 1, a score between 99 and 100 is considered to be Grade 2, and a score less than 99 is considered to be Grade 3.

2.5.1. Normalization of the Original Matrix

To evaluate the sample quality, four evaluation indicators are defined: extremely large indicator (benefit-based indicator), extremely small indicator (cost-based indicator), intermediate indicator, and interval indicator. For the length of asparagus, we want the longer the better, so it is called the extremely large indicator; if the surface of asparagus has bruises, the less there are the better, so it is called the extremely small indicator. For the intermediate indicator, we want its value to be in the middle of the range, while for the interval indicator, we want its value to be in an interval. When calculating the score, the original matrix of the indicator data must be normalized, and by normalizing the raw matrix, we mean that all indicator types should be converted uniformly to extremely large indicators. The very small indicator is converted into the very large indicator as follows:
max x
Here, max is maximum value of data, and x is the value of any sample. When converting very small indicators into very large ones, the reciprocal of 1 x can be used if all elements are positive.
The intermediate indicator is transformed into the extremely large indicator as follows:
M = max { x i x b e s t }
x i = 1 x i x b e s t M
where { x i } is the series of intermediate indicators, and x b e s t is the best value.
The interval-type indicator is transformed into the extremely large indicator as follows:
M = max { a min { x i } , max { x i } b }
x i = 1 a x i M , x i < a 1 , a x i b 1 x i b M , x i > b
where { x i } is the series of intermediate indicators. The best interval is [a, b].

2.5.2. Standardization of the Normalized Matrix

The normalized matrix after processing is standardized to eliminate the influence of different index dimensions. Suppose that there are n objects to be evaluated, and the normalized matrix composed of m evaluation indicators is as follows:
X = x 11 x 12 x 1 m x 21 x 22 x 2 m x n 1 x n 2 x n m
Then, its standardized matrix is denoted as Z, where the elements of Z are as follows:
z i j = x i j / i = 1 n x i j 2
The measured lengths and diameters of the asparagus are showed in Figure 4 and listed in Table 1.
Because the length and diameter of asparagus are very large indicators, the asparagus data are substituted into the matrix and standardized, yielding the standardized matrix.

2.5.3. Score Normalization

Suppose that there are n objects to be evaluated and a standardized matrix of m evaluation indicators, i.e.,
Z = z 11 z 12 z 1 m z 21 z 22 z 2 m z n 1 z n 2 z n m
The value of the maximum Z + is defined as follows:
Z + = ( Z 1 + , Z 2 + , , Z m + ) = ( max { z 11 , z 21 , , z n 1 } , max { z 12 , z 22 , , z n 2 } , , max { z 1 m , z 2 m , , z n m } )
The value of the minimum Z is defined as follows:
Z = ( Z 1 , Z 2 , , Z m ) = ( min { z 11 , z 21 , , z n 1 } , min { z 12 , z 22 , , z n 2 } , , min { z 1 m , z 2 m , , z n m } )
The distance D i + between the i-th evaluation object (i = 1, 2, …, n) and the maximum value is the following:
D i + = j = 1 m ( Z j + z i j ) 2
The distance D i between the i-th evaluation object (i = 1, 2, …, n) and the minimum value is the following:
D i = j = 1 m ( Z j z i j ) 2
We can then calculate the unnormalized score of the i-th valuation object:
S i = D I D i + + D i
where 0 S i 1 . The larger S i is, the smaller D i + is, and the closer it is to the maximum value.
We can normalize the score as S ¯ i = S i / i = 1 n S i , where i = 1 n S i = 1 . It is important to note that normalizing the scores does not affect the ranking.

3. Results

3.1. Decision Grading Level

MATLAB (2016a) was used to calculate and normalize the scores of the standardized asparagus data; the results are presented in Table 2.
After the calculations, the scores and rankings of the asparagus were analyzed. With asparagus No. 100 and No. 99 as the control group, 15 were classified as primary asparagus, 66 as secondary asparagus, and 17 as tertiary asparagus. Asparagus Nos. 3 and 4 scored the highest, whereas asparagus No. 95 scored the lowest.

3.2. Grade Level Added Bruises

The quality of asparagus is not only related to its length and diameter but also to the bruises in the process of asparagus production and harvest. Asparagus is often damaged during picking and transportation. Therefore, the detection of the number of bruises, as an important attribute for judging the quality, is more consistent with the actual situation. The data updates after detection are listed in Table 3.
According to the principle of TOPSIS, the smaller the number of bruises, the better the quality is, and the higher the actual benefit; therefore, the number of bruises is a very small attribute. Normalization processing was performed, and the data are listed in Table 4.
MATLAB (2016a) was used to calculate and normalize the scores of the processed data, and the results are listed in Table 5.
Analysis of the asparagus score data showed that 8 were classified as primary asparagus, 59 as secondary asparagus, and 31 as tertiary asparagus. It is not difficult to see that the score and grade of asparagus change greatly after the bruises number attribute is added; therefore, the bruises number attribute has a significant impact on asparagus quality.

3.3. Grade Level Added Weight

When judging, the selected attributes had different degrees of influence. Therefore, we assigned weights to three criteria: asparagus length, diameter, and bruises number, that is, the greater the attribute weight, the greater the impact on asparagus quality. After consulting relevant industry experts, the weight ratio of the three attributes (length, diameter, and bruises number) was 1:1:2. Therefore, weights were added when defining the distance between the evaluation object and the maximum value.
The distance D i + between the i-th evaluation object (i = 1, 2, …, n) and the maximum value is defined as follows:
D i + = j = 1 m w j ( Z j + z i j ) 2
The distance D i between the i-th evaluation object (i = 1, 2, …, n) and the minimum value is defined as follows:
D i = j = 1 m w j ( Z j z i j ) 2
where w j is the weight of the attribute.
MATLAB (2016a) was used to calculate and normalize the score of the data after adding the weight, and the results are listed in Table 6.
Analysis of the asparagus score data showed that 9, 58, and 31 were classified as primary, secondary, and tertiary, respectively. After observation and analysis of the data, the asparagus numbers at different levels changed slightly after adding the weight; the number with the highest and lowest scores did not change, and the ordering of asparagus in the middle changed slightly.
In summary, asparagus quality is affected by length, diameter, and bruises. Adding the number of attributes affects the asparagus score; therefore, in comparison with the control group, the grade of asparagus also changes, and the results are more realistic. Given that different attributes have different effects on asparagus, the grade will change slightly if the attributes are weighted, and the grade will change if different weights are given.

4. Discussion

4.1. Sample Acquisition

The experimental samples were purchased from different vegetable markets in Nanjing randomly and transported to the laboratory at Nanjing Agricultural University. To establish a robust and reliable prediction model, the inedible part of the asparagus was cut off, and the remaining part with economic value was preserved, as shown in Figure 5.
A total of 15 asparagus spears were selected as the test set, and those with length of 20–25 cm, diameter of 0–0.8 cm, and bruises number greater than three and less than or equal to five were classified as Grade 3. The asparagus with length of 25–30 cm, diameter of 0.8–1.0 cm, and bruises number greater than one and less than or equal to three were classified as Grade 2; those with length greater than 30 cm, diameter greater than 1.0 cm, and bruises number less than or equal to one were classified as Grade 1.
The attribute data of each group of samples were measured, and the proposed method based on TOPSIS was implemented using MATLAB(2016a) software. The experiment was repeated three times for each group to ensure accuracy. The scores of the verified asparagus samples are displayed in Table 7.

4.2. Experimental Instrument

The camera used in the experiment was a pyAI-K210 (Manufactured by 01 Electronic Technology Co., Ltd., Shenzhen, China). The main body of the K210 AI chip inside the camera is composed of two parts: a pluggable camera module and a main control module. The image information of asparagus was obtained using the camera and was transmitted to the main control board for identification and processing, and the basic attribute information of asparagus was read. To ensure the stability of the experimental device, the conveyor belt speed was adjusted to 1 m/s, and the computer detection software (Lenovo New 15) was initialized. The test device for apparatus grading is shown in Figure 6.

4.3. Model Training Results and Analysis

In machine learning, the recall ratio and precision ratio are typically used to indicate the percentage of correct predictions. The recall and precision ratios are the following:
R = T P T P + T N
P = T P T P + F P
where TP is true positive, TN is true negative, and FP is false positive.
These two variables are generally negatively correlated. In practice, when one is selected as a reference, the F1 score is introduced, which is the harmonic average of the two variables.
2 F 1 = 1 R + 1 P
The closer the result is to one, the better the prediction result.
The recall ratio R, that is, the true class rate, is the longitudinal coordinate, and the false-positive class rate FPR is the horizontal coordinate used to draw a curve, that is, the receiver operating characteristic (ROC) curve is obtained, where the false-positive class rate is the following:
F P R = F P F P + T N
If the ROC curves of the different models are plotted in a graph, the curve closest to the upper-left corner represents the best model classification. In an actual situation, if two curves cross each other, it is difficult to determine which is better or worse. Therefore, the area under the curve (AUC) is introduced, that is, the area surrounded by the curve and the coordinate axis. The larger the area, the better the effect. In general, if the AUC is greater than 0.85, the model performs well.
To judge the prediction ability of the model for unknown data, called the generalization ability of the model, dataset U was randomly divided into k mutually exclusive subsets of similar sizes using the K-fold cross-validation method. Each time, the union of k − 1 subsets was used as the training set, and the remaining subset was used as the test set. This yields k training/test sets, which allows training and testing k times and ultimately returns the average result of the k tests.
The above grading levels of 100 samples obtained by TOPSIS were selected as the training set and a scatterplot was made, having length as the horizontal coordinate and diameter as the vertical coordinate, as shown in Figure 7.
The scatterplot shows the distribution and concentration of asparagus. Approximately 85% of the asparagus is 20–30 cm in length and 0.8–1.0 cm in diameter; 10% percent of the asparagus is less than 22 cm in length, with a diameter of less than 0.8 cm; the remaining 5% of the asparagus is greater than 30 cm in length and 1.0 cm in diameter, suggesting that the asparagus was concentrated in the range of 20–30 cm in length and 0.8–1.0 cm in diameter.
By setting the parameters of medium tree (Max Num Splits = 20), fine K-NN (Num Neighbors = 1), medium K-NN (Num Neighbors = 10), medium Gaussian SVM (Kernel Scale = 1.7, Box Constraint = 1), linear SVM (Box Constraint = 1), quadratic SVM (Polynomial Order = 2, Box Constraint = 1), and cubic SVM (Polynomial Order = 3, Box Constraint = 1), using the classification learning program in MATLAB (2016a) and comparing different models, such as decision trees, discriminant analysis, SVM, and K-NN, it can be seen from Figure 8 that the SVM, linear discriminant, and fine K-NN have high accuracies of 96%, 94%, and 93%, respectively.
As shown in Figure 9, by comparing the AUC values of the ROC curves, it is found that the AUC value of the ROC curve of the fine K-NN is less than 0.85, whereas the AUC value of the ROC curve of the medium Gaussian SVM is 1, indicating that the fine K-NN model performed poorly. As can be seen from the prediction results in Table 8, the test accuracy of linear discriminant was 80.00%, which is lower than that of the medium Gaussian SVM (test accuracy of 86.67%); therefore, the generalization ability of the linear discriminant was poor. Thus, the SVM method was selected.
By comparing four different SVM models, the samples were trained by selecting five-fold cross-validation. The training accuracy is displayed in Table 9.
As seen in Table 9, the training accuracy of the medium Gaussian SVM is higher than that of the other three methods, reaching 96%. However, it is necessary to determine the predictive ability of the model for unknown data.

4.4. Model Verification

After the training analysis results were obtained, 15 asparagus of known grade obtained by the above method were used as the test set. Different models were used to make predictions, and the predicted results were statistically analyzed, as listed in Table 10.
By comparing Table 9 and Table 10, it can be seen that although the medium Gaussian SVM has a higher training accuracy than the quadratic SVM and cubic SVM methods, the test accuracy was only 86.67%, whereas the quadratic SVM and cubic SVM methods obtained the highest test accuracy of 93.34%. This demonstrates good generalization ability, which indicates that there may be overfitting in the medium Gaussian SVM.
To visualize the data, a parallel coordinate diagram is shown in Figure 10, representing each variable of the high-dimensional data (length, diameter, and bruises) with a series of parallel axes; the value of the variable corresponds to the position on the axis, which reflects the changing trend and relationship between each variable. As shown in Figure 10, the classification of labels mainly depends on whether lines of the same color are concentrated. On the parallel coordinate diagram of quadratic SVM and cubic SVM, the values of the length attribute are concentrated in the range of −1.5 std to 1.0 std, and the values of the diameter attribute are concentrated in the range of −1.5 std to 0.5 std. The bruises attribute has six discrete values, and the concentration is relatively uniform. The same-colored lines for each attribute (length, diameter, and bruises) are relatively concentrated, and different colors have a certain distance, indicating that the three selected attributes are useful for predicting the label category. In the observation chart, there are a few lines (such as the blue line in the cubic SVM chart) with large deviation from the same color, which affects the prediction results.
To obtain the accuracy more intuitively, the records in the dataset are summarized in the form of a matrix according to the two criteria of the real category and the category judgment predicted by the classification model. The confusion matrix is shown in Figure 11.
The accuracy of the quadratic SVM and cubic SVM models can be intuitively seen from the confusion matrix, that is, the ratio of the sum of the diagonal numbers of the matrix to the total number is the accuracy of the model. In Figure 11, the accuracy of the two models is 94% and 92%, respectively.
In practice, we pay more attention to the good asparagus, which will affect economic value; therefore, Grade 3 is regarded as positive and Grades 1 and 2 as negative. The ROC curve is shown in Figure 12, in which the AUC values of the ROC curves for the two models are 1.00, that is, the model performs well.

4.5. Discussion

According to the above verification results, the medium Gaussian SVM method has high accuracy, but its generalization ability is inferior to that of the quadratic SVM and cubic SVM, that is, quadratic SVM and cubic SVM are more accurate in predicting the unknown grades of asparagus.

5. Conclusions

Based on the analysis and statistics of the length, diameter, and bruises number of asparagus, a comprehensive classification method for asparagus based on TOPSIS objective evaluation and SVM prediction was proposed, which has the advantages of high classification accuracy and efficiency. In addition, kinematic and dynamic analysis of the experimental device showed that the speed of the conveyor belt should be greater than or equal to 0.86 m/s and less than or equal to 1.55 m/s, and the speed should be adjusted to 1 m/s during the test to ensure the conveying stability.
In machine learning, an attribute is an important factor to evaluate the quality of an item, but an item will have multiple attributes, some attributes have a large impact, and some attributes have a small impact, so it is necessary to add weight to the attribute of the item, and the result is more convincing. The test results showed that there was a large difference between the asparagus grade obtained when the length and diameter were used as the attributes, and the asparagus grade obtained after the attribute of the bruises number was added; therefore, the attribute of the bruises number had a greater impact on the asparagus quality. After adding weights, the numbers at different levels changed slightly, the number with the highest and lowest scores did not change, and the order of asparagus in the middle changed slightly.
Machine learning was used to compare the feasibility of the different methods, and SVM was found to be the best approach. Four different SVM models were selected to analyze the unknown asparagus data. The training accuracy of the medium Gaussian SVM model was 96%, and that of the quadratic SVM and cubic SVM models was 94% and 92%, respectively. However, the prediction test accuracy of the medium Gaussian SVM model was 86.67%, while the test accuracy of the quadratic SVM and cubic SVM models was 93.34%. Therefore, the generalization ability of the medium Gaussian SVM model was shown to be inferior to that of the quadratic SVM and cubic SVM, that is, quadratic SVM and cubic SVM are more accurate in predicting the unknown grades of asparagus. The test accuracy of the quadratic and cubic SVM methods reached 93.34%, which meets the actual demand.

Author Contributions

Q.C.: conceptualization, methodology, software, writing—original draft, data curation, visualization, and formal analysis. C.X.: software, formal analysis, and writing—review and editing. Y.S.: conceptualization, data curation, writing—review and editing, and supervision. X.W.: software, formal analysis, writing—review and editing, and validation. X.Z. and Y.H.: formal Analysis and writing—review and editing. All authors have read and agreed to the published version of the manuscript.

Funding

The authors acknowledge the financial support provided by the Jiangsu Agricultural Science and Technology Innovation Fund (No. CX(23)3029), the Natural Science Foundation of Jiangsu Province (Grant No. BK20210410), and the Jiangsu Provincial Key Research and Development Plan (No. BE2021302-2).

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

The authors are grateful to the editor and anonymous reviewers for providing insightful comments and helpful suggestions to improve the quality of our manuscript.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Huang, J.; Tang, H.; Fan, C.; Gong, H.; Gao, Y. Research progress on nutritional and health functions of asparagus and its processing. China Food Saf. Mag. 2022, 23, 122–125. [Google Scholar]
  2. He, C. Development status and prospect of asparagus industry in China. Vegetables 2022, 5, 33–39. [Google Scholar]
  3. Zhou, X.; Yao, Y. Development status and thinking of asparagus industry in Yongshou, Shaanxi Province. Prim. Agric. Technol. Ext. 2021, 9, 50–52. [Google Scholar]
  4. Li, W.; Hu, Z.; Tian, W. Analysis on the Development Status, Problems and Suggestions of Asparagus Industry in Zhangjiajie. Hunan Agric. Sci. 2020, 8, 105–107. [Google Scholar] [CrossRef]
  5. Jia, H.; Zhao, J.; Li, S. Discussion on classification standard and investigation method of asparagus stem blight. China Veg. 2010, 11, 25–26. [Google Scholar]
  6. Zhou, Q.; Zhao, L.; Wang, R.; Han, Y.; Jin, N. Study on Standard for Harvesting and Grading in Fresh Green Asparagus. J. Changjiang Veg. 2003, 8, 44–45. [Google Scholar] [CrossRef]
  7. Zhou, L. The design of portable electric fruit picking grading device. J. Agric. Sci. Technol. Equip. 2018, 2, 15–16+20. [Google Scholar]
  8. Rigney, M.P.; Brusewitz, G.H. Asparagus shape features for quality assessment. Trans. ASAE 1992, 35, 1607–1613. [Google Scholar] [CrossRef]
  9. Ruhm, G. Economic evaluation of various harvesting, grading and cultivation methods for asparagus. In Proceedings of the XV International Symposium on Horticultural Economics and Management, Berlin, Germany, 29 August–3 September 2004; pp. 503–507. [Google Scholar]
  10. Donis-González, I.R.; Guyer, D.E. Classification of processing asparagus sections using color images. Comput. Electron. Agric. 2016, 127, 236–241. [Google Scholar] [CrossRef]
  11. Donis-González, I.R.; Guyer, D.E.; Pease, A. Postharvest noninvasive classification of tough-fibrous asparagus using computed tomography images. Postharvest Biol. Technol. 2016, 121, 27–35. [Google Scholar] [CrossRef]
  12. Siomos, A.S. The quality of asparagus as affected by preharvest factors. Sci. Hortic. 2018, 233, 510–519. [Google Scholar] [CrossRef]
  13. Susnjak, T.; Brczaj, A.; Reyes, N. Add composition machine-learning strategy for automated fruit grading. Lect. Eng. Comput. Sci. 2013, 2208, 819–825. [Google Scholar]
  14. Zawbaa, H.M.; Hazman, M.; Abbass, M.; Hassanien, A.E. Automatic fruit classification using random forest algorithm. In Proceedings of the International Conference on Hybrid Intelligent Systems, Kuwait, Kuwait, 14–16 December 2014; IEEE: New York, NY, USA, 2014; pp. 164–168. [Google Scholar]
  15. Zhang, B.; Ye, Y.; Jin, S.; Luo, W.; Zhou, J.; Yin, Y.; Luo, S.; Tang, Y. Overall Evaluation of Asparagus Germplasm Resources Based on Grey Relational Analysis and DTOPSIS Method. J. Henan Agric. Sci. 2022, 51, 96–107. [Google Scholar]
  16. Liu, J.; Gao, J.; Zhang, B.; Wang, J. Design of fruit grading system based on machine vision. Food Mach. 2023, 39, 112–118. [Google Scholar]
  17. Li, Y.; Zhang, P.; Yuan, J.; Liu, X. Visual positioning and harvesting path optimization of white asparagus harvesting robot. Smart Agric. 2019, 2, 65–78. [Google Scholar]
  18. Yuan, J. Research Progress Analysis of Robotics Selective Harvesting Technologies. Trans. Chin. Soc. Agric. Mach. 2019, 51, 1–17. [Google Scholar]
  19. Dou, B. Design and Test of Control System for Selective Harvesting of White Asparagus Based on Machine Vision. Master’s Thesis, Shandong Agricultural University, Tai’an, China, 2020. [Google Scholar]
  20. Wang, X.; Qiao, H.; Liu, F.; Guo, J.; Cui, M. Review of Fruit Quality Grading Methods Based on Machine Vision. Group Technol. Prod. Mod. 2023, 40, 6–13. [Google Scholar]
  21. Nie, M. Research on External Quality Detection Method of Red Fuji Apple. Master’s Thesis, Jinan University, Jinan, China, 2020. [Google Scholar]
  22. Cai, Y. The CNN-SVM Model Based on Machine Learning Algorithm for Robust Grading of Apples. Master’s Thesis, Harbin Institute of Technology, Harbin, China, 2020. [Google Scholar]
  23. Yu, J.; Zhang, C.; Wang, J.; Zhang, M.; Zhang, X.; Li, X. Research on Asparagus Recognition Based on Deep Learning. IEEE Access 2023, 11, 117362–117367. [Google Scholar] [CrossRef]
  24. Jiang, Y.; Wang, J.; Teng, H.; Li, H. Coupling coordination analysis of the quality evaluation of cultivated land and soil erosion in typical black soil areas using TOPSIS method. Trans. Chin. Soc. Agric. Eng. 2019, 39, 82–94. [Google Scholar]
  25. Lei, X.; Robin, Q.; Liu, Y. Evaluation of regional land use performance based on entropy TOPSIS model and diagnosis of its obstacle factors. Trans. Chin. Soc. Agric. Eng. 2016, 32, 243–253. [Google Scholar]
  26. Lv, Y.; Yun, W.; Zhang, C.; Zhu, D.; Yang, J.; Chen, Y. Multi-characteristic Comprehensive Recognition of Well-facilitied Farmland Based on TOPSIS and BP Neural Network. Trans. Chin. Soc. Agric. Mach. 2018, 49, 196–204. [Google Scholar]
  27. Liu, D.; Gong, F.H.; Fu, Q.; Faiz, M.; Li, T.; Gui, S. Evaluation Model of Irrigation Water Use Efficiency Based on Game Theory and GRA-TOPSIS. Trans. Chin. Soc. Agric. Mach. 2017, 48, 218–226. [Google Scholar]
  28. Behzadian, M.; Otaghsara, S.K.; Yazdani, M.; Ignatius, J. A state-of the-art survey of TOPSIS applications. Expert Syst. Appl. 2012, 39, 13051–13069. [Google Scholar] [CrossRef]
  29. Olson, D.L. Comparison of weights in TOPSIS models. Math. Comput. Model. 2004, 40, 721–727. [Google Scholar] [CrossRef]
  30. Chakraborty, S. TOPSIS and Modified TOPSIS: A comparative analysis. Decis. Anal. J. 2022, 2, 100021. [Google Scholar] [CrossRef]
  31. Chen, P. Effects of normalization on the entropy-based TOPSIS method. Expert Syst. Appl. 2019, 136, 33–41. [Google Scholar] [CrossRef]
Figure 1. Schematic diagram of the online grading system for asparagus. 1. Bracket; 2. conveying device; 3. computer; 4. camera; 5. camera support frame; 6. guide baffle; 7. classification device; 8. divider baffle; 9. second photoelectric sensor; 10. cutting device; 11. first-layer baffle; 12. binding device; 13. second-layer (mobilized) baffles; 14. conveyor drive motor; 15. first photoelectric sensor.
Figure 1. Schematic diagram of the online grading system for asparagus. 1. Bracket; 2. conveying device; 3. computer; 4. camera; 5. camera support frame; 6. guide baffle; 7. classification device; 8. divider baffle; 9. second photoelectric sensor; 10. cutting device; 11. first-layer baffle; 12. binding device; 13. second-layer (mobilized) baffles; 14. conveyor drive motor; 15. first photoelectric sensor.
Agronomy 14 01175 g001
Figure 2. Analysis of asparagus transport movement.
Figure 2. Analysis of asparagus transport movement.
Agronomy 14 01175 g002
Figure 3. Stress analysis diagram of asparagus.
Figure 3. Stress analysis diagram of asparagus.
Agronomy 14 01175 g003
Figure 4. Column diagram of asparagus length and diameter.
Figure 4. Column diagram of asparagus length and diameter.
Agronomy 14 01175 g004
Figure 5. Picture of asparagus.
Figure 5. Picture of asparagus.
Agronomy 14 01175 g005
Figure 6. Test device for apparatus grading.
Figure 6. Test device for apparatus grading.
Agronomy 14 01175 g006
Figure 7. Scatter plot about the sample prediction model under length and diameter attributes (blue—grade 1; red—grade 2; yellow—grade 3).
Figure 7. Scatter plot about the sample prediction model under length and diameter attributes (blue—grade 1; red—grade 2; yellow—grade 3).
Agronomy 14 01175 g007
Figure 8. Training accuracy of different algorithms.
Figure 8. Training accuracy of different algorithms.
Agronomy 14 01175 g008
Figure 9. ROC curve comparison between fine K-NN and medium Gaussian SVM.
Figure 9. ROC curve comparison between fine K-NN and medium Gaussian SVM.
Agronomy 14 01175 g009
Figure 10. Parallel coordinate diagram between quadratic SVM and cubic SVM.
Figure 10. Parallel coordinate diagram between quadratic SVM and cubic SVM.
Agronomy 14 01175 g010
Figure 11. Confusion matrix between quadratic SVM and cubic SVM (the ratio of the sum of the numbers in the green box to the total number is the accuracy).
Figure 11. Confusion matrix between quadratic SVM and cubic SVM (the ratio of the sum of the numbers in the green box to the total number is the accuracy).
Agronomy 14 01175 g011
Figure 12. ROC curve between quadratic SVM and cubic SVM (the value of AUC in the figure represents the area surrounded by the ROC curve and the coordinate axis, and generally greater than 0.85 indicates that the model performs well).
Figure 12. ROC curve between quadratic SVM and cubic SVM (the value of AUC in the figure represents the area surrounded by the ROC curve and the coordinate axis, and generally greater than 0.85 indicates that the model performs well).
Agronomy 14 01175 g012
Table 1. Asparagus data.
Table 1. Asparagus data.
Sample NumberLength/cmDiameter/cm
128.61.1
2311.2
3321.3
4321.3
9720.20.75
9819.80.8
99250.8
100301.0
Table 2. Scores of asparagus.
Table 2. Scores of asparagus.
Score Sorted by Size (Length and Diameter)Number Corresponding to the Score
0.02163
0.02164
0.0192
0.0139100
0.006999
0.00289
0.001391
0.000895
Table 3. Updated data of asparagus.
Table 3. Updated data of asparagus.
Sample NumberLength/cmDiameter/cmBruises
128.61.11
2311.25
3321.32
4321.32
9720.20.752
9819.80.83
99250.83
100301.01
Table 4. Asparagus data after forward conversion.
Table 4. Asparagus data after forward conversion.
Sample NumberLength/cmDiameter/cmBruises
128.61.14
2311.20
3321.33
4321.33
9720.20.753
9819.80.82
99250.82
100301.04
Table 5. Scores after adding the “Bruises” attributes.
Table 5. Scores after adding the “Bruises” attributes.
Score Sorted by Size
(Length, Diameter, and Bruises)
Number Corresponding to the Score
0.01818
0.017715
0.017622
0.016100
0.008199
0.002288
0.002181
0.001794
Table 6. Scores after adding weights.
Table 6. Scores after adding weights.
Score Sorted by SizeNumber Corresponding to the Score
0.01878
0.018515
0.018422
0.0163100
0.008299
0.001688
0.001581
0.001394
Table 7. Scores of the first group of verified asparagus samples.
Table 7. Scores of the first group of verified asparagus samples.
The Score Is Sorted by SizeThe Number Corresponding to the ScoreLevel
0.0161041
0.01521011
0.01421051
0.01371021
0.01361031
0.0135100Control group
0.01341072
0.01311062
0.0121102
0.011082
0.00911122
0.00721092
0.006999Control group
0.00671113
0.00671143
0.00661153
0.00331133
Table 8. Comparison of linear discriminant and medium Gaussian SVM on test accuracy.
Table 8. Comparison of linear discriminant and medium Gaussian SVM on test accuracy.
Class of ModelNumber of Grade 1Number of Grade 2Number of Grade 3Test Accuracy
ActualPredictedActualPredictedActualPredicted
Linear Discriminant55694180.00%
Medium Gaussian SVM54684386.67%
Table 9. Training accuracy of SVM training under different models.
Table 9. Training accuracy of SVM training under different models.
Class of ModelTraining Accuracy
Linear SVM91%
Quadratic SVM94%
Cubic SVM92%
Medium Gaussian SVM96%
Table 10. Test accuracy rates under four methods.
Table 10. Test accuracy rates under four methods.
Class of ModelNumber of Grade 1Number of Grade 2Number of Grade 3Test Accuracy
ActualPredictedActualPredictedActualPredicted
Linear SVM546104173.34%
Quadratic SVM55674393.34%
Cubic SVM56654493.34%
Medium Gaussian SVM54684386.67%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Chen, Q.; Xia, C.; Shi, Y.; Wang, X.; Zhang, X.; He, Y. A Novel Approach for Asparagus Comprehensive Classification Based on TOPSIS Evaluation and SVM Prediction. Agronomy 2024, 14, 1175. https://doi.org/10.3390/agronomy14061175

AMA Style

Chen Q, Xia C, Shi Y, Wang X, Zhang X, He Y. A Novel Approach for Asparagus Comprehensive Classification Based on TOPSIS Evaluation and SVM Prediction. Agronomy. 2024; 14(6):1175. https://doi.org/10.3390/agronomy14061175

Chicago/Turabian Style

Chen, Qiang, Chuang Xia, Yinyan Shi, Xiaochan Wang, Xiaolei Zhang, and Ye He. 2024. "A Novel Approach for Asparagus Comprehensive Classification Based on TOPSIS Evaluation and SVM Prediction" Agronomy 14, no. 6: 1175. https://doi.org/10.3390/agronomy14061175

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop