Research on Classification Model of Panax notoginseng Taproots Based on Machine Vision Feature Fusion

The existing classification methods for Panax notoginseng taproots suffer from low accuracy, low efficiency, and poor stability. In this study, a classification model based on image feature fusion is established for Panax notoginseng taproots. The images of Panax notoginseng taproots collected in the experiment are preprocessed by Gaussian filtering, binarization, and morphological methods. Then, a total of 40 features are extracted, including size and shape features, HSV and RGB color features, and texture features. Through BP neural network, extreme learning machine (ELM), and support vector machine (SVM) models, the importance of color, texture, and fusion features for the classification of the main roots of Panax notoginseng is verified. Among the three models, the SVM model performs the best, achieving an accuracy of 92.037% on the prediction set. Next, iterative retaining information variables (IRIVs), variable iterative space shrinkage approach (VISSA), and stepwise regression analysis (SRA) are used to reduce the dimension of all the features. Finally, a traditional machine learning SVM model based on feature selection and a deep learning model based on semantic segmentation are established. With the model size of only 125 kb and the training time of 3.4 s, the IRIV-SVM model achieves an accuracy of 95.370% on the test set, so IRIV-SVM is selected as the main root classification model for Panax notoginseng. After being optimized by the gray wolf optimizer, the IRIV-GWO-SVM model achieves the highest classification accuracy of 98.704% on the test set. The study results of this paper provide a basis for developing online classification methods of Panax notoginseng with different grades in actual production.


Introduction
Panax notoginseng is one of the most representative traditional Chinese medicines in Yunnan Province, China, and it is also known as "Jinbuhuan". It not only has medicinal values (e.g., promoting blood circulation, removing blood stasis, relieving swelling and pain, and anti-cancer) but also has health care effects (e.g., enhancing learning and memory, improving immunity, and delaying aging) [1]. The number of heads of Panax notoginseng refers to the number of Panax notoginseng taproots per 500 g, which is the main basis for the classification of Panax notoginseng in the market. The weight of a single Panax notoginseng is the main factor that determines its selling price [2]. Currently, there are two main classification methods of Panax notoginseng taproots: manual classification and mechanical sorting. Manual classification is characterized by high labor intensity and low automation and efficiency, and it is often affected by subjective factors, causing misclassification and

Test Materials
This study takes Panax notoginseng planted in Wenshan City, Yunnan Province, as the research object. According to the market research, it is known that more than 90% of Panax notoginseng sold in the market have between 20 and 60 heads. Therefore, after preliminary treatment, 450 three-year-old "spring" Panax notoginseng samples with 20 heads (grade I), 30 heads (grade II), 40 heads (grade III), and 60 heads (grade IV) were selected, and the moisture content of these samples was less than 13%. The samples of different grades were weighted one by one before image information collection. The four different grades of Panax notoginseng main roots are shown in Figure 1.
provides a reference for applying machine vision technology to the classification of Panax notoginseng taproots.

Test Materials
This study takes Panax notoginseng planted in Wenshan City, Yunnan Province, as the research object. According to the market research, it is known that more than 90% of Panax notoginseng sold in the market have between 20 and 60 heads. Therefore, after preliminary treatment, 450 three-year-old "spring" Panax notoginseng samples with 20 heads (grade I), 30 heads (grade II), 40 heads (grade III), and 60 heads (grade IV) were selected, and the moisture content of these samples was less than 13%. The samples of different grades were weighted one by one before image information collection. The four different grades of Panax notoginseng main roots are shown in Figure 1.

The Grading Standard of Panax notoginseng Taproots
According to the national standard of Wenshan Panax notoginseng [20] (gbt19086-2008), the grading specifications of the four grades of the main root of notoginseng are shown in Table 1.

Image Acquisition System Introduction
As shown in Figure 2, the image acquisition system consisted of a computer (Lenovo-T480), a Hikvision industrial camera (model: MV-CA013-20GC, lens: MVL-HF0828M-6MP, with a resolution of 1280 × 1024), a test chamber (400 mm × 400 mm × 400 mm), a stage, a ring-shaped LED shadowless lamp, a USB cable, and other components. The camera was fixed at the center of the top of the test box; the annular LED shadowless lamp was used as the light source, and the white high contrast was used as the background of the overhead camera; the object distance was adjusted to 27 cm, and the focal length was set to 2.8 mm. Then, the Panax notoginseng taproots of different grades were placed one by one on the central position of the object platform, and the shooting mode was started. The collected image data were transmitted to the computer through a USB cable, and the collected image was preprocessed using the Python language and the OpenCV machine learning framework.

The Grading Standard of Panax notoginseng Taproots
According to the national standard of Wenshan Panax notoginseng [20] (gbt19086-2008), the grading specifications of the four grades of the main root of notoginseng are shown in Table 1. Table 1. Grading specification of taproot of Panax notoginseng.

