# Tobacco Leaves Disease Identification and Spot Segmentation Based on the Improved ORB Algorithm

Authors: Min Xu; Lihua Li; Liangkun Cheng; Haobin Zhao; Jiang Wu; Xiaoqiang Wang; Hongchen Li; Jianjun Liu
Journal: Scientific Programming
 (2022)

---

## Abstract

In order to improve the problems of poor accuracy and low efficiency in tobacco leaves disease recognition and diagnosis and avoid the misjudgment in tobacco disease recognition, a disease recognition and spot segmentation method based on the improved ORB algorithm was proposed. The improved FAST14-24 algorithm was used to preliminarily extract corners. It overcame the deficiency of the sensitivity of the traditional ORB corner detection algorithm to image edges. During the experiment, 28 parameters were obtained through the extraction of color features, morphological features, texture, and other features of tobacco disease spots. Through the experimental comparisons, it was found that the fitness of the improved ORB algorithm was 96.68 and the cross-checking rate was 93.21%. The validation and recognition rate for samples was 96%. The identification rate of tobacco brown spot disease and frog eye disease was 92%, and the identification rate of 6 categories in different periods was over 96%. The experimental results verified the effects of the disease identification fully.


---

## Body

## 1. Introduction

Tobacco is an important economic crop of China. The tobacco-related industry is also an important industry in China’s social economy [1, 2]. The tobacco industry provides an important support for social and economic development every year. At the same time, the existence of tobacco diseases also seriously restricts the output and the overall quality of tobacco, which directly affects the economic development of the tobacco industry and the overall income of tobacco farmers. Therefore, many Chinese scholars have never stopped their research on tobacco diseases. The effective identification and rational control of tobacco diseases not only relate to the physiological health of tobacco leaves but also directly relate to the yield and the final quality of tobacco leaves. And for different regions and different types of tobacco, the corresponding disease types are also different. And the pathology of leaf disease is relatively complex [3, 4]. In order to deal with the problems of poor accuracy and low efficiency in tobacco disease diagnosis, a better and an improved ORB algorithm for disease recognition and disease spot segmentation was proposed and the effects of the disease recognition were verified through experiments.


## 2. Literature Review

At present, the research on plant disease identification mainly focuses on crop and cash crop diseases. The traditional disease detection was mainly based on manual recognition. The method of manual recognition was low in efficiency and accuracy. Before the rise of deep learning, the traditional disease recognition methods were mainly based on shallow machine learning algorithms, such as SVM and Bayesian classifiers [5, 6]. Some scholars used the statistical learning method of the naive Bayes classifier to realize the classification and recognition of maize leaf diseases, and the diagnostic accuracy of five maize leaf diseases was above 83%. Based on H-threshold segmentation, iterative binarization, image morphology operation, contour extraction, and other algorithms, the texture, color, and shape features of the disease image were extracted. The genetic algorithm was used to optimize the selection of classification features, and the Fischer discriminant method was used to identify three common maize leaf diseases. According to the features of the maize leaf disease images, a multiclassifier composed of a support vector machine (SVM) was proposed to identify the maize leaf diseases. Experimental results showed that this method was suitable for a small sample and achieved a good classification effect. A support vector machine (SVM) was used to classify cucumber diseases, and the shape, color, texture, and onset time of the disease spots were extracted. The SVM classifier was used to select four common kernel functions for recognition. The results showed that the SVM method had a good classification effect in dealing with small sample problems [7, 8]. A tobacco disease image retrieval method based on the spot feature fusion was proposed to diagnose 7 common tobacco diseases with high recognition accuracy. Five common tobacco diseases were studied and an image processing method based on SVM and ResNet was proposed to diagnose tobacco diseases with an accuracy of 89%. By using image processing and data mining methods, some scholars introduced the disease recognition system based on the double clustering technology. The leaf image was captured by a nonlocal median filter and the noise was removed. Through the double clustering method, anthrax and white leaf diseases of grapes, cucumbers, and tomatoes were segmented. The pattern matching method was used to compare the segmented parts with diseased leaves, which achieved a high recognition accuracy. A method of identification and classification of leaf diseases by digital image processing and machine vision was proposed. Firstly, the leaf images were preprocessed and the features were extracted. And, the leaves were identified by the training and classification based on the artificial neural network. Secondly, the defect region segmentation based on K-means, the feature extraction of the defect part, and the classification of diseases in leaves based on ANN were carried out. A method of tea leaf disease recognition (TLDR) was proposed [9, 10]. The tea image was clipped, resized, and converted into the threshold value in the image processing. Then, the feature extraction method was adopted and the neural network integration was used for the pattern recognition. The recognition accuracy was 91%. Three different convolutional neural network architectures were proposed. Context nonimage metadata were integrated into the image-based convolutional neural network. Combined with the advantages of learning from the entire multicrop dataset, the complexity of the disease classification task was reduced. VGG16 and SingingV3 networks were used to detect and identify the rice pests and diseases, and a two-level small CNN architecture was proposed. Compared with MobileNet, NASNet-Mobile, and SqueezeNet networks, the identification accuracy was 93.3% [11, 12].


## 3. The Improved ORB Algorithm

### 3.1. The Improved FAST Corner Detection Algorithm

FAST algorithm is a fast corner detection algorithm at present, but it will produce false detection of some edge points, resulting in the existence of some false corners. Pointp is a point on the edge, but it is not a corner point. If the traditional FAST9-16 algorithm is used for detection, it meets the requirement that the gray value of more than 9 continuous pixels in the neighborhood of 16 pixels is sufficiently different. So, the system will identify it as a corner point, and the point p is only an edge point [13, 14].Therefore, in order to exclude the interference of such edge points on the detection results, the FAST algorithm is improved as follows: 24-pixel points around the pixel pointp are taken as the detection template, the gray value of the point p is Ip, and a threshold T is set. If 14 consecutive pixel points among 24-pixel points have a gray value greater than Ip+T or less than Ip−T, then the point p is a corner point. And taking the p point as an example, the improved FAST14-24 algorithm does not identify the p point as a corner point, overcoming the deficiency of the traditional FAST9-16 corner point detection algorithm which is sensitive to edges.


### 3.2. Feature Descriptor Design

The comparison criterion of the gray mean is defined as follows:(1)τp;x,y=1,px<py,0,px≥py.In formula (1), px is the mean pixel value of pixel point 5 × 5 neighborhood. If there are m comparison point pairs, then the m bits binary descriptor is generated.(2)fnp=∑1≤i≤m2i−1τp;x,y.Suppose the coordinate of the feature point isO, then OC is the direction of the feature point, and the calculation formula of the direction angle is as follows:(3)θ=atan2m01,m10.In formula (3), the centroid of the image gray expression is as follows:(4)C=m10m00,m01m00.Add the direction of feature points obtained from formula (3) to the descriptor. We define a 2 × m matrix Q as follows:(5)Q=x1,x2,…,xm−1,xmy1,y2,…,ym−1,ym.In formula (5), xi,yi is a test point pair. Let the corrected feature point pair matrix be(6)Qθ=RθQ.In formula (6), Rθ is the rotation matrix corresponding to the direction of the feature point θ. The descriptor with rotation invariance obtained is as follows:(7)gmp,θ=fmpxi,yi∈Qθ.The Shi-Tomasi algorithm is used to optimize feature points. The Shi-Tomasi algorithm takes the smaller of the two eigenvalues and compares it with the given minimum threshold. If it is larger than the minimum threshold, a strong corner point will be obtained [15, 16]. The Shi-Tomasi algorithm detects corners by calculating the gray level of local small windows Wx,y moving in all directions. The gray scale change Eu,v generated by the window translation u,v is as follows:(8)Eu,v=u,vWuv.In formula (8), M is the autocorrelation matrix of 2 × 2, which can be calculated by the derivative of the image as shown.(9)M=∑x,ywx,yIx2IxIyIxIyIy2.The two eigenvaluesλmax and λmin of the matrix M are analyzed. Since the uncertainty of larger curvature depends on smaller corner points, the corner response function is defined as λmin. The Shi-Tomasi algorithm is used to calculate the corner response function λmin of each point for the feature points initially extracted by the improved FAST corner detection algorithm. According to λmin, the point with the maximum response value of the first N is determined as the feature point. There are at least two strong boundaries in different directions around the screened feature points, which are easy to identify and are stable [17, 18].The feature descriptors in the research are designed by a retina-like model. The distribution of sampling points is similar to the structure of the retinal receptive field. The location of feature points is the central point, and the sampling points are evenly distributed on 7 concentric circles, with 6 sampling points on each concentric circle. In terms of the value of sampling points, the research takes the gray mean of the sampling point field as the description of sampling points, just like the ORB algorithm. The difference lies in that ORB uses an equal field to describe sampling points. The research uses square neighborhood descriptions with different side lengths for sampling points on concentric circles [19, 20]. From the intermediate feature point outwards, the sampling side length of each layer is 1, 3, 5, 7, 9, 11, 13, and 15, respectively.The improved retina-like descriptors are obtained by comparing the results of the neighborhood gray mean of sampling points. Let F be a feature point descriptor, then(10)F=∑0<i<N2iTPab,(11)TPab=1IPa−IPb>0,0,others.N is the dimension of the feature vector (N = 512 in the research). Pa is the position of the sampling point to the midpoint a.Pb is the position of the sampling point to the midpoint b.IPa and IPb are the gray mean values of the sampling point in the sampling neighborhood.For the matching of binary feature description vectors, the Hamming distance is generally used as the similarity measure between descriptors. The Hamming distance is as follows:(12)HMdistance=F1⊕F2.By determining the threshold of the Hamming distance, the matching of feature vectors can be judged.


