Methods for constructing field plant identification models and methods for identifying field plants.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2026-08-11
AI Technical Summary
[0005]本发明提供一种野外植物识别模型的构建方法和野外植物识别方法,用以解决现有技术中植物识别在复杂自然场景中易受光照变化、遮挡和背景干扰影响,泛化能力有限或者基于深度学习的方法计算复杂度高,依赖高性能计算设备,难以部署在资源受限的林业终端的缺陷,实现高效、鲁棒且计算成本低的植物检测与识别
[0019] The present invention provides a method for constructing a wild plant identification model and a wild plant identification method. The method involves acquiring wild plant images and performing image preprocessing to construct a wild plant image dataset; constructing an initial feature extraction network using a lightweight bottleneck structure; dividing the feature map channels into multiple subgroups using a spatial feature enhancement mechanism within the initial feature extraction network, and improving the initial feature extraction network within each subgroup using average pooling and max pooling to obtain a target feature extraction network; constructing an initial wild plant identification model based on the target feature extraction network; training the initial wild plant identification model using the wild plant image dataset, employing the Adam optimizer for optimization during model training, and evaluating the model training effect using multiple preset comprehensive evaluation metrics. When the comprehensive evaluation metric results are optimal, the model training is considered complete, and the target wild plant identification model is obtained. Compared to existing plant identification technologies, which are susceptible to changes in lighting, occlusion, and background interference in complex natural scenes, have limited generalization capabilities, or whose deep learning-based methods suffer from high computational complexity, reliance on high-performance computing equipment, and difficulty in deployment on resource-constrained forestry terminals, this solution optimizes the data acquisition and model training process. It enables accurate identification of plant species and locations in images with limited energy consumption, effectively improving the efficiency and accuracy of field plant detection and identification. This method significantly reduces the number of model parameters and computational load while maintaining high-precision plant identification, making it suitable for deployment on embedded and edge devices, meeting the practical needs of ecological monitoring.
Smart Images