Image Acquisition System Introduction
As shown in Figure 2, the image acquisition system consisted of a computer (Lenovo-T480), a Hikvision industrial camera (model: MV-CA013-20GC, lens: MVL-HF0828M-6MP, with a resolution of 1280 × 1024), a test chamber (400 mm × 400 mm × 400 mm), a stage, a ring-shaped LED shadowless lamp, a USB cable, and other components. The camera was fixed at the center of the top of the test box; the annular LED shadowless lamp was used as the light source, and the white high contrast was used as the background of the overhead camera; the object distance was adjusted to 27 cm, and the focal length was set to 2.8 mm. Then, the Panax notoginseng taproots of different grades were placed one by one on the central position of the object platform, and the shooting mode was started. The collected image data were transmitted to the computer through a USB cable, and the collected image was preprocessed using the Python language and the OpenCV machine learning framework.

Image Preprocessing
To facilitate feature extraction and improve the algorithm efficiency, in this study, the resolution of the original image ( Figure 3a) was adjusted from 1280 × 1024 to 512 × 512. Then, the image was denoised with a Gaussian filter (Figure 3b), and the filtered image was converted to grayscale ( Figure 3c). Next, an open (corrode) operation with a 5 × 5 kernel function and a closed (dilate) operation were used to remove image noise, and the holes in the target were filled. Finally, the grayscale image was binarized using the Great Law (Otsu) threshold value (Figure 3d).

Feature Extraction
The Panax notoginseng taproots of different grades have obvious differences in shape, size, surface color, and texture [21,22]. Therefore, the shape, size, color, chromaticity, brightness, and saturation were selected for characterization.

Shape and Size Feature Extraction
The shape and size features [23,24] are the basic features of the image. These features will not be affected by scaling, rotation, and translation, and they have been widely used in computer vision recognition systems. Based on the OpenCV library of Python, nine two-dimensional plane features of the Panax notoginseng taproots were extracted, including the mapping perimeter (the pink line in Figure 4b), the mapping area (Figure 4c), the width and height of the circumscribed rectangle (the green line in Figure 4d), and the smallest circumscribed rectangle (the width and height of the blue line in Figure 4d), the slender length (the height/width of the smallest circumscribed rectangle), the duty cycle (the area of the contour area divided by the area of the smallest circumscribed rectangle), and the radius of the smallest circumscribed circle (the green line in Figure 4d). These

Image Preprocessing
To facilitate feature extraction and improve the algorithm efficiency, in this study, the resolution of the original image ( Figure 3a) was adjusted from 1280 × 1024 to 512 × 512. Then, the image was denoised with a Gaussian filter (Figure 3b), and the filtered image was converted to grayscale ( Figure 3c). Next, an open (corrode) operation with a 5 × 5 kernel function and a closed (dilate) operation were used to remove image noise, and the holes in the target were filled. Finally, the grayscale image was binarized using the Great Law (Otsu) threshold value (Figure 3d).

Image Preprocessing
To facilitate feature extraction and improve the algorithm efficiency, in this study, the resolution of the original image ( Figure 3a) was adjusted from 1280 × 1024 to 512 × 512. Then, the image was denoised with a Gaussian filter (Figure 3b), and the filtered image was converted to grayscale ( Figure 3c). Next, an open (corrode) operation with a 5 × 5 kernel function and a closed (dilate) operation were used to remove image noise, and the holes in the target were filled. Finally, the grayscale image was binarized using the Great Law (Otsu) threshold value (Figure 3d).

Feature Extraction
The Panax notoginseng taproots of different grades have obvious differences in shape, size, surface color, and texture [21,22]. Therefore, the shape, size, color, chromaticity, brightness, and saturation were selected for characterization.

Shape and Size Feature Extraction
The shape and size features [23,24] are the basic features of the image. These features will not be affected by scaling, rotation, and translation, and they have been widely used in computer vision recognition systems. Based on the OpenCV library of Python, nine two-dimensional plane features of the Panax notoginseng taproots were extracted, including the mapping perimeter (the pink line in Figure 4b), the mapping area (Figure 4c), the width and height of the circumscribed rectangle (the green line in Figure 4d), and the smallest circumscribed rectangle (the width and height of the blue line in Figure 4d), the slender length (the height/width of the smallest circumscribed rectangle), the duty cycle (the area of the contour area divided by the area of the smallest circumscribed rectangle), and the radius of the smallest circumscribed circle (the green line in Figure 4d). These

Feature Extraction
The Panax notoginseng taproots of different grades have obvious differences in shape, size, surface color, and texture [21,22]. Therefore, the shape, size, color, chromaticity, brightness, and saturation were selected for characterization.

Shape and Size Feature Extraction
The shape and size features [23,24] are the basic features of the image. These features will not be affected by scaling, rotation, and translation, and they have been widely used in computer vision recognition systems. Based on the OpenCV library of Python, nine two-dimensional plane features of the Panax notoginseng taproots were extracted, including the mapping perimeter (the pink line in Figure 4b), the mapping area (Figure 4c), the width and height of the circumscribed rectangle (the green line in Figure 4d), and the smallest circumscribed rectangle (the width and height of the blue line in Figure 4d), the slender length (the height/width of the smallest circumscribed rectangle), the duty cycle (the area of the contour area divided by the area of the smallest circumscribed rectangle), and the radius of the smallest circumscribed circle (the green line in Figure 4d). These shape and size features were stored in the feature vector and provided to the classification model. shape and size features were stored in the feature vector and provided to the classification model.

