A method, system, electronic device and storage medium for identifying plant species
By rotating the plant leaf image and extracting a variety of contour features, the problem of poor feature invariance caused by leaf angle rotation in the prior art is solved, and the accuracy of plant leaf recognition is improved.
Patent Information
- Application Number
- CN202111056314.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-09
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2041-09-09
AI Technical Summary
In the recognition of plant leaf, the characteristics of edge point shape descriptors are poorly invariant due to factors such as leaf angle rotation, scale and local area edge shape changes in plant leaf, resulting in poor characteristic invariance, noise is introduced, and identification effect is reduced.
Extract the leaf edge contour of the plant leaf image and obtain the leaf profile image through rotation transformation to ensure that the contour inclination angles of all images are the same. Then, convex defect features, contour shape symmetry features, and contour shape vector features are extracted from the blade profile image, and these features are combined to enhance feature descriptions of local contour edge points.
By standardizing the rotation angle of the leaf profile and extracting a variety of contour features, the characteristic invariance and recognition accuracy of plant leaves are improved, and the effectiveness of plant species recognition is enhanced.
Smart Images

Figure CN113837037B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and particularly to a method, a system, an electronic device, and a storage medium for identifying plant species. Background Art
[0002] With the increasing attention paid by the country to the construction of ecological civilization, the protection of species diversity has also received more and more attention. The protection of plant diversity is of great significance to the stability of the earth's ecological environment. The identification of plant species is the cornerstone of protecting plant diversity. At present, the identification of plant species mainly relies on manual identification. It is estimated that there are about 550,000 plant species on the earth, which poses a great challenge to the manual identification and statistics of plant species. It not only takes a long time and has low efficiency, but also there are a large number of plant varieties. Sometimes even botanists are difficult to accurately identify them.
[0003] In this field, computer vision and artificial intelligence methods are usually used to identify plant species. To a certain extent, the leaf contour features can describe the local edge point information. However, due to factors such as the rotation of the leaf angle, scale, and the change of the edge shape of the local area of the leaf, the feature invariance of the edge point shape descriptor becomes poor, introducing noise into the leaf contour feature data, resulting in poor plant leaf recognition effect.
[0004] Therefore, how to improve the accuracy of identifying plant categories is a technical problem that needs to be solved by those skilled in the art at present. Summary of the Invention
[0005] The purpose of the present application is to provide a method, a system, an electronic device, and a storage medium for identifying plant species, which can improve the accuracy of identifying plant categories.
[0006] To solve the above technical problem, the present application provides a method for identifying plant species, which includes:
[0007] Extracting the leaf edge contour of the plant leaf image, and performing a rotation transformation on the leaf edge contour to obtain a leaf contour image; wherein, the contour inclination angles of all the leaf contour images are the same;
[0008] Extracting contour features from the leaf contour image; wherein, the contour features include any one or a combination of any several of the convex defect feature, the contour shape symmetry feature, and the contour shape vector feature;
[0009] Training a plant leaf classification model by using the contour features, so as to perform a plant species identification operation by using the trained plant leaf classification model.
[0010] Optionally, performing a rotation transformation on the leaf edge contour to obtain a leaf contour image includes:
[0011] Convert the color model of the plant leaf image to the YIQ color model, and perform the Otsu thresholding segmentation operation on the Q-channel image of the plant leaf image to obtain a binary plant leaf image;
[0012] Process the binary plant leaf image through morphological closing operation to obtain a first alternative image, and perform distance transformation and binarization processing on the first alternative image to obtain a second alternative image;
[0013] Perform contour detection operation on the second alternative image to obtain leaf edge points;
[0014] Process the leaf edge points by using the linear fitting algorithm of the least squares method to obtain a target line; wherein, the target line is the line closest to all the leaf edge points;
[0015] Determine the contour rotation angle according to the slope of the target line, and perform a rotation transformation on the leaf edge contour according to the contour rotation angle to obtain the leaf contour image.
[0016] Optionally, if the contour feature includes a convex defect feature, extracting contour features from the leaf contour image includes:
[0017] Generate a convex hull of the leaf edge contour in the leaf contour image, and determine convex defects according to the region enclosed by the sides of the convex hull and the leaf edge contour;
[0018] Set the distance from the farthest point of the convex defect to the side of the convex hull as the target distance; wherein, the farthest point of the convex defect is the leaf contour point with the largest distance from the side of the convex hull;
[0019] Take the eigenvalue of all the target distances as the convex defect feature of the leaf contour image; wherein, the eigenvalues of all the target distances include any one or a combination of several of the maximum value, average value, and variance.
[0020] Optionally, if the contour feature includes a contour shape symmetry feature, extracting contour features from the leaf contour image includes:
[0021] Set the two leaf contour points with the farthest distance in the length direction of the leaf edge contour as the near-end point and the far-end point;
[0022] Determine the contour centroid of the leaf edge contour, set the distance between the near-end point and the contour centroid as the first distance, and set the distance between the far-end point and the contour centroid as the second distance;
[0023] Judge whether the first distance is less than the second distance;
[0024] If so, use the ratio of the first distance to the second distance as the contour shape symmetry feature of the blade contour image;
[0025] If not, use the ratio of the second distance to the first distance as the contour shape symmetry feature of the blade contour image.
[0026] Optionally, if the contour feature includes a contour shape vector feature, extracting the contour feature from the blade contour image includes:
[0027] Set the two blade contour points with the farthest distance in the length direction of the blade edge contour as the near-end point and the far-end point;
[0028] Set the line connecting the near-end point and the far-end point as the reference line;
[0029] Determine the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line.
[0030] Optionally, determining the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line includes:
[0031] Select multiple equally spaced points on the reference line as reference points, and select the corresponding reference blade contour points on the blade edge contour; wherein, the line connecting the reference blade contour point and the corresponding reference point is perpendicular to the reference line;
[0032] Record the distances between each reference point and the corresponding reference blade contour point to obtain a distance statistical data set;
[0033] Divide the value of each element in the distance statistical data set by the length of the reference line to obtain the contour shape vector feature of the blade contour image.
[0034] Optionally, the contour feature further includes any one or a combination of any several of the aspect ratio feature, rectangularity feature, circularity feature, roundness feature, compactness feature, and convexity feature.
[0035] This application also provides a plant species recognition system, which includes:
[0036] A preprocessing module for extracting the blade edge contour of the plant leaf image and performing a rotation transformation on the blade edge contour to obtain a blade contour image; wherein, the contour inclination angles of all the blade contour images are the same;
[0037] A feature extraction module for extracting contour features from a leaf contour image; wherein the contour features include any one or a combination of convex defect features, contour shape symmetry features, and contour shape vector features;
[0038] A feature learning module for training a plant leaf classification model using the contour features, so as to perform plant species recognition operations using the trained plant leaf classification model.
[0039] This application also provides a storage medium, on which a computer program is stored, and when the computer program is executed, the steps performed by the above plant species recognition method are implemented.
[0040] This application also provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps performed by the above plant species recognition method are implemented.
[0041] This application provides a plant species recognition method, including: extracting the leaf edge contour of a plant leaf image, and performing a rotation transformation on the leaf edge contour to obtain a leaf contour image; wherein, the contour inclination angles of all the leaf contour images are the same; extracting contour features from the leaf contour image; wherein, the contour features include any one or a combination of convex defect features, contour shape symmetry features, and contour shape vector features; training a plant leaf classification model using the contour features, so as to perform plant species recognition operations using the trained plant leaf classification model.
[0042] This application extracts the leaf edge contour from a plant leaf image, performs a rotation transformation on the plant leaf image according to the leaf edge contour to obtain a leaf contour image, so that the contour inclination angles of the leaf edge contours in all the leaf contour images are the same, thereby ensuring the feature invariance of the leaf edge contour. This application also extracts contour features from the leaf contour image. The contour features include any one or a combination of convex defect features, contour shape symmetry features, and contour shape vector features. The above contour features can enhance the features of local contour edge points, so that training a plant leaf classification model using the contour features can fully learn the features of plant leaves, so as to perform plant species recognition operations using the trained plant leaf classification model, and can improve the accuracy of identifying plant categories. This application also provides a plant species recognition system, an electronic device, and a storage medium at the same time, which have the above beneficial effects and will not be elaborated here. Description of the Drawings
[0043] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0044] Figure 1 Flowchart of a plant species recognition method provided by an embodiment of the present application;
[0045] Figure 2 Schematic diagram of a contour angle measurement provided by an embodiment of the present application;
[0046] Figure 3 Schematic diagram of the first contour rotation transformation method provided by an embodiment of the present application;
[0047] Figure 4 Schematic diagram of the second contour rotation transformation method provided by an embodiment of the present application;
[0048] Figure 5 Schematic diagram of the symmetry of a contour shape provided by an embodiment of the present application;
[0049] Figure 6 Schematic diagram of a contour shape vector provided by an embodiment of the present application;
[0050] Figure 7 Flowchart of a leaf recognition method based on leaf contour features provided by an embodiment of the present application;
[0051] Figure 8 Flowchart of leaf edge contour point detection provided by an embodiment of the present application;
[0052] Figure 9 Flowchart of contour rotation angle calculation provided by an embodiment of the present application;
[0053] Figure 10 Schematic diagram of the features of a contour shape feature vector provided by an embodiment of the present application. Detailed implementation manners
[0054] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0055] Please refer to the followingFigure 1 , Figure 1 is a flowchart of a plant species recognition method provided by an embodiment of the present application.
[0056] The specific steps may include:
[0057] S101: Extract the leaf edge contour of the plant leaf image, and perform a rotation transformation on the leaf edge contour to obtain a leaf contour image;
[0058] Among them, before this step, there may be an operation of obtaining multiple plant leaf images and the corresponding plant species of each plant leaf image, so as to train a plant leaf classification model through supervised machine learning. Based on the obtained plant leaf image, the leaf edge contour can be extracted from the plant leaf image. Since the inclination angles of the leaves in each plant leaf image are different, the present application performs a rotation transformation on the plant leaf image according to the leaf edge contour to obtain a leaf contour image. The contour inclination angles of all the above leaf contour images are the same, and the above contour inclination angle is the included angle between the growth direction of the leaf and the horizontal line.
[0059] S102: Extract contour features from the leaf contour image;
[0060] Based on the obtained target mapping leaf image, in this embodiment, contour features can be obtained by performing a feature extraction operation on the leaf contour image. The above contour features include any one or a combination of convex defect features, contour shape symmetry features, and contour shape vector features. Further, the above contour features may also include any one or a combination of aspect ratio features, rectangularity features, circularity features, circular features, compactness features, and convexity features.
[0061] S103: Use the contour features to train a plant leaf classification model, so as to perform a plant species recognition operation using the trained plant leaf classification model.
[0062] Among them, after obtaining the contour features of the leaf contour image, in this embodiment, the plant leaf classification model can be trained according to the contour features of the leaf contour image and the leaf species. The above plant leaf classification model may specifically be an SVM (support vector machines) model. After training the plant leaf classification model, if an unknown plant leaf is received, the service leaf can be input into the trained plant leaf classification model, and the plant species corresponding to the plant leaf can be determined according to the output result of the trained plant leaf classification model.
[0063] In this embodiment, the leaf edge contour is extracted from the plant leaf image, and the plant leaf image is rotationally transformed according to the leaf edge contour to obtain a leaf contour image, so that the contour inclination angles of the leaf edge contours in all leaf contour images are the same, thereby ensuring the feature invariance of the leaf edge contour. This embodiment also extracts contour features from the leaf contour image. The contour features include any one or a combination of convex defect features, contour shape symmetry features, and contour shape vector features. The above contour features can enhance the features of local contour edge points, so that the plant leaf classification model trained using the contour features can fully learn the features of plant leaves, so as to use the trained plant leaf classification model to perform plant species recognition operations, which can improve the accuracy of identifying plant categories.
[0064] As a further introduction to Figure 1 the corresponding embodiment, Figure 1 the corresponding embodiment can detect the leaf edge contour of the plant leaf image through a contour detection algorithm. Specifically, the purpose of contour detection is to detect the contour points on the leaf edge. The input of the contour detection algorithm is the binary image of the plant leaf image. Therefore, before contour detection, the image is first segmented and preprocessed to separate the background and the leaf area with the leaf edge as the boundary. Considering the color difference between the white background area and the leaf area, the OSTU (Otsu threshold method) threshold segmentation method is used for the B (blue) channel image in the RGB color model to separate the leaf and the background, and a binary image containing the leaf area and the background area is obtained, which is input into the contour detection algorithm to obtain a series of contour points. Affected by factors such as uneven illumination in the local area of the leaf, texture veins, or plant lesions, the contour detection algorithm may output multiple sets of contours including the leaf edge and the internal area of the leaf. The set of contours with the largest perimeter or area is selected as the leaf edge contour, and the leaf contour point set C = {P 1 , P 2 , P 3 , …, P i , …, P N} is defined, and the contour point P i = (x i , yi), i = 1, 2, 3, …, N.
[0065] As a further introduction to Figure 1 the corresponding embodiment, the leaf contour image can be obtained in the following way: first calculate the contour rotation angle, and then perform contour rotation transformation according to the contour rotation angle to obtain the leaf contour image.
[0066] This embodiment can calculate the contour rotation angle through at least the following two methods:
[0067] Method 1: Use the minAreaRect function to calculate the contour rotation angle.
[0068] Please refer to Figure 2 , Figure 2 which is a schematic diagram of contour angle measurement provided by the embodiment of the present application. The rotation angle of the contour is calculated by the angle between the direction indicated by the line connecting the two farthest points in the blade contour and the X-axis. As Figure 2 shown, the minAreaRect function in the computer vision library OpenCV uses this method to calculate the rotated bounding rectangle and the contour angle. The angle θ between the line connecting the blade edge points Q1 and Q2 and the horizontal direction is the contour rotation angle.
[0069] However, since the positions of the blade edge points Q1 and Q2 are sensitive and easy to change, resulting in poor invariance of the contour rotation angle, the present embodiment can also use Method 2 to determine the contour rotation angle with better invariance.
[0070] Method 2: Obtain more blade edge points by performing a series of preprocessing on the blade image, and then perform linear fitting on the edge points to obtain the inclination angle of the line, so as to obtain the rotation angle of the blade contour. The specific process is as follows:
[0071] Convert the color model of the plant leaf image to the YIQ color model, and perform an Otsu thresholding segmentation operation on the Q-channel image of the plant leaf image to obtain a binary plant leaf image; process the binary plant leaf image through morphological closing operation to obtain a first alternative image, perform distance transformation and binary processing on the first alternative image to obtain a second alternative image; perform contour detection operation on the second alternative image to obtain blade edge points; process the blade edge points by using the linear fitting algorithm of the least squares method to obtain a target line; wherein, the target line is the line closest to all the blade edge points; determine the contour rotation angle according to the slope of the target line, and perform a rotation transformation on the blade edge contour according to the contour rotation angle to obtain the blade contour image. Specifically, the angle between the target line and the horizontal line can be used as the contour rotation angle.
[0072] In the above embodiments, in order to segment the complete leaf area and weaken the influence of factors such as illumination on the uneven brightness within the leaf area, the RGB color model is transformed into the YIQ color model. By using the OSTU threshold segmentation method for the Q-channel image, a binary image of the relatively complete leaf area can be obtained. The binary image is processed using the morphological closing operation method. The morphological closing operation is an operation that first dilates and then erodes the image, which can eliminate small black dots in the foreground area. Therefore, the closing operation can further remove the mis-segmented pixel points within the leaf area caused by factors such as illumination. The image from the previous step is subjected to distance transformation and binarization. On the one hand, it can further eliminate small black dots in the leaf area, and on the other hand, it is to shrink the leaf area and weaken the influence of the serrated points at the leaf edge. Contour detection is performed on the binary image obtained in the previous step to obtain several leaf edge points. A straight line fitting algorithm based on the least squares method is used to process the contour points to obtain a straight line, which is the straight line with the minimum distance from all contour points to the line, and the direction of the line represents the rotation angle of the leaf contour.
[0073] Based on the determination of the contour rotation angle, in this embodiment, the contour can be rotationally transformed through the affine transformation method to obtain the leaf contour image. Specifically, the process of rotating the contour points is to perform an affine transformation on the contour points. The affine transformation is a linear transformation between two-dimensional coordinates. The affine transformation of the contour points in the present invention only includes the rotation transformation. Assume that the two-dimensional coordinate point P(x, y) rotates clockwise by θ radians around the rotation center (x 0 , y 0 ) to obtain the coordinate point P'(x', y'), and the corresponding affine transformation matrix is:
[0074]
[0075] The transformation from the coordinate point P(x, y) to P'(x', y') is:
[0076]
[0077] The coordinate point (x, y) rotates clockwise by θ radians around the center point (x 0 , y 0 ) and the resulting coordinate is:
[0078]
[0079] Please refer to Figure 3 and Figure 4 , Figure 3 which is a schematic diagram of the first contour rotation transformation method provided by the embodiments of the present application, Figure 4 and Figure 3 is a schematic diagram of the second contour rotation transformation method provided by the embodiments of the present application. As shown in 4The figure shows the process of rotational transformation of the blade profile. The left figures are all the original blade profiles, and the right figures are all the transformed original blade profiles. Figure 3 The contour angle in Figure 4 is θ radians (θ > 0). To obtain the blade profile in the right figure, the original blade profile points are rotated counterclockwise by θ radians with the contour centroid center as the rotation center, that is, rotated clockwise by (-θ) radians. And
[0080]
[0081] As for Figure 1 the further introduction of the corresponding embodiment, the contour feature extraction can be carried out in the following way. After preprocessing such as contour detection and contour rotation of the plant leaf image, the inclination angles of the blade contours are basically the same, making the blade contour points have certain rotation invariance characteristics, thus improving the rotation invariance of the contour feature descriptor. The following is the calculation of contour feature extraction, mainly including the geometric shape features, concavity-convexity attributes, shape symmetry attributes and shape features of local contour points of the contour. The above geometric shape features include aspect ratio feature, rectangularity feature, roundness feature and circularity feature, and the concavity-convexity attribute features include compactness feature, convexity feature and convex defect attribute feature.
[0082] (1) The calculation process of the aspect ratio feature includes: determining the length l and width w of the minimum bounding rectangle of the blade contour, and the aspect ratio of the rectangle is w / l. Among them, the closer the aspect ratio is to 0, the "thinner and longer" the contour shape is, and the closer the aspect ratio is to 1, the "shorter and thicker" the contour shape is.
[0083] (2) The calculation process of the rectangularity feature includes:
[0084] Rectangularity describes the similarity between the shape and a rectangle. The area of the blade contour is A cont , and the area of its corresponding minimum bounding rectangle is A rect , then the rectangularity is rectangularity as A cont / A rect . Among them, the closer the rectangularity is to 1, the closer the contour shape is to a rectangle.
[0085] (3) The calculation process of the roundness feature includes: Roundness describes the degree to which the shape approaches a circle. The area of the blade contour is A cont , and the radius of the minimum bounding circle is R. The roundness is roundess as Acont / (pi * R 2 ). Among them, the closer roundess is to 1, the closer the contour shape is to a circle. pi is the circumference ratio π.
[0086] (4) The calculation process of the circular feature includes: the area of the blade contour is A cont , the perimeter of the blade contour is P cont , and the circular feature circularity is 4 * pi * A cont / (P cont ). 2 The circular feature describes the degree of circularity of the shape. When circularity is close to 1, it means the contour is a perfect circle. When circularity approaches 0, it means the contour shape is a polygon or rectangle close to a straight line.
[0087] (5) The tightness feature is the ratio of the contour area to the convex hull area. The convex hull is the convex polygon that encloses the contour, and the area of the convex hull is A convex , then the tightness feature solidity is A cont / A convex .
[0088] (6) The convexity feature is the ratio of the contour perimeter to the convex hull perimeter. The convex hull perimeter is P convex , then the convexity feature is convexity = P cont / P convex .
[0089] (7) Convexity defects represent the area between the convex hull edge and the contour. To describe the properties of convexity defects, the feature of calculating the distance from the farthest point to the convex hull edge is calculated, and the distance distribution feature is described based on three attributes: maximum value, average value, and variance. The distance from the farthest point of the i-th convexity defect to the convex hull edge is d i , considering the image scale factor, the width w of the minimum bounding rectangle is used to normalize d i , that is, d i / w. The distance vector from the farthest point of the convexity defect to the convex hull edge is defined as where m is the number of convexity defects. Then the convexity defect feature is:
[0090] cd max = max(cd)
[0091] cd mean = mean(cd norm )
[0092] cd dev = variance(cd norm )
[0093] In the above formula, cd max is the maximum value, cd mean is the average value, cd dev is the variance, cd norm is to normalize cd to [0, 1], that is cd max and cd mean The larger they are, the larger the convex defect of the contour. The smaller cd dev is, the more evenly distributed the convex defects of the contour are.
[0094] Specifically, if the contour feature includes a convex defect feature, the process of extracting the contour feature from the blade contour image includes: generating a convex hull of the blade edge contour in the blade contour image, determining the convex defect according to the area enclosed by the edges of the convex hull and the blade edge contour; setting the distance from the farthest point of the convex defect to the edge of the convex hull as the target distance; wherein, the farthest point of the convex defect is the blade contour point with the largest distance from the edge of the convex hull; taking the eigenvalue of all the target distances as the convex defect feature of the blade contour image; wherein, the eigenvalues of all the target distances include any one or a combination of several of the maximum value, the average value and the variance.
[0095] (8) The calculation process of the contour shape symmetry feature includes:
[0096] Please refer to Figure 5 , Figure 5 , which is a schematic diagram of a contour shape symmetry provided by an embodiment of the present application. After the contour rotation transformation, the contour points P1 and P2 corresponding to the minimum X coordinate and the maximum X coordinate are denoted as the near endpoint and the far endpoint, center is the centroid of the contour, d 1 and d 2 are the distances from the near endpoint and the far endpoint in the X direction to the centroid respectively. Q1 and Q2 are the intersection points of the straight line passing through the centroid of the contour and perpendicular to the X coordinate axis and the blade contour. The contour between P 1 and Q 1 is denoted as C P1,Q1 , the contour between P 2 and Q 1 is denoted as C P2,Q1 , the contour between P 1 and Q 2 is denoted as C P1,Q2 , the contour between P 2 and Q 2 is denoted as C P2,Q2 .
[0097] The symmetry of the contour shape in the X direction depends on the symmetry between the contour C P1,Q1 and the contour C P2,Q1 or the contour CP1,Q2 and the contour C P2,Q2 The symmetry between them, and the symmetry of the left and right contours affects the position of the centroid. To simplify the calculation, through the near-end point P in the X direction 1 , the far-end point P 2 to the distance d from the centroid 1 and d 2 The ratio of is used to describe the symmetry. The calculation process of the contour shape symmetry feature symmetry is as follows:
[0098] symmetry = min(d 1 , d 2 ) / max(d 1 , d 2 ).
[0099] Specifically, if the contour feature includes the contour shape symmetry feature, the contour feature is extracted from the blade contour image, including: setting the two blade contour points with the farthest distance in the length direction of the blade edge contour as the near-end point and the far-end point; determining the contour centroid of the blade edge contour, setting the distance between the near-end point and the contour centroid as the first distance, and setting the distance between the far-end point and the contour centroid as the second distance; judging whether the first distance is less than the second distance; if so, taking the ratio of the first distance to the second distance as the contour shape symmetry feature of the blade contour image; if not, taking the ratio of the second distance to the first distance as the contour shape symmetry feature of the blade contour image.
[0100] (9) The calculation process of the contour shape vector feature includes:
[0101] Please refer to Figure 6 , Figure 6 which is a schematic diagram of a contour shape vector provided by an embodiment of the present application. As Figure 6 shown, after the contour rotation transformation, the contour points corresponding to the minimum X coordinate and the maximum X coordinate are denoted as P 1 and P 2 , the distance between P 1 and P 2 is denoted as d p12 , the connection line between P 1 and P 2 is used as the axis of symmetry, denoted as L 12 , the line segment L 12 is equally divided at equal intervals to obtain a number of equally spaced points, denoted as S 1 , S 2 , …, S k , k represents the number of divisions, and the two intersection points of the straight line passing through the interval point S i and perpendicular to the axis of symmetry and the contour curve are denoted as Ci,1 , C i,2 , the contour point C i,1 , C i,2 The distance is denoted as d i , if d i is used to describe the distribution of each contour point, the corresponding contour shape vector feature C shape is:
[0102] C shape =(d 1 , d 2 ,..., d k ).
[0103] Considering the ratio problem of the contour point distances in the direction of the axis of symmetry and the direction perpendicular to the axis of symmetry, using the maximum contour point distance in the direction of the axis of symmetry, that is, the distance d 1 between point P 2 and P p12 to normalize C shape , the normalized contour shape vector feature is:
[0104] Specifically, if the contour feature includes the contour shape vector feature, the process of extracting the contour feature from the blade contour image includes: setting the two blade contour points with the farthest distances in the length direction of the blade edge contour as the near-end point and the far-end point; setting the connection line between the near-end point and the far-end point as the reference line; determining the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line.
[0105] Further, the process of determining the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line includes: selecting multiple equally spaced points on the reference line as reference points, and selecting the corresponding reference blade contour points on the blade edge contour; wherein, the connection line between the reference blade contour point and the corresponding reference point is perpendicular to the reference line; recording the distances between each reference point and the corresponding reference blade contour point to obtain a distance statistical data set; dividing the value of each element in the distance statistical data set by the length of the reference line to obtain the contour shape vector feature of the blade contour image.
[0106] After obtaining the above-mentioned contour features, the contour features can be input into a support vector machine (SVM) model for training to obtain an SVM classifier model, and the category of the plant can be obtained by inputting the feature data of the blade picture.
[0107] The above embodiments propose an image preprocessing method to calculate the rotation angle of the leaf contour, and then perform a rotation transformation on all contour points based on this angle to ensure that the inclination directions of the leaf contours are consistent. In addition to using the contour geometric shape features to describe the global attributes of the contour, the feature extraction method of this embodiment also proposes a feature descriptor for describing the convex defects of the leaf contour, a feature descriptor for describing the symmetry characteristics of the leaf shape, and a contour shape vector descriptor for describing the shape distribution of local contour points. This embodiment uses an SVM model to perform model learning on the leaf contour features and classify and identify the leaves based on this model. By combining computer vision image algorithms and machine learning models, a leaf recognition method based on leaf contour features is proposed, which can improve the classification accuracy of plant categories.
[0108] Plant species are mainly identified from their appearance and smell. The appearance contains more characteristics and is more intuitive than smell. Therefore, most plant identification methods are based on the visual features of plants. According to different plant organs, the features are divided into flowers, leaves, stems, roots, buds, and even the internal texture of rhizomes. It can be said that plant identification methods are characterized by complexity and diversity. Among them, species identification based on leaves is a common and simple method, generally without considering the growth cycle of plants and is simple and easy to operate. Therefore, in recent years, there have been endless studies on plant classification and recognition based on leaves, mainly using traditional computer vision algorithms and deep learning algorithms. Feature extraction based on computer vision algorithms is simple and efficient for small samples, and combined with human vision, it has a certain interpretability, so it has a wider application.
[0109] Currently, the commonly used computer vision feature extraction methods are based on the contour shape, texture, and color of the leaf. Among them, the leaf color is mostly green, with low discrimination, and the leaf texture is relatively fine and is easily affected by the growth environment and changes. Therefore, the contour shape of the leaf is a feature with greater discrimination and better invariance. Therefore, the contour features of the leaf are of great significance for efficient and accurate plant recognition.
[0110] The following describes the process described in the above embodiments through a leaf recognition method based on leaf contour features in practical applications. This embodiment is dedicated to improving the leaf contour features in the following aspects: improving the preprocessing method of leaf contour detection to improve the rotation invariance of features, adding feature descriptors for the convex defect attributes of the leaf edge, adding descriptors for the shape symmetry characteristics of the leaf, and adding descriptors for the contour shape vector. The leaf recognition method based on leaf contour features proposed by the present invention can describe both the global information of the leaf contour shape and the shape information of local edge points. This embodiment proposes an image preprocessing method to improve the detection of leaf contour points, and improves the rotation invariance of contour points through contour rotation angle calculation and contour point rotation transformation; this embodiment proposes a feature method for describing the attributes of local leaf contour points, including convex defect distribution, shape symmetry, and shape distribution characteristics of local contour points.
[0111] This embodiment proposes an image preprocessing method to calculate the rotation angle of the leaf contour. By performing rotation transformation on the contour points, a leaf contour with the same direction of inclination can be obtained, which can improve the rotation invariance of the leaf contour. In addition to extracting the geometric shape features of the contour, this embodiment also proposes feature descriptors for describing the convex defects of the leaf contour, feature descriptors for describing the shape symmetry characteristics of the leaf, and descriptors for the contour shape vector, thereby enhancing the features of local contour edge points. This embodiment uses a support vector machine (SVM) model to train the above leaf contour features, and classifies and recognizes the leaves based on this model. The present invention combines computer vision image algorithms and machine learning models to propose a leaf recognition method based on leaf contour features, which can improve the accuracy of plant species recognition.
[0112] The following details the basic principle of the leaf recognition method based on leaf contour features proposed by the present invention.
[0113] The classification and recognition application usually includes three parts: image preprocessing, feature extraction, and feature learning. Among them, the image preprocessing process in the classification application is also called feature detection. The algorithm flow in the present invention includes five steps: ① contour point detection, ② calculation of the contour rotation angle, ③ contour rotation transformation, ④ contour feature extraction, and ⑤ support vector machine (SVM) classification. Among them, steps ①②③ are equivalent to image preprocessing to obtain leaf edge contour points with the same inclination direction. Steps ④⑤ are feature extraction and feature learning. The feature descriptors calculated during the contour feature extraction process include: aspect ratio, rectangularity, roundness, circularity, compactness, convexity, convex defect, contour shape symmetry, and contour shape vector. The feature learning model uses the SVM model. The feature data extracted in the previous step is input into the SVM model for training to obtain the SVM model parameters, and the feature vector of the leaf picture is input into this model to obtain the plant category.
[0114] Please refer toFigure 7 , Figure 7 is a flowchart of a leaf recognition method based on leaf contour features provided by an embodiment of the present application. This embodiment may include the following steps:
[0115] Step 1: Input of leaf sample images.
[0116] The sample picture format used in this step is an RGB color picture, sourced from the Flavia public plant dataset. This dataset contains 32 plant categories, a total of 1908 pictures, with a white leaf background and a picture size of 1600×1200.
[0117] Step 2: Detection of leaf edge contour points.
[0118] Leaf contour points are obtained by performing segmentation preprocessing and contour detection algorithms on the sample pictures.
[0119] Step 3: Calculation of the rotation angle of the leaf contour.
[0120] The rotation angle of the leaf contour is obtained by performing segmentation, morphological closing operation, distance transformation, binarization, contour point detection, and line fitting on the sample pictures.
[0121] Step 4: Rotation transformation of contour points.
[0122] According to the angle in Step 3, an affine transformation matrix is calculated, and the contour points in Step 2 are subjected to affine transformation to update the coordinates of the contour points.
[0123] Step 5: Extraction of contour features.
[0124] Nine groups of contour morphological features such as aspect ratio, rectangularity, circularity, and compactness are calculated based on the coordinates of the contour points.
[0125] Step 6: Training and classification of the SVM model.
[0126] All the above sample pictures, the feature data obtained through Steps 1 to 5, and the corresponding class label data are input into the SVM model. After optimization and solution, the optimal SVM classifier is obtained. Then, a set of feature data is input into the SVM classifier, and the class of the plant is output.
[0127] The specific implementation processes and results of each step will be described in sequence below according to the order of contour detection, contour angle calculation, contour rotation transformation, contour feature extraction, and SVM training and classification.
[0128] The process of leaf contour detection is as follows:
[0129] Please refer to Figure 8 , Figure 8 which is a flowchart of a leaf edge contour point detection provided by an embodiment of the present application, asFigure 8 As shown, the B-channel image of the RGB color image can be extracted first, and then the threshold segmentation method based on Otsu's method is used to process the B-channel image to obtain a binary image of the leaf and background segmentation. Finally, the binary image is subjected to contour detection to obtain the leaf edge contour points.
[0130] The contour angle calculation process is as follows:
[0131] Please refer to Figure 9 , Figure 9 which is a flowchart for calculating the contour rotation angle provided by the embodiment of the present application. As Figure 9 shown, first perform YIQ color model conversion on the RGB color image and extract the Q-channel image; then use threshold segmentation based on Otsu's method to process the Q-channel image to obtain a binary image of the leaf area and background segmentation; perform morphological closing operation on the binary image to remove noise points in the leaf area; then, perform distance transformation on the binary image to obtain the leaf skeleton; binarize the leaf skeleton image to obtain a binary image of the reduced area of the leaf; use contour detection to obtain the leaf edge contour points; finally, perform least squares line fitting on the leaf edge points to obtain a straight line equation and convert it into the included angle θ with the X-axis (i.e., the straight line angle).
[0132] The contour rotation transformation process is as follows:
[0133] Rotate the obtained contour points (x, y) in the above text clockwise by (-θ) radians with the contour centroid as the rotation center. The coordinate rotation transformation formula is:
[0134]
[0135] The contour feature extraction process is as follows:
[0136] The extracted contour features include: contour geometric shape features, concavity and convexity features, shape symmetry, and contour shape vectors.
[0137] The contour geometric shape features include: aspect ratio, rectangularity, circularity, and circularity.
[0138] The aspect ratio and rectangularity features are calculated based on the minimum bounding rectangle of the contour. Calculate the length and width of the minimum bounding rectangle of the contour as l and w respectively, and the area as A rect , and the area of the leaf contour is A cont , then the rectangular aspect ratio aspectratio is w / l, and the rectangularity rectangularity is A cont / A rect .
[0139] The circularity and circularity features are calculated based on the minimum fitting circle of the contour. Calculate the radius R of the minimum bounding circle of the contour, and the perimeter of the leaf contour is P cont, then the roundness feature is A cont / (pi*R 2 ), and the circularity feature is 4*pi*A cont / (P cont ) 2 .
[0140] The concavity-convexity features of the contour include tightness, convexity, and convex defect. The concavity-convexity features are calculated based on the convex hull of the contour. The area of the convex hull of the blade contour is A convex , and the perimeter of the convex hull is P convex , then the tightness feature solidity is A cont / A convex . The convexity is convexity = P cont / P convex .
[0141] The convex defect feature is described by the distance distribution from the farthest point of the convex defect to the convex hull edge. The distance from the farthest point of the i-th convex defect to the convex hull edge is d i . Considering the image scale factor, the width w of the minimum bounding rectangle is used to normalize d i . Then, the distances from the farthest points of all convex defects to the convex hull edge form a vector m is the number of convex defects. The distance distribution from the farthest point of the convex defect to the convex hull edge is described based on three parameters: maximum value, average value, and variance, as follows:
[0142] cd max = max(cd)
[0143] cd mean = mean(cd norm )
[0144] cd dev = variance(cd norm )
[0145] where cd norm is the normalization of cd to [0,1], that is
[0146] Shape symmetry feature: Find the contour points P1 and P2 corresponding to the minimum X coordinate and the maximum X coordinate among all contour points, and then calculate the X-direction distances d 1 and d 2 from P1 and P2 to the contour centroid, and then calculate the ratio of the two to describe the contour shape symmetry in the X direction. The calculation formula for the contour shape symmetry is: symmetry = min(d 1 , d 2 ) / max(d 1 , d2 )。
[0147] The contour shape vector describes the distribution of local contour points of the blade. After contour rotation transformation, the contour points corresponding to the minimum X coordinate and the maximum X coordinate are denoted as P 1 and P 2 , P 1 and P 2 The distance between them is denoted as d p12 , P 1 and P 2 The line connecting them is used as the axis of symmetry, denoted as L 12 , For the line segment L 12 Equally spaced division is performed to obtain a number of equally spaced points, denoted as S 1 , S 2 , …, S k , k represents the number of divisions. The two intersection points of the straight line passing through the interval point S i and perpendicular to the axis of symmetry and the contour curve are denoted as C i,1 , C i,2 , The distance between the contour points C i,1 , C i,2 is denoted as d i , If d i is used to describe the distribution of each contour point, the contour shape vector feature is: C shape =(d 1 , d 2 ,..., d k ).
[0148] Using the maximum contour point distance in the direction of the axis of symmetry, that is, the distance d 1 between the point P 2 and P p12 to normalize C shape . The normalized contour shape vector feature is:
[0149] Please refer to Figure 10 , Figure 10 This is a schematic diagram of the contour shape feature vector feature provided by the embodiment of the present application. In this embodiment, the number of divisions k = 12, and the contour shape vector contains 11 feature data. As Figure 10 shown, the result of the contour shape feature vector feature, (a) is the intersection points C i,1 , C i,2 of the straight line determined above and the contour curve, (b) is the line graph of the contour shape feature vector. In (b), the abscissa represents the ID of the points selected from L 12 , and the ordinate in (b) represents the distance d i,1 , C i,2 between the contour points C i .
[0150] In this embodiment, a support vector machine (SVM) model is used for feature learning. Based on the SVM model function of the scikit learn machine learning library, it mainly includes three steps: sample set division, model parameter configuration, and model training and testing.
[0151] The process of dividing the sample set is as follows: The leaf samples of each category are divided into two parts by the random method, and the ratio of the training and test data sets is configured as 90% and 10%, 85% and 15%, 80% and 20%. When configuring the SVM parameters, a linear SVM model can be selected, and the grid method is used to optimize the SVM model parameter C. The feature data of the training and test samples are input into the SVM model for training and testing, and the classification accuracy is calculated.
[0152] As shown in Table 1 are the results of 20 tests. Among them, the features included in feature combination ① are: aspect ratio, rectangularity, roundness, circularity, compactness, convexity, and the features included in feature combination ② are: feature combination ①, convex defect, shape symmetry, and contour shape vector. The feature descriptor for convex defects describing the leaf contour, the feature descriptor for describing the shape symmetry characteristics of the leaf, and the contour shape vector descriptor for describing the shape distribution of local contour points proposed by the present invention can improve the leaf recognition accuracy.
[0153] Table 1 Comparison table of classification and recognition tests
[0154] Training and test data ratio Feature combination ① Feature combination ② 90%vs 10% 77.0% 91.1% 85%vs 15% 76.1% 91.3% 80%vs 20% 76.7% 90.5%
[0155] This embodiment improves the leaf contour point detection method, proposes an image preprocessing method to calculate the rotation angle of the leaf contour, and improves the rotational invariance of contour point detection through contour point rotation transformation; then, it improves the feature description method of local leaf contour points, and adds feature descriptors for convex defects describing the leaf contour, for describing the shape symmetry characteristics of the leaf, and for describing the shape distribution of local contour points. The leaf recognition scheme based on leaf contour features provided by this embodiment proposes an image preprocessing method to calculate the rotation angle of the leaf contour, and then performs rotation transformation on the contour points to improve the rotational invariance of contour point detection; this embodiment also proposes a feature descriptor for convex defects describing the leaf contour, a feature descriptor for describing the shape symmetry characteristics of the leaf, and a contour shape vector descriptor for describing the shape distribution of local contour points, strengthening the attribute description of the leaf edge contour points in the local area. The leaf recognition scheme based on leaf contour features in this embodiment can, on the one hand, solve the problem of poor rotational invariance of contour features caused by leaf angle rotation, and on the other hand, enhance the feature description of local leaf contour points on the basis of traditional global geometric shape features, which can improve the difference of features.
[0156] A plant species recognition system provided by an embodiment of the present application may include:
[0157] A preprocessing module, configured to extract the leaf edge contour of a plant leaf image, and perform a rotation transformation on the leaf edge contour to obtain a leaf contour image; wherein, the contour inclination angles of all the leaf contour images are the same;
[0158] A feature extraction module, configured to extract contour features from the leaf contour image; wherein, the contour features include any one or any combination of convex defect features, contour shape symmetry features, and contour shape vector features;
[0159] A feature learning module, configured to train a plant leaf classification model by using the contour features, so as to perform a plant species recognition operation by using the trained plant leaf classification model.
[0160] In this embodiment, the leaf edge contour is extracted from the plant leaf image, and the plant leaf image is rotationally transformed according to the leaf edge contour to obtain a leaf contour image, so that the contour inclination angles of the leaf edge contours in all the leaf contour images are the same, thereby ensuring the feature invariance of the leaf edge contour. This embodiment also extracts contour features from the leaf contour image, and the contour features include any one or any combination of convex defect features, contour shape symmetry features, and contour shape vector features. The above contour features can enhance the features of local contour edge points, so that the plant leaf classification model trained by using the contour features can fully learn the features of plant leaves, so as to perform a plant species recognition operation by using the trained plant leaf classification model, and can improve the accuracy of identifying plant categories.
[0161] Further, the preprocessing module is configured to convert the color model of the plant leaf image into a YIQ color model, and perform an Otsu thresholding segmentation operation on the Q-channel image of the plant leaf image to obtain a binary plant leaf image; process the binary plant leaf image through a morphological closing operation to obtain a first alternative image, perform a distance transformation and a binary processing on the first alternative image to obtain a second alternative image; is further configured to perform a contour detection operation on the second alternative image to obtain leaf edge points; is further configured to process the leaf edge points by using a linear fitting algorithm of the least squares method to obtain a target line; wherein, the target line is the line closest to all the leaf edge points; is further configured to determine a contour rotation angle according to the slope of the target line, and perform a rotation transformation on the leaf edge contour according to the contour rotation angle to obtain the leaf contour image.
[0162] Further, the feature extraction module includes:
[0163] The convex defect feature extraction unit is used to generate the convex hull of the blade edge contour in the blade contour image, and determine the convex defect according to the area enclosed by the edges of the convex hull and the blade edge contour; it is also used to set the distance from the farthest point of the convex defect to the edge of the convex hull as the target distance; wherein, the farthest point of the convex defect is the blade contour point with the maximum distance from the edge of the convex hull; it is also used to use the eigenvalue of all the target distances as the convex defect feature of the blade contour image; wherein, the eigenvalues of all the target distances include any one or a combination of several of the maximum value, average value and variance.
[0164] Further, the feature extraction module includes:
[0165] The contour shape symmetry feature extraction unit is used to set the two blade contour points with the farthest distance in the length direction of the blade edge contour as the near-end point and the far-end point; it is also used to determine the contour centroid of the blade edge contour, set the distance between the near-end point and the contour centroid as the first distance, and set the distance between the far-end point and the contour centroid as the second distance; it is also used to judge whether the first distance is less than the second distance; if so, use the ratio of the first distance to the second distance as the contour shape symmetry feature of the blade contour image; if not, use the ratio of the second distance to the first distance as the contour shape symmetry feature of the blade contour image.
[0166] Further, the feature extraction module includes:
[0167] The contour shape vector feature extraction unit is used to set the two blade contour points with the farthest distance in the length direction of the blade edge contour as the near-end point and the far-end point; it is used to set the line connecting the near-end point and the far-end point as the reference line; it is used to determine the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line.
[0168] Further, the process by which the contour shape vector feature extraction unit determines the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line includes: selecting multiple equally spaced points on the reference line as reference points, and selecting the reference blade contour points corresponding to each reference point on the blade edge contour; wherein, the line connecting the reference blade contour point and the corresponding reference point is perpendicular to the reference line; recording the distances between each reference point and the corresponding reference blade contour point to obtain a distance statistical data set; dividing the value of each element in the distance statistical data set by the length of the reference line to obtain the contour shape vector feature of the blade contour image.
[0169] Further, the contour feature further includes any one or a combination of any several of the aspect ratio feature, rectangularity feature, roundness feature, circularity feature, compactness feature, and convexity feature.
[0170] Since the embodiments of the system part correspond to the embodiments of the method part, for the descriptions of the embodiments of the system part, please refer to the descriptions of the embodiments of the method part, which will not be elaborated here for the time being.
[0171] This application also provides a storage medium, on which a computer program is stored. When the computer program is executed, the steps provided by the above embodiments can be implemented. The storage medium may include: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0172] This application also provides an electronic device, which may include a memory and a processor. When the processor calls the computer program stored in the memory, the steps provided by the above embodiments can be implemented. Of course, the electronic device may also include various network interfaces, power supplies, and other components.
[0173] The embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the system disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method part. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0174] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including an..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.
Claims
1. A method for identifying plant species, characterized in that, it includes: extracting the leaf edge contour of a plant leaf image, and performing a rotation transformation on the leaf edge contour to obtain a leaf contour image; wherein, the contour inclination angles of all the leaf contour images are the same; extracting contour features from the leaf contour image; wherein, the contour features include convex defect features, contour shape symmetry features, and contour shape vector features; training a plant leaf classification model using the contour features, so as to perform plant species identification operations using the trained plant leaf classification model; wherein, extracting contour features from the leaf contour image includes: setting two leaf contour points with the farthest distance in the length direction of the leaf edge contour as the near endpoint and the far endpoint; setting the connection line between the near endpoint and the far endpoint as the reference line; determining the contour shape vector feature of the leaf contour image according to the distances between multiple leaf contour points on the leaf edge contour and the reference line; generating a convex hull of the leaf edge contour in the leaf contour image, and determining convex defects according to the regions enclosed by the sides of the convex hull and the leaf edge contour; setting the distance from the farthest point of the convex defect to the side of the convex hull as the target distance; wherein, the farthest point of the convex defect is the leaf contour point with the largest distance from the side of the convex hull; taking the eigenvalue of all the target distances as the convex defect feature of the leaf contour image; wherein, the eigenvalues of all the target distances include any one or a combination of several of the maximum value, average value, and variance.
2. The plant species identification method according to claim 1, characterized in that, performing a rotation transformation on the leaf edge contour to obtain a leaf contour image, including: converting the color model of the plant leaf image to the YIQ color model, and performing an Otsu thresholding segmentation operation on the Q-channel image of the plant leaf image to obtain a binary plant leaf image; processing the binary plant leaf image through morphological closing operation to obtain a first alternative image, and performing distance transformation and binary processing on the first alternative image to obtain a second alternative image; performing a contour detection operation on the second alternative image to obtain leaf edge points; processing the leaf edge points using the straight line fitting algorithm of the least squares method to obtain a target straight line; wherein, the target straight line is the straight line with the closest distance to all the leaf edge points; determining the contour rotation angle according to the slope of the target straight line, and performing a rotation transformation on the leaf edge contour according to the contour rotation angle to obtain the leaf contour image.
3. The plant species identification method according to claim 1, characterized in that, extracting contour features from the leaf contour image, including: setting two leaf contour points with the farthest distance in the length direction of the leaf edge contour as the near endpoint and the far endpoint; determining the contour centroid of the leaf edge contour, setting the distance between the near endpoint and the contour centroid as the first distance, and setting the distance between the far endpoint and the contour centroid as the second distance; judging whether the first distance is less than the second distance; If so, use the ratio of the first distance to the second distance as the contour shape symmetry feature of the blade contour image; If not, use the ratio of the second distance to the first distance as the contour shape symmetry feature of the blade contour image.
4. The plant species recognition method according to claim 1, characterized in that determining the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line, including: selecting multiple equally spaced points on the reference line as reference points, and selecting corresponding reference blade contour points on the blade edge contour; wherein, the connection line between the reference blade contour point and the corresponding reference point is perpendicular to the reference line; recording the distances between each reference point and the corresponding reference blade contour point to obtain a distance statistical data set; dividing the value of each element in the distance statistical data set by the length of the reference line to obtain the contour shape vector feature of the blade contour image.
5. The plant species recognition method according to any one of claims 1 to 4, characterized in that the contour feature further includes any one or a combination of any several of the aspect ratio feature, rectangularity feature, roundness feature, circularity feature, compactness feature and convexity feature.
6. A plant species recognition system, characterized in that comprising: a preprocessing module, configured to extract the blade edge contour of the plant leaf image and perform a rotation transformation on the blade edge contour to obtain a blade contour image; wherein, the contour inclination angles of all the blade contour images are the same; a feature extraction module, configured to extract contour features from the blade contour image; wherein, the contour features include convex defect features, contour shape symmetry features and contour shape vector features; a feature learning module, configured to train a plant leaf classification model by using the contour features, so as to perform plant species recognition operations by using the trained plant leaf classification model; wherein, the feature extraction module is specifically configured to set the two blade contour points with the farthest distances in the length direction of the blade edge contour as the near-end point and the far-end point; set the connection line between the near-end point and the far-end point as the reference line; determine the contour shape vector feature of the blade contour image according to the distances between multiple blade contour points on the blade edge contour and the reference line; generate a convex hull of the blade edge contour in the blade contour image, and determine convex defects according to the region enclosed by the sides of the convex hull and the blade edge contour; set the distance from the farthest point of the convex defect to the side of the convex hull as the target distance; wherein, the farthest point of the convex defect is the blade contour point with the largest distance from the side of the convex hull; use the feature values of all the target distances as the convex defect features of the blade contour image; wherein, the feature values of all the target distances include any one or a combination of any several of the maximum value, average value and variance.
7. An electronic device, characterized in that It includes a memory and a processor. A computer program is stored in the memory. When the processor calls the computer program in the memory, the steps of the plant species identification method according to any one of claims 1 to 5 are implemented.
8. A storage medium, characterized in that computer-executable instructions are stored in the storage medium. When the computer-executable instructions are loaded and executed by a processor, the steps of the plant species identification method according to any one of claims 1 to 5 are implemented.