### 3.3. MSRCR

The reflectivity is determined by the object itself and varies without the influence of the emitted light. That is, the object image can be expressed as the product of the reflected image and illumination image, as shown in the formula:(13)Sx,y=Rx,y⋅Lx,y.After the logarithmic processing of both sides of formula (13) is carried out, the following formula can be obtained:(14)logRx,y=logSx,y−logLx,y.In formula (14), Sx,y is the image of the object, Rx,y is the reflection component of the object itself, and Lx,y is the illumination component.By constructing the Gaussian surround function, the Gaussian surround function is used to filter the three channels of RGB image to obtain the estimated light component. The reflection component can be obtained by subtracting the original image and light component in the logarithmic domain; thus, obtaining the output image as shown in the formula.(15)rix,y=logRix,y=logsix,yLix,y=logSix,y−logSix,y∗Gx,y.The formula for the color recovery factor is calculated as follows:(16)Cix,y=βlog∂Six,y−log∑i∈R,G,BSix,y.The MSRCR algorithm can not only ensure the gray level of the disease image and remove the influence of the uneven lighting during the shooting but can also improve the saturation of the image color to a certain extent when processing the disease image, which has the best color retention effect on the image.


### 3.4. Analysis of Experimental Results

All experiments were performed on a P computer environment with a 2.20 GHz CPU and 4 GB memory, and VC++ programming language was used in VS2010.


#### 3.4.1. Analysis of the Distribution of Feature Points

To evaluate the merits and demerits of feature point detection methods, the repetition rate method is often used, so thatm1 and m2 feature points are detected in two images to be matched. Then, the repetition rate is calculated as follows:(17)R=Cm1,m2minm1,m2.In formula (17), minm1,m2 is the least number of feature points in the two images. Cm1,m2 refers to the corresponding feature points, and the corresponding feature points should meet the following two definitions.(1)
Position error of feature points:(18)εL=xa−H⋅xb<1.5pixel.(2)
Surface error of feature area:(19)εs=1−s2σa2σb2<0.2.In formula (19), s is the actual scale scaling factor between images and σa,σb is the feature scale of two feature points.The ORB feature point detection algorithm and the improved algorithm in the research are used to calculate the repetition rate of feature points for images, respectively, as shown in Table1.Table 1
Comparison of repetition rates of feature points.
ORB algorithmText algorithmRepeat pointsTotal pointsRepetition rateRepeat pointsTotal pointsRepetition rate2555000.5102855000.5461053890.2861393730.3851615000.3221855000.3682205000.4422405000.480As can be seen from Table1, for images with scale transformation, rotation change, illumination transformation, noise interference, and perspective transformation, the improved feature point detection algorithm in the research has improved the repetition rate compared with the ORB feature point detection algorithm. This is because the improved FAST14-24 algorithm is used in the research to eliminate some pseudo-corner points on the edge and eliminate certain interference. In the process of the feature point optimization, the Shi-Tomasi algorithm is used to select feature points with large curvature changes, which are easy to identify and are stable [21, 22]. The feature point matching performance test is conducted on the test images, and the correct matching point pairs of each image are counted as shown in Table 2.Table 2
Comparison of feature point matching performance.
ORB algorithm correct matching pointText correct algorithm matching pointEnhancement rate (%)18221518.110112422.816523165.87410540.5As can be seen from Table2, the improved ORB feature extraction algorithm in the research improves the matching accuracy by about 18% ∼ 65% compared with the traditional ORB algorithm. Specially for the images with light changes, the matching accuracy of the proposed algorithm is significantly better than that of the traditional ORB algorithm, with an increase of 65.8%. Experimental results show that the proposed algorithm is superior to the traditional ORB algorithm in both matching accuracy and robustness for various types of image matching.


## 3.1. The Improved FAST Corner Detection Algorithm

FAST algorithm is a fast corner detection algorithm at present, but it will produce false detection of some edge points, resulting in the existence of some false corners. Pointp is a point on the edge, but it is not a corner point. If the traditional FAST9-16 algorithm is used for detection, it meets the requirement that the gray value of more than 9 continuous pixels in the neighborhood of 16 pixels is sufficiently different. So, the system will identify it as a corner point, and the point p is only an edge point [13, 14].Therefore, in order to exclude the interference of such edge points on the detection results, the FAST algorithm is improved as follows: 24-pixel points around the pixel pointp are taken as the detection template, the gray value of the point p is Ip, and a threshold T is set. If 14 consecutive pixel points among 24-pixel points have a gray value greater than Ip+T or less than Ip−T, then the point p is a corner point. And taking the p point as an example, the improved FAST14-24 algorithm does not identify the p point as a corner point, overcoming the deficiency of the traditional FAST9-16 corner point detection algorithm which is sensitive to edges.


## 3.2. Feature Descriptor Design

The comparison criterion of the gray mean is defined as follows:(1)τp;x,y=1,px<py,0,px≥py.In formula (1), px is the mean pixel value of pixel point 5 × 5 neighborhood. If there are m comparison point pairs, then the m bits binary descriptor is generated.(2)fnp=∑1≤i≤m2i−1τp;x,y.Suppose the coordinate of the feature point isO, then OC is the direction of the feature point, and the calculation formula of the direction angle is as follows:(3)θ=atan2m01,m10.In formula (3), the centroid of the image gray expression is as follows:(4)C=m10m00,m01m00.Add the direction of feature points obtained from formula (3) to the descriptor. We define a 2 × m matrix Q as follows:(5)Q=x1,x2,…,xm−1,xmy1,y2,…,ym−1,ym.In formula (5), xi,yi is a test point pair. Let the corrected feature point pair matrix be(6)Qθ=RθQ.In formula (6), Rθ is the rotation matrix corresponding to the direction of the feature point θ. The descriptor with rotation invariance obtained is as follows:(7)gmp,θ=fmpxi,yi∈Qθ.The Shi-Tomasi algorithm is used to optimize feature points. The Shi-Tomasi algorithm takes the smaller of the two eigenvalues and compares it with the given minimum threshold. If it is larger than the minimum threshold, a strong corner point will be obtained [15, 16]. The Shi-Tomasi algorithm detects corners by calculating the gray level of local small windows Wx,y moving in all directions. The gray scale change Eu,v generated by the window translation u,v is as follows:(8)Eu,v=u,vWuv.In formula (8), M is the autocorrelation matrix of 2 × 2, which can be calculated by the derivative of the image as shown.(9)M=∑x,ywx,yIx2IxIyIxIyIy2.The two eigenvaluesλmax and λmin of the matrix M are analyzed. Since the uncertainty of larger curvature depends on smaller corner points, the corner response function is defined as λmin. The Shi-Tomasi algorithm is used to calculate the corner response function λmin of each point for the feature points initially extracted by the improved FAST corner detection algorithm. According to λmin, the point with the maximum response value of the first N is determined as the feature point. There are at least two strong boundaries in different directions around the screened feature points, which are easy to identify and are stable [17, 18].The feature descriptors in the research are designed by a retina-like model. The distribution of sampling points is similar to the structure of the retinal receptive field. The location of feature points is the central point, and the sampling points are evenly distributed on 7 concentric circles, with 6 sampling points on each concentric circle. In terms of the value of sampling points, the research takes the gray mean of the sampling point field as the description of sampling points, just like the ORB algorithm. The difference lies in that ORB uses an equal field to describe sampling points. The research uses square neighborhood descriptions with different side lengths for sampling points on concentric circles [19, 20]. From the intermediate feature point outwards, the sampling side length of each layer is 1, 3, 5, 7, 9, 11, 13, and 15, respectively.The improved retina-like descriptors are obtained by comparing the results of the neighborhood gray mean of sampling points. Let F be a feature point descriptor, then(10)F=∑0<i<N2iTPab,(11)TPab=1IPa−IPb>0,0,others.N is the dimension of the feature vector (N = 512 in the research). Pa is the position of the sampling point to the midpoint a.Pb is the position of the sampling point to the midpoint b.IPa and IPb are the gray mean values of the sampling point in the sampling neighborhood.For the matching of binary feature description vectors, the Hamming distance is generally used as the similarity measure between descriptors. The Hamming distance is as follows:(12)HMdistance=F1⊕F2.By determining the threshold of the Hamming distance, the matching of feature vectors can be judged.