Color Feature Extraction
In this study, the color moment method was adopted to extract the color features of the Panax notoginseng samples through two color-space models, RGB and HSV [25][26][27]. Because the color information is mainly distributed in low-order moments, the color distribution of Panax notoginseng taproot images was expressed by first-order moments (mean), second-order moments (variance), third-order moments (skewness), and fourthorder moments (kurtosis). Therefore, a total of 24 color features of R (Figure 5a  The calculation formulas of RGB and HSV color characteristic parameters are as follows:

Color Feature Extraction
In this study, the color moment method was adopted to extract the color features of the Panax notoginseng samples through two color-space models, RGB and HSV [25][26][27]. Because the color information is mainly distributed in low-order moments, the color distribution of Panax notoginseng taproot images was expressed by first-order moments (mean), secondorder moments (variance), third-order moments (skewness), and fourth-order moments (kurtosis). Therefore, a total of 24 color features of R ( shape and size features were stored in the feature vector and provided to the classification model.

Color Feature Extraction
In this study, the color moment method was adopted to extract the color features of the Panax notoginseng samples through two color-space models, RGB and HSV [25][26][27]. Because the color information is mainly distributed in low-order moments, the color distribution of Panax notoginseng taproot images was expressed by first-order moments (mean), second-order moments (variance), third-order moments (skewness), and fourthorder moments (kurtosis). Therefore, a total of 24 color features of R ( The calculation formulas of RGB and HSV color characteristic parameters are as follows: The calculation formulas of RGB and HSV color characteristic parameters are as follows: In the formulas, i represents the three color channels R, G, and B; j represents the pixel value; N represents the number of pixels in the image; P ij represents the i-th color component of the j-th pixel of the color image, and µ i represents the average value of each color channel.

Texture Feature Extraction
The texture feature of the image [28][29][30] reflects the external structure and organization characteristics of periodic changes on the object surface. This kind of feature is common but difficult to describe. The gray-level co-occurrence matrix (GLCM) reflects the comprehensive gray-level information about the direction, adjacent interval, and change amplitude of an image. It is widely used to convert gray values into texture information. Based on the GLCM, this study extracted seven texture features to quantitatively describe the Panax notoginseng taproots, including homogeneity, contrast, dissimilarity, entropy, energy, correlation, and auto-correlation. A visualization of the above seven texture features is shown in Figure 6.
In the formulas, i represents the three color channels R, G, and B; j represents the pixel value; N represents the number of pixels in the image; Pij represents the i-th color component of the j-th pixel of the color image, and μi represents the average value of each color channel.

Texture Feature Extraction
The texture feature of the image [28][29][30] reflects the external structure and organization characteristics of periodic changes on the object surface. This kind of feature is common but difficult to describe. The gray-level co-occurrence matrix (GLCM) reflects the comprehensive gray-level information about the direction, adjacent interval, and change amplitude of an image. It is widely used to convert gray values into texture information. Based on the GLCM, this study extracted seven texture features to quantitatively describe the Panax notoginseng taproots, including homogeneity, contrast, dissimilarity, entropy, energy, correlation, and auto-correlation. A visualization of the above seven texture features is shown in Figure 6. The calculation formulas for the seven texture features are as follows: The calculation formulas for the seven texture features are as follows: In these formulas, d represents the relative distance between the gray levels of two pixels, and it was set to 2; θ represents the four directions of the GLCM, i.e., 0 • , 45 • , 90 • , and 135 • . For the four directions, the average of the eigenvalues was taken as the final eigenvalue of the co-occurrence matrix. i, j = 0, 1, 2, . . . , L − 1; L ∈ (M, N) represents the gray level, and it was set to 64; M and N represent the size of the GLCM; µ represents the square root of the mean square sum in the x-axis and y-axis direction; the size of the sliding window was set to 7 × 7. Additionally, all images in the θ direction were separated by δ. After feature extraction, a total of 40 features and 1800 pieces of feature data were obtained for the 450 Panax notoginseng samples. However, the use of all features of Panax notoginseng taproots will cause data redundancy, reduce the robustness of the model, and increase the calculation amount. Feature selection can reduce the calculation amount by reducing the data dimension without affecting the prediction accuracy. In this study, three characteristic variables were adopted for feature selection, including iterative and Retaining informative variables (IRIVs), variable iterative space shrinkage approach (VISSA), and stepwise regression analysis (SRA).
IRIV [31] can statistically divide all variables into four categories: strongly sensitive variables, weakly sensitive variables, insensitive variables, and interference variables. Then, it retains strongly sensitive variables and weakly sensitive variables until there are no insensitive variables and interference variables. Based on model cluster analysis (MPA), VISSA [32] gradually optimizes spatial variables in each iteration and finally selects the optimal variable combination. The algorithm judges the error between the real value and the predicted value through interactive verification of root mean square error (RMSECV). SRA [33] eliminates insignificant variables by introducing variables into the characteristic equation one by one until all variables involved in the regression equation are significant.

Modeling Method and Model Evaluation
The models based on traditional machine vision classification, including established BP (backpropagation) neural network [34], extreme learning machine (ELM) [35], and support vector machine (SVM) [36], and the deep learning models, including the segmented U-net [37], PSPNet [38], and DeepLabv3+ [39], are used as the main root classification models for different head numbers.
SVM is a supervised classification method with good generalization ability. It can effectively deal with linear and nonlinear data and can be used for regression, classification, etc. In this paper, radial basis function (RBF) was used as the kernel function of SVM. The parameters were optimized using genetic algorithm (GA), particle swarm optimization (PSO), and gray wolf optimizer (GWO). The three intelligent optimization algorithms all use five-fold cross-validation.
PSPNet is a classic semantic segmentation network, and it can effectively extract and classify image data features. The core module is the pyramid pooling module, which can aggregate the context information of different regions, thereby improving the acquisition of global information. In this article, PSPNet automatically extracted and classified the MATLAB 2019a, PyCharm, and OpenCV software were used for sampling, feature extraction, feature selection, model establishment, and analysis of the original data. Prediction accuracy was taken as the performance evaluation metric of the models. The higher the value of prediction accuracy, the better the performance of the model.

Comparison of Fusion Feature Classification Models in Different Dimensions
In this paper, there were 1800 samples in total, and the ratio of the training set to test set was 7:3. Thus, 1260 training set samples (315 Panax notoginseng taproots at different grades) were randomly selected, and the remaining 540 samples were used as test set (135 Panax notoginseng taproots of different grades). Through the three network models of BP, ELM, and SVM, shape and size (9 features); shape, size, and texture (16 features); shape, size, and color (33 features); and shape, size, texture, and color (40 types of features) were respectively analyzed. The fusion features of four different situations and different dimensions were compared and analyzed, and the results are shown in Table 2. The following observations can be made from Table 2: (1) When shape and size were taken as the features, among the three classification models, SVM achieved the highest accuracy, with an accuracy of 76.467% on the training set and an accuracy of 75.185% on the test set. (2) When shape, size, and texture were taken as the features, on the test set, the accuracy of the BP neural network was 14.782% higher than that without texture features; the accuracy of ELM was 17.222% higher than that without texture features; the accuracy of SVM was 15.222% higher than that without texture features. Thus, texture features were important in the main root classification of Panax notoginseng. Among the three classification models, SVM achieved the highest accuracy on the training set and test set. (3) When shape, size, and color were taken as the features, on the test set, the accuracy of the BP neural network was 23.309% higher than that without color features; the accuracy of ELM was 36.297% higher than that without texture features; the accuracy of SVM was 16.111% higher than that without texture features. Thus, color features were important in the classification of the main root of Panax notoginseng. Among the three classification models, SVM achieved the highest accuracy on the training set and test set. (4) When shape, size, texture, and color were taken as the features, on the test set, the accuracy of the BP neural network was 1.47% higher than that with color features without texture features, and it was 10.005% higher than that with texture features without color features; the accuracy of ELM was 5.135% higher than that with color features without texture features, and it was 24.21% higher than that with texture features without color features; the accuracy of SVM was 0.741% higher than that with color features without texture features, and it was 1.63% is higher than that with texture features without color features.
The above results show that the Panax notoginseng main root classification model established on fusion features was the best, and the accuracy of the SVM model on the training set and test set was, respectively, 91.191% and 92.037%, both of which were the highest. Therefore, SVM was selected as the classification model of the main root of Panax notoginseng.

Comparison and Analysis of Different Feature Selection Methods
If there are too many features in the process of model building, the robustness of the model will be reduced. Moreover, too much redundant information will be introduced, which will prolong the time of data processing. If there are too few features, it will cause information loss and reduce the prediction accuracy of the model. Therefore, the extracted feature data were optimized first, and the best feature combination was selected for model building.

Selection of Characteristic Variables Based on IRIV
This study exploited the IRIV algorithm to reduce the dimensions of the shape, size, color, and texture features of the taproots of different grades. The result is shown in Figure 7. After four iterations, the feature variables were reduced from 40 to 22. Then, the elimination strategy was performed on the remaining features to calculate the RMSECV. When the smallest RMSECV was achieved, the remaining features were eliminated from 22 to 12. Finally, ten feature variables were determined, which were projected area (A), slender length (E), R skewness (Rs), R kurtosis (Rk), B average (Bmean), S average (Smean), S variance (Svar), S skewness (Ss), contrast, and auto-correlation. where Y is the real value; YV is the predicted value during cross-validation, and n is the number of samples.

Selection of Characteristic Variables Based on VISSA
In VISSA feature selection, the variable subset generated by weighted binary sampling (WBMS) was set to 500. In this case, the initial sampling weight was 0.5, and the proportion of the subset model was 5%, leading to the best feature combination. It can be seen from Figure 8 that when the number of characteristic variables was less than 13, the RMSECV gradually decreased as the number of selected variables increased. When the number of feature variables was between 13 and 21, RMSECV remained at 0.2639. When the number of features was greater than 21, RMSECV increased. Therefore, 13 to 21 features could be selected. Through VISSA feature selection, it was found that the following 21 feature combinations were optimal, i.e., the projected area (A), the width of the smallest bounding rectangle (Min_w), the slender length (E), the skewness of R (Rs), and the vari- The calculation formula of RMSECV is as follows: where Y is the real value; Y V is the predicted value during cross-validation, and n is the number of samples.

Selection of Characteristic Variables Based on VISSA
In VISSA feature selection, the variable subset generated by weighted binary sampling (WBMS) was set to 500. In this case, the initial sampling weight was 0.5, and the proportion of the subset model was 5%, leading to the best feature combination. It can be seen from Figure 8 that when the number of characteristic variables was less than 13, the RMSECV gradually decreased as the number of selected variables increased. When the number of feature variables was between 13 and 21, RMSECV remained at 0.2639. When the number of features was greater than 21, RMSECV increased. Therefore, 13 to 21 features could be selected. Through VISSA feature selection, it was found that the following 21 feature combinations were optimal, i.e., the projected area (A), the width of the smallest bounding rectangle (Min_w), the slender length (E), the skewness of R (Rs), and the variance of G (Gvar), the variance of B (Bvar), the skewness of B (Bs), the variance of H (Hvar), the skewness of H (Hs), the average of S (Smean), the variance of S (Svar), S skewness (Ss), S kurtosis value (Sk), V mean value (Vmean), V skewness (Vs), V kurtosis value (Vk), energy, contrast, homogeneity, dissimilarity, and auto-correlation.

Selection of Characteristic Variables Based on VISSA
In VISSA feature selection, the variable subset generated by weighted binary sampling (WBMS) was set to 500. In this case, the initial sampling weight was 0.5, and the proportion of the subset model was 5%, leading to the best feature combination. It can be seen from Figure 8 that when the number of characteristic variables was less than 13, the RMSECV gradually decreased as the number of selected variables increased. When the number of feature variables was between 13 and 21, RMSECV remained at 0.2639. When the number of features was greater than 21, RMSECV increased. Therefore, 13 to 21 features could be selected. Through VISSA feature selection, it was found that the following 21 feature combinations were optimal, i.e., the projected area (A), the width of the smallest bounding rectangle (Min_w), the slender length (E), the skewness of R (Rs), and the variance of G (Gvar), the variance of B (Bvar), the skewness of B (Bs), the variance of H (Hvar), the skewness of H (Hs), the average of S (Smean), the variance of S (Svar), S skewness (Ss), S kurtosis value (Sk), V mean value (Vmean), V skewness (Vs), V kurtosis value (Vk), energy, contrast, homogeneity, dissimilarity, and auto-correlation.

Selection of Characteristic Variables Based on SRA
Based on the independent variable's influence on the dependent variable, SRA introduces significant independent variables into the regression equation and eliminates insignificant independent variables from the regression equation one by one until no variables are introduced or eliminated. As shown in Figure 9, when there were 22 characteristic variables, RMSE was the minimum. This indicates that the fitting effect between the observed values and real values was good and that the 22 features had a great influence on classifying Panax notoginseng taproots. Therefore, these 22 features were extracted through the SRA algorithm as the optimal combination of feature variables, including projected area (A), the slender length (E), the radius of the smallest circumscribed circle (Radius), the average value of R (Rmean), R variance (Rvar), G average (Gmean), G variance (Gvar), G skewness (Gs), B average (Bmean), H average (Hmean), H variance (Hvar), the skewness of H (Hs), the kurtosis value of H (Hk), the variance of S (Svar), the kurtosis value of S (Sk), the average value of V (Vmean), the value of V Variance (Vvar), V skewness (Vs), V kurtosis (Vk), entropy, contrast, and auto-correlation.
the SRA algorithm as the optimal combination of feature variables, including projected area (A), the slender length (E), the radius of the smallest circumscribed circle (Radius), the average value of R (Rmean), R variance (Rvar), G average (Gmean), G variance (Gvar), G skewness (Gs), B average (Bmean), H average (Hmean), H variance (Hvar), the skewness of H (Hs), the kurtosis value of H (Hk), the variance of S (Svar), the kurtosis value of S (Sk), the average value of V (Vmean), the value of V Variance (Vvar), V skewness (Vs), V kurtosis (Vk), entropy, contrast, and auto-correlation.

Establishment of SVM Classification Model Based on Feature Selection
IRIV, VISSA, and SRA were, respectively, adopted for feature selection to establish an SVM classification model for Panax notoginseng taproots. The established models were compared and analyzed, and the results are listed in Table 3. It can be seen from Table 3 that after feature selection, the number of feature variables was reduced, and the accuracy of the model on the training set and test set was higher than that of the model established with full features. Therefore, feature selection for full features was essential. In addition, the IRIV-SVM model achieved an accuracy of 95.370% on the test set, which was higher than that of VISSA-SVM and SRA-SVM. It shows that the combined feature variables extracted by IRIV could better reflect the characteristics of

Establishment of SVM Classification Model Based on Feature Selection
IRIV, VISSA, and SRA were, respectively, adopted for feature selection to establish an SVM classification model for Panax notoginseng taproots. The established models were compared and analyzed, and the results are listed in Table 3. It can be seen from Table 3 that after feature selection, the number of feature variables was reduced, and the accuracy of the model on the training set and test set was higher than that of the model established with full features. Therefore, feature selection for full features was essential. In addition, the IRIV-SVM model achieved an accuracy of 95.370% on the test set, which was higher than that of VISSA-SVM and SRA-SVM. It shows that the combined feature variables extracted by IRIV could better reflect the characteristics of Panax notoginseng taproots of different grades. Therefore, this paper choose IRIV-SVM as the classification model for Panax notoginseng taproots.

The Establishment of Deep Learning Network Model Based on Semantic Segmentation
In recent years, deep learning methods have performed well in the classification, detection, and segmentation of agricultural products. Compared with traditional machine learning technology, deep learning networks can automatically extract image features layer by layer from images and then classify and recognize the features through classifiers, which avoids the data preparation and manual feature selection of traditional machine learning algorithms. Furthermore, the extracted image features are richer, and the model performance is better.
In this paper, three semantic segmentation networks, PSPnet, U-net, and DeepLabv3+ were selected as the classification models for Panax notoginseng main root with different head counts. Meanwhile, three types of convolutional neural networks, including ResNet50, VGG16, and MobileNetV2, were used as feature extraction networks. Among them, VGG16 consists of 13 convolutional layers and 3 fully connected layers, a total of 16 floors. ResNet50 introduces the residual network, and there are two basic blocks, i.e., Identity Block and Conv Block. Identity Block uses 1 × 1 convolution to reduce the dimensionality before the 3 × 3 network structure and uses 1 × 1 convolution to increase the dimensionality after the 3 × 3 network structure. Compared with the direct use of 3 × 3 network convolution, Identity Block achieves a better effect with fewer parameters. Moreover, the input and output have the same dimension, and they can be connected in series to deepen the network. The input and output of Conv Block have different dimensions and they cannot be directly connected in series. The function of Conv Block is to change the dimension of the network. The MobileNetV2 network uses an inverted residual structure. It uses 1 × 1 convolution to increase the dimension before the 3 × 3 network structure and uses 1 × 1 convolution to reduce the dimension after the 3 × 3 network structure. All model training and testing were performed under the same hardware and software environment. The hardware platform was equipped with Intel(R) Xeon(R) Gold 5218 CPU, 64GB RAM, 512GB SK hynix SC401 SATA disk, and NVIDIA RTX 2070 GPU. The software included Tensorflow-GPU 1.13.2 deep learning framework, Python 3.6 language, and Windows operating system. There were 1800 samples in total, and the ratio of the training set to test set was determined to be 8:2 by experimentation. The loss curve of the three models is shown in Figure 10.
performance is better.
In this paper, three semantic segmentation networks, PSPnet, U-net, and DeepLabv3+ were selected as the classification models for Panax notoginseng main root with different head counts. Meanwhile, three types of convolutional neural networks, including ResNet50, VGG16, and MobileNetV2, were used as feature extraction networks. Among them, VGG16 consists of 13 convolutional layers and 3 fully connected layers, a total of 16 floors. ResNet50 introduces the residual network, and there are two basic blocks, i.e., Identity Block and Conv Block. Identity Block uses 1 × 1 convolution to reduce the dimensionality before the 3 × 3 network structure and uses 1 × 1 convolution to increase the dimensionality after the 3 × 3 network structure. Compared with the direct use of 3 × 3 network convolution, Identity Block achieves a better effect with fewer parameters. Moreover, the input and output have the same dimension, and they can be connected in series to deepen the network. The input and output of Conv Block have different dimensions and they cannot be directly connected in series. The function of Conv Block is to change the dimension of the network. The MobileNetV2 network uses an inverted residual structure. It uses 1 × 1 convolution to increase the dimension before the 3 × 3 network structure and uses 1 × 1 convolution to reduce the dimension after the 3 × 3 network structure. All model training and testing were performed under the same hardware and software environment. The hardware platform was equipped with Intel(R) Xeon(R) Gold 5218 CPU, 64GB RAM, 512GB SK hynix SC401 SATA disk, and NVIDIA RTX 2070 GPU. The software included Tensorflow-GPU 1.13.2 deep learning framework, Python 3.6 language, and Windows operating system. There were 1800 samples in total, and the ratio of the training set to test set was determined to be 8:2 by experimentation. The loss curve of the three models is shown in Figure 10.  As can be seen from Figure 10, the U-net model was quickly fitted in the first five iterations, and the loss value decreased rapidly. During 5-61 iterations, the loss value decreased slowly, and the variation was extremely large during 34-36 iterations. After 61 iterations, the loss value gradually stabilized at about 0.56. The PSPNet model was quickly fitted in the first 31 iterations, and the loss value decreased rapidly. During 31-80 iterations, the loss value decreased slowly and the variation was extremely large during 50-60 iterations. After 80 iterations, the loss value gradually stabilized at about 0.344. Before the 50th iteration, the loss value of the DeepLabv3+ model gradually decreased, and the model gradually converged. After the 50th iteration, the loss value gradually stabilized at about 0.019.
In the training process, a total of 100 weights were output in each iteration. It is not that the model performance increases with the number of iterations, but too much training may lead to overfitting, so the trained model needs to be tested and evaluated. Taking category pixel average accuracy rate (MPA) and average interaction ratio (MIoU) as the metrics, the evaluation results are listed in Table 4. It can be seen from Table 4 that PSPNet achieved the best overall performance, and the MPA and MIoU were, respectively, 77.98% and 88.97% on the test set. Although PSPNet did not have the decoder module of the DeepLabv3+ model feature extraction network, and the number of feature extraction network layers was relatively small, it achieved 2.73% higher accuracy than DeepLabv3+ with fewer feature extraction network layers and parameters. This result indicates that too many network layers will indeed extract a lot of features, but the network model is large, and the training time is long; also, there are too many features that are useless for classifying the main root of Panax notoginseng. This leads to a decrease in the accuracy of the network. The MIoU of U-net was only 80.98%, which was lower than that of PSPNet and DeepLabv3+. This was because U-net had fewer feature extraction network layers. Though DeepLabv3+ had a large model, its performance was moderate in terms of MPA and MIoU. To sum up, as a segmentation network for the main roots of different grades, the ResNet50 convolutional neural network in the PSPNet model achieved better performance and was suitable for grading the main roots of notoginseng.

Model Comparison
According to Section 3.3.1, among the traditional machine learning models based on feature selection, the IRIV-SVM model achieved an accuracy of 94.048 on the training set and an accuracy of 95.370% on the test set, both of which were the highest. According to Section 3.3.2, among the deep learning models based on semantic segmentation, PSPNet achieved an MPA of 77.98% and an MIoU of 88.97%, both of which were the highest.
Compared with IRIV-SVM, PSPNet automatically extracts features from the image layer by layer, so it can avoid the problem of manual feature selection. However, the model size of PsPNet was 0.65 G, and the training time was 9 h, which has a high requirement on the hardware platform. Though the IRIV-SVM algorithm involves data preparation and manual feature selection, its model size was only 125 kb, the training time was 3.4 s, and the accuracy was high. Therefore, IRIV-SVM was chosen as the classification model for Panax notoginseng taproot.

Optimization of IRIV-SVM Hierarchical Model
Since the classification accuracy of SVM is determined by c (penalty factor) and g (kernel function parameter) [40], the default setting of c and g may not lead to the best performance. Therefore, the interference to the model performance can be eliminated by adjusting the values of c and g. In this paper, the IRIV-SVM model was optimized by five-fold cross-validation and three intelligent optimization algorithms, i.e., GWO, GA, and PSO. After experimentation, the maximum number of iterations of the three optimization algorithms was set to 100, and the population size was set to 20. In GWO, the search range of c and g were both set to [0.01, 100]. In GA, the search range of c was set to [0, 100], and the search range of g was set to [0, 1000]. Furthermore, the crossover probability was set to 0.6, and the mutation probability was set to 0.03. In PSO, the search range of c was set to [0.1, 100], and the search range of g was set to [0.01, 1000].
It can be seen from Figure 11 that after 100 iterations, the three optimization algorithms all achieved the best fitness. The GWO algorithm converged to the best fitness of 98.704% in the 19th iteration; the GA algorithm converged to the best fitness of 97.220% in the 25th iteration, and the PSO algorithm converged to the best fitness of 96.67% in the 44th iteration. Comparative analysis indicates that the GWO algorithm had the fastest convergence speed and the best adaptability. to [0.1, 100], and the search range of g was set to [0.01, 1000].
It can be seen from Figure 11 that after 100 iterations, the three optimization algorithms all achieved the best fitness. The GWO algorithm converged to the best fitness of 98.704% in the 19th iteration; the GA algorithm converged to the best fitness of 97.220% in the 25th iteration, and the PSO algorithm converged to the best fitness of 96.67% in the 44th iteration. Comparative analysis indicates that the GWO algorithm had the fastest convergence speed and the best adaptability. It can be seen from Table 5 that after optimization by the three optimization algorithms of GWO, GA, and PSO, the accuracy of the IRIV-SVM model on the test set increased by 3.334%, 3.149%, and 2.408%, respectively. Comparative analysis indicates that IRIV-GWO-SVM achieved an accuracy of 98.703% on the test set, which was higher than that of IRIV-GA-SVM and IRIV-PSO-SVM. Therefore, this study chose the IRIV-GWO-SVM model for Panax notoginseng taproot classification.  It can be seen from Table 5 that after optimization by the three optimization algorithms of GWO, GA, and PSO, the accuracy of the IRIV-SVM model on the test set increased by 3.334%, 3.149%, and 2.408%, respectively. Comparative analysis indicates that IRIV-GWO-SVM achieved an accuracy of 98.703% on the test set, which was higher than that of IRIV-GA-SVM and IRIV-PSO-SVM. Therefore, this study chose the IRIV-GWO-SVM model for Panax notoginseng taproot classification.

Model Validation
The confusion matrix of IRIV-GWO-SVM for classifying the Panax notoginseng taproots at different grades is shown in Figure 12. The accuracy of IRIV-GWO-SVM for classifying grade-I, grade-II, grade-III, and grade-IV Panax notoginseng taproots was, respectively, 99.259%, 99.259%, 98.510%, and 98.510%, with an average classification accuracy of 98.8845%. In summary, the IRIV-GWO-SVM model achieved good classification accuracy for Panax notoginseng taproots of different grades.

Model Validation
The confusion matrix of IRIV-GWO-SVM for classifying the Panax notoginseng taproots at different grades is shown in Figure 12. The accuracy of IRIV-GWO-SVM for classifying grade-I, grade-II, grade-III, and grade-IV Panax notoginseng taproots was, respectively, 99.259%, 99.259%, 98.510%, and 98.510%, with an average classification accuracy of 98.8845%. In summary, the IRIV-GWO-SVM model achieved good classification accuracy for Panax notoginseng taproots of different grades.

Discussion
In this study, 450 Panax notoginseng taproots at four different grades were selected. The use of sufficient and diverse samples makes the model more convincing. Considering

Discussion
In this study, 450 Panax notoginseng taproots at four different grades were selected. The use of sufficient and diverse samples makes the model more convincing. Considering the irregularity of the shape of Panax notoginseng taproot, the characteristics of size, shape, texture, color, and other characteristics that affect the classification of Panax notoginseng taproot were extracted. This solves the problem that the previously extracted features are relatively simple and cannot accurately express the characteristics of Panax notoginseng taproots. Deep learning can automatically extract image features layer by layer from images through convolutional neural networks and then perform classification and recognition through classifiers. This research established a deep learning classification model based on PSPnet, U-net, and DeepLabv3+ for semantic segmentation of different heads and notoginseng roots. Meanwhile, three types of convolutional neural networks including ResNet50, VGG16, and MobileNet were used as feature extraction networks. Taking the category average pixel accuracy and average interaction ratio as evaluation indicators, the traditional machine learning and deep learning grading models were compared and analyzed, and the best model was selected and optimized. The accuracy of the optimized model reached 98.704% on the test set.

Conclusions
In this study, the IRIV-GWO-SVM classification model achieved rapid and nondestructive classification of Panax notoginseng taproots, which provides an effective method for the classification of irregular agricultural products.
(1) A model based on image feature fusion was established for classifying Panax notoginseng taproots. By preprocessing the taproot images of Panax notoginseng collected using a CCD camera, 40 features such as shape, size, color, and texture were extracted. Through the classification accuracy of the three classification models of BP, ELM, and SVM, the importance of color, texture, and fusion features to the classification model of Panax notoginseng root was proved. Three feature selection algorithms, i.e., IRIV, VISSA, and SRA, were used to reduce the dimension of the whole feature. After feature selection, 22, 21, and 10 optimal feature variable combinations were obtained respectively, and redundant feature data were eliminated. (2) Deep learning can automatically extract image features layer by layer from images through convolutional neural networks and then perform classification and recognition through classifiers. This research established a deep learning classification model for Panax notoginseng taproots and selected PSPnet, U-net, and DeepLabv3+ for semantic segmentation. Meanwhile, three types of convolutional neural networks including ResNet50, VGG16, and MobileNet were used as feature extraction networks. Additionally, the average pixel accuracy and average interaction ratio of the categories were used as evaluation indicators. The results show that the PSPNet model achieved the best overall performance, with MPA of 77.98% and MioU of 88.97% on the test set. Among the traditional machine learning SVM classification models, the IRIV-SVM model achieved an accuracy of 94.048% on the training set and an accuracy of 95.370% on the test set, both of which were the highest. Among the deep learning models, PSPNet achieved a MAP of 77.98% and a MioU of 88.97%, both of which were the highest. Compared with IRIV-SVM, PSPNet automatically extracts image features layer by layer. It avoids manual feature selection, but its model size was 0.65 G, and the training time was 9 h, which has high requirements for the hardware equipment. Though IRIV-SVM involves data preparation and manual feature selection, its model as only 125 kb, and the training time was 3.4 s. While the number of features was reduced, it effectively increased the efficiency and accuracy of the model. Therefore, IRIV-SVM was chosen as the classification model of Panax notoginseng taproot.
(4) The GWO, GA, and PSO algorithms were introduced to optimize the IRIV-SVM model. The results show that the IRIV-GWO-SVM classification model achieved the best optimization effect. The classification accuracy was 98.704% on the test set, and the optimization effect was increased by 3.334%.
In this study, a new classification method of Panax notoginseng taproot is proposed, and a classification model based on machine vision feature fusion is established for Panax notoginseng taproot of different grades. The results show that the proposed model is feasible, which provides a theoretical reference for the subsequent development of Panax notoginseng taproot classification system based on machine vision.
Author Contributions: Y.Z., H.T. and T.Q. collected data on Panax notoginseng taproots; Y.Z., F.Z. and Y.L. analyzed the data; F.Z. and Y.Z. wrote the paper; Y.Z., F.Z., Z.Z. and L.S. drew pictures for this paper; F.Z., Y.Z., L.L., Y.L., Z.Z. and L.S. reviewed and edited the paper. All authors have read and agreed to the published version of the manuscript.