Improved Gabor and HOG adaptive weighted multi-feature fusion method for plant leaf recognition
By using an improved Gabor and HOG algorithm with adaptive weighted multi-feature fusion and dimensionality reduction, combined with an SVM classifier, the problem of inaccurate feature extraction in plant leaf identification was solved, achieving efficient identification in complex environments.
Patent Information
- Application Number
- CN202111550041.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-12-17
AI Technical Summary
Existing technologies struggle to accurately extract and identify plant leaf features in complex environments, resulting in low classification and recognition rates.
An improved Gabor and HOG algorithm is used for adaptive weighted multi-feature fusion, combined with kernel principal component analysis (KPCA) for dimensionality reduction, and a support vector machine (SVM) with combined kernel functions is used for classification training.
It improves the accuracy of plant leaf identification, effectively extracts and identifies plant leaf features in complex environments, and makes up for the shortcomings of traditional methods.
Smart Images

Figure CN114529503B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a plant leaf recognition method based on adaptive weighted multi-feature fusion of improved Gabor and HOG, and belongs to the field of machine vision. Background Art
[0002] Plants are a unique nutritional, medical and industrial raw material that humans need. They play an irreplaceable role in ecological environmental protection, food and drug development, and daily necessities production. Therefore, studying plant classification is very necessary for human economic and social development. With the rapid development of computer sensor technology, machine vision and machine learning technology, it has become possible to quickly obtain plant physiological characteristics through image capture devices and use image processing and pattern recognition algorithms to quickly classify plants.
[0003] Due to the non-rigid characteristics of plant leaves, the structural characteristics of leaf shapes are complex and changeable. Even for the same plant leaf image, different factors such as growth stage, growth position, season, and light exposure will lead to huge differences in its classification characteristics, thus limiting the classification and recognition rate of existing leaf image feature extraction algorithms and technologies. Therefore, accurate and efficient image feature extraction methods and classification and recognition algorithms are the key to solving the problem of plant leaf classification. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the present invention proposes a plant leaf recognition method based on adaptive weighted multi-feature fusion of improved Gabor and HOG, improves the traditional Gabor filter, and makes it have better feature extraction ability for the curved part on the basis of maintaining the original good directional characteristics and scale characteristics, making up for the lack of description of plant leaf information, thereby achieving the purpose of accurate plant leaf recognition. First, the image is preprocessed, and then the Gabor filter in the Gabor algorithm is improved, and then the improved Gabor algorithm and HOG algorithm are used to extract features from the preprocessed image respectively to obtain Gabor and HOG feature vectors, and the two feature vectors are adaptively weighted and fused for dimensionality reduction, and then the combined kernel function of SVM is used for classification training to output the recognition result.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] The present invention proposes a method for plant leaf recognition based on adaptive weighted multi-feature fusion of improved Gabor and HOG. The method is based on an improved Gabor feature extraction algorithm, a HOG feature extraction algorithm, an improved Gabor and HOG adaptive weighted multi-feature fusion and dimensionality reduction processing, and SVM classification training. The specific process is as follows:
[0007] Step 1, preprocessing the collected plant leaf images to remove noise;
[0008] Step 2: The Gabor feature algorithm has a good ability to describe the texture information of the object. The Gabor filter in the Gabor feature algorithm is improved to have better feature extraction capabilities for curved parts.
[0009] Step 3, using the improved Gabor algorithm and HOG algorithm to extract features from the preprocessed image, respectively, to obtain Gabor and HOG feature vectors, and adaptively weighted fusion of the two feature vectors;
[0010] Step 4, kernel principal component analysis (KPCA) is used to reduce the dimension of the fused feature vector;
[0011] Step 5: linearly combine the radial basis kernel function and the polynomial kernel function, use the combined kernel function as the kernel function of the SVM, and perform classification training on the feature vector after dimensionality reduction.
[0012] Beneficial effects: The plant leaf recognition method based on adaptive weighted multi-feature fusion of improved Gabor and HOG proposed by the present invention improves the traditional Gabor filter so that it has better feature extraction capability for curved parts while maintaining the original good directional characteristics and scale characteristics. The present invention can be widely used in plant leaf recognition in complex environments in the field of machine vision, making up for the lack of description of plant leaf information, thereby achieving the purpose of accurate plant leaf recognition, and has a very broad application scenario. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a flowchart of a method for plant leaf recognition by improving Gabor and HOG adaptive weighted multi-feature fusion in one embodiment;
[0014] Figure 2 A flowchart of Gabor feature extraction in one embodiment;
[0015] Figure 3 A flowchart of improving the adaptive weighted multi-feature fusion and dimensionality reduction of Gabor and HOG in one embodiment;
[0016] Figure 4 FIG. 1 is a flow chart of plant leaf recognition in one embodiment. DETAILED DESCRIPTION
[0017] In order to describe the plant leaf recognition method of the improved Gabor and HOG adaptive weighted multi-feature fusion proposed by the present invention in more detail, the following examples are given in conjunction with the accompanying drawings:
[0018] In one embodiment, Figure 1 As shown, a plant leaf recognition method based on adaptive weighted multi-feature fusion of improved Gabor and HOG is provided, and the method comprises the following steps:
[0019] Step 1, preprocessing the collected plant leaf images;
[0020] Step 2, using the improved Gabor algorithm and HOG algorithm to extract features from the preprocessed image, respectively, to obtain Gabor feature vectors and HOG feature vectors, and adaptively weighted fusion of the two feature vectors;
[0021] Step 3, using kernel principal component analysis KPCA to reduce the dimension of the feature vector fused in step 2;
[0022] Step 4, linearly combine the radial basis kernel function and the polynomial kernel function, use the combined kernel function as the kernel function of the SVM classifier, and train the SVM classifier using the feature vector after dimensionality reduction in step 3;
[0023] Step 5: Use the SVM classifier trained in step 4 to identify plant leaves.
[0024] In one embodiment, Figure 2 As shown, a Gabor feature extraction method is provided, which mainly includes the following steps:
[0025] Step S101, input image preprocessing;
[0026] The input image is generally in RGB format, which contains more detailed information but also more noise, which increases the amount of calculation. Therefore, before extracting image features, grayscale processing is required to reduce the complexity of calculation. Grayscale images do not contain color information, but only represent the grayscale information of the image. The depth of black and white of each pixel in the image is represented by grayscale values. Use different weights to perform weighted average of the three components of R, G, and B for grayscale conversion. The formula is:
[0027] I(x,y)=0.299r(x,y)+0.587g(x,y)+0.114b(x,y)
[0028] Among them, I(x, y) is the grayscale value of the pixel point after grayscale transformation at the coordinates (x, y), and the value range is [0, 255]. r(x, y), g(x, y), and b(x, y) represent the pixel values of the pixel point (x, y) in the R, G, and B channels, respectively.
[0029] Step S102, improving the Gabor filter;
[0030] The traditional Gabor filter x′ and y′ are both first-order terms, which have strong representation capabilities for straight lines, but poor representation capabilities for curves, resulting in poor results when extracting features of the curved part of the image; therefore, in order to better extract the features of the curved part of the plant leaf, the Gabor filter needs to be improved. First, the cube of y′ is coupled to x′, and then a parameter curvature coefficient l is used to control the curvature of the curve, thereby enhancing the nonlinearity of the filter, so that it has better feature extraction capabilities for the curved part while maintaining the original good directional and scale characteristics; the x′ and y′ coordinates of the improved Gabor filter are:
[0031] y′=y cosθ-x sinθ
[0032] x′=x cosθ+y sinθ+l(y cosθ-x sinθ) 3
[0033] Wherein, x represents the horizontal coordinate of a pixel in the image, y represents the vertical coordinate of a pixel in the image, θ represents the direction of the Gabor kernel function (0, 2π), and the value range of l is (0, 1).
[0034] Step S103, constructing a Gabor filter bank;
[0035] The mathematical expression of the complex form of the two-dimensional Gabor filter is:
[0036]
[0037] Where θ represents the direction of the Gabor kernel function, θ∈(0, 2π); ψ represents the phase shift of the harmonic function, ψ∈(-π, π); λ represents the wavelength of the sine function, represents the spatial aspect ratio, and σ represents the standard deviation of the Gaussian filter.
[0038] By changing the wavelength λ and the value of the Gabor kernel function direction θ to obtain filters of different scales and directions, the Gabor filters that can extract better express the texture features of plant leaves are combined to construct a filter group that can be used to extract the texture features of plant leaves.
[0039] Step S104, calculating the Gabor feature vector of the image;
[0040] The grayscale image I(x, y) is convolved with the constructed Gabor filter bank and modulo to obtain the output of the Gabor filter, which is:
[0041]
[0042] In one embodiment, Figure 3 As shown, a HOG feature extraction method is provided, which mainly includes the following steps:
[0043] Step S201, Gamma correction;
[0044] Gamma correction refers to detecting dark and light parts in image signals to increase the contrast between dark and light colors in the image. Generally, the texture intensity of an image is related to local illumination, and the gamma correction method helps reduce the impact of illumination on the image. The formula is as follows:
[0045]
[0046] Among them, gamma represents the correction value, o(x, y) in Indicates the pixel value before correction, o(x, y) out Represents the corrected pixel value.
[0047] Step S202, calculating the gradient amplitude and direction;
[0048] For the input image, the horizontal gradient G of the image at the pixel point (x, y) x (x, y) and the vertical gradient G y (x, y):
[0049] G x (x,y)=J(x+1,y)-J(x-1,y)
[0050] G y (x, y)=J(x, y+1)-J(x, y-1)
[0051] Wherein, J(x, y) represents the pixel value at the pixel point (x, y) in the input image.
[0052] The gradient magnitude and gradient direction of the image at the pixel point (x, y) are expressed as Γ(x, y) and α(x, y), respectively:
[0053] Γ(x, y)=[G x (x, y) 2 +G y (x, y) 2 ] 0.5
[0054] α(x, y) = tan -1 [G y (x,y) / G x (x, y)]
[0055] Step S202, constructing cell and block directional gradient histograms;
[0056] When calculating the histogram of oriented gradients, the image is first divided into multiple connected cells of size 8×8, and then further divided into blocks, 2×2 cells form a block, and the resulting block size is 16×16. According to the step size of 8 pixels, the block slides from left to right and from top to bottom on the detection window until the entire image is traversed.
[0057] Then, the gradient information of the cell and block is calculated based on the pixel gradient direction and amplitude. The gradient direction and corresponding directional amplitude of each pixel (x, y) are determined using bilinear interpolation. The directional gradient amplitudes of the same range of each pixel in each cell are added together to obtain the statistical component of the gradient direction. The statistical components of other directional gradients are obtained by analogy, and the gradient information of the cell is then statistically calculated. The HOG features of the block area are then formed by serially combining the gradient information of the cells.
[0058] Step S203, generating a feature vector HOG;
[0059] The HOG descriptors of each block of the image are concatenated together to obtain the HOG feature vector of the image.
[0060] In one embodiment, an improved Gabor and HOG adaptive weighted multi-feature fusion and dimensionality reduction method is provided, as follows:
[0061] The improved Gabor algorithm and HOG algorithm are used to extract features from the preprocessed image respectively to obtain Gabor and HOG feature vectors, and the two feature vectors are weighted fused using the adaptive weighted multi-feature fusion method; a rectangular target area R with a size of h×w pixels covering all plant leaves is selected from the preprocessed image. obj , respectively calculate the probability density function p of the Gabor feature vector G And the probability density function p of the HOG feature vector H , the formula is as follows:
[0062]
[0063]
[0064] Among them, β G represents the Gabor eigenvector, β H represents the HOG feature vector, δ(z) is the Kronecker delta function, a(z)-β G Indicates whether the z pixel belongs to the eigenvalue β G , if it belongs to, then a(z)-β G =0, the function takes the value of 1, otherwise the function takes the value of 0, a(z)-βH Similarly, N obj Indicates the target area R obj The number of pixels;
[0065] The pixel-based log-likelihood ratio formula is calculated:
[0066]
[0067] Wherein, m=G or H;
[0068] At this time, different eigenvectors β m The corresponding fusion weight coefficient is ω m ,ω m The calculation formula is as follows:
[0069] ω m =L m (z) / L G (z)+L H (z)
[0070] Where m = G or H, ω G +ω H =1, when extracting the features of the curved part of the plant leaf, ω G The value is greater than ω H , when extracting the features of the edge of plant leaves, ω H The value is greater than ω G ;
[0071] Then the fusion feature vector ν is expressed as:
[0072] v=ω G β G +ω H β H
[0073] Since feature fusion will increase the dimension of the fused feature vector, KPCA is used for dimensionality reduction. Before feature extraction, KPCA uses a selected orthogonal dimensionality reduction matrix to map redundant related data to a high-dimensional space F using a kernel function, thereby removing redundant information but retaining the main information. The new low-dimensional approximate feature space replaces the original high-dimensional space, thereby achieving data dimensionality reduction.
[0074] In one embodiment, Figure 4 As shown, a plant leaf recognition method is provided, which mainly includes the following steps:
[0075] Step S301, training a SVM classifier;
[0076] The linear combination polynomial kernel function and radial basis kernel function are used as the kernel function of SVM, and the combined kernel function SVM classifier is trained according to the learned weighted multi-features.
[0077] Step S302, using a classifier to determine the type of plant leaves;
[0078] The fused and reduced-dimensional Gabor and HOG feature vectors are sent to the trained SVM classifier to determine the type of plant leaves and output the recognition results.
[0079] It should be pointed out that the description of the above embodiments is only used to help understand the method of the present application and its core idea. For ordinary technicians in this technical field, several improvements and modifications can be made to the present application without departing from the principles of the present application. These improvements and modifications are also within the scope of protection of the claims of the present application.
Claims
1. Improved Gabor and HOG adaptive weighted multi-feature fusion plant leaf recognition method, characterized in that: The specific steps of this method are as follows: Step 1, preprocessing the collected plant leaf images; Step 2, using the improved Gabor algorithm and HOG algorithm to extract features from the preprocessed image, respectively, to obtain Gabor feature vectors and HOG feature vectors, and adaptively weighted fusion of the two feature vectors; Step 3, using kernel principal component analysis KPCA to reduce the dimension of the feature vector fused in step 2; Step 4, linearly combine the radial basis kernel function and the polynomial kernel function, use the combined kernel function as the kernel function of the SVM classifier, and train the SVM classifier using the feature vector after dimensionality reduction in step 3; Step 5, using the SVM classifier trained in step 4 to identify plant leaves; The improved Gabor algorithm in step 2 refers to improving the Gabor filter. The x' and y' coordinates of the improved Gabor filter are: y′=ycosθ-xsinθ x′=xcosθ+ysinθ+l(ycosθ-xsinθ) 3 Among them, x represents the horizontal coordinate of a pixel point in the image, y represents the vertical coordinate of a pixel point in the image, θ represents the direction of the Gabor kernel function, and l represents the curvature coefficient; The feature vector ν after adaptive weighted fusion in step 2 is expressed as: n = oh G b G +oh H b H Among them, β G represents the Gabor eigenvector, β H represents the HOG feature vector, ω G and ω H Respectively represent β G and β H The corresponding fusion weight coefficient, ω G +ω H =1; Fusion weight coefficient ω m The calculation formula is as follows: ω m =L m (z) / L G (z)+L H (z) Where, m = G, H; β G represents the Gabor eigenvector, β H Represents the HOG feature vector; R obj is the h×w rectangular target region in the image, which covers all plant leaves in the image; δ(·) is the Kronecker delta function, a(z)-β m Indicates whether the z pixel belongs to β m , if it belongs to, then a(z)-β m =0,δ(a(z)-β m ) takes the value of 1, otherwise δ(a(z)-β m The value is 0; p G represents the probability density function of the Gabor feature vector in the target area, p H Represents the probability density function of the HOG feature vector in the target area.
2. The plant leaf recognition method based on adaptive weighted multi-feature fusion of improved Gabor and HOG according to claim 1 is characterized in that: The preprocessing in step 1 refers to grayscale processing of the image.
3. The plant leaf recognition method based on improved Gabor and HOG adaptive weighted multi-feature fusion according to claim 1 is characterized in that: When extracting the features of the curved part of a plant leaf, ω G Greater than ω H ; When extracting the features of the edge of a plant leaf, ω H Greater than ω G .
4. The plant leaf recognition method based on the improved Gabor and HOG adaptive weighted multi-feature fusion according to claim 1 is characterized in that: N obj Indicates the target area R obj The number of pixels; 5. The plant leaf recognition method based on improved Gabor and HOG adaptive weighted multi-feature fusion according to claim 1 is characterized in that: The kernel function expression after the combination in step 4 is: Among them, ζ is a constant coefficient, γ represents the gamma parameter, represents the feature vector at any point in the image, The eigenvector at point q in the image, d represents the order of the polynomial kernel function.