## 3.3. MSRCR

The reflectivity is determined by the object itself and varies without the influence of the emitted light. That is, the object image can be expressed as the product of the reflected image and illumination image, as shown in the formula:(13)Sx,y=Rx,y⋅Lx,y.After the logarithmic processing of both sides of formula (13) is carried out, the following formula can be obtained:(14)logRx,y=logSx,y−logLx,y.In formula (14), Sx,y is the image of the object, Rx,y is the reflection component of the object itself, and Lx,y is the illumination component.By constructing the Gaussian surround function, the Gaussian surround function is used to filter the three channels of RGB image to obtain the estimated light component. The reflection component can be obtained by subtracting the original image and light component in the logarithmic domain; thus, obtaining the output image as shown in the formula.(15)rix,y=logRix,y=logsix,yLix,y=logSix,y−logSix,y∗Gx,y.The formula for the color recovery factor is calculated as follows:(16)Cix,y=βlog∂Six,y−log∑i∈R,G,BSix,y.The MSRCR algorithm can not only ensure the gray level of the disease image and remove the influence of the uneven lighting during the shooting but can also improve the saturation of the image color to a certain extent when processing the disease image, which has the best color retention effect on the image.


## 3.4. Analysis of Experimental Results

All experiments were performed on a P computer environment with a 2.20 GHz CPU and 4 GB memory, and VC++ programming language was used in VS2010.


### 3.4.1. Analysis of the Distribution of Feature Points

To evaluate the merits and demerits of feature point detection methods, the repetition rate method is often used, so thatm1 and m2 feature points are detected in two images to be matched. Then, the repetition rate is calculated as follows:(17)R=Cm1,m2minm1,m2.In formula (17), minm1,m2 is the least number of feature points in the two images. Cm1,m2 refers to the corresponding feature points, and the corresponding feature points should meet the following two definitions.(1)
Position error of feature points:(18)εL=xa−H⋅xb<1.5pixel.(2)
Surface error of feature area:(19)εs=1−s2σa2σb2<0.2.In formula (19), s is the actual scale scaling factor between images and σa,σb is the feature scale of two feature points.The ORB feature point detection algorithm and the improved algorithm in the research are used to calculate the repetition rate of feature points for images, respectively, as shown in Table1.Table 1
Comparison of repetition rates of feature points.
ORB algorithmText algorithmRepeat pointsTotal pointsRepetition rateRepeat pointsTotal pointsRepetition rate2555000.5102855000.5461053890.2861393730.3851615000.3221855000.3682205000.4422405000.480As can be seen from Table1, for images with scale transformation, rotation change, illumination transformation, noise interference, and perspective transformation, the improved feature point detection algorithm in the research has improved the repetition rate compared with the ORB feature point detection algorithm. This is because the improved FAST14-24 algorithm is used in the research to eliminate some pseudo-corner points on the edge and eliminate certain interference. In the process of the feature point optimization, the Shi-Tomasi algorithm is used to select feature points with large curvature changes, which are easy to identify and are stable [21, 22]. The feature point matching performance test is conducted on the test images, and the correct matching point pairs of each image are counted as shown in Table 2.Table 2
Comparison of feature point matching performance.
ORB algorithm correct matching pointText correct algorithm matching pointEnhancement rate (%)18221518.110112422.816523165.87410540.5As can be seen from Table2, the improved ORB feature extraction algorithm in the research improves the matching accuracy by about 18% ∼ 65% compared with the traditional ORB algorithm. Specially for the images with light changes, the matching accuracy of the proposed algorithm is significantly better than that of the traditional ORB algorithm, with an increase of 65.8%. Experimental results show that the proposed algorithm is superior to the traditional ORB algorithm in both matching accuracy and robustness for various types of image matching.


## 3.4.1. Analysis of the Distribution of Feature Points

To evaluate the merits and demerits of feature point detection methods, the repetition rate method is often used, so thatm1 and m2 feature points are detected in two images to be matched. Then, the repetition rate is calculated as follows:(17)R=Cm1,m2minm1,m2.In formula (17), minm1,m2 is the least number of feature points in the two images. Cm1,m2 refers to the corresponding feature points, and the corresponding feature points should meet the following two definitions.(1)
Position error of feature points:(18)εL=xa−H⋅xb<1.5pixel.(2)
Surface error of feature area:(19)εs=1−s2σa2σb2<0.2.In formula (19), s is the actual scale scaling factor between images and σa,σb is the feature scale of two feature points.The ORB feature point detection algorithm and the improved algorithm in the research are used to calculate the repetition rate of feature points for images, respectively, as shown in Table1.Table 1
Comparison of repetition rates of feature points.
ORB algorithmText algorithmRepeat pointsTotal pointsRepetition rateRepeat pointsTotal pointsRepetition rate2555000.5102855000.5461053890.2861393730.3851615000.3221855000.3682205000.4422405000.480As can be seen from Table1, for images with scale transformation, rotation change, illumination transformation, noise interference, and perspective transformation, the improved feature point detection algorithm in the research has improved the repetition rate compared with the ORB feature point detection algorithm. This is because the improved FAST14-24 algorithm is used in the research to eliminate some pseudo-corner points on the edge and eliminate certain interference. In the process of the feature point optimization, the Shi-Tomasi algorithm is used to select feature points with large curvature changes, which are easy to identify and are stable [21, 22]. The feature point matching performance test is conducted on the test images, and the correct matching point pairs of each image are counted as shown in Table 2.Table 2
Comparison of feature point matching performance.
ORB algorithm correct matching pointText correct algorithm matching pointEnhancement rate (%)18221518.110112422.816523165.87410540.5As can be seen from Table2, the improved ORB feature extraction algorithm in the research improves the matching accuracy by about 18% ∼ 65% compared with the traditional ORB algorithm. Specially for the images with light changes, the matching accuracy of the proposed algorithm is significantly better than that of the traditional ORB algorithm, with an increase of 65.8%. Experimental results show that the proposed algorithm is superior to the traditional ORB algorithm in both matching accuracy and robustness for various types of image matching.


## 4. Identification and Extraction of Tobacco Leaf Disease Data and Segmentation of Disease Spots

### 4.1. Feature Extraction of Tobacco Spot Image

#### 4.1.1. Color Features

