Plant species identification method, device, terminal and storage medium
By designing a hierarchical classification head structure and performing plant species identification layer by layer, the problem of limited plant species identification accuracy in existing technologies is solved, and high-precision identification is achieved in complex environments.
Patent Information
- Application Number
- CN202510750282.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-06-06
AI Technical Summary
The existing plant species identification methods are limited in classification accuracy due to the lack of hierarchical information utilization, especially in complex multi-level classification tasks, where prior knowledge of plant taxonomy cannot be fully utilized.
A hierarchical classification head design is adopted, which includes multiple classification layers (order classification layer, family classification layer, genus classification layer and species classification layer). Each classification layer corresponds to a different level of plant classification in turn. Through layer-by-layer prediction and feature fusion, plant species identification is performed using prior knowledge of plant taxonomy.
It significantly improves the accuracy and robustness of plant species identification, can effectively extract features under complex backgrounds, lighting changes and noise interference, reduce computational complexity and improve model generalization ability.
Smart Images

Figure CN120279339B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a plant species identification method, device, terminal and storage medium. Background Art
[0002] Plant species identification is a crucial component of biodiversity research and ecological monitoring, and its accuracy directly impacts the accuracy of species classification and the reliability of ecological data. Existing plant species identification methods primarily rely on deep neural network models, such as Residual Networks (ResNet) and Dense Convolutional Networks (DenseNet). These models directly extract features from input images and perform classification in an end-to-end manner. While these methods perform well in single-level classification tasks, when dealing with complex multi-level classification tasks, plant species identification is often treated as a single, flat classification due to a lack of utilization of hierarchical information. This single-level classification strategy fails to fully utilize prior knowledge of plant taxonomy, resulting in limited classification accuracy.
[0003] Therefore, the existing technology has defects and needs to be improved and developed. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a plant species identification method, device, terminal and storage medium in response to the above-mentioned defects of the prior art, aiming to solve the problem of limited accuracy of plant species identification in the prior art.
[0005] The technical solutions adopted by the present invention to solve the technical problems are as follows:
[0006] In a first aspect, an embodiment of the present invention provides a method for identifying plant species, the method comprising:
[0007] Acquire a plant image to be identified;
[0008] After preprocessing, the plant image to be identified is input into a preset feature extraction network to obtain the target visual features;
[0009] The target visual features are input into a trained hierarchical classification head, which includes multiple classification layers, each of which corresponds to a different order of plant classification. The hierarchical classification head performs classification prediction layer by layer and outputs a plant species recognition result.
[0010] In one embodiment, the plant image to be identified is preprocessed and then input into a preset feature extraction network to obtain target visual features, including:
[0011] After preprocessing the plant image to be identified, a second plant image is obtained;
[0012] After inputting the second plant image into a preset feature extraction network, the image is processed by a feature extraction module in the feature extraction network to obtain initial visual features;
[0013] The initial visual features are input into the linear layer of the feature extraction network for dimension adjustment to obtain target visual features.
[0014] In one embodiment, the plant image to be identified is preprocessed to obtain a second plant image, including:
[0015] Determine the species of the plant image to be identified;
[0016] If the type is a satellite remote sensing image, radiometric calibration, atmospheric correction, orthorectification, multispectral and full-band image fusion, target area image cropping, image normalization, and image size unification operations are sequentially performed on the plant image of the satellite remote sensing image to obtain a second plant image;
[0017] If the type is a non-satellite remote sensing image, image normalization and image size unification operations are performed on the plant image of the non-satellite remote sensing image type to obtain a second plant image.
[0018] In one embodiment, the multiple classification layers include an order classification layer, a family classification layer, a genus classification layer, and a species classification layer. The order classification layer is used to predict the order-level classification of plants, the family classification layer is used to predict the family-level classification of plants, the genus classification layer is used to predict the genus-level classification of plants, and the species classification layer is used to predict the plant species.
[0019] In one embodiment, the target visual features are input into a trained hierarchical classification head, which includes multiple classification layers, each of which corresponds to a different level of plant classification. The hierarchical classification head performs classification prediction layer by layer and outputs a plant species recognition result, including:
[0020] Inputting the target visual features into the target classification layer, generating target layer prediction probabilities after classification processing, converting them into target layer prediction features through the embedding layer in the target classification layer, and performing weighted fusion with the target visual features using an attention mechanism to obtain a first splicing feature;
[0021] Inputting the first splicing feature into the subject classification layer, generating subject-level prediction probabilities after classification processing, converting the subject-level prediction probabilities into subject-level prediction features through an embedding layer in the subject classification layer, and performing weighted fusion with the first splicing feature using an attention mechanism to obtain a second splicing feature;
[0022] Inputting the second splicing feature into the attribute classification layer, generating an attribute layer prediction probability after classification processing, converting the attribute layer prediction probability into an attribute layer prediction feature through an embedding layer in the attribute classification layer, and performing weighted fusion with the second splicing feature using an attention mechanism to obtain a third splicing feature;
[0023] The third splicing feature is input into the species classification layer, and after classification processing by the species classification layer, a species layer prediction probability is generated as a plant species recognition result and output.
[0024] In one embodiment, the training step of the hierarchical classification head includes:
[0025] Obtaining a training set, wherein the training set includes a plurality of plant images and corresponding order-level category annotations, family-level category annotations, genus-level category annotations, and plant species annotations;
[0026] Inputting the training set into a preset feature extraction network to generate a plurality of target training visual features;
[0027] Input all target training visual features into the hierarchical classification head to be trained, calculate the corresponding loss function in each classification layer of the hierarchical classification head, and add the loss functions of each layer according to the preset weights to obtain the total loss function;
[0028] Based on the total loss function, the parameters of all classification layers in the hierarchical classification head are adjusted through the back-propagation algorithm;
[0029] The process of generating target training visual features, calculating the total loss function, and adjusting parameters is repeated until the preset number of rounds is reached, and a trained hierarchical classification head is obtained.
[0030] In one embodiment, the loss function of each classification layer is a cross entropy loss function.
[0031] In a second aspect, an embodiment of the present invention further provides a plant species identification device, the device comprising:
[0032] An image acquisition module, used for acquiring an image of a plant to be identified;
[0033] The target visual feature generation module is used to input the plant image to be identified into a preset feature extraction network after preprocessing to obtain the target visual features;
[0034] The species recognition module is used to input the target visual features into a trained hierarchical classification head, which includes multiple classification layers, each of which corresponds to a different level of plant classification. The hierarchical classification head performs classification prediction layer by layer and outputs the plant species recognition result.
[0035] In a third aspect, an embodiment of the present invention further provides a terminal comprising: a memory, a processor, and a plant species identification program stored in the memory and executable on the processor, wherein the plant species identification program implements the steps of the plant species identification method described above when executed by the processor.
[0036] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plant species identification program, and the plant species identification program can be executed to implement the steps of the plant species identification method described above.
[0037] The present invention has the following beneficial effects: The present invention obtains an image of a plant to be identified; pre-processes the image and then inputs it into a preset feature extraction network to obtain target visual features; then inputs the target visual features into a trained hierarchical classification head, which includes multiple classification layers, each corresponding to a different level of plant classification. The hierarchical classification head performs classification prediction layer by layer, and outputs a plant species identification result. By employing a hierarchical classification head design corresponding to plant taxonomic levels and utilizing the classification layers within the hierarchical classification head to progressively predict plant species, the present invention can effectively improve plant species identification accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a flow chart of a preferred embodiment of the plant species identification method of the present invention.
[0039] Figure 2 It is a structural diagram of the hierarchical classification head in the present invention.
[0040] Figure 3 This is a schematic diagram of the deep supervised learning mechanism in the classification layer.
[0041] Figure 4 It is a schematic diagram of calculating the total loss function in the present invention.
[0042] Figure 5 It is a structural diagram of a preferred embodiment of the plant species identification device in the present invention.
[0043] Figure 6 It is a block diagram of the terminal principle of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the present invention more clear and distinct, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0045] Plant species identification is a crucial component of biodiversity research and ecological monitoring, and its accuracy directly impacts the accuracy of species classification and the reliability of ecological data. Existing plant species identification methods primarily rely on deep neural network models, such as Residual Networks (ResNet) and Dense Convolutional Networks (DenseNet). These models directly extract features from input images and perform classification in an end-to-end manner. While these methods perform well in single-level classification tasks, when dealing with complex multi-level classification tasks, plant species identification is often treated as a single, flat classification due to a lack of utilization of hierarchical information. This single-level classification strategy fails to fully utilize prior knowledge of plant taxonomy, resulting in limited classification accuracy.
[0046] To address the aforementioned shortcomings of the prior art, the present invention provides a plant species identification method, device, terminal, and storage medium. The method comprises: obtaining an image of the plant to be identified; preprocessing the image and then inputting it into a preset feature extraction network to obtain target visual features; inputting the target visual features into a trained hierarchical classification head, the hierarchical classification head comprising multiple classification layers, each corresponding to a different level of plant classification; the hierarchical classification head performs classification prediction layer by layer, and outputs a plant species identification result. By designing a hierarchical classification head structure that conforms to the characteristics of plant taxonomic levels and utilizing its internal hierarchical progressive plant species prediction, the present invention can effectively improve plant species identification accuracy.
[0047] See Figure 1 The plant species identification method according to the embodiment of the present invention comprises the following steps:
[0048] Step S100: Acquire a plant image to be identified.
[0049] Specifically, plant images can be obtained by taking pictures with cameras, drones, cameras, mobile phones and other equipment, or by collecting ground data from satellite remote sensing platforms, without any limitation here.
[0050] See Figure 1 The plant species identification method according to the embodiment of the present invention further includes the following steps:
[0051] Step S200: After preprocessing, the plant image to be identified is input into a preset feature extraction network to obtain target visual features.
[0052] Specifically, the target visual features extracted by the feature extraction network can serve as the basis for subsequent plant species recognition. The feature extraction network includes a feature extraction module and a linear layer.
[0053] In one implementation, the plant image to be identified is preprocessed and then input into a preset feature extraction network to obtain target visual features, including:
[0054] After preprocessing the plant image to be identified, a second plant image is obtained;
[0055] After inputting the second plant image into a preset feature extraction network, the image is processed by a feature extraction module in the feature extraction network to obtain initial visual features;
[0056] The initial visual features are input into the linear layer of the feature extraction network for dimension adjustment to obtain target visual features.
[0057] Specifically, the plant image to be identified is identified by species: if the plant image is a satellite remote sensing image, radiometric calibration, atmospheric correction, orthorectification, multispectral and full-band image fusion, target area image cropping, image normalization, and image resizing are performed on the plant image to obtain a second plant image. If the plant image is not a satellite remote sensing image, image normalization and image resizing are performed on the plant image to obtain a second plant image. By differentially preprocessing images from different sources, a stable data foundation is provided for model processing, effectively ensuring the model's processing accuracy.
[0058] The second plant image is input into a pre-set feature extraction network. The feature extraction module processes the image to generate initial visual features. This feature extraction module can be a convolutional neural network (CNN) or a Transformer network. The linear layers in the feature extraction network then resize the initial visual features to optimize their compatibility with the subsequent hierarchical classification head, resulting in the target visual features.
[0059] See Figure 1 The plant species identification method according to the embodiment of the present invention further includes the following steps:
[0060] Step S300: Input the target visual features into a trained hierarchical classification head, wherein the hierarchical classification head comprises multiple classification layers, each of which corresponds to a different order of plant classification. The hierarchical classification head performs classification prediction layer by layer and outputs a plant species recognition result.
[0061] Specifically, with the rapid development of deep learning technology, image classification methods based on convolutional neural networks (CNNs) and Transformer networks have been widely used in plant species recognition. However, plant species recognition faces numerous challenges, such as high visual similarity between species, complex image backgrounds, and variable lighting conditions. Traditional single-class classification methods often struggle to achieve high classification accuracy in these complex scenarios. Existing techniques typically simplify the plant species recognition task into a single, flat recognition process, ignoring the inherent order-family-genus-species hierarchical structure of plant taxonomy. This results in an inability to effectively leverage prior taxonomic knowledge to improve accuracy. As the classification hierarchy deepens, the number of categories explodes exponentially, significantly increasing model complexity and computational load, and reducing the training and inference efficiency of multi-level classification tasks. This approach focuses solely on the final species classification result while ignoring intermediate-level information (such as family- and genus-level features). This loss of hierarchical information leads to insufficient generalization in complex scenarios, particularly when faced with species with high visual similarity, resulting in large classification errors. At the same time, the lack of a hierarchical feature transfer mechanism makes it difficult for the model to extract effective discriminant features under complex backgrounds, lighting changes and noise interference, resulting in decreased plant classification accuracy and poor robustness.
[0062] The present invention employs a hierarchical classification head aligned with plant taxonomic levels, comprising, in sequence, an order classification layer, a family classification layer, a genus classification layer, and a species classification layer, all of which are linear layers. The order classification layer is used to predict the order classification of plants, the family classification layer is used to predict the family classification of plants, the genus classification layer is used to predict the genus classification of plants, and the species classification layer is used to predict the species of plants. This approach allows taxonomic prior knowledge to be explicitly encoded into the network structure. Each classification layer corresponds to a specific biological taxonomic unit, enabling the model to automatically learn the characteristic discriminant patterns of different taxonomic levels during training. This hierarchical classification approach fully utilizes prior knowledge of plant taxonomy and enhances the discriminative power of the classification layer. Furthermore, the exponentially growing category space is decomposed into four hierarchical tasks. For example, at the genus-level classification stage, the model only needs to distinguish a few candidate genera, rather than directly facing tens of thousands of species categories, significantly reducing the decision-making difficulty and computational complexity of single-level classification. Through layer-by-layer prediction, the present invention effectively uses the morphological knowledge learned by the previous classification layer to guide the next classification layer, effectively improving prediction accuracy. At the same time, the four levels of classification layers work together, allowing the model to extract effective discriminant features under complex backgrounds, lighting changes and noise interference, further improving accuracy and robustness.
[0063] In one implementation, the target visual features are input into a trained hierarchical classification head, which includes multiple classification layers, each of which corresponds to a different level of plant classification. The hierarchical classification head performs classification prediction layer by layer and outputs a plant species recognition result, including:
[0064] Inputting the target visual features into the target classification layer, generating target layer prediction probabilities after classification processing, converting them into target layer prediction features through the embedding layer in the target classification layer, and performing weighted fusion with the target visual features using an attention mechanism to obtain a first splicing feature;
[0065] Inputting the first splicing feature into the subject classification layer, generating subject-level prediction probabilities after classification processing, converting the subject-level prediction probabilities into subject-level prediction features through an embedding layer in the subject classification layer, and performing weighted fusion with the first splicing feature using an attention mechanism to obtain a second splicing feature;
[0066] Inputting the second splicing feature into the attribute classification layer, generating an attribute layer prediction probability after classification processing, converting the attribute layer prediction probability into an attribute layer prediction feature through an embedding layer in the attribute classification layer, and performing weighted fusion with the second splicing feature using an attention mechanism to obtain a third splicing feature;
[0067] The third splicing feature is input into the species classification layer, and after classification processing by the species classification layer, a species layer prediction probability is generated as a plant species recognition result and output.
[0068] Specifically, the order-level prediction probability is the order-level probability distribution, indicating the possibility that the plant image belongs to each order level; the family-level prediction probability is the family-level probability distribution, indicating the possibility that the plant image belongs to each family level; the genus-level prediction probability is the genus-level probability distribution, indicating the possibility that the plant image belongs to each genus level; the species-level prediction probability is the species-level probability distribution, indicating the possibility that the plant image belongs to various levels, which is the final plant species recognition result.
[0069] The structural diagram of the hierarchical classification head is as follows Figure 2As shown. After classification at each classification layer, the classification prediction probability is converted into prediction features through the embedding layer, and spliced with the features of the previous layer to form a new feature vector. This feature splicing mechanism can not only provide more information for the next layer, but also narrow the classification range of the next layer, thereby improving the classification accuracy. When faced with species with high visual similarity, the present invention can effectively identify them. In addition, the hierarchical classification head of the present invention gradually narrows the set of candidate species at each classification layer through step-by-step constraints of the order classification layer, family classification layer, genus classification layer, and species classification layer, which greatly reduces the model calculation cost. By embedding prior knowledge of plant taxonomy into the deep learning model, the prediction probability of each level not only provides the classification result of the current level element, but also constrains the search space of subsequent levels through feature fusion, thereby achieving efficient fine-grained species recognition.
[0070] In one implementation, the step of training the hierarchical classification head includes:
[0071] Obtaining a training set, wherein the training set includes a plurality of plant images and corresponding order-level category annotations, family-level category annotations, genus-level category annotations, and plant species annotations;
[0072] Inputting the training set into a preset feature extraction network to generate a plurality of target training visual features;
[0073] Input all target training visual features into the hierarchical classification head to be trained, calculate the corresponding loss function in each classification layer of the hierarchical classification head, and add the loss functions of each layer according to the preset weights to obtain the total loss function;
[0074] Based on the total loss function, the parameters of all classification layers in the hierarchical classification head are adjusted through the back-propagation algorithm;
[0075] The process of generating target training visual features, calculating the total loss function, and adjusting parameters is repeated until the preset number of rounds is reached, and a trained hierarchical classification head is obtained.
[0076] Specifically, the training set contains multiple plant images and their corresponding order-level, family-level, genus-level, and species-level annotations. These plant images cover a wide variety of plants in different environments, at different growth stages, and from different camera angles. By building a diverse training set, the model's generalization capabilities can be effectively improved.
[0077] Each classification layer introduces a corresponding loss function to perform deep supervised learning. The schematic diagram of the deep supervised learning mechanism in the classification layer is as follows: Figure 3As shown in Figure 1. When receiving the target training visual features output by the linear layer in the feature extraction network, the order classification layer calculates the loss function of this layer. The input data passes through the order classification layer, family classification layer, genus classification layer, and species classification layer in sequence. After each classification layer completes the current classification task, it immediately calculates the loss value of the classification layer and saves the calculation result. The calculation flow chart of the total loss function is shown in Figure 1. Figure 4 As shown. After the forward propagation of all classification layers is completed, the losses of each classification layer are weighted and summed to obtain the total loss function. The loss function of each classification layer is the cross entropy loss function. The total loss function is expressed as:
[0078] ;
[0079] Where, α m1 , α m2 , α m3 , α L is the preset weight, α m1 +α m2 +α m3 +α L =1, and 0≤α m1 , α m2 , α m3 , α L ≤1, is the loss function of the classification layer, is the loss function of the subject classification layer, is the loss function of the classification layer, is the loss function of the classification layer, t j is the probability of the jth class in the true label t, usually expressed in the form of a one-hot encoding, C is the number of plant species, j is the subscript, representing the species, is the predicted probability that the plant output by the order classification layer belongs to the jth class in the order level, is the predicted probability that the plant output by the family classification layer belongs to the jth class in the family level, is the predicted probability that the plant belongs to the jth class in the genus level output by the genus classification layer, is the predicted probability of the plant belonging to the jth class in the family level output by the family classification layer. α can be dynamically adjusted during training. m1 , α m2 , α m3 , α LThe present invention designs the total loss function as a weighted loss function, and comprehensively considers the classification results of the intermediate layer and the last layer by assigning different weights to the loss function of each layer. This weighted loss function can balance the classification tasks of different levels and avoid the classification error of a certain layer from having too much influence on the overall result. The present invention ensures that the classification results of each layer are effectively supervised by designing a deep supervision mechanism, avoids the classification error caused by the loss of hierarchical information in traditional methods, and effectively improves the overall classification accuracy and robustness of the model. In addition, through the hierarchical feature transfer method, the search space of the classification task is gradually reduced, which significantly reduces the computational complexity. After multiple rounds of training, a trained hierarchical classification head can be obtained. The trained hierarchical classification head can be well applied to the scene of plant species recognition. When processing images with complex backgrounds, lighting changes and noise interference, it can effectively extract features and determine the category of plants.
[0080] In summary, the present invention does not rely on the traditional single classification strategy. By simulating the hierarchical structure of plant taxonomy, it performs coarse classification and fine classification layer by layer, and is suitable for complex plant species classification tasks. The present invention can automatically extract the features of plant images and gradually refine the classification results through a hierarchical classification head. This hierarchical classification method can make full use of the prior knowledge of plant taxonomy, enhance the discrimination ability of the classifier, and thus improve the accuracy of species identification. The four-level classification layers work together, so that the model can extract effective discriminant features under complex backgrounds, illumination changes and noise interference, further improving accuracy and robustness. The exponentially growing category space is decomposed into four hierarchical tasks, which significantly reduces the decision-making difficulty and computational complexity of single-level classification. The classification results of each layer are constrained by the supervisory signal, realizing deep supervised learning, thereby avoiding the classification error caused by the loss of hierarchical information in traditional methods. Through this hierarchical classification head, the present invention can significantly improve the generalization ability and robustness of the model while ensuring classification accuracy.
[0081] In one embodiment, if Figure 5 As shown, based on the above-mentioned plant species identification method, the present invention also provides a plant species identification device, which includes:
[0082] An image acquisition module 100 is used to acquire an image of a plant to be identified;
[0083] The target visual feature generation module 200 is used to input the plant image to be identified into a preset feature extraction network after preprocessing to obtain the target visual feature;
[0084] The species identification module 300 is used to input the target visual features into a trained hierarchical classification head, which includes multiple classification layers, each of which corresponds to a different level of plant classification. The hierarchical classification head performs classification prediction layer by layer and outputs the plant species identification result.
[0085] In one embodiment, the target visual feature generation module includes:
[0086] a preprocessing unit, configured to preprocess the plant image to be identified to obtain a second plant image;
[0087] a coarse feature extraction unit, configured to input the second plant image into a preset feature extraction network, and process the image through a feature extraction module in the feature extraction network to obtain initial visual features;
[0088] The target visual feature generation unit is used to input the initial visual feature into the linear layer of the feature extraction network for dimension adjustment to obtain the target visual feature.
[0089] In one embodiment, the apparatus further comprises:
[0090] A species determination unit, used to determine the species of the plant image to be identified;
[0091] a first image processing unit configured to, if the plant image is a satellite remote sensing image, sequentially perform radiometric calibration, atmospheric correction, orthorectification, multispectral and full-band image fusion, target area image cropping, image normalization, and image size unification operations on the plant image, thereby obtaining a second plant image;
[0092] The second image processing unit is used to perform image normalization and image size unification operations on the plant image of the non-satellite remote sensing image type to obtain a second plant image if the type is a non-satellite remote sensing image.
[0093] In one embodiment, the species identification module includes:
[0094] a first prediction unit, configured to input the target visual features into the target classification layer, generate a target layer prediction probability after classification processing, convert the target layer prediction probability into a target layer prediction feature through an embedding layer in the target classification layer, and perform weighted fusion with the target visual features using an attention mechanism to obtain a first splicing feature;
[0095] a second prediction unit, configured to input the first splicing feature into the subject classification layer, generate subject-level prediction probabilities after classification processing, convert the subject-level prediction probabilities into subject-level prediction features through an embedding layer in the subject classification layer, and perform weighted fusion with the first splicing feature using an attention mechanism to obtain a second splicing feature;
[0096] a third prediction unit, configured to input the second splicing feature into the attribute classification layer, generate an attribute layer prediction probability after classification processing, convert the attribute layer prediction probability into an attribute layer prediction feature through an embedding layer in the attribute classification layer, and perform weighted fusion with the second splicing feature using an attention mechanism to obtain a third splicing feature;
[0097] The fourth prediction unit is used to input the third splicing feature into the species classification layer, generate a species layer prediction probability as a plant species recognition result after classification processing by the species classification layer, and output it.
[0098] In one embodiment, the apparatus further comprises:
[0099] A training set acquisition unit, configured to acquire a training set, wherein the training set includes a plurality of plant images and corresponding order-level category annotations, family-level category annotations, genus-level category annotations, and plant species annotations;
[0100] a target training visual feature generation unit, configured to input the training set into a preset feature extraction network to generate a plurality of target training visual features;
[0101] A loss function calculation unit is used to input all target training visual features into the hierarchical classification head to be trained, calculate the corresponding loss function in each classification layer of the hierarchical classification head, and add the loss functions of each layer according to preset weights to obtain a total loss function;
[0102] A parameter updating unit, used to adjust the parameters of all classification layers in the hierarchical classification head through the back-propagation algorithm based on the total loss function;
[0103] The iterative unit is used to repeatedly generate target training visual features, calculate the total loss function and adjust parameters until the preset rounds are reached to obtain a trained hierarchical classification head.
[0104] Based on the above embodiment, the present invention further provides a terminal, whose structural diagram can be as follows: Figure 6 As shown. The terminal includes a processor, a memory, a network interface and a display screen connected via a device bus. The processor of the terminal is used to provide computing and control capabilities. The memory of the terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating device and a plant species identification program. The internal memory provides an environment for the operation of the operating device and the plant species identification program in the non-volatile storage medium. The network interface of the terminal is used to communicate with an external terminal via a network connection. When the plant species identification program is executed by the processor, the steps of any one of the above-mentioned plant species identification methods are implemented. The display screen of the terminal can be a liquid crystal display or an electronic ink display.
[0105] Those skilled in the art will understand that Figure 6 The structural schematic diagram shown in the figure is only a schematic diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the terminal to which the solution of the present invention is applied. The specific terminal may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0106] In one embodiment, a terminal is provided, comprising a memory, a processor, and a plant species identification program stored in the memory and executable on the processor. When the plant species identification program is executed by the processor, the steps of any one of the plant species identification methods provided in the embodiments of the present invention are implemented.
[0107] An embodiment of the present invention further provides a computer-readable storage medium, on which a plant species identification program is stored. When the plant species identification program is executed by a processor, the steps of any one of the plant species identification methods provided in the embodiments of the present invention are implemented.
[0108] It should be understood that the sequence numbers of the steps in the above embodiments do not imply a specific order of execution; the order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0109] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0110] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0111] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0112] In the embodiments provided by the present invention, it should be understood that the disclosed apparatus / terminal device and method can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For example, the division of the modules or units described above is merely a logical functional division. In actual implementation, other division methods may be used. For example, multiple units or components may be combined or integrated into another device, or some features may be omitted or not implemented.
[0113] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A method for identifying plant species, characterized in that: The method comprises: Acquire a plant image to be identified; After preprocessing, the plant image to be identified is input into a preset feature extraction network to obtain target visual features. The feature extraction network is a Transformer network; Inputting the target visual features into a trained hierarchical classification head, the hierarchical classification head comprising a plurality of classification layers, each of which corresponds to a different order of plant classification, performing classification prediction layer by layer through the hierarchical classification head, and outputting a plant species recognition result; The multiple classification layers include an order classification layer, a family classification layer, a genus classification layer, and a species classification layer; the target visual features are input into a trained hierarchical classification head, the hierarchical classification head includes multiple classification layers, each classification layer corresponds to a different level element of plant classification in turn, the hierarchical classification head performs classification prediction layer by layer, and outputs a plant species recognition result, including: Inputting the target visual features into the target classification layer, generating target layer prediction probabilities after classification processing, converting them into target layer prediction features through the embedding layer in the target classification layer, and performing weighted fusion with the target visual features using an attention mechanism to obtain a first splicing feature; Inputting the first splicing feature into the subject classification layer, generating subject-level prediction probabilities after classification processing, converting the subject-level prediction probabilities into subject-level prediction features through an embedding layer in the subject classification layer, and performing weighted fusion with the first splicing feature using an attention mechanism to obtain a second splicing feature; Inputting the second splicing feature into the attribute classification layer, generating an attribute layer prediction probability after classification processing, converting the attribute layer prediction probability into an attribute layer prediction feature through an embedding layer in the attribute classification layer, and performing weighted fusion with the second splicing feature using an attention mechanism to obtain a third splicing feature; The third splicing feature is input into the species classification layer, and after classification processing by the species classification layer, a species layer prediction probability is generated as a plant species recognition result and output.
2. The plant species identification method according to claim 1, characterized in that: After preprocessing, the plant image to be identified is input into the preset feature extraction network to obtain the target visual features, including: After preprocessing the plant image to be identified, a second plant image is obtained; After inputting the second plant image into a preset feature extraction network, the image is processed by a feature extraction module in the feature extraction network to obtain initial visual features; The initial visual features are input into the linear layer of the feature extraction network for dimension adjustment to obtain target visual features.
3. The plant species identification method according to claim 2, characterized in that: After preprocessing the plant image to be identified, a second plant image is obtained, including: Determine the species of the plant image to be identified; If the type is a satellite remote sensing image, radiometric calibration, atmospheric correction, orthorectification, multispectral and full-band image fusion, target area image cropping, image normalization, and image size unification operations are sequentially performed on the plant image of the satellite remote sensing image to obtain a second plant image; If the type is a non-satellite remote sensing image, image normalization and image size unification operations are performed on the plant image of the non-satellite remote sensing image type to obtain a second plant image.
4. The plant species identification method according to claim 1, characterized in that: The order classification layer is used to predict the order classification of plants, the family classification layer is used to predict the family classification of plants, the genus classification layer is used to predict the genus classification of plants, and the species classification layer is used to predict the species of plants.
5. The plant species identification method according to claim 1, characterized in that: The training steps of the hierarchical classification head include: Obtaining a training set, wherein the training set includes a plurality of plant images and corresponding order-level category annotations, family-level category annotations, genus-level category annotations, and plant species annotations; Inputting the training set into a preset feature extraction network to generate a plurality of target training visual features; Input all target training visual features into the hierarchical classification head to be trained, calculate the corresponding loss function in each classification layer of the hierarchical classification head, and add the loss functions of each layer according to the preset weights to obtain the total loss function; Based on the total loss function, the parameters of all classification layers in the hierarchical classification head are adjusted through the back-propagation algorithm; The process of generating target training visual features, calculating the total loss function, and adjusting parameters is repeated until the preset number of rounds is reached, and a trained hierarchical classification head is obtained.
6. The plant species identification method according to claim 5, characterized in that: The loss function of each classification layer is the cross entropy loss function.
7. A plant species identification device, characterized in that: include: An image acquisition module, used for acquiring an image of a plant to be identified; The target visual feature generation module is used to input the plant image to be identified into a preset feature extraction network after preprocessing to obtain the target visual features. The feature extraction network is a Transformer network; A species recognition module is configured to input the target visual features into a trained hierarchical classification head, wherein the hierarchical classification head comprises multiple classification layers, each of which corresponds to a different order of plant classification, and the hierarchical classification head performs classification prediction layer by layer to output a plant species recognition result; The multiple classification layers include an order classification layer, a family classification layer, a genus classification layer, and a species classification layer; the target visual features are input into a trained hierarchical classification head, the hierarchical classification head includes multiple classification layers, each classification layer corresponds to a different level element of plant classification in turn, the hierarchical classification head performs classification prediction layer by layer, and outputs a plant species recognition result, including: Inputting the target visual features into the target classification layer, generating target layer prediction probabilities after classification processing, converting them into target layer prediction features through the embedding layer in the target classification layer, and performing weighted fusion with the target visual features using an attention mechanism to obtain a first splicing feature; Inputting the first splicing feature into the subject classification layer, generating subject-level prediction probabilities after classification processing, converting the subject-level prediction probabilities into subject-level prediction features through an embedding layer in the subject classification layer, and performing weighted fusion with the first splicing feature using an attention mechanism to obtain a second splicing feature; Inputting the second splicing feature into the attribute classification layer, generating an attribute layer prediction probability after classification processing, converting the attribute layer prediction probability into an attribute layer prediction feature through an embedding layer in the attribute classification layer, and performing weighted fusion with the second splicing feature using an attention mechanism to obtain a third splicing feature; The third splicing feature is input into the species classification layer, and after classification processing by the species classification layer, a species layer prediction probability is generated as a plant species recognition result and output.
8. A terminal, characterized in that: The terminal includes: a memory, a processor, and a plant species identification program stored in the memory and executable on the processor. When the plant species identification program is executed by the processor, the steps of the plant species identification method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a plant species identification program, and when the plant species identification program is executed by the processor, the steps of the plant species identification method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Plant recognition method based on deep learning and plant classification
CN109871885A
Long-tail distribution image recognition method based on hierarchical learning
CN111738303A
Hierarchical classification method for wild animal monitoring images based on species classification tree
CN119723171A