An invasive alien plant detection method based on improved YOLOv9 algorithm
By introducing the DynamicConv module and TripletAttention mechanism into the YOLOv9 algorithm, combined with the MPDIoU loss function and data augmentation techniques, the detection model for invasive alien plants was optimized, solving the problems of insufficient detection accuracy and efficiency in existing technologies, and achieving efficient and accurate plant identification.
Patent Information
- Application Number
- CN202411444282.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2044-10-16
AI Technical Summary
Existing YOLO algorithms lack sufficient accuracy and efficiency when dealing with high-density plant populations or similar species, making it difficult to achieve efficient and accurate detection of invasive alien plants.
Based on the YOLOv9 algorithm, the DynamicConv module is introduced to replace the downsampling module, the TripletAttention attention mechanism is embedded, and the MPDIoU loss function is used. Combined with multi-stage learning rate adjustment and data augmentation techniques, the network model is optimized.
It significantly improves the accuracy and robustness of detecting invasive alien plants, adapts to complex backgrounds and different light environments, and achieves efficient and accurate detection results.
Smart Images

Figure CN119399688B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computer vision, and particularly relates to a method for detecting alien invasive plants based on an improved YOLOv9 algorithm. This method aims to automatically identify and classify various alien invasive plants through advanced deep learning technology, effectively supporting ecological monitoring and agricultural management. BACKGROUND
[0002] Alien invasive plants pose a serious threat to the ecological environment and agricultural production. Traditional methods for detecting invasive plants often rely on manual patrols, which are 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 plant detection, with the YOLO (You Only Look Once) series of algorithms receiving widespread attention due to their real-time detection performance. However, existing YOLO algorithms still have certain deficiencies in terms of 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
[0003] Therefore, the present application provides a method for detecting alien invasive plants based on an improved YOLOv9 algorithm to solve the above technical problems.
[0004] To achieve the above purpose, the present application adopts the following technical solution: a method for detecting alien invasive plants based on an improved YOLOv9 algorithm, comprising the following steps:
[0005] 1) obtaining images of alien invasive plants;
[0006] 2) labeling the obtained alien invasive plant images, constructing an alien invasive plant dataset, and dividing it into a training set, a validation set, and a test set according to a certain proportion;
[0007] 3) establishing an improved YOLOv9 network model;
[0008] 4) training the improved network model;
[0009] 5) using the trained model to detect the images of alien invasive plants, obtaining the detection results, and evaluating the test effect.
[0010] Further, step 1) of obtaining images of alien invasive plants specifically includes: taking photos of target alien invasive plants through image acquisition equipment, and the photos contain single-species alien invasive plants or multi-species alien invasive plants.
[0011] Further, in step 2), the collected images of alien invasive plants are accurately labeled, each image label including the plant species name, location, and external features; the labeled dataset is preprocessed, including uniform adjustment of image size and color space conversion, to ensure consistency and standardization of input data, and then divided into training set, validation set, and test set according to a certain proportion.
[0012] Further, in step 3), on the basis of the YOLOv9 network model, the DynamicConv module is introduced to replace the down-sampling module of the YOLOv9 model backbone network; the TripletAttention attention mechanism module is embedded; and the MPDIoU loss function is used to replace the original CIoU loss function of the YOLOv9 model. By introducing new network hierarchy and improved feature fusion technology, the recognition ability of the model for small or partially occluded plants in complex background is enhanced. In particular, the DynamicConv convolutional layer with adaptive receptive field is added to better capture the detailed features of plants. TripletAttention improves the model's focus on target plants and suppresses background noise, thereby improving the accuracy and robustness of detection. The MPDIoU loss function not only considers the overlap between the predicted box and the real box, but also considers their shape matching degree, making the model more accurate when dealing with irregularly shaped plants.
[0013] Further, in step 4), training the improved network model includes: using multi-stage learning rate adjustment strategy and data augmentation 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 training process of the model, shorten the training period, and improve the training efficiency; introducing early stopping strategy to control the loss on the validation set, automatically terminating training when the loss does not significantly decrease for consecutive training cycles, preventing overfitting.
[0014] Further, in step 5), model effect evaluation includes but is not limited to performance evaluation in field and laboratory environments, using standardized evaluation indicators such as precision, mean average precision (mAP), and detection speed (FPS). The confusion matrix is used to analyze the classification performance of the model, and the recognition accuracy, misrecognition rate, and missed recognition rate of each alien invasive 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 operation.
[0015] The beneficial effects of the present application are:
[0016] The present invention provides a method for detecting invasive alien plants based on the improved YOLOv9 algorithm. By improving and optimizing the YOLOv9 algorithm, it offers an efficient and accurate detection scheme. It has significant technical advantages and practical application value for monitoring invasive alien plants, and is particularly suitable for large-scale monitoring and rapid response environments. It is of great significance for ecological protection and agricultural safety management. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the present invention;
[0018] Figure 2 This is a schematic diagram of the TripletAttention attention mechanism module structure of the present invention;
[0019] Figure 3 This is the improved network structure diagram of the present invention;
[0020] Figure 4 This is a diagram showing the detection effect of the improved network model for invasive alien plants in this invention. Detailed Implementation
[0021] To further explain the technical solution of the present invention, a detailed description is provided below through specific embodiments.
[0022] like Figure 1 As shown, this 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) The acquired images of invasive alien plants are labeled to construct an invasive alien plant dataset, which is then divided into training, validation, and test sets according to a certain ratio;
[0025] 3) Establish an improved YOLOv9 network model;
[0026] 4) Train the improved network model;
[0027] 5) Use the trained model to detect images of invasive alien plants, obtain the detection results, and evaluate the test results.
[0028] In step 1), a large number of images of five invasive alien plants—ragweed, lantana, sesbania, black nightshade, and cocklebur—were collected from different regions and seasons using various handheld image acquisition devices such as smartphones and GoPro action cameras. A total of 2,657 valid images of invasive alien plants were collected, including 395 images of ragweed, 664 images of lantana, 538 images of sesbania, 762 images of black nightshade, and 298 images of cocklebur. These images included different shooting angles, heights, and occlusion conditions, and covered different stages of growth of the selected invasive alien plants (e.g., lantana and black nightshade included both flowering and non-flowering stages).
[0029] Step 2) uses the data annotation tool LabelImg 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. Then, the data is divided into training, validation, and test sets in an 8:1:1 ratio.
[0030] In step 3), the improved network structure of this embodiment is as follows: Figure 3 As shown, based on the YOLOv9 network model, the DynamicConv module is introduced to replace the downsampling module of the YOLOv9 model backbone network. This allows for adaptive adjustment of convolution operations, dynamically changing the kernel size and shape according to the feature density and complexity in the input image to optimize processing efficiency and accuracy, enabling the model to better adapt to different backgrounds and plant morphological changes. A TripletAttention attention mechanism module is embedded into the YOLOv9 model. TripletAttention consists of three branches, such as... Figure 2 As shown, each branch is responsible for capturing the interaction features between the spatial dimension H or W and the channel dimension C: a 7x7 convolution after channel pooling, Z-pooling, followed by another 7x7 convolution, then batch normalization and the sigmoid function. Each branch has a permute operation to adjust the dimensions. Finally, the results from the three branches are aggregated through average pooling to generate the final attention weights, improving the model's focus on the target region and reducing background interference; MPDIoU is used as the loss function for calculating bounding box regression, improving the accuracy and stability of object detection.
[0031] In step 4), the improved model was trained on a Windows Server 2022 Standard (64-bit) computing system equipped with a 13th Gen Intel(R) Core(TM) i9-13900 CPU @ 2.00GHz x 64GB of memory. The software environment was Python 3.10, CUDA 12.1, and the training framework was a deep learning framework based on PyTorch 2.2.2. Optionally, the main training parameters were set as follows: learning rate momentum was set to 0.937; initial learning rate, 0.01; input image resolution, 640×640 pixels (the default value); batch size per training iteration, 32; number of iterations, 200. Data augmentation techniques included random cropping, rotation, and color transformation to adapt plant images to different lighting and environmental conditions. Mosaic enhancement was disabled in the last 10 rounds of training until the model training was complete. The best weight values from the trained model were taken as the final result for subsequent result analysis.
[0032] In step 5), the model performance evaluation includes, but is not limited to, performance evaluation in field and laboratory environments, using standardized evaluation metrics such as precision, mean accuracy (mAP), and detection speed (FPS). The confusion matrix is used to analyze the model's classification performance, recording in detail the identification accuracy, false positive rate, and false negative rate for each invasive alien plant. Real-time performance testing of the model is conducted, recording the time required to process a single image to assess its application potential in practical applications.
[0033] To verify the detection performance of the improved model, this invention compared the improved YOLOv9 with other YOLO series models. The dataset and classification used in the experiments were the same. The weights of all models were randomly initialized, as shown in Table 1.
[0034] Table 1 shows a comparison of parameters and experimental results for different models:
[0035]
[0036]
[0037] The results show that the improved model achieves 90.7% accuracy on the invasive alien plant dataset, while also achieving the best mAP (91.2%), recall (mAP50: 95), and FPs (84.3%, 65.1%), with a detection speed of 72 FPS (13.9 ms / image). Compared with the YOLOv9 baseline network model, recsll and mAP50 are improved by 3.5% and 1.5%, respectively. The YOLO-IAPs model also achieves the best detection performance compared to other object detection models (such as YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOv10, etc.), highlighting the effectiveness of the improved model in improving accuracy.
[0038] like Figure 4 As shown, the improved network model demonstrates its effectiveness in detecting invasive alien plants. Through the above implementation methods, the invasive plant detection system of this invention significantly improves the accuracy of identifying invasive alien plants, especially in complex backgrounds and low-contrast environments, by introducing improved network modules and loss functions. Extensive data augmentation and multi-environment testing have enabled the model to adapt to different lighting and climatic conditions, enhancing its reliability in field applications.
[0039] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An alien invasive plant detection method based on an improved YOLOv9 algorithm, characterized in that, The method comprises the following steps: 1) acquiring images of alien invasive plants; 2) labeling the acquired alien invasive plant images, constructing an alien invasive plant dataset, and dividing it into a training set, a validation set, and a test set according to a certain proportion; 3) establishing an improved YOLOv9 network model; 4) training the improved network model; 5) using the trained model to detect the images of alien invasive plants to obtain detection results and evaluate the test effect; The step 3) specifically comprises: On the basis of the YOLOv9 network model, a DynamicConv module is introduced to replace the down-sampling module of the YOLOv9 model backbone network to improve the sensitivity to the characteristics of alien invasive plants; A TripletAttention attention mechanism module is embedded in the YOLOv9 model to improve the attention of the model to the target area and reduce background interference; MPDIoU is used as the loss function for calculating the boundary box regression to improve the accuracy and stability of target detection.
2. The method of claim 1, wherein the improved YOLOv9 algorithm-based detection method for alien invasive plants is characterized by: In the step 1), the images of alien invasive plants are acquired by photographing the target alien invasive plants through an image acquisition device, and the photos contain single-species alien invasive plants or multi-species alien invasive plants.
3. The method of claim 1, wherein the improved YOLOv9 algorithm-based detection method for alien invasive plants is characterized by: The step 2) specifically comprises: The collected alien invasive plant images are accurately labeled, and each image label includes the species name, position, and external characteristics of the plant; The labeled dataset is preprocessed, including uniform adjustment of image size and color space conversion, to ensure the consistency and standardization of input data; When the dataset is segmented, ensure that the images of each plant are evenly distributed in the training set, the validation set, and the test set to avoid bias and overfitting during model training.
4. The method of claim 1, wherein the improved YOLOv9 algorithm-based detection method for alien invasive plants is characterized by: The DynamicConv module can adaptively adjust the convolution operation, 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 changes in different backgrounds and plant morphologies; The calculation process of the DynamicConv module is as follows: given an input feature X, and a set of convolution kernels W1, W2, …, W M , each kernel corresponds to an expert; the contribution of each expert is controlled by a dynamic coefficient a i , which is dynamically generated for each input sample; the output Y is the weighted sum of the operations of all dynamically selected convolution kernels: where * denotes a convolution operation, a i is dynamically computed by a small network whose input is the global average pooled features.
5. The method of claim 1, wherein the improved YOLOv9 algorithm-based detection method for alien invasive plants is characterized by: The TripletAttention attention mechanism module can more accurately focus on plant features in 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; Triplet Attention consists of three branches, each responsible for capturing the interaction features between spatial dimensions H or W and channel dimensions C: a 7x7 convolution after channel pooling, Z pooling, followed by another 7x7 convolution, then batch normalization and a Sigmoid function; each branch has a Permute operation to adjust the dimensions; finally, the results of the three branches are aggregated by average pooling to generate the final attention weights.
6. The method of claim 1, wherein the improved YOLOv9 algorithm-based detection method for alien invasive plants is characterized by: The MPDIoU loss function not only considers the maximum possible intersection over union between the predicted bounding box and the real bounding box, but also considers the shape symmetry, which makes the loss function more effective in processing irregularly shaped plant targets, and significantly improves the accuracy of bounding box positioning; the calculation process of the MPDIoU is as follows: ; wherein x1 prd , y1 prd , x2 prd , y2 prd are the coordinate values of the upper left and lower right corners of the predicted bounding box, respectively; x1 gt , x2 gt , y1 gt , y2 gt are the coordinate values of the upper left and lower right corners of the actual labeled bounding box, respectively; IoU is the intersection over union of the predicted box and the true box, w, h are the width and height of the input image, respectively, and L PMPDIoU is the loss function.
7. The method of claim 1, wherein the improved YOLOv9 algorithm-based detection method for alien invasive plants is characterized by: The training of the improved network model in step 4) includes a multi-stage learning rate adjustment strategy and data augmentation techniques, including random cropping, rotation, and color transformation, to adapt to plant images under different lighting and environmental conditions; The training process of the model is accelerated using multi-GPU parallel processing technology, shortening the training period and improving the training efficiency; Early stopping strategy is introduced to control the loss on the validation set. When the loss does not significantly decrease for several consecutive training periods, the training is automatically terminated to prevent overfitting.
8. The method of claim 1, wherein the improved YOLOv9 algorithm-based detection method for alien invasive plants is characterized by: The test model effect evaluation of step 5) includes but is not limited to performance evaluation in field and laboratory environment, using standardized evaluation indicators including precision, mean average precision (mAP) and detection speed (FPS); The classification performance of the model is analyzed using a confusion matrix, which records the identification accuracy, misidentification rate and missed identification rate of each alien invasive plant in detail; The real-time performance of the model is tested, and the time required to process a single image is recorded to evaluate its application potential in actual operation.
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