The color feature is widely used in image recognition because of its intuitiveness. In a broad sense, it can be understood that color feature, like texture feature, is used to express the surface attribute information of the scene in the image, but the attribute information expressed by the two is different. It describes the surface properties of the scene corresponding to the image region and is also a global feature. In the research, color moments are used to extract color features based on experimental requirements [23, 24]. The color moment can be understood as saving the information of the image color channel in the form of numerical size. The features of color moments are also different in terms of color information presented by different color channels. In an image, first-order moment (mean), second-order moment (variance), and third-order moment (skewness) are used to express the sufficient color information distribution according to the distribution of all information contained in the color. For example, most of the pictures we often come in contact with are RGB color space models, and there are 9 kinds of information to be extracted from this space model. In the three components R, G, and B, the corresponding first-, second-, and third-moment information is extracted from each component.In the research, color moment features of RGB and HSV channels need to be extracted, and each extracted color moment has a total of 9 features. The corresponding color moments of the three components of the image constitute a 9-dimensional histogram vector, and the color feature information extracted from each image has a total of 18 dimensions. The model information is shown in Tables3 and 4.Table 3
Selected color feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages (RGB color space model).
RGB first-order color momentRGB second-order color momentRGB third-order color momentEarly stage of brown spot disease1.2381.0600.8751.3401.3591.3291.2451.2321.242Middle stage of brown spot disease8.5696.8796.0853.1963.1993.1982.1742.1762.175Late stage of brown spot disease8.8087.9355.14311.58011.28511.2105.1335.0705.634Early stage of frog eye disease0.5210.5130.4930.7580.7650.7610.8430.8530.598Middle stage of frog eye disease2.7672.5412.0631.8221.8191.0121.5111.5001.504Late stage of frog eye disease5.9614.9243.2582.8202.8112.8022.0082.0012.005Table 4
Selected color feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages (HSV color space model).
HSV first-order color momentHSV second-order color momentHSV third-order color momentEarly stage of brown spot disease0.0030.0070.8750.0450.0710.0590.2450.2320.142Middle stage of brown spot disease0.0060.0180.0850.0500.0990.1980.0740.1760.175Late stage of brown spot disease0.1490.1200.14300520.0850.0210.1330.0700.111Early stage of frog eye disease0.0020.0020.0020.0580.0650.7600.0430.1530.120Middle stage of frog eye disease0.0040.0090.0110.0450.0190.0120.0110.5000.504Late stage of frog eye disease0.0080.0250.0230.0600.0110.0020.0080.0010.005


#### 4.1.2. Morphological Features

The methods of morphological feature extraction [25–27] are as follows: the first is the boundary feature method, which is used to obtain shape parameters of image data information by describing boundary features. The second is the Fourier shape descriptor method, which is based on the mathematical idea of Fourier transform as a shape description, using the closure and periodicity of binary image boundary to reduce its dimension. The third is the shape parameter method for the quantitative measurement of fixed shape, which is based on the representation and matching of shape. The fourth is the shape invariant moment method, which is based on the moment of the region occupied by the target as a shape description parameter. According to the different appearance features of tobacco disease spots in different periods, four feature parameters of tobacco disease spots are extracted, including rectangularity, roundness, complexity, and compactness. The details are shown in Table 5.Table 5
Selected morphological feature information of six pictures of tobacco brown spot disease and frog eye disease in the early, middle, and late stages.
RectangularityRoundnessComplexityCompactnessEarly stage of brown spot disease0.99730.31750.87530.3172Middle stage of brown spot disease0.96630.3.662.87850.6033Late stage of brown spot disease0.91490.21844.41430.2185Early stage of frog eye disease1.00020.32580.02810.3184Middle stage of frog eye disease0.98990.31510.26340.3158Late stage of frog eye disease0.87990.31573.97540.3107


#### 4.1.3. Texture Features

Texture features describe the surface properties of the image, such as the patterns on the surface of butterflies, zebra lines, tree rings, and so on [28, 29]. The feature information is based on the statistical features of the whole gray image. Texture features have rotation invariance and strong resistance to noise. In the research, according to the features of spots in the early, middle, and late stages of the two diseases, six texture feature parameters, namely, energy, contrast, correlation, entropy, homogeneity, and uniformity, are needed as texture feature parameters as shown in Table 6.Table 6
Selected texture feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages.
EnergyContrastCorrelationEntropyHomogeneityUniformityEarly stage of brown spot disease0.978511.05980.96690.20870.99231.0851Middle stage of brown spot disease0.906531.31230.98800.83150.96387.3023Late stage of brown spot disease0.185450.26830.98608.12530.56329.8857Early stage of frog eye disease0.99325.09870.97890.06520.99820.5070Middle stage of frog eye disease0.963912.11580.98870.30950.98682.5544Late stage of frog eye disease0.920019.10230.98850.68510.97565.0451


### 4.2. Image Feature Optimization of Tobacco Leaf Spots Based on PSO and ORB

#### 4.2.1. Algorithm Principle

Particle swarm optimization takes the feasible solution space of the optimization problem as its search space and randomly generates the initial population in the search space. An individual is a particle without volume or mass [30]. The spatial position of each particle is a feasible solution to the optimization problem. The fitness of a particle is a measure of its position in space. The particle dynamically adjusts its flight speed and space position in the search space to search for the optimal space position and for finding an optimal solution to the problem [31, 32]. The PSO algorithm is used to reduce the original data dimension, and relatively few features are used to achieve better results. In the research, the PSO algorithm was used for the feature optimization of color features, texture features, and shape features extracted above. The algorithm flow is shown in Figure 1.Figure 1
Flow chart of the PSO algorithm.The ORB algorithm is a fast feature point extraction and description algorithm [33, 34]. To extract feature points, a scale pyramid is first constructed to make feature points meet scale invariance to a certain extent. Secondly, for each layer of the image pyramid, the FAST algorithm is used for the preliminary extraction of corner points. If the gray value of a pixel and enough pixels in its surrounding area differ sufficiently from the gray value of the point, the pixel is considered a FAST corner point. Furthermore, the Harris corner detection method was used to sort the feature points according to the response function of feature points. And, the first N corner points with good curvature are selected as the feature points according to the sorting results. Finally, the gray center of the mass method is used to determine the direction of feature points, and Rosin defines the moments of image blocks.For discrete problems, the spatial position of the particle is represented as a vector composed of 0 and 1. For each iteration, it becomes difficult to calculate the velocity and spatial position of the particle in the search space.


#### 4.2.2. Feature Selection Results

A total of 28 normalized features are selected in the early, middle, and late stages of brown spot disease and frog eye disease. After using the particle swarm optimization algorithm for 15 times, the feature selection results are derived which are shown in Table7.Table 7
Experimental results of feature selection of particle swarm optimization for 15 times.
Number of experimentsBinary representation of feature-preferred combinationsAdaptabilityCross-validation rate (%)Verification set recognition rate (%)1010110110010110110100101010194.2388.5794.002100101100001010100101000101194.1588.6993.673000100101011011010100111101098.6589.2391.004110101001110000100110010001195.5687.8795.675000110011001011111010101011092.1592.6689336100010010001000010101101110193.2686.7192.677001010011011011011100110111194.3187.2493.008100110010001100110101100111194.1189.3194.009000110010100111100110011110095.6888.6592.6510100001000110101010110010101195.2693.3196.0011100101001000101101101011100194.3792.3394.3312110101000100110110010010101092.3189.2393.0013110101000100110110010010101091.3687.5692.0014110111010100110011001001001195.1586.2689.2315000101010101001001100101010198.2691.2297.65Table7 shows that the fitness of the tenth group of data is 95.23, and the cross-validation rate is 93.31%. The recognition rate of the verification set is 96%, which also reaches the maximum value. The feature optimization is a 13-dimensional feature parameter. Therefore, the tenth group of optimization results is selected for the next step of classification recognition, namely, R1, B2, H1, S1, H2, V2, S3, rectangularity, complexity, energy, contrast, entropy, and average grayscale.


### 4.3. Classification and Recognition of Tobacco Leaf Disease Spots Based on SVM

