Method for detecting alien invasive plants based on improved YOLOv9 algorithm
By introducing DynamicConv module, TripletAttention attention mechanism and MPDIoU loss function in the YOLOv9 algorithm, the problem of insufficient accuracy and efficiency in the detection of high-density plant populations and similar species is solved, and more efficient and accurate alien invasion is achieved Plant detection.
Patent Information
- Application Number
- CN202411444282.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-10-16
AI Technical Summary
When the existing YOLO algorithm deals with high-density plant populations or similar species, the detection accuracy and efficiency are insufficient, making it difficult to effectively identify invasive alien plants.
Based on the YOLOv9 algorithm, the DynamicConv module was introduced to replace the downsampling module, the TripletAttention attention mechanism module was embedded, and the MPDIoU loss function was used to enhance the model's ability to identify complex backgrounds and small or partially occluded plants.
The recognition accuracy and detection efficiency of invasive plants are significantly improved, especially in complex backgrounds and low-contrast environments, enhancing the robustness and adaptability of the model.
Smart Images

Figure CN119399688A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to computer vision related fields, and in particular to an alien invasive plant detection method based on an improved YOLOv9 algorithm. The method aims to automatically identify and classify various alien invasive plants through advanced deep learning technology, and effectively support ecological monitoring and agricultural management. Background Art
[0002] Alien invasive plants pose a serious threat to the ecological environment and agricultural production. Traditional invasive plant detection methods often rely on manual inspections, which is not only time-consuming and labor-intensive, but also difficult to achieve efficient and accurate detection. In recent years, computer vision technology based on deep learning has made significant progress in the field of plant detection. Among them, the YOLO (You Only Look Once) series of algorithms have attracted widespread attention due to their real-time detection performance. However, the existing YOLO algorithm still has certain deficiencies in detection accuracy and efficiency when dealing with high-density plant populations or similar species. Therefore, it is necessary to improve the YOLO algorithm to enhance the detection capability of alien invasive plants. Summary of the invention
[0003] Therefore, the present invention provides an alien invasive plant detection method based on an improved YOLOv9 algorithm to solve the above technical problems.
[0004] In order to achieve the above object, the present invention adopts the following technical scheme: a method for detecting invasive alien plants based on an improved YOLOv9 algorithm, comprising the following steps:
[0005] 1) Obtain images of invasive alien plants;
[0006] 2) Annotate the acquired invasive alien plant images, construct an invasive alien plant dataset, and divide it into training set, validation set, and test set according to a certain ratio;
[0007] 3) Establish an improved YOLOv9 network model;
[0008] 4) Training the improved network model;
[0009] 5) Use the trained model to detect images of invasive alien plants, obtain detection results, and evaluate the test effect.
[0010] Furthermore, in step 1), obtaining the image of the invasive alien plant specifically includes: photographing the target invasive alien plant by an image acquisition device to obtain a photo, wherein the photo includes a single species of invasive alien plant or multiple species of invasive alien plants.
[0011] Furthermore, in step 2), the collected invasive alien plant images are accurately annotated, and each image annotation includes the species name, location and appearance characteristics of the plant; the annotated data set is preprocessed, including uniform image size adjustment and color space conversion to ensure the consistency and standardization of the input data, and then divided into a training set, a validation set and a test set according to a certain ratio.
[0012] Furthermore, in step 3), based on the YOLOv9 network model, the DynamicConv module is introduced to replace the downsampling module of the YOLOv9 model backbone network; the TripletAttention attention mechanism module is embedded; and the MPDloU loss function is used to replace the original CIoU loss function of the YOLOv9 model. By introducing a new network hierarchy and improved feature fusion technology, the model's ability to recognize small or partially occluded plants in complex backgrounds is enhanced. In particular, the DynamicConv convolution layer with an adaptive receptive field is added to better capture the detailed features of the plant. TripletAttention is used to improve the model's ability to focus on the target plant and suppress background noise, thereby improving the accuracy and robustness of detection. The MPDloU loss function not only considers the overlap between the predicted box and the true box, but also their shape matching, making the model more accurate when dealing with irregularly shaped plants.
[0013] Furthermore, the training of the improved network model in step 4) includes: using a multi-stage learning rate adjustment strategy and data enhancement techniques, such as random cropping, rotation and color transformation, to adapt to plant images under different lighting and environmental conditions; using multi-GPU parallel processing technology to accelerate the model training process, shorten the training cycle, and improve training efficiency; introducing an early stopping strategy to control the loss on the validation set, and automatically terminating the training when the loss has not decreased significantly for several consecutive training cycles to prevent overfitting.
[0014] Furthermore, the evaluation of the test model effect in step 5) includes but is not limited to performance evaluation in the field and laboratory environment, using standardized evaluation indicators such as precision, mean average precision (mAP) and detection speed (FPS). The classification performance of the model is analyzed using a confusion matrix, and the recognition accuracy, false recognition rate and missed recognition rate of each invasive alien plant are recorded in detail; the model is tested in real time, and the time required to process a single image is recorded to evaluate its application potential in actual operations.
[0015] Beneficial effects of the present invention:
[0016] The invasive alien plant detection method based on the improved YOLOv9 algorithm of the present invention provides an efficient and accurate detection scheme by improving and optimizing the YOLOv9 algorithm. The monitoring of invasive alien plants has significant technical advantages and practical application value, is particularly suitable for large-scale monitoring and rapid response environments, and is of great significance to ecological protection and agricultural safety management. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of the process of the present invention;
[0018] Figure 2 It is a schematic diagram of the structure of the TripletAttention mechanism module of the present invention;
[0019] Figure 3 is an improved network structure diagram of the present invention;
[0020] Figure 4 This is a diagram showing the effect of detecting invasive alien plants using the improved network model of the present invention. DETAILED DESCRIPTION
[0021] In order to further explain the technical solution of the present invention, it is described in detail below through specific embodiments.
[0022] like Figure 1 As shown, the present invention provides a method for detecting invasive alien plants based on an improved YOLOv9 algorithm, comprising the following steps:
[0023] 1) Obtain images of invasive alien plants;
[0024] 2) Annotate the acquired invasive alien plant images, construct an invasive alien plant dataset, and divide it into training set, validation set, and test set according to a certain ratio;
[0025] 3) Establish an improved YOLOv9 network model;
[0026] 4) Training the improved network model;
[0027] 5) Use the trained model to detect images of invasive alien plants, obtain detection results, and evaluate the test effect.
[0028] In step 1), first, a large number of images of five invasive alien plants, namely, ragweed, lantana, sesbania, Solanum spinulosum and Xanthium sibiricum, were collected from different regions and seasons using different handheld image acquisition devices such as smartphones and GoPro sports cameras. A total of 2,657 valid images of alien invasive plants were collected, including 395 images of ragweed, 664 images of lantana, 538 images of sesbania, 762 images of Solanum spinulosum and 298 images of Xanthium sibiricum, including different shooting angles, heights, and occlusion conditions, covering the growth conditions of the selected alien invasive plants at different stages (such as lantana and Solanum spinulosum including flowering and non-flowering stages).
[0029] In step 2), the data annotation tool LabelImg is used to accurately annotate the images. Each image annotation includes the species name and location of the plant, generating the txt format annotation data required by the YOLOv9 network model. The data is then divided into a training set, a validation set, and a test set in a ratio of 8:1:1.
[0030] In step 3), the improved network structure of this embodiment is as follows Figure 3 As shown in the figure, based on the YOLOv9 network model, the DynamicConv module is introduced to replace the downsampling module of the YOLOv9 model backbone network, which can adaptively adjust the convolution operation and dynamically change the kernel size and shape according to the feature density and complexity in the input image to optimize the processing efficiency and accuracy, so that the model can better adapt to different backgrounds and changes in plant morphology; the TripletAttention mechanism module is embedded in the YOLOv9 model. TripletAttention consists of three branches, such as Figure 2 As shown in the figure, each branch is responsible for capturing the interaction features between the spatial dimension H or W and the channel dimension C: 7x7 convolution after channel pooling, Z pooling, followed by a 7x7 convolution, followed by batch normalization and Sigmoid function. Each branch has a Permute operation to adjust the dimension. Finally, the results of the three branches are aggregated through average pooling to generate the final attention weight to enhance the model's attention to the target area and reduce background interference; MPDIoU is used as the loss function for calculating bounding box regression to improve the accuracy and stability of target detection.
[0031] In step 4), the improved model is trained on a computing system based on Windows Server 2022Standard (64-bit), which is equipped with a 13th Gen Intel(R)Core(TM)i9-13900 CPU@2.00GHz x 64GB memory. The software environment is Python version 3.10, CUDA 12.1, and the training framework is a deep learning framework based on PyTorch 2.2.2. Optionally, the main training parameters are set as follows: the learning rate momentum is set to 0.937; the initial learning rate, 0.01; the resolution of the input image, 640×640 pixels, which is the default value; the batch size for each training, 32; the number of iterations, 200. The data enhancement techniques are random cropping, rotation, and color transformation to adapt to plant images under different lighting and environmental conditions. In the last 10 rounds of training, the model turns off mosaic enhancement until the model training is completed. The best weight value of the model training is taken as the final result of the model for subsequent result analysis.
[0032] In step 5), the evaluation of the model effect includes but is not limited to performance evaluation in the field and laboratory environment, using standardized evaluation indicators such as precision, mean average precision (mAP) and detection speed (FPS). The classification performance of the model is analyzed using a confusion matrix, and the recognition accuracy, false recognition rate and missed recognition rate of each invasive alien plant are recorded in detail; the model is tested for real-time performance, and the time required to process a single image is recorded to evaluate its application potential in actual operations.
[0033] In order to verify the detection performance of the improved model, the improved YOLOv9 is compared with other YOLO series models. The data sets and classifications used for the experiment are the same. The weights of all models are randomly initialized, as shown in Table 1.
[0034] Table 1 shows the parameter comparison of different models and the experimental comparison results:
[0035]
[0036]
[0037] The results show that the improved model achieved an accuracy of 90.7% on the invasive plant dataset, while achieving the best mAP (91.2%), recall rate, mAP50: 95, FPs of 84.3%, 65.1%, and a detection speed of 72FPS (13.9ms / per image). Compared with the YOLOv9 baseline network model, recsll, mAP50 increased by 3.5%, 1.5%, respectively. Compared with other target detection models (such as YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOv10, etc.), the YOLO-IAPs model also achieved the best detection performance, which highlights the effectiveness of the improved model in improving accuracy.
[0038] like Figure 4 As shown, the improved network model has an invasive plant detection effect. Through the above embodiments, the invasive plant detection system of the present invention significantly improves the recognition accuracy of invasive plants, especially in complex backgrounds and low-contrast environments, by introducing improved network modules and loss functions. After extensive data enhancement and multi-environment testing, the model can adapt to different lighting and climatic conditions, enhancing the reliability of field applications.
[0039] The above description is only a preferred example of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for detecting invasive alien plants based on an improved YOLOv9 algorithm, characterized in that: The following steps are involved: 1) Obtain images of invasive alien plants; 2) Annotate the acquired invasive alien plant images, construct an invasive alien plant dataset, and divide it into training set, validation set, and test set according to a certain ratio; 3) Establish an improved YOLOv9 network model; 4) Training the improved network model; 5) Use the trained model to detect images of invasive alien plants, obtain detection results, and evaluate the test effect.
2. According to claim 1, a method for detecting invasive alien plants based on an improved YOLOv9 algorithm, characterized in that: Acquiring the image of the invasive alien plant in step 1) specifically includes: photographing the target invasive alien plant by an image acquisition device to obtain a photo, wherein the photo contains a single species of invasive alien plant or multiple species of invasive alien plants.
3. The method for detecting invasive alien plants based on the improved YOLOv9 algorithm according to claim 1, characterized in that: The step 2) specifically includes: Accurately label the collected images of invasive alien plants, with each image labeling including the plant species name, location and appearance characteristics; Preprocess the labeled data set, including image resizing and color space conversion, to ensure the consistency and standardization of input data; When splitting the dataset, ensure that the images of each type of plant are evenly distributed in the training set, validation set, and test set to avoid bias and overfitting during model training.
4. The method for detecting invasive alien plants based on the improved YOLOv9 algorithm according to claim 1, characterized in that: The step 3) specifically includes: Based on the YOLOv9 network model, the DynamicConv module is introduced to replace the downsampling module of the YOLOv9 model backbone network to improve the sensitivity to the characteristics of invasive alien plants; The TripletAttention mechanism module is embedded in the YOLOv9 model to improve the model's attention to the target area and reduce background interference; MPDIoU is used as the loss function for calculating bounding box regression to improve the accuracy and stability of object detection.
5. The method for detecting invasive alien plants based on the improved YOLOv9 algorithm according to claim 4, characterized in that: The DynamicConv module can adaptively adjust the convolution operation and dynamically change the kernel size and shape according to the feature density and complexity in the input image to optimize processing efficiency and accuracy, so that the model can better adapt to different backgrounds and changes in plant morphology; The calculation process of the DynamicConv module is as follows: given the input feature X, and a set of convolution kernels W1, W2, ..., W M , each core corresponds to an expert; the contribution of each expert is determined by a dynamic coefficient α i Controlled by , these coefficients are generated dynamically for each input sample; the output Y is the weighted sum of all dynamically selected convolution kernel operations: Where * represents the convolution operation, α i It is dynamically calculated through a small network (such as MLP), the input of which is the feature after global average pooling.
6. The method for detecting invasive alien plants based on the improved YOLOv9 algorithm according to claim 4, characterized in that: The TripletAttention module can more accurately focus on plant features at multiple scales and angles by calculating the feature relationships between different regions in the image, further reducing false detections caused by background elements and optimizing the model's ability to recognize plant targets in complex backgrounds. TripletAttention consists of three branches, each of which is responsible for capturing the interaction features between the spatial dimension H or W and the channel dimension C: 7x7 convolution after channel pooling, Z pooling, followed by a 7x7 convolution, followed by batch normalization and Sigmoid function; each branch has a Permute operation to adjust the dimension; finally, the results of the three branches are aggregated by average pooling to generate the final attention weights.
7. The method for detecting invasive alien plants based on the improved YOLOv9 algorithm according to claim 4, characterized in that: The MPDIoU loss function not only considers the maximum possible intersection-over-union ratio between the predicted bounding box and the true bounding box, but also considers the shape symmetry, which makes the loss function more effective when dealing with irregularly shaped plant targets and significantly improves the accuracy of bounding box positioning; the calculation process of MPDIoU is as follows: Among them, x1 prd , y1 prd , x2 prd , y2 prd The coordinates of the upper left and lower right corners of the predicted bounding box respectively; x1 gt , x2 gt ,y1 gt , y2 gt are the coordinates of the upper left corner and lower right corner of the actual annotated bounding box; IoU is the intersection over union ratio between the predicted box and the real box, w and h are the width and height of the input image, respectively, and L PMPDIoU is the loss function.
8. The method for detecting invasive alien plants based on the improved YOLOv9 algorithm according to claim 1, characterized in that: The training improved network model of step 4) includes: using a multi-stage learning rate adjustment strategy and data enhancement techniques, such as random cropping, rotation and color transformation, to adapt to plant images under different lighting and environmental conditions; Use multi-GPU parallel processing technology to accelerate the model training process, shorten the training cycle, and improve training efficiency; An early stopping strategy is introduced to control the loss on the validation set. When the loss does not decrease significantly after several consecutive training cycles, the training is automatically terminated to prevent overfitting.
9. The method for detecting invasive alien plants based on the improved YOLOv9 algorithm according to claim 1, characterized in that: The test model effect evaluation of step 5) includes but is not limited to performance evaluation in the field and laboratory environments, using standardized evaluation indicators such as precision, mean average precision (mAP) and detection speed (FPS); The classification performance of the model was analyzed using a confusion matrix, with detailed records of the recognition accuracy, false recognition rate, and missed recognition rate for each invasive alien plant. The model was tested for real-time performance and the time required to process a single image was recorded to evaluate its potential for application in actual operations.
Citation Information
Patent Citations
Detection method for invasive plant seeds in imported seed products
CN116310548A
Yo-v9 multi-mode road adhesion coefficient estimation algorithm fused with dynamics
CN118439032A
Cited By
Improved YOLO11-based water hyacinth target rapid detection method
CN120635395A
A method for quickly detecting water hyacinth targets based on improved YOLO11
CN120635395B