Figure CN120997664B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and deep learning technology, and in particular to a method for constructing a field plant identification model and a method for identifying field plants. Background Technology
[0002] With the rapid development of computer vision and deep learning technologies, plant identification technology is playing an increasingly important role in forestry resource surveys, ecological monitoring, and biodiversity research. Efficient plant detection and identification methods can provide crucial data support for tasks such as forest resource management, endangered species protection, and ecological restoration. For example, in forestry surveys, automated identification systems can replace traditional manual surveys, significantly improving data collection efficiency; in ecological monitoring, long-term, large-scale plant identification helps analyze vegetation dynamics; and in biodiversity research, accurate species identification can provide a scientific basis for conservation decisions. However, existing plant identification methods still face significant challenges in terms of accuracy, real-time performance, and computational efficiency in complex field environments.
[0003] Currently, plant identification methods are mainly divided into two categories: methods based on traditional image processing and methods based on deep learning. Traditional methods typically rely on color, texture, or shape features and perform well in controlled environments (such as a single background and uniform lighting). However, they are easily affected by changes in lighting, occlusion, and background interference in complex natural scenes, resulting in limited generalization ability. Deep learning-based methods, on the other hand, have achieved higher accuracy in plant identification tasks due to their powerful feature learning capabilities. However, existing deep learning models often have high computational complexity, rely on high-performance computing equipment, and are difficult to deploy on resource-constrained forestry terminals (such as drones and handheld inspection devices). In addition, most existing research focuses on the identification of single plant organs (such as leaves and flowers), lacking the ability to jointly detect multiple parts of the whole plant, which limits their practical application value in field surveys.
[0004] Therefore, how to achieve lightweight models while ensuring recognition accuracy, making them adaptable to edge computing devices, has become a key problem that urgently needs to be solved in the field of plant identification. Especially under the interference of complex backgrounds, varying light conditions, and diverse plant morphologies, designing efficient, robust, and computationally inexpensive plant detection and identification methods has significant research and application value. Summary of the Invention
[0005] This invention provides a method for constructing a field plant identification model and a field plant identification method to address the shortcomings of existing technologies, such as plant identification being susceptible to changes in lighting, occlusion, and background interference in complex natural scenes, having limited generalization ability, or having high computational complexity based on deep learning methods, relying on high-performance computing equipment, and being difficult to deploy on resource-constrained forestry terminals. This invention achieves efficient, robust, and low-computational-cost plant detection and identification.
[0006] This invention provides a method for constructing a field plant identification model, comprising: Acquire field images and perform image preprocessing on the field images to construct a field plant image dataset; An initial feature extraction network is constructed using a lightweight bottleneck structure; In the initial feature extraction network, a spatial feature enhancement mechanism is used to divide the feature map channels into multiple subgroups, and average pooling and max pooling are used in each subgroup to improve the initial feature extraction network, thereby obtaining the target feature extraction network; An initial field plant identification model is constructed based on the target feature extraction network. The initial wild plant recognition model is trained using the wild plant image dataset. During the model training process, the Adam optimizer is used for optimization training, and the model training effect is evaluated by multiple preset comprehensive evaluation indicators. When the comprehensive result of the multiple comprehensive evaluation indicators is optimal, the model training is determined to be completed, and the target wild plant recognition model is obtained.
[0007] In one possible implementation, the method further includes: The field-captured images are annotated with information, including the plant species and locations in the field-captured images; Unsharpened masking preprocessing is performed on the field images after information annotation to obtain field images with enhanced clarity of target plant edges and textures; A dataset of field plant images was constructed based on all the field-captured images after unsharpened mask preprocessing.
[0008] In one possible implementation, the method further includes: The dataset of wild plant images is input into the initial feature extraction network to extract initial image features for each input image, the initial image features including the number of input image channels; The initial image features are processed by 1×1 channel compressed convolution to obtain compressed intermediate features for each input image; The compressed intermediate features are sequentially processed through a 3×3 depthwise convolution and a 1×1 convolution to obtain the number of output image channels; Determine whether the number of input image channels is consistent with the number of output image channels; If they are consistent, a residual connection is introduced; if they are inconsistent, the number of output image channels is further processed by 1×1 channel compression convolution and then introduced into a residual connection to construct the initial feature extraction network.
[0009] In one possible implementation, the method further includes: In the initial feature extraction network, each channel dimension of the wild plant image dataset is divided into multiple subspaces, and a spatial attention map is independently learned in each subspace to obtain the original feature map of each subspace; For the original feature map of each subspace, the spatial context features of the original feature map are extracted by max pooling and average pooling. The spatial context features are then concatenated along the channel dimension to obtain a two-dimensional feature map. For each subspace's two-dimensional feature map, a 7×7 convolutional layer is used to extract spatial features, and an attention map is generated using the Sigmoid activation function. The attention map obtained in each subspace is multiplied element-wise with the original feature map of that subspace to perform an attention weighting operation; The feature maps after performing attention weighting operations on each subspace are concatenated to form the final feature map.
[0010] In one possible implementation, the method further includes: During the model training process, a number of preset evaluation metrics are recorded. These metrics include the cross-entropy loss and regression loss of the Adam optimizer, the proportion of true samples among all predicted positive samples, the proportion of true samples among all actual positive samples, a first comprehensive metric for measuring precision and recall, and a second comprehensive metric for measuring the multi-class target detection model by calculating the sum of the average precision of each plant identification and then taking the average. A lightweight performance evaluation metric is constructed, which includes model size and total floating-point operations.
[0011] The model weight with the highest score on the second comprehensive index on the validation set is selected as the final target wild plant identification model.
[0012] In one possible implementation, the method further includes: The target wild plant identification model is deployed in an embedded system or edge device.
[0013] This invention provides a method for identifying plants in the wild, comprising: Images of wild plants to be identified are acquired using edge devices; The wild plant image to be identified is input into the target wild plant identification model, and the target wild plant identification model outputs the plant species and precise location in the wild plant image to be identified.
[0014] The present invention also provides a device for constructing a field plant identification model, comprising the following modules: The image processing module is used to acquire field-captured images and perform image preprocessing on the field-captured images to construct a field plant image dataset. The network building module is used to build an initial feature extraction network using a lightweight bottleneck structure. The network optimization module is used to divide the feature map channels into multiple subgroups in the initial feature extraction network using a spatial feature enhancement mechanism, and to improve the initial feature extraction network by using average pooling and max pooling in each subgroup to obtain the target feature extraction network. The model building module is used to build an initial field plant identification model based on the target feature extraction network; The model training module is used to train the initial wild plant recognition model using the wild plant image dataset. During the model training process, the Adam optimizer is used for optimization training, and the model training effect is evaluated by multiple preset comprehensive evaluation indicators. When the comprehensive result of the multiple comprehensive evaluation indicators is optimal, the model training is determined to be completed, and the target wild plant recognition model is obtained.
[0015] The present invention also provides a field plant identification device, comprising the following modules: Image acquisition module, used to acquire images of wild plants to be identified through edge devices; The image recognition module is used to input the wild plant image to be identified into the target wild plant recognition model, and output the plant species and precise location in the wild plant image to be identified through the target wild plant recognition model.
[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for constructing a field plant identification model and the method for identifying field plants as described above.
[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for constructing a field plant identification model and the method for identifying field plants as described above.
[0018] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the method for constructing a field plant identification model and the method for identifying field plants as described above.
[0019] The present invention provides a method for constructing a wild plant identification model and a wild plant identification method. The method involves acquiring wild plant images and performing image preprocessing to construct a wild plant image dataset; constructing an initial feature extraction network using a lightweight bottleneck structure; dividing the feature map channels into multiple subgroups using a spatial feature enhancement mechanism within the initial feature extraction network, and improving the initial feature extraction network within each subgroup using average pooling and max pooling to obtain a target feature extraction network; constructing an initial wild plant identification model based on the target feature extraction network; training the initial wild plant identification model using the wild plant image dataset, employing the Adam optimizer for optimization during model training, and evaluating the model training effect using multiple preset comprehensive evaluation metrics. When the comprehensive evaluation metric results are optimal, the model training is considered complete, and the target wild plant identification model is obtained. Compared to existing plant identification technologies, which are susceptible to changes in lighting, occlusion, and background interference in complex natural scenes, have limited generalization capabilities, or whose deep learning-based methods suffer from high computational complexity, reliance on high-performance computing equipment, and difficulty in deployment on resource-constrained forestry terminals, this solution optimizes the data acquisition and model training process. It enables accurate identification of plant species and locations in images with limited energy consumption, effectively improving the efficiency and accuracy of field plant detection and identification. This method significantly reduces the number of model parameters and computational load while maintaining high-precision plant identification, making it suitable for deployment on embedded and edge devices, meeting the practical needs of ecological monitoring. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0021] Figure 1 This is one of the flowcharts illustrating the construction method of the field plant identification model provided by the present invention.
[0022] Figure 2 This is the second flowchart illustrating the method for constructing a field plant identification model provided by the present invention.
[0023] Figure 3 This is a schematic diagram of the data annotation and processing process provided by the present invention.
[0024] Figure 4 This is a schematic diagram of the overall structure of the ULS-FRCNN model provided by the present invention.
[0025] Figure 5 This is a flowchart illustrating the field plant identification method provided by the present invention.
[0026] Figure 6 This is a schematic diagram of the structure of the device for constructing a field plant identification model provided by the present invention.
[0027] Figure 7 This is a schematic diagram of the structure of the field plant identification device provided by the present invention.
[0028] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0030] To facilitate understanding of the embodiments of the present invention, further explanations and descriptions will be provided below with reference to the accompanying drawings and specific embodiments. These embodiments do not constitute a limitation on the embodiments of the present invention.
[0031] Figure 1 This is one of the flowcharts illustrating the method for constructing a field plant identification model provided by the present invention, such as... Figure 1 As shown, the method includes the following: S11. Acquire field images and perform image preprocessing on the field images to construct a field plant image dataset.
[0032] In this embodiment of the invention, a field image dataset for training a field plant identification model is first constructed. The data comes from field images taken in the PlantCLEF 2015 dataset. Plant species and locations can be manually labeled to construct a self-built data subset containing diverse image information, ensuring broad coverage of the data in terms of resolution, illumination, angle, and background complexity.
[0033] Furthermore, the image dataset is preprocessed with an unsharpened mask to improve the clarity of the target plant edges and textures, thereby enhancing the model's ability to perceive plant features.
[0034] S12. Construct an initial feature extraction network using a lightweight bottleneck structure.
[0035] A lightweight feature extraction backbone network architecture is constructed, using depthwise separable convolutions (lightweight bottleneck structure) to replace the Bottleneck module in the traditional ResNet, in order to reduce network computation and model parameter size.
[0036] S13. In the initial feature extraction network, a spatial feature enhancement mechanism is used to divide the feature map channels into multiple subgroups, and average pooling and max pooling are used in each subgroup to improve the initial feature extraction network, thereby obtaining the target feature extraction network.
[0037] A Split SAM spatial attention mechanism (spatial feature enhancement mechanism) is introduced into the backbone network. The feature map channels of the input image are divided into multiple subgroups, and average pooling and max pooling are used to generate foreground-background separated spatial attention maps in each subgroup to enhance the model's ability to perceive plant target regions.
[0038] S14. Construct an initial field plant identification model based on the target feature extraction network.
[0039] S15. The initial wild plant recognition model is trained using the wild plant image dataset. During the model training process, the Adam optimizer is used for optimization training, and the model training effect is evaluated by multiple preset comprehensive evaluation indicators. When the comprehensive result of the multiple comprehensive evaluation indicators is optimal, the model training is determined to be completed, and the target wild plant recognition model is obtained.
[0040] Based on the improved modules described above, a ULS-FRCNN target detection model (initial wild plant identification model) was constructed. The model was trained using an enhanced wild plant image dataset, and the Adam optimizer was used for end-to-end optimization training. The training effect of the model was evaluated using multiple preset comprehensive evaluation metrics. Finally, the target wild plant identification model was obtained. The model was deployed in an edge device, and the wild plant images were collected by the edge device to achieve accurate identification of plant species and locations in the images.
[0041] The present invention provides a method for constructing a wild plant identification model, which involves acquiring wild plant images and performing image preprocessing to construct a wild plant image dataset; constructing an initial feature extraction network using a lightweight bottleneck structure; dividing the feature map channels into multiple subgroups using a spatial feature enhancement mechanism in the initial feature extraction network, and improving the initial feature extraction network within each subgroup using average pooling and max pooling to obtain a target feature extraction network; constructing an initial wild plant identification model based on the target feature extraction network; training the initial wild plant identification model using the wild plant image dataset, optimizing the training process using the Adam optimizer, and evaluating the model training effect using multiple preset comprehensive evaluation indicators. When the comprehensive evaluation result of the multiple comprehensive evaluation indicators is optimal, the model training is considered complete, and the target wild plant identification model is obtained. Compared to existing plant identification technologies, which are susceptible to changes in lighting, occlusion, and background interference in complex natural scenes, have limited generalization capabilities, or whose deep learning-based methods suffer from high computational complexity, reliance on high-performance computing equipment, and difficulty in deployment on resource-constrained forestry terminals, this method optimizes the data acquisition and model training process. It achieves accurate identification of plant species and locations in images with limited energy consumption, effectively improving the efficiency and accuracy of field plant detection and identification. While ensuring high-precision plant identification, this method significantly reduces the number of model parameters and computational load, making it suitable for deployment on embedded and edge devices, meeting the practical needs of ecological monitoring.
[0042] Figure 2 This is the second flowchart illustrating the method for constructing a field plant identification model provided by this invention, as shown below. Figure 2 As shown, the method includes the following: S21. Label the field images with information, labeling the plant species and locations in the field images.
[0043] A field image dataset was constructed for training the field plant identification model. The data came from field images taken in the PlantCLEF2015 dataset, and representative field plant species were selected, including *Gnaphalium affine*, *Thistle*, *Gentiana macrophylla*, *Bluebell*, and *Lettuce*. Figure 3As shown, plant species and locations were manually labeled using the LabelImg software, ultimately constructing a self-built subset of data containing diverse image information, while ensuring broad coverage in terms of resolution, illumination, angle, and background complexity. Considering the complexity of the field environment and the tendency of plants of the same species to grow in clusters, the following labeling strategy was adopted: if the number of plants or the number of target local features (such as flowers) in the image is greater than 3, range labeling is used; if the number of plants or the number of target local features (such as flowers) in the image is less than or equal to 3, single-plant labeling is used. Based on the characteristics of the small-scale dataset, this study adopted a stratified sampling strategy to divide the field plant dataset into a training set (429 images), a validation set (48 images), and a test set (54 images) in an 8:1:1 ratio. This partitioning method ensures a sufficient sample size for the training set under certain conditions, while achieving hyperparameter optimization through the validation set, and finally evaluating the model's generalization ability through an independent test set. The final dataset information is shown in Table 1. The dataset was divided into a training set, validation set, and test set in an 8:1:1 ratio, with the training sample set being... ,in For image, For bounding boxes and category labels.
[0044] Table 1 Dataset Partitioning Table
[0045] S22. Perform unsharpened mask preprocessing on the field images after information annotation to obtain field images with enhanced clarity of target plant edges and textures.
[0046] S23. Construct a field plant image dataset based on all the field-captured images after unsharpened mask preprocessing.
[0047] The dataset obtained above is preprocessed using an unsharpened mask to enhance the original data, thereby improving the clarity of the target plant edges and textures and enhancing the model's ability to perceive plant features.
[0048] Specifically, unsharpened mask image processing includes the following steps: A0. Let the input image be... The standard deviation is Gaussian kernel is The enhancement factor is k = 1.5; A1. Perform a two-dimensional Gaussian blur on the input image and apply a low-pass filter to obtain the blurred image. , where * represents the convolution operation: A2. Calculate the detail information (high-frequency terms) in the enhanced image as follows: A3. Obtain the unsharpened enhanced image, and by substituting the enhancement factor k = 1.5, you can obtain the feature-enhanced images after different types of feature enhancement: A4. Enhanced image Replace the original images in the dataset without changing the image label format; A5. During the model training phase, this process is performed in the form of "offline enhancement," that is, the image is enhanced and written to disk before training, without changing the basic information of the data such as resolution, maintaining data consistency, and reducing the complexity of model training.
[0049] Finally, a dataset of field plant images was constructed based on all field-captured images preprocessed with unsharpened masks.
[0050] S24. Input the wild plant image dataset into the initial feature extraction network to extract the initial image features of each input image, wherein the initial image features include the number of input image channels.
[0051] A lightweight bottleneck structure based on depthwise separable convolution is used to construct the backbone network architecture of the initial feature extraction network.
[0052] The dataset of wild plant images is input into the initial feature extraction network, and the input feature map is denoted as . The output channel is The input channel is .in Input the number of channels. , This refers to the spatial dimensions.
[0053] S25. The initial image features are processed by 1×1 channel compression convolution to obtain compressed intermediate features for each input image.
[0054] The initial image features of the input feature map are first compressed into intermediate features through a 1×1 channel compressed convolution. For batch normalization, the compressed intermediate features obtained after the first compressed convolution are as follows: S26. The compressed intermediate features are sequentially processed by a 3×3 depthwise convolution and a 1×1 convolution to obtain the number of output image channels.
[0055] The intermediate features are obtained by performing a 3×3 depthwise convolution (each channel is independent): Furthermore, by performing a 1×1 convolution to recover the number of channels, we obtain the number of output channels: S27. Determine whether the number of input image channels is consistent with the number of output image channels. If they are consistent, introduce residual connections. If they are inconsistent, introduce residual connections after the number of output image channels is compressed and convolved by 1×1 channels to construct the initial feature extraction network.
[0056] If the number of input channels is the same as the number of output channels, then a residual connection is introduced. Otherwise, the number of output image channels will be further processed by 1×1 channel compression convolution and then introduced into residual connections to construct the initial feature extraction network.
[0057] The aforementioned multi-layer convolutional module reduces the number of parameters by approximately 50% compared to the standard Bottleneck module, making it suitable for deployment in embedded devices.
[0058] S28. In the initial feature extraction network, a spatial feature enhancement mechanism is used to divide the feature map channels into multiple subgroups, and average pooling and max pooling are used in each subgroup to improve the initial feature extraction network, thereby obtaining the target feature extraction network.
[0059] In the initial feature extraction network, each channel dimension of the field plant image dataset is divided into multiple subspaces, and spatial attention maps are learned independently in each subspace to obtain the original feature map for each subspace. For each subspace's original feature map, spatial context features are extracted using max pooling and average pooling. These spatial context features are then concatenated along the channel dimension to obtain a two-dimensional feature map. For each subspace's two-dimensional feature map, a 7×7 convolutional layer is used to extract spatial features, and an attention map is generated using the sigmoid activation function. The attention map obtained for each subspace is then element-wise multiplied with the original feature map of that subspace, performing an attention weighting operation. Finally, the attention-weighted feature maps from each subspace are concatenated to form the final feature map.
[0060] Specifically, based on the above model improvements, a Split SAM spatial attention mechanism is introduced into the backbone network. This mechanism divides the feature map channels into multiple subgroups and generates foreground-background separated spatial attention maps within each subgroup using average pooling and max pooling, thereby enhancing the model's ability to perceive plant target regions.
[0061] like Figure 4 The Split SAM section of the LightSplitBottleckneck shown mainly includes the following steps: B0. Divide the channel dimension of the input feature map into multiple subspaces, and learn a spatial attention map independently in each subspace. Let the input feature map be... ,in For training batch size, For the number of channels, , The spatial dimensions of the feature map are defined. The channel dimensions are divided into... Each subspace contains Each channel yields a feature map set. ; B1. For each subspace Split SAM extracts the spatial context features of this group through max pooling and average pooling, in the following form: By concatenating the two along the channel dimension, a two-dimensional feature map is obtained: B2. Extract spatial features using a 7×7 convolutional layer, and generate an attention map using a sigmoid activation function: B3. Multiply the obtained attention map element-wise with the original subgroup feature map, i.e., perform the attention weighting operation: B4. Finally, the weighted features of each subgroup are concatenated to output the final feature map: S29. During the model training process, record a number of preset evaluation metrics, including the cross-entropy loss and regression loss of the Adam optimizer, the proportion of true samples among all predicted positive samples, the proportion of reverse-predicted true samples among all actual positive samples, a first comprehensive metric for measuring precision and recall, and a second comprehensive metric for measuring the multi-class target detection model by calculating the sum of the average precision of each type of plant identification and then taking the average.
[0062] S210. Construct lightweight performance evaluation metrics, which include model size and total floating-point operations.
[0063] S211. Select the model weight with the highest score on the second comprehensive index on the validation set as the final target wild plant identification model.
[0064] The following provides a unified explanation of S29-S211: Based on the improved modules described above, a ULS-FRCNN object detection model was constructed and trained using the enhanced dataset. End-to-end optimization training was performed using the Adam optimizer, and mAP, Precision, Recall, and F1-Score were used as comprehensive evaluation metrics to ultimately achieve accurate identification of plant species and locations in images. The parameter and hyperparameter settings used in training this model are shown in Table 2.
[0065] Table 2 shows the parameter and hyperparameter settings used in model training.
[0066] Specifically, it includes the following steps: C0. Employ the Adam optimizer with cross-entropy loss. and regression loss As a joint objective: C1. During training, four evaluation metrics are recorded: P represents the proportion of true positive samples among all predicted positive samples; R reflects the proportion of true positive samples among all actual positive samples; F1 is a comprehensive metric used to measure precision and recall. TP, FP, and FN represent the number of true positives, false positives, and false negatives, respectively; AP(c) represents the average precision of a single plant category c; C represents the total number of detected categories; and mAP represents the comprehensive metric of the multi-class object detection model, calculated by summing the average precision of each plant category and then averaging the results. The formulas for calculating P, R, F1, and mAP are shown below: P = R = AP = mAP = C2. Construct lightweight performance evaluation metrics, mainly including: model size (MB) and total FLOPs (floating-point operations).
[0067] C3. Select the model weight with the highest mAP score on the validation set as the final target field plant identification model, and deploy it in an embedded system or edge device to achieve high-precision plant identification.
[0068] In summary, this embodiment proposes a method for constructing a field plant identification model to meet the requirements of accuracy and deployment efficiency in plant identification and detection in complex field environments. This method first constructs a plant detection dataset based on PlantCLEF 2015 field images. Taking into account the characteristics of clustered plant growth, a mixed labeling strategy of range or single plant is adopted. Training, validation, and test sets are constructed based on stratified sampling principles. To enhance the model's ability to perceive plant textures and edges in complex backgrounds, an unsharpened mask method is used for data preprocessing to improve image detail representation. In terms of model structure, a lightweight backbone network is constructed using depthwise separable convolutions to replace the Bottleneck module in traditional ResNet, effectively reducing computational cost and parameter size. Simultaneously, a Split SAM spatial attention mechanism is introduced into the backbone network, utilizing a foreground-background separation strategy to enhance the model's attention representation ability for salient plant regions. By dividing the channel dimension into subgroups and independently generating spatial attention maps, the model's target perception ability in complex backgrounds is effectively improved. In terms of model construction, this embodiment builds a ULS-FRCNN object detection model and trains it using an enhanced dataset. The Adam optimizer is employed to jointly optimize the classification and regression losses, and the model performance is comprehensively evaluated using metrics such as mAP, Precision, Recall, and F1-Score. For model application and testing, lightweight metrics such as model size and total FLOPs are introduced to ensure efficient operation on embedded devices or edge computing platforms. The combined strategy proposed in this embodiment balances accuracy and efficiency, demonstrating good generalization ability and adaptability in various plant detection scenarios. Furthermore, this method possesses flexible module replacement and expansion capabilities, allowing for the expansion of the objective function to construct multi-objective optimization problems based on different scenario characteristics and professional needs, further enhancing the scenario adaptability of the detection system.
[0069] This invention, through constructing a dataset containing diverse image information, utilizing an unsharpened mask algorithm to enhance image edge and texture representation, designing a ULS-FRCNN model backbone network integrating a lightweight bottleneck structure and a Split SAM spatial attention module, and co-designing the model structure and training strategy, realizes a fully lightweight Faster R-CNN method for field plant detection and identification. This method significantly reduces the number of model parameters and computational load while ensuring high-accuracy plant identification, making it suitable for deployment on embedded and edge devices and meeting practical needs for ecological monitoring. By optimizing the data acquisition and model training process, this invention can achieve accurate identification of plant species and locations in images with limited energy consumption, effectively improving the efficiency and accuracy of field plant detection and identification.
[0070] Figure 5This is a flowchart illustrating the field plant identification method provided by the present invention, as shown below. Figure 5 As shown, the method specifically includes: S51. Collect images of wild plants to be identified using edge devices.
[0071] S52. Input the wild plant image to be identified into the target wild plant identification model, and output the plant species and precise location in the wild plant image to be identified through the target wild plant identification model.
[0072] Images of wild plants to be identified are acquired through an edge device, which is equipped with the target wild plant identification model obtained above.
[0073] The wild plant image to be identified is input into the target wild plant identification model, and the target wild plant identification model outputs the plant species and precise location in the wild plant image to be identified.
[0074] The present invention provides a method for constructing a wild plant identification model, which involves acquiring images of wild plants to be identified using an edge device; inputting the images of wild plants to be identified into a target wild plant identification model; and outputting the plant species and precise location in the images of wild plants to be identified through the target wild plant identification model. This method achieves efficient, robust, and computationally inexpensive plant detection and identification.
[0075] The following describes the apparatus for constructing a field plant identification model provided by the present invention. The apparatus for constructing a field plant identification model described below and the method for constructing a field plant identification model described above can be referred to in correspondence.
[0076] Figure 6 This is a schematic diagram of the structure of the device for constructing a field plant identification model provided by the present invention, specifically including: Image processing module 601 is used to acquire field-photographed images and perform image preprocessing on the field-photographed images to construct a field plant image dataset. For detailed descriptions, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0077] Network construction module 602 is used to construct an initial feature extraction network using a lightweight bottleneck structure. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0078] The network optimization module 603 is used to divide the feature map channels into multiple subgroups in the initial feature extraction network using a spatial feature enhancement mechanism, and to improve the initial feature extraction network within each subgroup using average pooling and max pooling, thereby obtaining the target feature extraction network. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0079] The model building module 604 is used to build an initial field plant identification model based on the target feature extraction network. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0080] The model training module 605 is used to train the initial wild plant recognition model using the wild plant image dataset. During model training, the Adam optimizer is used for optimization, and the training effect is evaluated using multiple preset comprehensive evaluation metrics. When the overall result of the multiple comprehensive evaluation metrics is optimal, the model training is considered complete, and the target wild plant recognition model is obtained. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0081] The field plant identification device provided by the present invention is described below. The field plant identification device described below can be referred to in correspondence with the field plant identification method described above.
[0082] Figure 7 This is a schematic diagram of the structure of the field plant identification device provided by the present invention, specifically including: The image acquisition module 701 is used to acquire images of wild plants to be identified via an edge device. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0083] The image recognition module 702 is used to input the image of the wild plant to be identified into the target wild plant recognition model, and output the plant species and precise location in the image of the wild plant to be identified through the target wild plant recognition model. For detailed explanation, please refer to the relevant descriptions in the above method embodiments, which will not be repeated here.
[0084] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8As shown, the electronic device may include: a processor 810, a communications interface 820, a memory 830, and a communications bus 840, wherein the processor 810, the communications interface 820, and the memory 830 communicate with each other through the communications bus 840. The processor 810 can call logic instructions in the memory 830 to execute a method for constructing a wild plant identification model. This method includes: acquiring wild-shot images and performing image preprocessing on the wild-shot images to construct a wild plant image dataset; constructing an initial feature extraction network using a lightweight bottleneck structure; dividing the feature map channels into multiple subgroups using a spatial feature enhancement mechanism in the initial feature extraction network, and improving the initial feature extraction network within each subgroup using average pooling and max pooling to obtain a target feature extraction network; constructing an initial wild plant identification model based on the target feature extraction network; training the initial wild plant identification model using the wild plant image dataset, optimizing the training using the Adam optimizer during model training, and evaluating the model training effect using multiple preset comprehensive evaluation metrics. When the comprehensive result of the multiple comprehensive evaluation metrics is optimal, the model training is determined to be complete, and the target wild plant identification model is obtained.
[0085] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0086] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the construction method of the field plant identification model provided by the above methods. The method includes: acquiring field-photographed images and performing image preprocessing on the field-photographed images to construct a field plant image dataset; constructing an initial feature extraction network using a lightweight bottleneck structure; dividing the feature map channels into multiple subgroups using a spatial feature enhancement mechanism in the initial feature extraction network, and improving the initial feature extraction network in each subgroup using average pooling and max pooling to obtain a target feature extraction network; constructing an initial field plant identification model based on the target feature extraction network; training the initial field plant identification model using the field plant image dataset, using the Adam optimizer for optimization training during the model training process, and evaluating the model training effect through multiple preset comprehensive evaluation indicators. When the comprehensive result of the multiple comprehensive evaluation indicators is optimal, the model training is determined to be completed, and the target field plant identification model is obtained.
[0087] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a method for constructing a field plant identification model provided by the above methods. The method includes: acquiring field-captured images and performing image preprocessing on the field-captured images to construct a field plant image dataset; constructing an initial feature extraction network using a lightweight bottleneck structure; dividing the feature map channels into multiple subgroups using a spatial feature enhancement mechanism in the initial feature extraction network, and improving the initial feature extraction network within each subgroup using average pooling and max pooling to obtain a target feature extraction network; constructing an initial field plant identification model based on the target feature extraction network; training the initial field plant identification model using the field plant image dataset, wherein the Adam optimizer is used for optimization training during the model training process, and the model training effect is evaluated using multiple preset comprehensive evaluation indicators. When the comprehensive result of the multiple comprehensive evaluation indicators is optimal, the model training is determined to be complete, and the target field plant identification model is obtained.
[0088] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0089] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for constructing a field plant identification model, characterized in that, include: Acquire field images and perform image preprocessing on the field images to construct a field plant image dataset; An initial feature extraction network is constructed using a lightweight bottleneck structure; The method of constructing an initial feature extraction network using a lightweight bottleneck structure includes: The dataset of wild plant images is input into the initial feature extraction network to extract initial image features for each input image, the initial image features including the number of input image channels; The initial image features are processed by 1×1 channel compressed convolution to obtain compressed intermediate features for each input image; The compressed intermediate features are sequentially processed through a 3×3 depthwise convolution and a 1×1 convolution to obtain the number of output image channels; Determine whether the number of input image channels is consistent with the number of output image channels; If they are consistent, a residual connection is introduced; if they are inconsistent, the number of output image channels is further processed by 1×1 channel compression convolution and then introduced into a residual connection to construct the initial feature extraction network. In the initial feature extraction network, a spatial feature enhancement mechanism is used to divide the feature map channels into multiple subgroups, and average pooling and max pooling are used in each subgroup to improve the initial feature extraction network, thereby obtaining the target feature extraction network; In the initial feature extraction network, each channel dimension of the wild plant image dataset is divided into multiple subspaces, and a spatial attention map is independently learned in each subspace to obtain the original feature map of each subspace; For the original feature map of each subspace, the spatial context features of the original feature map are extracted by max pooling and average pooling. The spatial context features are then concatenated along the channel dimension to obtain a two-dimensional feature map. For each subspace's two-dimensional feature map, a 7×7 convolutional layer is used to extract spatial features, and an attention map is generated using the Sigmoid activation function. The attention map obtained in each subspace is multiplied element-wise with the original feature map of that subspace to perform an attention weighting operation; The feature maps after performing attention weighting operations on each subspace are concatenated to form the final feature map. An initial field plant identification model is constructed based on the target feature extraction network. The initial wild plant recognition model is trained using the wild plant image dataset. During the model training process, the Adam optimizer is used for optimization training, and the model training effect is evaluated by multiple preset comprehensive evaluation indicators. When the comprehensive result of the multiple comprehensive evaluation indicators is optimal, the model training is determined to be completed, and the target wild plant recognition model is obtained.
2. The method according to claim 1, characterized in that, The process of acquiring field-captured images and performing image preprocessing on these images to construct a field plant image dataset includes: The field-captured images are annotated with information, including the plant species and locations in the field-captured images; Unsharpened masking preprocessing is performed on the field images after information annotation to obtain field images with enhanced clarity of target plant edges and textures; A dataset of field plant images was constructed based on all the field-captured images after unsharpened mask preprocessing.
3. The method according to claim 1, characterized in that, The initial wild plant identification model is trained using the wild plant image dataset. During training, the Adam optimizer is used for optimization, and the training effect is evaluated using multiple preset comprehensive evaluation metrics. When the overall result of these metrics is optimal, the model training is considered complete, resulting in the target wild plant identification model. During the model training process, a number of preset evaluation metrics are recorded. These metrics include the cross-entropy loss and regression loss of the Adam optimizer, the proportion of true samples among all predicted positive samples, the proportion of true samples among all actual positive samples, a first comprehensive metric for measuring precision and recall, and a second comprehensive metric for measuring the multi-class target detection model by calculating the sum of the average precision of each plant identification and then taking the average. Construct lightweight performance evaluation metrics, which include model size and total floating-point operations; The model weight with the highest score on the second comprehensive index on the validation set is selected as the final target wild plant identification model.
4. The method according to claim 1, characterized in that, The method further includes: The target wild plant identification model is deployed in an embedded system or edge device.
5. A method for identifying plants in the wild, characterized in that, include: Images of wild plants to be identified are acquired using edge devices; The wild plant image to be identified is input into the target wild plant identification model constructed as described in any one of claims 1-4, and the target wild plant identification model outputs the plant species and precise location in the wild plant image to be identified.
6. A device for constructing a field plant identification model, characterized in that, include: The image processing module is used to acquire field-captured images and perform image preprocessing on the field-captured images to construct a field plant image dataset. The network building module is used to build an initial feature extraction network using a lightweight bottleneck structure. The method of constructing an initial feature extraction network using a lightweight bottleneck structure includes: inputting the wild plant image dataset into the initial feature extraction network to extract initial image features for each input image, wherein the initial image features include the number of input image channels; processing the initial image features through a 1×1 channel compressed convolution to obtain compressed intermediate features for each input image; sequentially processing the compressed intermediate features through a 3×3 depthwise convolution and a 1×1 convolution to obtain the number of output image channels; determining whether the number of input image channels is consistent with the number of output image channels; if consistent, introducing a residual connection; if inconsistent, processing the number of output image channels again through a 1×1 channel compressed convolution and then introducing a residual connection to construct the initial feature extraction network. The network optimization module is used to divide the feature map channels into multiple subgroups in the initial feature extraction network using a spatial feature enhancement mechanism, and to improve the initial feature extraction network within each subgroup using average pooling and max pooling to obtain the target feature extraction network. In the initial feature extraction network, each channel dimension of the field plant image dataset is divided into multiple subspaces, and a spatial attention map is independently learned in each subspace to obtain the original feature map of each subspace. For the original feature map of each subspace, spatial context features are extracted using max pooling and average pooling, and the spatial context features are concatenated along the channel dimension to obtain a two-dimensional feature map. For the two-dimensional feature map of each subspace, spatial features are extracted using a 7×7 convolutional layer, and an attention map is generated using a sigmoid activation function. The attention map obtained in each subspace is multiplied element-wise with the original feature map of that subspace, performing an attention weighting operation. The feature maps of each subspace after the attention weighting operation are concatenated to form the final feature map. The model building module is used to build an initial field plant identification model based on the target feature extraction network; The model training module is used to train the initial wild plant recognition model using the wild plant image dataset. During the model training process, the Adam optimizer is used for optimization training, and the model training effect is evaluated by multiple preset comprehensive evaluation indicators. When the comprehensive result of the multiple comprehensive evaluation indicators is optimal, the model training is determined to be completed, and the target wild plant recognition model is obtained.
7. A field plant identification device, characterized in that, include: Image acquisition module, used to acquire images of wild plants to be identified through edge devices; An image recognition module is used to input the wild plant image to be identified into the target wild plant recognition model constructed as described in any one of claims 1-4, and output the plant species and precise location in the wild plant image to be identified through the target wild plant recognition model.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the method for constructing a field plant identification model as described in any one of claims 1 to 4 and the field plant identification method as described in claim 5.