Pattern recognition refers to the analysis and processing of all kinds of information representing things through computer technology. It is an integral part of artificial intelligence. Classifiers, also called discriminant models, are used in pattern recognition. The support vector machine (SVM) is one of the commonly used classifiers, which is commonly used in image retrieval, target tracking, face recognition, and other fields. In this research, a support vector machine (SVM) was used to classify the optimized feature parameters, so as to realize the classification and recognition of the early similar diseases of tobacco leaves (brown spot disease and frog eye disease) and the early, middle, and late stages of the two diseases.In real use, most are discrete, namely, nonlinear. Through the nonlinear mapping, the space samples are mapped to a high-dimensional feature space, constructing the optimal separating hyperplane again. At this time, considering that there is still linear inseparability caused by a small number of samples after nonlinear mapping to a high-dimensional feature space, relaxation variables need to be added. The penalty factor is added to the objective function, which plays a role in controlling the punishment degree of misclassification samples. The discrete classification problem can be regarded as a quadratic programming problem. The SVM is a binary classification algorithm, which can separate two different types of samples. But in the research process, six types of samples will appear at most, so it is necessary to construct appropriate multiclassifiers. Currently, there are two main methods to construct SVM multiclassifiers: direct method and indirect method. In this research, the one-to-one classification method of indirect method is used to design an SVM between any two different samples. Therefore, samples of N different categories needn(n − 1)/2 SVMs. During the classification, the category with the most votes is the category of samples, as shown in Figure 2. The one-to-one classification method of the SVM function is adopted in MATLAB, and there are at the most six types of data in the research study. Figure 2 is an example diagram of the one-to-one classifier of the support vector machine. In this study, the main research is aimed at the early diseases of tobacco brown spot and frog eye disease, and the middle and late stages of tobacco brown spot and frog eye disease are added as the references in the classification process.Figure 2
Sample diagram of the one-to-one classifier of SVM.Two kinds of classification problems are solved, that is, the sample of one class at a time is selected as the positive class sample, and the sample of the negative class becomes only one class (called the “one-to-one” method). According to the maximum category adopted in the research, there are six categories. For this pair of one-category devices, the first one only answers “is it the first or the second,” the second one only answers “is it the first or the third one,” and the third one only answers “is it the first or the fourth one”. There should be 15 such classifiers (n(n − 1)/2 SVM classifiers are constructed if there are n categories). Although the number of classifiers is increased, the total time spent in the training stage is less than that of the “one-to-others” method, which is a directed acyclic graph, so this method is also called the DAG SVM.The classifier used in the research determines whether these categories belong to the first or the sixth category in the “1 to 6” classification process. It continues to judge the category according to the order shown in the above figure and runs the judgment until all six categories of data are identified. At this time, 15 classifiers are actually called, which can accurately distinguish different classes.


### 4.4. Analysis of Identification Results

The total number of samples in the research is 1200 groups, including 600 groups of tobacco frog eye disease and 600 groups of brown spot disease, including 200 groups in the early, middle, and late stages, respectively. 150 groups are selected as the training data, and 50 groups are selected as the test data. The color features, morphological features, and texture features extracted above are normalized and optimized by the particle swarm optimization algorithm. Finally, the SVM classification model is established for recognition. The test recognition results are shown in Table8.Table 8
Early identification rates of frog eye disease and brown spot disease.
Disease typeTime of the diseaseTraining sampleTest sampleTest the correct sampleTest correct sample recognition rate (%)Brown spot diseaseEarly150504794Frog eye diseaseEarly150504896Total3001009595The identification rate of early disease samples of frog eye disease is 90% and that of brown spot disease is 94%. According to Figure3, the external morphology of frog eye disease and brown spot disease in the early stage is very similar. Brown spot disease has patches of different widths around the spot in the early stage, but frog eye disease does not. The early stage of brown spot disease is characterized by round spots, and the color of the spots is mostly yellowish brown. The early stage of frog eye disease is characterized by round spots which are brown, tawny or dirty white, or mostly brown. The identification rate of frog eye disease is lower than that of brown spot disease based on the color and halo of frog eye disease and brown spot disease and is shown in Table 9.Figure 3
Classification results of tobacco brown spot in the early, middle, and late stages and tobacco frog eye disease in the early, middle, and late stages.Table 9
Identification rates of brown spot disease and frog eye disease in different periods.
Disease typeTime of the diseaseTraining sampleTest sampleTest the correct sampleTest correct sample recognition rate (%)Brown spot diseaseEarly150504794Middle150504998Late150504998Frog eye diseaseEarly150504896Middle150504590Late1505050100Total90030028896The number of identification errors in the early, middle, and late stages of frog eye disease samples is 4, 1, and 1, respectively. The number of identification errors in the early, middle, and late stages of brown spot disease samples is 4, 2, and 0, respectively. The early stage of frog eye disease is characterized by round spots which are brown, tawny or dirty white, or mostly brown. There is no significant difference in the area of the middle and late stages of frog eye disease. The actual measurement shows a width range of 0.5 cm-1 cm. The middle stage of frog eye disease is gray parchment in the center, and the gray mold layer and perforation damage are produced in the late stage of frog eye disease. The early stage of brown spot disease is characterized by round spots, and the color of the spots is mostly yellowish brown. In the middle stage, there are obvious rims and the area of the lesion gradually becomes larger. The actual measurement in the field shows a width range of 0.6 cm-2 cm. The width of a single spot in the late stage ranges from 4 cm to 10 cm, and the whole leaf surface will be necrotic if multiple disease spots are linked together.On the other hand, in order to further improve the efficiency of recognition, a deep learning framework is used. After the data enhancement, a total of 2668 original crop leaf disease images are analyzed. 20 labels are assigned to each image in the dataset, each label representing a crop disease. Through the data enhancement, the original data images are extended to the sample set with 32016 images. Through transfer learning, the parameter weights of the last layer are retrained, and then the recognition accuracy of the four groups of experiments on several deep learning frameworks is compared with the verification set. Other parameters are shown in Table10.Table 10
Parameter selection of deep learning framework.
Parameter selection1. Deep learning framework selection: AlexNet, VGG-16, and GoogleNet2. Model training method: transfer learning3. Training-test set distribution: the training set is 80%, and the test set is 20%First, it is determined that the dataset contains 32,016 images after data enhancement of the original images, and the influence of different center loss weightsλ on the supervision effect is tested. Then, in the best λ case, four groups of experiments are carried out to cross-verify the influence of data enhancement and joint supervision on the model. The verification combination is shown in Table 11.Table 11
Cross-validation combinations.
Experiment serial numberPortfolio to be verified1CNN2AD-GAC CNN3CNN + joint supervision4AD-GAC CNIN + joint supervisionThe specific experimental results are presented in Figures4 to 6.Figure 4
Influence of the weight loss of test center on the recognition accuracy of B + C sets on AlexNet.Figure 5
Influence of the weight loss of test center on the recognition accuracy of B + C sets on VGG-16.Figure 6
Influence of the weight loss of test center on the recognition accuracy of B + C sets on GoogleNet.After the abovementioned figure is iterated, the recognition accuracy curve gradually becomes stable and rises. Similarly, after 5000 iterations, the loss gradually declines gently. Experimental results show that the two-stage AD-GACCNN network structure can effectively improve the generalization ability of the model and reduce the occurrence of the overfitting phenomenon. When using the central loss function and softmax function as the joint supervision mechanism, the model can effectively reduce the intraclass distance and increase the interclass distance. When the two methods are simultaneously applied to the model, the recognition accuracy of the model is increased by nearly 10% compared with that of the model without either method. It can be seen that it has obvious significance for spot recognition tasks for small samples under complex backgrounds and also has reference significance for other types of recognition tasks.


## 4.1. Feature Extraction of Tobacco Spot Image

### 4.1.1. Color Features

The color feature is widely used in image recognition because of its intuitiveness. In a broad sense, it can be understood that color feature, like texture feature, is used to express the surface attribute information of the scene in the image, but the attribute information expressed by the two is different. It describes the surface properties of the scene corresponding to the image region and is also a global feature. In the research, color moments are used to extract color features based on experimental requirements [23, 24]. The color moment can be understood as saving the information of the image color channel in the form of numerical size. The features of color moments are also different in terms of color information presented by different color channels. In an image, first-order moment (mean), second-order moment (variance), and third-order moment (skewness) are used to express the sufficient color information distribution according to the distribution of all information contained in the color. For example, most of the pictures we often come in contact with are RGB color space models, and there are 9 kinds of information to be extracted from this space model. In the three components R, G, and B, the corresponding first-, second-, and third-moment information is extracted from each component.In the research, color moment features of RGB and HSV channels need to be extracted, and each extracted color moment has a total of 9 features. The corresponding color moments of the three components of the image constitute a 9-dimensional histogram vector, and the color feature information extracted from each image has a total of 18 dimensions. The model information is shown in Tables3 and 4.Table 3
Selected color feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages (RGB color space model).
RGB first-order color momentRGB second-order color momentRGB third-order color momentEarly stage of brown spot disease1.2381.0600.8751.3401.3591.3291.2451.2321.242Middle stage of brown spot disease8.5696.8796.0853.1963.1993.1982.1742.1762.175Late stage of brown spot disease8.8087.9355.14311.58011.28511.2105.1335.0705.634Early stage of frog eye disease0.5210.5130.4930.7580.7650.7610.8430.8530.598Middle stage of frog eye disease2.7672.5412.0631.8221.8191.0121.5111.5001.504Late stage of frog eye disease5.9614.9243.2582.8202.8112.8022.0082.0012.005Table 4
Selected color feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages (HSV color space model).
HSV first-order color momentHSV second-order color momentHSV third-order color momentEarly stage of brown spot disease0.0030.0070.8750.0450.0710.0590.2450.2320.142Middle stage of brown spot disease0.0060.0180.0850.0500.0990.1980.0740.1760.175Late stage of brown spot disease0.1490.1200.14300520.0850.0210.1330.0700.111Early stage of frog eye disease0.0020.0020.0020.0580.0650.7600.0430.1530.120Middle stage of frog eye disease0.0040.0090.0110.0450.0190.0120.0110.5000.504Late stage of frog eye disease0.0080.0250.0230.0600.0110.0020.0080.0010.005


### 4.1.2. Morphological Features

The methods of morphological feature extraction [25–27] are as follows: the first is the boundary feature method, which is used to obtain shape parameters of image data information by describing boundary features. The second is the Fourier shape descriptor method, which is based on the mathematical idea of Fourier transform as a shape description, using the closure and periodicity of binary image boundary to reduce its dimension. The third is the shape parameter method for the quantitative measurement of fixed shape, which is based on the representation and matching of shape. The fourth is the shape invariant moment method, which is based on the moment of the region occupied by the target as a shape description parameter. According to the different appearance features of tobacco disease spots in different periods, four feature parameters of tobacco disease spots are extracted, including rectangularity, roundness, complexity, and compactness. The details are shown in Table 5.Table 5
Selected morphological feature information of six pictures of tobacco brown spot disease and frog eye disease in the early, middle, and late stages.
RectangularityRoundnessComplexityCompactnessEarly stage of brown spot disease0.99730.31750.87530.3172Middle stage of brown spot disease0.96630.3.662.87850.6033Late stage of brown spot disease0.91490.21844.41430.2185Early stage of frog eye disease1.00020.32580.02810.3184Middle stage of frog eye disease0.98990.31510.26340.3158Late stage of frog eye disease0.87990.31573.97540.3107


### 4.1.3. Texture Features

Texture features describe the surface properties of the image, such as the patterns on the surface of butterflies, zebra lines, tree rings, and so on [28, 29]. The feature information is based on the statistical features of the whole gray image. Texture features have rotation invariance and strong resistance to noise. In the research, according to the features of spots in the early, middle, and late stages of the two diseases, six texture feature parameters, namely, energy, contrast, correlation, entropy, homogeneity, and uniformity, are needed as texture feature parameters as shown in Table 6.Table 6
Selected texture feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages.
EnergyContrastCorrelationEntropyHomogeneityUniformityEarly stage of brown spot disease0.978511.05980.96690.20870.99231.0851Middle stage of brown spot disease0.906531.31230.98800.83150.96387.3023Late stage of brown spot disease0.185450.26830.98608.12530.56329.8857Early stage of frog eye disease0.99325.09870.97890.06520.99820.5070Middle stage of frog eye disease0.963912.11580.98870.30950.98682.5544Late stage of frog eye disease0.920019.10230.98850.68510.97565.0451


## 4.1.1. Color Features

The color feature is widely used in image recognition because of its intuitiveness. In a broad sense, it can be understood that color feature, like texture feature, is used to express the surface attribute information of the scene in the image, but the attribute information expressed by the two is different. It describes the surface properties of the scene corresponding to the image region and is also a global feature. In the research, color moments are used to extract color features based on experimental requirements [23, 24]. The color moment can be understood as saving the information of the image color channel in the form of numerical size. The features of color moments are also different in terms of color information presented by different color channels. In an image, first-order moment (mean), second-order moment (variance), and third-order moment (skewness) are used to express the sufficient color information distribution according to the distribution of all information contained in the color. For example, most of the pictures we often come in contact with are RGB color space models, and there are 9 kinds of information to be extracted from this space model. In the three components R, G, and B, the corresponding first-, second-, and third-moment information is extracted from each component.In the research, color moment features of RGB and HSV channels need to be extracted, and each extracted color moment has a total of 9 features. The corresponding color moments of the three components of the image constitute a 9-dimensional histogram vector, and the color feature information extracted from each image has a total of 18 dimensions. The model information is shown in Tables3 and 4.Table 3
Selected color feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages (RGB color space model).
RGB first-order color momentRGB second-order color momentRGB third-order color momentEarly stage of brown spot disease1.2381.0600.8751.3401.3591.3291.2451.2321.242Middle stage of brown spot disease8.5696.8796.0853.1963.1993.1982.1742.1762.175Late stage of brown spot disease8.8087.9355.14311.58011.28511.2105.1335.0705.634Early stage of frog eye disease0.5210.5130.4930.7580.7650.7610.8430.8530.598Middle stage of frog eye disease2.7672.5412.0631.8221.8191.0121.5111.5001.504Late stage of frog eye disease5.9614.9243.2582.8202.8112.8022.0082.0012.005Table 4
Selected color feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages (HSV color space model).
HSV first-order color momentHSV second-order color momentHSV third-order color momentEarly stage of brown spot disease0.0030.0070.8750.0450.0710.0590.2450.2320.142Middle stage of brown spot disease0.0060.0180.0850.0500.0990.1980.0740.1760.175Late stage of brown spot disease0.1490.1200.14300520.0850.0210.1330.0700.111Early stage of frog eye disease0.0020.0020.0020.0580.0650.7600.0430.1530.120Middle stage of frog eye disease0.0040.0090.0110.0450.0190.0120.0110.5000.504Late stage of frog eye disease0.0080.0250.0230.0600.0110.0020.0080.0010.005


## 4.1.2. Morphological Features

The methods of morphological feature extraction [25–27] are as follows: the first is the boundary feature method, which is used to obtain shape parameters of image data information by describing boundary features. The second is the Fourier shape descriptor method, which is based on the mathematical idea of Fourier transform as a shape description, using the closure and periodicity of binary image boundary to reduce its dimension. The third is the shape parameter method for the quantitative measurement of fixed shape, which is based on the representation and matching of shape. The fourth is the shape invariant moment method, which is based on the moment of the region occupied by the target as a shape description parameter. According to the different appearance features of tobacco disease spots in different periods, four feature parameters of tobacco disease spots are extracted, including rectangularity, roundness, complexity, and compactness. The details are shown in Table 5.Table 5
Selected morphological feature information of six pictures of tobacco brown spot disease and frog eye disease in the early, middle, and late stages.
RectangularityRoundnessComplexityCompactnessEarly stage of brown spot disease0.99730.31750.87530.3172Middle stage of brown spot disease0.96630.3.662.87850.6033Late stage of brown spot disease0.91490.21844.41430.2185Early stage of frog eye disease1.00020.32580.02810.3184Middle stage of frog eye disease0.98990.31510.26340.3158Late stage of frog eye disease0.87990.31573.97540.3107


## 4.1.3. Texture Features

Texture features describe the surface properties of the image, such as the patterns on the surface of butterflies, zebra lines, tree rings, and so on [28, 29]. The feature information is based on the statistical features of the whole gray image. Texture features have rotation invariance and strong resistance to noise. In the research, according to the features of spots in the early, middle, and late stages of the two diseases, six texture feature parameters, namely, energy, contrast, correlation, entropy, homogeneity, and uniformity, are needed as texture feature parameters as shown in Table 6.Table 6
Selected texture feature information of six images of tobacco brown spot disease and frog eye disease in the early, middle, and late stages.
EnergyContrastCorrelationEntropyHomogeneityUniformityEarly stage of brown spot disease0.978511.05980.96690.20870.99231.0851Middle stage of brown spot disease0.906531.31230.98800.83150.96387.3023Late stage of brown spot disease0.185450.26830.98608.12530.56329.8857Early stage of frog eye disease0.99325.09870.97890.06520.99820.5070Middle stage of frog eye disease0.963912.11580.98870.30950.98682.5544Late stage of frog eye disease0.920019.10230.98850.68510.97565.0451


## 4.2. Image Feature Optimization of Tobacco Leaf Spots Based on PSO and ORB

### 4.2.1. Algorithm Principle

Particle swarm optimization takes the feasible solution space of the optimization problem as its search space and randomly generates the initial population in the search space. An individual is a particle without volume or mass [30]. The spatial position of each particle is a feasible solution to the optimization problem. The fitness of a particle is a measure of its position in space. The particle dynamically adjusts its flight speed and space position in the search space to search for the optimal space position and for finding an optimal solution to the problem [31, 32]. The PSO algorithm is used to reduce the original data dimension, and relatively few features are used to achieve better results. In the research, the PSO algorithm was used for the feature optimization of color features, texture features, and shape features extracted above. The algorithm flow is shown in Figure 1.Figure 1
Flow chart of the PSO algorithm.The ORB algorithm is a fast feature point extraction and description algorithm [33, 34]. To extract feature points, a scale pyramid is first constructed to make feature points meet scale invariance to a certain extent. Secondly, for each layer of the image pyramid, the FAST algorithm is used for the preliminary extraction of corner points. If the gray value of a pixel and enough pixels in its surrounding area differ sufficiently from the gray value of the point, the pixel is considered a FAST corner point. Furthermore, the Harris corner detection method was used to sort the feature points according to the response function of feature points. And, the first N corner points with good curvature are selected as the feature points according to the sorting results. Finally, the gray center of the mass method is used to determine the direction of feature points, and Rosin defines the moments of image blocks.For discrete problems, the spatial position of the particle is represented as a vector composed of 0 and 1. For each iteration, it becomes difficult to calculate the velocity and spatial position of the particle in the search space.


### 4.2.2. Feature Selection Results

A total of 28 normalized features are selected in the early, middle, and late stages of brown spot disease and frog eye disease. After using the particle swarm optimization algorithm for 15 times, the feature selection results are derived which are shown in Table7.Table 7
Experimental results of feature selection of particle swarm optimization for 15 times.
Number of experimentsBinary representation of feature-preferred combinationsAdaptabilityCross-validation rate (%)Verification set recognition rate (%)1010110110010110110100101010194.2388.5794.002100101100001010100101000101194.1588.6993.673000100101011011010100111101098.6589.2391.004110101001110000100110010001195.5687.8795.675000110011001011111010101011092.1592.6689336100010010001000010101101110193.2686.7192.677001010011011011011100110111194.3187.2493.008100110010001100110101100111194.1189.3194.009000110010100111100110011110095.6888.6592.6510100001000110101010110010101195.2693.3196.0011100101001000101101101011100194.3792.3394.3312110101000100110110010010101092.3189.2393.0013110101000100110110010010101091.3687.5692.0014110111010100110011001001001195.1586.2689.2315000101010101001001100101010198.2691.2297.65Table7 shows that the fitness of the tenth group of data is 95.23, and the cross-validation rate is 93.31%. The recognition rate of the verification set is 96%, which also reaches the maximum value. The feature optimization is a 13-dimensional feature parameter. Therefore, the tenth group of optimization results is selected for the next step of classification recognition, namely, R1, B2, H1, S1, H2, V2, S3, rectangularity, complexity, energy, contrast, entropy, and average grayscale.


## 4.2.1. Algorithm Principle

Particle swarm optimization takes the feasible solution space of the optimization problem as its search space and randomly generates the initial population in the search space. An individual is a particle without volume or mass [30]. The spatial position of each particle is a feasible solution to the optimization problem. The fitness of a particle is a measure of its position in space. The particle dynamically adjusts its flight speed and space position in the search space to search for the optimal space position and for finding an optimal solution to the problem [31, 32]. The PSO algorithm is used to reduce the original data dimension, and relatively few features are used to achieve better results. In the research, the PSO algorithm was used for the feature optimization of color features, texture features, and shape features extracted above. The algorithm flow is shown in Figure 1.Figure 1
Flow chart of the PSO algorithm.The ORB algorithm is a fast feature point extraction and description algorithm [33, 34]. To extract feature points, a scale pyramid is first constructed to make feature points meet scale invariance to a certain extent. Secondly, for each layer of the image pyramid, the FAST algorithm is used for the preliminary extraction of corner points. If the gray value of a pixel and enough pixels in its surrounding area differ sufficiently from the gray value of the point, the pixel is considered a FAST corner point. Furthermore, the Harris corner detection method was used to sort the feature points according to the response function of feature points. And, the first N corner points with good curvature are selected as the feature points according to the sorting results. Finally, the gray center of the mass method is used to determine the direction of feature points, and Rosin defines the moments of image blocks.For discrete problems, the spatial position of the particle is represented as a vector composed of 0 and 1. For each iteration, it becomes difficult to calculate the velocity and spatial position of the particle in the search space.


## 4.2.2. Feature Selection Results

A total of 28 normalized features are selected in the early, middle, and late stages of brown spot disease and frog eye disease. After using the particle swarm optimization algorithm for 15 times, the feature selection results are derived which are shown in Table7.Table 7
Experimental results of feature selection of particle swarm optimization for 15 times.
Number of experimentsBinary representation of feature-preferred combinationsAdaptabilityCross-validation rate (%)Verification set recognition rate (%)1010110110010110110100101010194.2388.5794.002100101100001010100101000101194.1588.6993.673000100101011011010100111101098.6589.2391.004110101001110000100110010001195.5687.8795.675000110011001011111010101011092.1592.6689336100010010001000010101101110193.2686.7192.677001010011011011011100110111194.3187.2493.008100110010001100110101100111194.1189.3194.009000110010100111100110011110095.6888.6592.6510100001000110101010110010101195.2693.3196.0011100101001000101101101011100194.3792.3394.3312110101000100110110010010101092.3189.2393.0013110101000100110110010010101091.3687.5692.0014110111010100110011001001001195.1586.2689.2315000101010101001001100101010198.2691.2297.65Table7 shows that the fitness of the tenth group of data is 95.23, and the cross-validation rate is 93.31%. The recognition rate of the verification set is 96%, which also reaches the maximum value. The feature optimization is a 13-dimensional feature parameter. Therefore, the tenth group of optimization results is selected for the next step of classification recognition, namely, R1, B2, H1, S1, H2, V2, S3, rectangularity, complexity, energy, contrast, entropy, and average grayscale.


## 4.3. Classification and Recognition of Tobacco Leaf Disease Spots Based on SVM

Pattern recognition refers to the analysis and processing of all kinds of information representing things through computer technology. It is an integral part of artificial intelligence. Classifiers, also called discriminant models, are used in pattern recognition. The support vector machine (SVM) is one of the commonly used classifiers, which is commonly used in image retrieval, target tracking, face recognition, and other fields. In this research, a support vector machine (SVM) was used to classify the optimized feature parameters, so as to realize the classification and recognition of the early similar diseases of tobacco leaves (brown spot disease and frog eye disease) and the early, middle, and late stages of the two diseases.In real use, most are discrete, namely, nonlinear. Through the nonlinear mapping, the space samples are mapped to a high-dimensional feature space, constructing the optimal separating hyperplane again. At this time, considering that there is still linear inseparability caused by a small number of samples after nonlinear mapping to a high-dimensional feature space, relaxation variables need to be added. The penalty factor is added to the objective function, which plays a role in controlling the punishment degree of misclassification samples. The discrete classification problem can be regarded as a quadratic programming problem. The SVM is a binary classification algorithm, which can separate two different types of samples. But in the research process, six types of samples will appear at most, so it is necessary to construct appropriate multiclassifiers. Currently, there are two main methods to construct SVM multiclassifiers: direct method and indirect method. In this research, the one-to-one classification method of indirect method is used to design an SVM between any two different samples. Therefore, samples of N different categories needn(n − 1)/2 SVMs. During the classification, the category with the most votes is the category of samples, as shown in Figure 2. The one-to-one classification method of the SVM function is adopted in MATLAB, and there are at the most six types of data in the research study. Figure 2 is an example diagram of the one-to-one classifier of the support vector machine. In this study, the main research is aimed at the early diseases of tobacco brown spot and frog eye disease, and the middle and late stages of tobacco brown spot and frog eye disease are added as the references in the classification process.Figure 2
Sample diagram of the one-to-one classifier of SVM.Two kinds of classification problems are solved, that is, the sample of one class at a time is selected as the positive class sample, and the sample of the negative class becomes only one class (called the “one-to-one” method). According to the maximum category adopted in the research, there are six categories. For this pair of one-category devices, the first one only answers “is it the first or the second,” the second one only answers “is it the first or the third one,” and the third one only answers “is it the first or the fourth one”. There should be 15 such classifiers (n(n − 1)/2 SVM classifiers are constructed if there are n categories). Although the number of classifiers is increased, the total time spent in the training stage is less than that of the “one-to-others” method, which is a directed acyclic graph, so this method is also called the DAG SVM.The classifier used in the research determines whether these categories belong to the first or the sixth category in the “1 to 6” classification process. It continues to judge the category according to the order shown in the above figure and runs the judgment until all six categories of data are identified. At this time, 15 classifiers are actually called, which can accurately distinguish different classes.


## 4.4. Analysis of Identification Results

The total number of samples in the research is 1200 groups, including 600 groups of tobacco frog eye disease and 600 groups of brown spot disease, including 200 groups in the early, middle, and late stages, respectively. 150 groups are selected as the training data, and 50 groups are selected as the test data. The color features, morphological features, and texture features extracted above are normalized and optimized by the particle swarm optimization algorithm. Finally, the SVM classification model is established for recognition. The test recognition results are shown in Table8.Table 8
Early identification rates of frog eye disease and brown spot disease.
Disease typeTime of the diseaseTraining sampleTest sampleTest the correct sampleTest correct sample recognition rate (%)Brown spot diseaseEarly150504794Frog eye diseaseEarly150504896Total3001009595The identification rate of early disease samples of frog eye disease is 90% and that of brown spot disease is 94%. According to Figure3, the external morphology of frog eye disease and brown spot disease in the early stage is very similar. Brown spot disease has patches of different widths around the spot in the early stage, but frog eye disease does not. The early stage of brown spot disease is characterized by round spots, and the color of the spots is mostly yellowish brown. The early stage of frog eye disease is characterized by round spots which are brown, tawny or dirty white, or mostly brown. The identification rate of frog eye disease is lower than that of brown spot disease based on the color and halo of frog eye disease and brown spot disease and is shown in Table 9.Figure 3
Classification results of tobacco brown spot in the early, middle, and late stages and tobacco frog eye disease in the early, middle, and late stages.Table 9
Identification rates of brown spot disease and frog eye disease in different periods.
Disease typeTime of the diseaseTraining sampleTest sampleTest the correct sampleTest correct sample recognition rate (%)Brown spot diseaseEarly150504794Middle150504998Late150504998Frog eye diseaseEarly150504896Middle150504590Late1505050100Total90030028896The number of identification errors in the early, middle, and late stages of frog eye disease samples is 4, 1, and 1, respectively. The number of identification errors in the early, middle, and late stages of brown spot disease samples is 4, 2, and 0, respectively. The early stage of frog eye disease is characterized by round spots which are brown, tawny or dirty white, or mostly brown. There is no significant difference in the area of the middle and late stages of frog eye disease. The actual measurement shows a width range of 0.5 cm-1 cm. The middle stage of frog eye disease is gray parchment in the center, and the gray mold layer and perforation damage are produced in the late stage of frog eye disease. The early stage of brown spot disease is characterized by round spots, and the color of the spots is mostly yellowish brown. In the middle stage, there are obvious rims and the area of the lesion gradually becomes larger. The actual measurement in the field shows a width range of 0.6 cm-2 cm. The width of a single spot in the late stage ranges from 4 cm to 10 cm, and the whole leaf surface will be necrotic if multiple disease spots are linked together.On the other hand, in order to further improve the efficiency of recognition, a deep learning framework is used. After the data enhancement, a total of 2668 original crop leaf disease images are analyzed. 20 labels are assigned to each image in the dataset, each label representing a crop disease. Through the data enhancement, the original data images are extended to the sample set with 32016 images. Through transfer learning, the parameter weights of the last layer are retrained, and then the recognition accuracy of the four groups of experiments on several deep learning frameworks is compared with the verification set. Other parameters are shown in Table10.Table 10
Parameter selection of deep learning framework.
Parameter selection1. Deep learning framework selection: AlexNet, VGG-16, and GoogleNet2. Model training method: transfer learning3. Training-test set distribution: the training set is 80%, and the test set is 20%First, it is determined that the dataset contains 32,016 images after data enhancement of the original images, and the influence of different center loss weightsλ on the supervision effect is tested. Then, in the best λ case, four groups of experiments are carried out to cross-verify the influence of data enhancement and joint supervision on the model. The verification combination is shown in Table 11.Table 11
Cross-validation combinations.
Experiment serial numberPortfolio to be verified1CNN2AD-GAC CNN3CNN + joint supervision4AD-GAC CNIN + joint supervisionThe specific experimental results are presented in Figures4 to 6.Figure 4
Influence of the weight loss of test center on the recognition accuracy of B + C sets on AlexNet.Figure 5
Influence of the weight loss of test center on the recognition accuracy of B + C sets on VGG-16.Figure 6
Influence of the weight loss of test center on the recognition accuracy of B + C sets on GoogleNet.After the abovementioned figure is iterated, the recognition accuracy curve gradually becomes stable and rises. Similarly, after 5000 iterations, the loss gradually declines gently. Experimental results show that the two-stage AD-GACCNN network structure can effectively improve the generalization ability of the model and reduce the occurrence of the overfitting phenomenon. When using the central loss function and softmax function as the joint supervision mechanism, the model can effectively reduce the intraclass distance and increase the interclass distance. When the two methods are simultaneously applied to the model, the recognition accuracy of the model is increased by nearly 10% compared with that of the model without either method. It can be seen that it has obvious significance for spot recognition tasks for small samples under complex backgrounds and also has reference significance for other types of recognition tasks.


## 5. Conclusion

The main content of the research was to investigate the early segmentation and recognition of brown spot disease and frog eye disease, which have high similarities to tobacco diseases. The images of two tobacco diseases (brown spot disease and frog eye disease) under complex background were used as segmentation objects.(1)
The commonly used segmentation methods and theories of crop diseases, especially tobacco leaf diseases, were summarized, and the segmentation methods of tobacco leaf diseases under complex backgrounds were emphatically investigated. In view of the difficulty in segmentation of images of two tobacco leaf diseases (brown spot disease and frog eye disease) under complex background in field practice, a multistep segmentation method based on saliency detection and seed point selection was proposed, which combined the mean shift smoothing preprocessing with simple linear iterative clustering preprocessing. It was suitable for image segmentation in a complex field environment, and the effectiveness of the method was proved.(2)
According to the realization forms of the two diseases in different periods, the color features, morphological features, and texture features were extracted, with a total of 28 dimensions of color feature information. After that, the particle swarm optimization algorithm was used to optimize the features and reduce the dimensions to 13 dimensions, greatly reducing the workload in the recognition classifier.(3)
According to different external forms of brown spot disease and frog eye disease in the early, middle, and late stages (six categories), the different diseases of the image color features, shape features, and texture features were extracted. A total of 28 dimensional data features were extracted from each category. Then, feature optimization was carried out by the particle swarm optimization algorithm, and finally, 13 dimensional feature parameters were obtained. The recognition rate of the verification test set reached 96%. In the recognition process, a support vector machine was used to classify tobacco brown spot disease and tobacco frog eye disease. The recognition rate of tobacco brown spot disease and frog eye disease in the early stage reached 92%, and the recognition rate of six categories of the early, middle, and late stages of the two diseases reached 96%.



---

*Source: 4285045-2022-09-27.xml*