Method and system for identifying different growth cycles of poppy based on attention enhancement
By constructing a multi-cycle dataset of poppies and embedding an attention module into the YOLOv8 model, the problems of insufficient accuracy and recall in the identification of the entire growth cycle of poppies were solved. This enabled accurate identification of poppy seedlings and buds, adapting to complex environments and meeting the needs of drug enforcement.
Patent Information
- Application Number
- CN202511739301.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-02-24
AI Technical Summary
Existing technologies struggle to efficiently identify the entire growth cycle of poppies in complex environments, especially during the seedling and bud stages. They are also susceptible to the effects of ambient light and shading, resulting in insufficient identification accuracy and recall, which fails to meet the needs of drug enforcement.
A multi-growth-cycle dataset of poppies was constructed. Data augmentation methods such as target copy-paste and background replacement, and occlusion sample addition were adopted. Combined with the YOLOv8 detection model, an attention module was embedded in the feature fusion network. The attention module divided the channel feature maps into groups and assigned attention weights for different growth cycles to achieve cross-group feature fusion.
It achieves accurate identification of poppies throughout their entire growth cycle, with an mAP50 of 82.3% in the seedling stage. The identification accuracy and recall rate are significantly improved. It is adaptable to complex environments and can be deployed in a lightweight manner on mobile terminals or drones to meet actual inspection needs.
Smart Images

Figure CN121564696A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of poppy identification technology, and more specifically, to a method and system for identifying different growth stages of poppies based on attention enhancement. Background Technology
[0002] As the primary source of drugs, the illegal cultivation of opium poppies seriously endangers national security, social stability, and public health. According to relevant laws and regulations, my country prohibits the illegal cultivation of opium poppies and other drug-producing plants. However, illegal growers are constantly improving their counter-surveillance methods, evading detection through small-scale, concealed, and mixed cultivation. They plant opium poppies in remote areas, woodlands, or mixed with crops and weeds, increasing the difficulty of monitoring and resulting in low efficiency and a high rate of missed detection with traditional manual inspections.
[0003] Traditional poppy identification relies on manual inspections, which are hampered by complex geographical environments and high labor costs, resulting in low efficiency and high false negative rates. Identification methods based on simple image features are easily affected by environmental factors, and their accuracy is insufficient for practical needs. In particular, existing poppy identification technologies have significant limitations: traditional image feature recognition methods can only distinguish poppies in the flowering stage, failing to address the morphological differences in the seedling and fruiting stages, and are easily affected by ambient lighting and occlusion. Most existing deep learning-based methods only cover interference-free scene recognition of poppies in the flowering stage, neglecting core challenges such as small targets and occlusion during the seedling and fruiting stages. While some methods combine YOLOv8 with Shuffle Attention (SA) modules for other fields (such as crop disease classification), disease identification targets static leaf features, which are completely different from the dynamic features of poppies across multiple growth cycles (small seedlings, bud occlusion, and variable fruit morphology). Furthermore, the SA module embedding position (the last convolutional layer) only optimizes classification accuracy and cannot adapt to multi-scale target detection.
[0004] Furthermore, identifying poppies at different growth stages presents unique technical challenges. During the seedling stage, the plants are 5-15cm tall and highly similar in morphology to weeds, posing a typical small-target detection problem. In the bud stage, the buds are easily obscured by leaves, requiring precise capture of the combined characteristics of a long stalk and an ovoid shape. During the fruiting stage, the capsules need to be distinguished from the fruits of common crops such as tomatoes and eggplants. Current technologies do not address these challenges specifically, resulting in insufficient identification accuracy and recall to meet law enforcement requirements. Therefore, there is an urgent need for a poppy identification technology that can cover the entire growth cycle, adapt to complex environments, and be lightweight for deployment, providing efficient technical support for drug enforcement.
[0005] No effective solutions have yet been proposed to address the problems in the relevant technologies. Summary of the Invention
[0006] To address the problems in related technologies, this invention proposes an attention-enhanced method and system for identifying different growth stages of poppies, in order to overcome the aforementioned technical problems existing in the prior art.
[0007] Therefore, the specific technical solution adopted by the present invention is as follows: According to one aspect of the present invention, an attention-enhanced method for identifying different growth stages of poppies is provided. This method includes: S1, constructing a multi-growth-stage poppy dataset; during the construction of the multi-growth-stage poppy dataset, for targets in the poppy seedling stage, target copy-paste and background replacement are used for specific enhancement; for targets in the poppy bud stage, a preset proportion of occlusion samples are added to the occlusion scene; for targets in the poppy fruiting stage, dual feature annotation of the capsule outline and pedicel position is performed; S2, selecting a basic detection model; the architecture of the basic detection model includes a backbone network, a feature fusion network, and a detection head; the backbone network is used to enhance gradient flow and feature reuse at different growth stages of poppies, the feature fusion network is used to achieve cross-scale feature fusion, and the detection head is used to separate poppy classification and localization tasks; S3, S4, S5, S6, S7, S8, S9, S1 ... 3. Based on the basic detection model, an identification model is constructed by embedding attention modules in several feature layers of the feature fusion network. The attention modules are used to divide the channel feature maps into groups to establish a correspondence with the morphological features of poppies. Spatial attention weights are strengthened for poppy seedling stage targets, channel feature responses are strengthened for poppy fruiting stage targets, and spatial and channel attention weights are balanced for poppy bud stage targets. Cross-group feature fusion is achieved through channel shuffling. S4. The identification model is trained using a multi-growth-cycle dataset of poppies, and the trained identification model outputs the poppy growth cycle category, morphological feature location coordinates, and confidence score. The training of the identification model includes setting the training rounds, using a positive sample matching strategy to improve the recall rate, using a loss function to optimize the bounding box localization accuracy, adjusting hyperparameters through a validation set, and using a test set to verify the identification performance for different growth stages of poppies.
[0008] Furthermore, constructing a multi-cycle poppy dataset includes: collecting images of poppy seedlings, buds, and fruits according to a preset ratio to obtain an effective image set; this effective image set includes images of different scenes, lighting conditions, and lighting angles; based on the effective image set, for poppy seedling targets, targeted enhancement is performed using target copy-paste and background replacement; for poppy bud targets, a preset ratio of occlusion samples is added to occluded scenes; for poppy fruiting targets, dual feature annotation of capsule outline and pedicel position is performed to obtain a sample set; the sample set is formatted, number sequence naming is standardized, and feature-level annotation is performed, and the samples are expanded using a combination method, and divided into training, validation, and test sets according to a preset ratio to obtain a multi-cycle poppy dataset.
[0009] Furthermore, the effective image set includes different morphological features of poppies; among them, the targets in the poppy seedling stage include short stems, no branches and basal leaves, the targets in the poppy bud stage include long stalks and drooping ovoid buds, and the targets in the poppy fruiting stage include round capsules and fruit stalks; the combination methods include original image preservation, mirror flipping, Gaussian noise, brightness adjustment, random rotation and translation.
[0010] Furthermore, the basic detection model adopts YOLOv8; the backbone network adopts a C2f structure; the feature fusion network adopts a bidirectional feature pyramid network; the detection head adopts an anchorless decoupled structure; and the input resolution of the basic detection model is set to a predetermined value.
[0011] Furthermore, embedding attention modules into several feature layers of the feature fusion network includes: embedding attention modules into several feature layers of the feature fusion network of the basic detection model; the several feature layers are adjacent to each other; through the attention modules, the feature maps are divided into different groups of channel features according to a preset number of groups; the different groups of channel features include poppy leaf feature channels, poppy flower feature channels, and poppy fruit feature channels, and the number of channels in each group of channel features is equal; based on the attention modules, spatial attention weights are strengthened for poppy seedling stage targets, channel feature responses are strengthened for poppy fruiting stage targets, and spatial and channel attention weights are balanced for poppy bud stage targets; cross-group feature fusion is achieved through channel shuffling, and different groups of channel features are rearranged in a specific order to promote the interaction of poppy leaf, poppy flower, and poppy fruit features.
[0012] Furthermore, the spatial attention weights for the poppy seedling stage target are enhanced by generating a two-dimensional attention mask. Specifically, this involves performing global average pooling and max pooling on the feature map and compressing the dimension using a convolutional kernel of a preset size. Based on the compressed feature map, an activation function is used to output a spatial weight matrix to enhance the weights for the poppy seedling stage target.
[0013] Furthermore, the target enhancement channel feature response during the poppy fruiting stage is achieved through channel statistical feature modeling, specifically including: calculating the mean and variance of each group of channel features and mapping them through a fully connected network; based on the mapping results, outputting channel weight vectors through activation functions to enhance the response intensity of poppy fruit feature channels.
[0014] Further, setting the training epochs includes: assigning loss weights to the poppy seedling stage target and setting a first training epoch and a second training epoch; enabling data augmentation in the first training epoch to improve the model's generalization ability; disabling data augmentation in the second training epoch to avoid distortion caused by splicing small targets; and the first training epoch is longer than the second training epoch; using a positive sample matching strategy to improve recall; and using a loss function to optimize bounding box localization accuracy includes: improving the recall rate of the poppy bud stage target through a positive sample matching strategy; and optimizing the bounding box localization accuracy of the poppy fruiting stage target and closely related crops by combining the loss function with the complete intersection-union loss function; and adjusting hyperparameters through the validation set includes: adjusting the learning rate and anchor box size; wherein, a first set of anchor box sizes is set for the poppy seedling stage target, and a second set of anchor box sizes is set for the poppy fruiting stage target, and the first set of anchor box sizes is smaller than the second set of anchor box sizes.
[0015] Furthermore, the sample sizes of the training set, validation set, and test set are set according to preset quantities to cover poppy samples at different growth stages under different scenarios and lighting conditions; among them, the sample size of the training set is greater than that of the validation set, and the sample size of the validation set is greater than that of the test set; feature-level annotation includes: using annotation tools to annotate poppy flowers, poppy fruits, and stems and leaves, and setting preset labels for each to generate annotation files conforming to the YOLO format; channel shuffling includes: using depthwise separable convolution for feature recombination, and setting the convolution kernel size and stride to preset values to avoid information loss during cross-group feature fusion.
[0016] According to another aspect of the present invention, an attention-enhanced poppy growth cycle identification system is also provided. This attention-enhanced poppy growth cycle identification system includes: a data acquisition and preprocessing module for constructing a multi-growth-cycle poppy dataset; a model building module for selecting a basic detection model; a training and optimization module for constructing an identification model based on the basic detection model by embedding attention modules in several feature layers of a feature fusion network; and an identification output module for training the identification model using the multi-growth-cycle poppy dataset and outputting the poppy growth cycle category, morphological feature location coordinates, and confidence level through the trained identification model.
[0017] The beneficial effects of this invention are as follows: (1) This invention constructs a multi-growth cycle dataset covering the seedling stage, bud stage and fruiting stage of poppy, and embeds an attention module in the feature layer of the feature fusion network to achieve accurate identification of different growth cycles of poppy. Among them, the mAP50 of the seedling stage reaches 82.3%, which is more than 40% higher than the traditional method. This solves the limitation of the existing technology that only covers the flowering stage and achieves full growth cycle coverage of poppy.
[0018] (2) This invention divides the channel feature maps into groups by attention modules and assigns different weight coefficients for different growth cycles, which strengthens the extraction of key features such as poppy flowers, fruits, stems and leaves, so that the mAP50 of the recognition model reaches 88.7% and the recall rate reaches 83.9%, which is significantly better than the traditional YOLOv8 and SSD models. It can accurately distinguish poppies and closely related plants at different growth cycles and improve the recognition accuracy.
[0019] (3) This invention collects poppy images under different scenes, lighting conditions and lighting angles, and performs special enhancement and feature-level annotation for different growth cycles of poppies. Combined with data augmentation strategies, the model has strong anti-interference capabilities and can cope with complex scenes such as occlusion and mixed planting. It reduces the false negative rate for scenes such as occlusion, small targets and lighting changes, and adapts to the complex environment of actual inspection.
[0020] (4) The attention module of the present invention improves performance without significantly increasing the number of parameters and computational complexity. Based on the architecture design of the basic detection model, it can be mounted on mobile terminals or drones, meeting the "air-ground integrated" inspection requirements and achieving lightweight and easy deployment.
[0021] (5) This invention not only combines the basic detection model and attention module to identify the poppy flowering period, but also addresses the unique difficulty of multiple growth cycles of poppies by embedding attention modules in several feature layers of the feature fusion network, customizing key technologies such as channel grouping, assigning attention weights to targets with different growth cycles, and channel shuffling to achieve cross-group feature fusion. Furthermore, by setting training rounds, adopting positive sample matching strategy to improve recall rate, and using loss function to optimize bounding box positioning accuracy, a systematic technical solution for identifying multiple growth cycles of poppies has been realized. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is an overall flowchart of an attention-enhanced method for identifying different growth stages of poppies according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the YOLOv8 network structure in an attention-enhanced method for identifying different growth stages of poppies according to an embodiment of the present invention. Figure 3This is a schematic diagram of the SA module workflow in an attention-enhanced method for identifying different growth stages of poppies according to an embodiment of the present invention. Figure 4 This is a comparison chart of the recognition performance of SA-YOLOv8 and YOLOv8 in an attention-enhanced method for identifying different growth stages of poppies according to an embodiment of the present invention. Figure 5 This is a flowchart illustrating an attention-enhanced method for identifying different growth stages of poppies according to an embodiment of the present invention. Figure 6 This is a block diagram illustrating the principle of an attention-enhanced poppy growth cycle identification system according to an embodiment of the present invention. Detailed Implementation
[0024] To further illustrate the various embodiments, the present invention provides accompanying drawings, which are part of the disclosure of the present invention. These drawings are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementation methods and the advantages of the present invention. The components in the drawings are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0025] According to an embodiment of the present invention, a method and system for identifying different growth stages of poppies based on attention enhancement are provided.
[0026] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments, such as... Figure 1 and Figure 5 As shown, according to an embodiment of the present invention, an attention-enhanced method for identifying different growth stages of poppies is provided, the method comprising: S1. Construct a multi-cycle dataset of poppies; the multi-cycle of poppies includes the seedling stage, bud stage, and fruiting stage; during the construction of the multi-cycle dataset of poppies, for the poppy seedling stage target, target copy and paste and background replacement are used for specific enhancement; for the poppy bud stage target, a preset proportion of occlusion samples are added for occlusion scenes; for the poppy fruiting stage target, dual feature annotation of capsule outline and pedicel position is performed; In one embodiment, constructing a multi-cycle poppy dataset includes: collecting images of poppy seedlings, buds, and fruits at a preset ratio to obtain an effective image set; this effective image set includes images of different scenes, different lighting conditions, and different lighting angles; based on the effective image set, for poppy seedling targets, targeted enhancement is performed using target copy-paste and background replacement; for poppy bud targets, a preset ratio of occlusion samples is added to occluded scenes; for poppy fruiting targets, dual feature annotation of capsule outline and pedicel position is performed to obtain a sample set; the sample set is formatted, number sequence naming is standardized, and feature-level annotation is performed, and the samples are expanded using a combination method, and divided into a training set, a validation set, and a test set at a preset ratio to obtain a multi-cycle poppy dataset.
[0027] In one embodiment, the effective image set includes different morphological features of poppies; wherein, the target of poppy seedling stage includes short stem, no branching and basal leaf features, the target of poppy bud stage includes long stalk and drooping ovoid bud features, and the target of poppy fruiting stage includes round capsule and pedicel features; the combination method includes original image preservation, mirror flipping, Gaussian noise, brightness adjustment, random rotation and translation.
[0028] S2. Select the basic detection model; the architecture of the basic detection model includes a backbone network, a feature fusion network, and a detection head; the backbone network is used to enhance the gradient flow and feature reuse at different growth stages of poppies, the feature fusion network is used to achieve cross-scale feature fusion, and the detection head is used to separate poppy classification and localization tasks. In one embodiment, the basic detection model uses YOLOv8; the backbone network uses a C2f structure; the feature fusion network uses a bidirectional feature pyramid network; the detection head uses an anchorless decoupled structure; and the input resolution of the basic detection model is set to a predetermined value.
[0029] S3. Based on the basic detection model, an identification model is constructed by embedding attention modules in several feature layers of the feature fusion network. The attention modules are used to divide the channel feature maps into groups to establish a correspondence with the morphological features of poppies. Spatial attention weights are strengthened for poppy seedling stage targets, channel feature responses are strengthened for poppy fruiting stage targets, and spatial and channel attention weights are balanced for poppy bud stage targets. Cross-group feature fusion is achieved through channel shuffling. In one embodiment, embedding an attention module into several feature layers of a feature fusion network includes: embedding an attention module into several feature layers of the feature fusion network of a basic detection model; the several feature layers are adjacent to each other; using the attention module, the feature map is divided into different groups of channel features according to a preset number of groups; the different groups of channel features include poppy leaf feature channels, poppy flower feature channels, and poppy fruit feature channels, and the number of channels in each group of channel features is equal; based on the attention module, spatial attention weights are strengthened for poppy seedling stage targets, channel feature responses are strengthened for poppy fruiting stage targets, and spatial and channel attention weights are balanced for poppy bud stage targets; cross-group feature fusion is achieved through channel shuffling, and different groups of channel features are rearranged in a specific order to promote the interaction of poppy leaf, poppy flower, and poppy fruit features.
[0030] In one embodiment, the spatial attention weights for poppy seedling targets are enhanced by generating a two-dimensional attention mask. Specifically, this includes: performing global average pooling and max pooling on the feature map and compressing the dimension using a convolutional kernel of a preset size; and outputting a spatial weight matrix based on the compressed feature map using an activation function to enhance the weights for poppy seedling targets.
[0031] In one embodiment, the enhanced channel feature response of the poppy fruiting stage is achieved through channel statistical feature modeling, specifically including: calculating the mean and variance of each group of channel features and mapping them through a fully connected network; based on the mapping results, outputting channel weight vectors through an activation function to enhance the response intensity of the poppy fruit feature channels.
[0032] S4. Train the recognition model using a multi-growth-cycle dataset of poppies, and output the poppy growth cycle category, morphological feature location coordinates, and confidence level through the trained recognition model. The training of the recognition model includes setting the training rounds, using a positive sample matching strategy to improve the recall rate, using a loss function to optimize the bounding box localization accuracy, adjusting hyperparameters through a validation set, and using a test set to verify the recognition performance for different growth cycles of poppies.
[0033] In one embodiment, setting the training epochs includes: assigning loss weights to poppy seedling stage targets and setting a first training epoch and a second training epoch; enabling data augmentation in the first training epoch to improve the model's generalization ability; disabling data augmentation in the second training epoch to avoid distortion caused by splicing small targets; and the first training epoch is longer than the second training epoch; using a positive sample matching strategy to improve recall; and using a loss function to optimize bounding box localization accuracy includes: improving the recall rate of poppy bud stage targets through a positive sample matching strategy; and optimizing the bounding box localization accuracy of poppy fruiting stage targets and closely related crops by combining a loss function with a complete intersection-union loss function; and adjusting hyperparameters through a validation set includes: adjusting the learning rate and anchor box size; wherein, a first set of anchor box sizes is set for poppy seedling stage targets, and a second set of anchor box sizes is set for poppy fruiting stage targets, and the first set of anchor box sizes is smaller than the second set of anchor box sizes.
[0034] In one embodiment, the sample sizes of the training set, validation set, and test set are set according to a preset number to cover poppy samples at different growth stages under different scenarios and lighting conditions; wherein, the sample size of the training set is greater than that of the validation set, and the sample size of the validation set is greater than that of the test set; feature-level annotation includes: using annotation tools to annotate poppy flowers, poppy fruits, and stems and leaves, and setting preset labels for each to generate annotation files conforming to the YOLO format; channel shuffling includes: using depthwise separable convolution for feature recombination, and setting the convolution kernel size and stride to predetermined values to avoid information loss during cross-group feature fusion.
[0035] It should be noted that, to address the problems of existing technologies only covering the poppy flowering stage, having a high false negative rate, and being unable to adapt to complex patrol environments, this invention provides a method and system for identifying different growth stages of poppies based on attention enhancement. This enables accurate identification of poppies in the seedling, bud, and fruiting stages, meeting the lightweight requirements for subsequent deployment on mobile terminals or drones. The technical solution includes: 1) Targeted Dataset Construction: Based on the morphological differences of poppies at different growth stages, samples were collected in a 3:4:3 ratio. After standardization of format, normalization of naming, and feature-level annotation, a special data augmentation strategy was designed to solve the problems of insufficient small target samples in the seedling stage and missing samples due to shading in the bud stage. A multi-scene, multi-light dataset adapted to the actual inspection environment was constructed, and the training set, validation set, and test set were divided in an 8:1:1 ratio. 2) Basic model structure selection: YOLOv8 was selected as the basic model, and three core structures were specifically adopted: C2f structure, BiFPN feature fusion network, and anchorless decoupling head, to solve the three major problems of poppy feature reuse, cross-scale target fusion, and detection efficiency, respectively. 3) SA module customization optimization: The SA module is embedded in the multi-scale feature layer of the Neck feature fusion network of YOLOv8. The channel groups are divided according to the features of poppy leaves, flowers and fruits. Attention weights are assigned to the target characteristics of different growth cycles. Cross-feature interaction is promoted through specific channel mixing rules, which strengthens the extraction of key poppy features and improves the anti-interference ability in complex environments. 4) Training strategy adaptation: Combine the needs of poppy identification, optimize the timing of data augmentation, positive sample matching strategy, and loss function combination to improve the recognition performance of small targets (seedlings) and occluded targets (flower buds); 5) Lightweight deployment: Through structural optimization and parameter control, the number of model parameters is ensured to be ≤3.01 million and the computational complexity is ≤8.1 GFLOPs, making it compatible with edge computing devices.
[0036] Specifically, this invention constructs a targeted dataset (poppy multi-growth-cycle dataset) covering the seedling, bud, and fruiting stages of poppies. It designs specific data augmentation and feature-level annotation strategies to address the morphological differences in each stage. After preprocessing and data augmentation, the dataset is divided into training, validation, and test sets. YOLOv8 is selected as the basic detection model, employing a C2f structure, a BiFPN feature fusion network, and a decoupled anchorless structure to enhance feature reuse, cross-scale fusion, and detection efficiency, respectively. A customized SA attention module is embedded in the Neck feature layer, grouped by leaf, flower, and fruit features, and attention weights are assigned to different growth stages. Cross-feature fusion is achieved through specific channel shuffling. An optimized training strategy (dynamically disabling Mosaic enhancement, TaskAlignedAssigner matching, and Distribution Focal loss) is used to improve model performance. This invention addresses the unique challenges of the poppy's multi-cycle growth (small seedlings, bud obstruction, and easily confused fruits) with a targeted solution. It achieves an overall mAP50 of 88.7% and a seedling stage recall rate of 81.5%, while maintaining lightweight characteristics. It can be deployed on drones or mobile terminals to achieve accurate identification and real-time monitoring throughout the entire growth cycle. This solves the problems of incomplete coverage and high false negative rates in existing technologies, providing efficient technical support for drug enforcement.
[0037] Specifically, the attention-enhanced method for identifying different growth stages of poppies includes the following steps: Step 1: Construct a multi-cycle poppy dataset: Images were collected in a ratio of seedling stage:bud stage:fruiting stage = 3:4:3, covering key morphological features such as "short stem + no branching + 5-7 basal leaves" in the seedling stage, "long stalk + drooping ovoid buds" in the bud stage, and "round capsule + pedicel" in the fruiting stage. Scenes such as greenhouses, hillsides, and woodlands were included, along with lighting conditions such as direct and diffused light. For small targets in the seedling stage, a specific enhancement method of "small target copy and paste + background replacement" was used, while for occlusion in the bud stage... The scene was increased by 20% of the occluded samples, and the fruits in the fruiting period were labeled with the dual features of "capsule outline + fruit stalk position". After the format was unified to JPG, the numerical sequence naming was standardized, and the feature level was labeled, the samples were expanded by a combination of original image preservation, mirror flipping, Gaussian noise (standard deviation 0.05-0.15), brightness adjustment (0.6-1.4 times), ±30° random rotation, and translation not exceeding 10% of the image size. The samples were divided into training set, validation set and test set in an 8:1:1 ratio. Step 2: YOLOv8 is selected as the basic detection model. Its architecture consists of three parts: Backbone, Neck, and Head. The Backbone adopts a C2f structure to enhance gradient flow and feature reuse at different growth stages of poppies. The Neck adopts a Bidirectional Feature Pyramid Network (BiFPN) to achieve cross-scale feature fusion between small targets in the seedling stage and large targets in the fruiting stage. The Head adopts an anchorless decoupled structure to separate poppy classification and localization tasks, thereby improving detection efficiency. The model input resolution is set to 640×640. Step 3: Embed the SA (ShuffleAttention) module into the P3, P4, and P5 feature layers of the YOLOv8 Neck feature fusion network to construct the SA-YOLOv8 recognition model. The SA module divides the channel features into 8 groups, where groups 1-3 correspond to poppy leaf feature channels, groups 4-5 correspond to poppy flower feature channels, and groups 6-8 correspond to poppy fruit feature channels, with 32 channels in each group. The SA unit strengthens the spatial attention weight (assigning a weight coefficient of 0.6-0.7) for small targets in the seedling stage (P3 layer), strengthens the channel feature response (assigning a weight coefficient of 0.6-0.7) for large fruits in the fruiting stage (P5 layer), and balances the spatial and channel attention weights (each assigned a weight coefficient of 0.5) for occluded targets in the bud stage (P4 layer). Cross-group feature fusion is achieved through channel shuffling, specifically by rearranging the 8 groups of channel features in the order of "1→5→2→6→3→7→4→8" to promote the interaction of leaf, flower, and fruit features. Step 4: Train the SA-YOLOv8 model using the training set, assigning a loss weight of 1.5 times to the seedling stage samples. The training epochs are set to 200 rounds. Mosaic data augmentation is enabled for the first 190 rounds to improve the model's generalization ability, and disabled for the last 10 rounds to avoid distortion in small object stitching. A Task Aligned Assigner positive sample matching strategy is used to improve the recall rate of occluded targets during the bud stage. Distribution... The Focal loss function is combined with the Complete Intersection over Union (CIoU) loss function to optimize the bounding box localization accuracy of poppy fruits and closely related crops. The learning rate (initial learning rate 0.01, decaying by 10 times every 50 rounds) and anchor box size (set to [10,13], [16,30], [33,23] for the seedling stage, and [116,90], [156,198], [373,326] for the fruiting stage) and other hyperparameters are adjusted using the validation set. The recognition performance at different growth stages is verified using the test set. The model outputs the poppy growth stage category, key morphological feature localization coordinates, and confidence score.
[0038] Specifically, the feature-level annotation in step 1 is completed using the labelImg tool, which annotates poppy flowers, poppy fruits, and stems and leaves, with the labels set as POPPY-flower, POPPY-fruit, and POPPY-leaf, respectively, generating a txt annotation file conforming to the YOLO format.
[0039] Specifically, in step 3, the spatial attention processing of the SA module is achieved by generating a 2D attention mask. Specifically, the feature map is subjected to global average pooling and max pooling. After the dimension is compressed by a 3×3 convolution kernel, the spatial weight matrix is output through the Sigmoid function to strengthen the weight of the small target region in the seedling stage.
[0040] Specifically, in step 3, the channel attention processing of the SA module is achieved through channel statistical feature modeling. Specifically, the mean and variance of each group of channel features are calculated, mapped through a 2-layer fully connected network (64 hidden layer neurons), and then the channel weight vector is output through the Sigmoid function to enhance the response intensity of the poppy fruit feature channel.
[0041] Specifically, in step 4, the sample sizes of the training set, validation set, and test set are 8400, 1800, and 18000, respectively, covering poppy samples at different growth stages under different scenarios and lighting conditions.
[0042] Specifically, in step 3, channel shuffling is implemented using depthwise separable convolution for feature recombination to avoid information loss during cross-group feature fusion. The convolution kernel size is 1×1, and the stride is 1. To facilitate understanding of the above-described technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments: The attention-enhanced method for identifying different growth stages of poppies proposed in this invention follows the following... Figure 1 The complete process shown is "algorithm selection - data construction - model training - optimization comparison - result output", combined with Figure 2 (YOLOv8 network structure) Figure 3 (SA module workflow) Figure 4 The core design (comparison of recognition results) enables accurate identification of poppies throughout their entire growth cycle. The implementation process is explained in detail below, combining diagrams and specific technical parameters.
[0043] Step 1: Construct the corresponding dataset Figure 1 The "dataset construction" stage includes the following steps: Step ①: Data collection. Poppy images were collected from the China Plant Image Database and open-source channels. 3,600 valid images were selected, covering scenes such as greenhouses, hillsides, and woodlands, lighting conditions such as direct light and diffused light, and observation angles such as 45° overhead and 0° eye level. Step 2: Data preprocessing: Use PyCharm scripts to unify the images into JPG format, perform numerical sequence numbering, and use the labelImg tool to label flowers, fruits, stems and leaves to generate YOLO format annotation files; Step 3: Data augmentation: The sample size was expanded to 12,000 images by using a combination of methods, including original image preservation, mirror flipping, Gaussian noise (standard deviation 0.05-0.15), brightness adjustment (0.6-1.4 times), ±30° rotation, and translation within 10%. Step 4: Data partitioning: Divide the data into a training set (8400 images), a validation set (1800 images), and a test set (1800 images) in an 8:1:1 ratio.
[0044] Step 2: Basic Model Selection and Architecture Analysis (corresponding to...) Figure 1 The sections on "YOLOv8 / SSD Model Architecture" and "YOLOv8 / SSD Comparison Experiment" were combined with... Figure 2 The specific steps include: Step ①: Model selection, click Figure 1 The process begins by comparing the performance of two mainstream object detection models, YOLOv8 and SSD. The results show that YOLOv8 significantly outperforms SSD in precision, recall, and mAP50, and also boasts advantages in parameter size and computational complexity. Therefore, YOLOv8 was selected as the base model.
[0045] Step 2: Model building, Figure 2The YOLOv8 demonstration shows that it consists of four parts: Input, Backbone, Neck, and Head. The implementation details of each module are as follows: Input: Mosaic data augmentation is used (enabled in the first 190 rounds of training), which simulates complex planting scenarios by stitching together four images; the input resolution is adaptively adjusted to 640×640 to balance feature preservation and computational efficiency.
[0046] Backbone: Replaces the traditional C3 structure with a C2f structure, enriches the gradient flow through multi-branch residual connections, and enhances the extraction of fine-grained features such as poppy leaf texture and petal morphology.
[0047] Feature Fusion Network (Neck): Employs a BiFPN bidirectional feature pyramid structure to achieve top-down transmission of high-level semantic features and bottom-up supplementation of low-level detailed features, thereby improving the detection capability of multi-scale targets (small targets in the seedling stage and large targets in the fruiting stage).
[0048] The detection head adopts an anchor-free decoupled design, separating the classification (Cls) and bounding box regression (Box) tasks to avoid task interference; the classification branch uses binary cross-entropy loss, and the regression branch combines distribution focal loss and CIoU loss to optimize positioning accuracy.
[0049] Step 3: Model optimization by embedding the SA attention module (corresponding to...) Figure 1 In the "Further Model Optimization" phase, combined with Figure 3 The specific steps include: Step ①: SA module selection, according to... Figure 1 The process involves embedding two attention mechanisms, SA and CBAM, into YOLOv8. Experimental comparisons show that the SA module, while maintaining the same number of parameters (3.006 million) and computational complexity (8.1G FLOPs), achieves an mAP50 of 88.7% and a recall of 83.9%, significantly outperforming the CBAM module (mAP50=88.5%, recall=83.2%). Therefore, the SA module was selected for optimization.
[0050] Step 3: SA module implementation process (corresponding to) Figure 3 ), Figure 3 This document details the workflow of the SA module, specifically the "channel grouping - attention processing - channel shuffling - feature fusion" process. The specific implementation steps are as follows: Step a: Channel grouping. The 256-channel feature map output by the Neck layer is divided into 8 groups (32 channels per group) according to function. Groups 1-3 correspond to poppy leaf features, groups 4-5 correspond to poppy flower features, and groups 6-8 correspond to poppy fruit features, so as to achieve targeted feature processing.
[0051] Step b: Joint attention processing, firstly spatial attention: global average pooling and global max pooling are performed on each set of feature maps, and after 3×3 convolution to compress the dimensions, the sigmoid function is applied ( Figure 3 middle σ (・) Generates spatial attention masks to enhance the local features of small targets in the seedling stage and occluded targets in the bud stage. The second is channel attention: through... Fe ( x )= Wx + b Linear transformation ( Figure 3 Model each group of channel features and generate dynamic weight vectors to improve the response intensity of key feature channels such as poppy flowers and fruits.
[0052] Step c: Channel shuffling and feature fusion, through Figure 3 The “Channel Shuffle” operation rearranges the 8 channels to achieve cross-channel information interaction; after “Concat” concatenation, “element-wise product” element-wise multiplication, and “Fuse” fusion, an enhanced feature map is output, and then the training process is stabilized through GN (group normalization).
[0053] Step d: Embedding location. The SA module is embedded into the Neck feature fusion network of YOLOv8 to enhance the extraction of key information of multi-scale features and improve the anti-interference ability in complex backgrounds.
[0054] Step 4: Model Training and Comparative Experiments (corresponding to...) Figure 1 The "SA-YOLOv8 Training" and "Experimental Comparison" sections include the following steps: Step ①: Training environment and parameter settings. In this embodiment, the hardware environment is an NVIDIA RTX3060 graphics card (8GB VRAM), an AMD Ryzen 7 5800H processor, and 16GB DDR4 memory; the software environment is Windows 11 Professional, Python 3.10, PyTorch 2.0, CUDA 11.7, and Ultralytics 8.0.200; the training parameters are 200 training rounds, with Mosaic data augmentation enabled for the first 190 rounds and disabled for the last 10 rounds to improve the accuracy of small target recognition; the initial learning rate is 0.01, decaying by a factor of 10 every 50 rounds; and the Task Aligned Assigner positive sample matching strategy is adopted.
[0055] Step 2: Model performance verification, corresponding to Figure 1 "Comprehensive Indicator Comparison" verifies the performance of the SA-YOLOv8 model based on metrics such as precision, recall, and mAP50. Comprehensive indicators: Precision 82.4%, Recall 83.9%, mAP50 = 88.7%; Feature-specific indicators: Poppy flower recognition precision 0.962, Poppy fruit 0.893, Poppy leaf 0.806, all superior to the basic model and the CBAM optimized model.
[0056] Comparison and analysis of recognition performance (corresponding) Figure 4 The specific analysis is as follows: YOLOv8 basic model recognition results ( Figure 4 The upper part detected some poppy flowers, poppy leaves and poppy fruits, but there were obvious missed detections (some seedling leaves were not identified) and low confidence labels; the main problem was the insufficient ability to extract fine-grained features (such as leaf texture) in complex backgrounds and the insufficient response intensity of key features.
[0057] SA-YOLOv8 model recognition results ( Figure 4 In the lower half, poppy flowers, poppy leaves, and poppy fruits were detected in all images, with an overall improvement in confidence and no obvious missed detections. Through channel shuffling and attention enhancement in the SA module, the model's sensitivity to key poppy features was significantly improved, effectively filtering out complex background interference and solving the problems of missed detections and low confidence annotation in the basic model.
[0058] It should also be noted that the function and selection criteria of some of the technical features involved in this invention are as follows: 1) Selection of C2f structure, BiFPN, and decoupled anchorless structure In this invention, the C2f structure is used to enhance the reuse of features and the continuity of gradient flow across different growth stages of poppies. The stem and leaf texture during the poppy seedling stage, the petal morphology during the bud stage, and the fruit outline during the fruiting stage are all key recognition features. The C2f structure, through multi-branch residual connections, allows the model to retain these fine-grained features even in deep networks, avoiding gradient vanishing. Compared to the C3 structure of YOLOv5, the C2f structure increases the number of branches, effectively distinguishing subtle morphological differences between poppies and weeds or closely related crops, while the C3 structure is prone to information loss when processing small target (seedling) features.
[0059] In this invention, BiFPN (Bidirectional Feature Pyramid Network) is used to achieve cross-feature fusion for multi-scale targets in poppies. Seedlings are considered small targets (corresponding to the P3 feature layer), while fruiting stages are considered large targets (corresponding to the P5 feature layer). BiFPN uses top-down upsampling to pass high-level semantic features and bottom-up downsampling to supplement low-level detailed features, ensuring sufficient semantic support for small targets (seedlings) and accurate detailed localization for large targets (fruits), thus solving the problem that single-scale features cannot adequately cover targets at multiple growth stages. Compared to traditional FPN, BiFPN adds cross-layer connections and weighted feature fusion, adapting to mixed detection scenarios of small targets in the poppy seedling stage and large targets in the fruiting stage, while traditional FPN has a recall rate of less than 70% in small target detection.
[0060] In this invention, a decoupled anchor-free structure is used to separate poppy classification and localization tasks, improving detection efficiency and localization accuracy. Poppy identification requires the simultaneous output of "growth cycle category" and "target coordinates." The decoupled structure extracts morphological features through independent classification branches and predicts bounding boxes through regression branches, avoiding interference between tasks. The anchor-free design eliminates the need for pre-set anchor boxes and can adapt to the size changes of poppies at different growth stages (seedling width-to-height ratio 1:2, fruit width-to-height ratio 1:1), solving the problem of missed detections caused by improper anchor point matching. Compared to the coupled anchor point structure of YOLOv7, the decoupled anchor-free structure improves detection speed by 25% and reduces localization error by 12%, making it particularly suitable for real-time UAV patrol scenarios. In contrast, the coupled anchor point structure is prone to anchor box mismatch when dealing with changes in fruit size.
[0061] 2) Detailed steps of the attention module The first step is channel grouping: The 256-channel feature map (channel dimension C=256) output by the Neck feature layer is divided into 8 groups of 32 channels each. The grouping rule is functionally related feature clustering, that is, groups 1-3 (96 channels) correspond to poppy leaf features (color, texture, edge), groups 4-5 (64 channels) correspond to poppy flower features (petal color, outline, pedicel), and groups 6-8 (96 channels) correspond to poppy fruit features (capsule outline, pedicel position, surface texture). The features of poppy leaves, flowers, and fruits have different response patterns in the channel dimension. After grouping, the weights of each feature channel can be strengthened in a targeted manner to avoid interference from irrelevant features. The random grouping of the general SA module cannot adapt to the feature distribution of poppies.
[0062] The second step involves joint spatial and channel attention processing: For spatial attention, global average pooling (GAP) and global max pooling (GMP) are performed on each set of feature maps to obtain two 1×1×32 statistical feature vectors; these two vectors are concatenated and input into a 3×3 convolution kernel (with padding 1) to compress the dimension to 1×1×32, and then the spatial attention mask (size equal to the input feature vector) is output via the Sigmoid function. Figure 1For the seedling stage (P3 layer), the weight coefficient of the target region in the mask is adjusted to 0.6-0.7, and the weight coefficient of the background region is reduced to 0.1-0.2 to enhance the features of small targets; for the bud stage (P4 layer), the weight coefficient of the area surrounding the occluded region is increased to 0.5-0.6 to achieve complete contour capture of the occluded target. Regarding channel attention processing, the mean (μ) and variance (σ) are calculated for each group of channel features. 2 The process yields a 2×32 statistical vector. A two-layer fully connected network is input (first layer: 64 neurons, ReLU activation function; second layer: 32 neurons, Sigmoid activation function), outputting a 32-dimensional channel weight vector. For the result period (P5 layer), the channel weight coefficients for groups 6-8 corresponding to the poppy fruit features are adjusted to 0.6-0.7 to suppress interference from leaf and flower feature channels and improve fruit localization accuracy.
[0063] The third step is channel shuffling to achieve cross-group feature fusion: the 8 channels (32 channels per group) are rearranged in the order "1→5→2→6→3→7→4→8", that is, the 1st group (leaf features) is adjacent to the 5th group (flower features), and the 3rd group (leaf features) is adjacent to the 7th group (fruit features), forming a mixed channel sequence of "leaf-flower-leaf-fruit-leaf-fruit-flower-fruit". Then, a 1×1 depthwise separable convolution (stride 1, padding 0) is used to linearly transform the recombined channel features to promote the interaction of leaf, flower, and fruit features. Poppy identification requires the combination of leaf, flower, and fruit features (such as leaves only in the seedling stage, leaves and flowers in the bud stage, and leaves and fruits in the fruiting stage). Channel shuffling allows the model to capture both single and combined features simultaneously, improving the accuracy of judging the growth cycle category. The random arrangement of traditional channel shuffling cannot meet this requirement of combined features.
[0064] 3) Training Strategy Description Disabling Mosaic Data Augmentation: This invention disables Mosaic data augmentation during the last 10 training epochs. Mosaic data augmentation increases sample diversity by stitching together four images, but it can cause small targets in the early stages to be stretched, occluded, or cropped, affecting the learning of small target features. Disabling this augmentation allows the model to focus on learning small target features at the original scale, improving the recall rate in the early stages and solving the problem of missed detections caused by the distortion of small targets.
[0065] Positive sample matching strategy: This invention adopts the Task Aligned Assigner positive sample matching strategy, which matches positive samples through the dual dimensions of "classification score and positioning accuracy" to avoid occluded targets being judged as negative samples due to positioning deviation, thereby improving the recall rate in the bud stage and reducing the missed detection of some occluded targets compared with the traditional IOU matching strategy.
[0066] Loss Function: This invention employs the Distribution Focal loss function. The bounding boxes of poppy fruits are relatively similar to those of tomatoes, eggplants, and other crops, making traditional loss functions prone to localization bias. This function, by focusing on the peak regions of the bounding box distribution, enhances the learning of subtle localization differences, effectively distinguishing poppy fruits from those of common crops.
[0067] like Figure 6 As shown, according to another embodiment of the present invention, an attention-enhanced poppy growth cycle identification system is also provided, the attention-enhanced poppy growth cycle identification system comprising: Data acquisition and preprocessing module 1 is used to construct a multi-cycle dataset of poppies. The multi-cycle of poppies includes the seedling stage, bud stage, and fruiting stage. During the construction of the multi-cycle dataset, for the poppy seedling stage target, target copy-paste and background replacement are used for specific enhancement. For the poppy bud stage target, a preset proportion of occlusion samples are added to the occlusion scene. For the poppy fruiting stage target, dual feature annotation of capsule outline and pedicel position is performed. Model building module 2 is used to select a basic detection model. The architecture of the basic detection model includes a backbone network, a feature fusion network, and a detection head. The backbone network is used to enhance the gradient flow and feature reuse at different growth stages of poppies. The feature fusion network is used to achieve cross-scale feature fusion. The detection head is used to separate poppy classification and localization tasks. Training optimization module 3 is used to build a recognition model based on the basic detection model by embedding attention modules in several feature layers of the feature fusion network. The attention module is used to divide the channel feature maps into groups to establish the correspondence with poppy morphological features, strengthen the spatial attention weight for poppy seedling stage targets, strengthen the channel feature response for poppy fruiting stage targets, balance the spatial and channel attention weights for poppy bud stage targets, and achieve cross-group feature fusion through channel shuffling. The recognition output module 4 is used to train the recognition model using a multi-growth-cycle dataset of poppies, and output the poppy growth cycle category, morphological feature location coordinates and confidence score through the trained recognition model. The training of the recognition model includes setting the training rounds, using a positive sample matching strategy to improve the recall rate, using a loss function to optimize the bounding box localization accuracy, adjusting hyperparameters through a validation set, and using a test set to verify the recognition performance for different growth cycles of poppies.
[0068] In one embodiment, the data acquisition and preprocessing module 1 is used to perform the dataset construction operation in step 1, including multi-scene image acquisition, specialized data augmentation, feature-level annotation, and dataset partitioning; the model construction module 2 is used to build the YOLOv8 basic model described in step 2, embedding the SA attention module in the P3, P4, and P5 layers of the Neck feature fusion network, and configuring channel grouping rules and attention weight allocation strategies; the training and optimization module 3 is used to perform the training operation in step 4, including loss weight configuration, data augmentation switch control, application of positive sample matching strategy, and hyperparameter optimization; the recognition output module 4 is used to receive on-site images collected by drones or mobile terminals, and output the poppy growth cycle category, location coordinates, and confidence level through the trained SA-YOLOv8 model, with a response time ≤ 0.5 seconds / frame.
[0069] In one embodiment, the attention-enhanced poppy growth cycle identification system can be deployed on mobile terminals or drones to achieve real-time monitoring and precise location of poppy cultivation.
[0070] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. 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. A method for identifying different growth stages of poppies based on attention enhancement, characterized in that, include: S1. Construct a multi-cycle dataset of poppies; during the construction of the multi-cycle dataset of poppies, for the target of poppy seedling stage, target copy and paste and background replacement are used for special enhancement; for the target of poppy bud stage, a preset proportion of occlusion samples are added for the occlusion scene; for the target of poppy fruiting stage, dual feature annotation of capsule outline and fruit stalk position is performed. S2. Select a basic detection model; the architecture of the basic detection model includes a backbone network, a feature fusion network, and a detection head; the backbone network is used to enhance the gradient flow and feature reuse of poppies at different growth stages, the feature fusion network is used to achieve cross-scale feature fusion, and the detection head is used to separate poppy classification and localization tasks. S3. Based on the basic detection model, an identification model is constructed by embedding attention modules in several feature layers of the feature fusion network. The attention modules are used to divide the channel feature maps into groups to establish a correspondence with the morphological features of poppies. Spatial attention weights are strengthened for poppy seedling stage targets, channel feature responses are strengthened for poppy fruiting stage targets, and spatial and channel attention weights are balanced for poppy bud stage targets. Cross-group feature fusion is achieved through channel shuffling. S4. Train the recognition model using a multi-growth-cycle dataset of poppies, and output the poppy growth cycle category, morphological feature location coordinates, and confidence level through the trained recognition model; the training of the recognition model includes setting the training rounds, adopting a positive sample matching strategy to improve the recall rate, using a loss function to optimize the bounding box location accuracy, adjusting hyperparameters through a validation set, and using a test set to verify the recognition performance for different growth cycles of poppies.
2. The method for identifying different growth stages of poppies based on attention enhancement according to claim 1, characterized in that, The construction of the poppy multi-growth-cycle dataset includes: Images of poppy seedlings, buds, and fruits were collected according to a preset ratio to obtain an effective image set; this effective image set includes images of different scenes, different lighting conditions, and different lighting angles. Based on the effective image set, for poppy seedling stage targets, target copy-paste and background replacement are used for specific enhancement; for poppy bud stage targets, a preset proportion of occlusion samples are added to the occlusion scene; for poppy fruiting stage targets, dual feature annotation of capsule outline and pedicel position is performed to obtain the sample set. The sample set was formatted, the numerical sequence naming was standardized, and the feature level was labeled. The sample was expanded by combining the samples and divided into training set, validation set and test set according to the preset ratio to obtain the poppy multi-growth cycle dataset.
3. The method for identifying different growth stages of poppies based on attention enhancement according to claim 2, characterized in that, The effective image set includes different morphological features of poppies; The poppy seedling stage target includes characteristics of short stems, no branches and basal leaves; the poppy bud stage target includes characteristics of long stalks and drooping ovoid buds; and the poppy fruiting stage target includes characteristics of round capsules and fruit stalks. The combination methods include original image preservation, mirror flipping, Gaussian noise, brightness adjustment, random rotation, and translation.
4. The method for identifying different growth stages of poppies based on attention enhancement according to claim 1, characterized in that, The basic detection model adopts YOLOv8; the backbone network adopts a C2f structure; the feature fusion network adopts a bidirectional feature pyramid network; and the detection head adopts an anchorless decoupled structure. The input resolution of the basic detection model is set to a predetermined value.
5. The method for identifying different growth stages of poppies based on attention enhancement according to claim 1, characterized in that, The embedding of attention modules in several feature layers of the feature fusion network includes: An attention module is embedded into several feature layers of the feature fusion network of the basic detection model; the several feature layers are adjacent to each other; The attention module divides the feature map into different groups of channel features according to a preset number of groups; the different groups of channel features include poppy leaf feature channels, poppy flower feature channels and poppy fruit feature channels, and the number of channels in each group of channel features is equal; Based on the attention module, spatial attention weights are strengthened for poppy seedling stage targets, channel feature responses are strengthened for poppy fruiting stage targets, and spatial and channel attention weights are balanced for poppy bud stage targets. Cross-group feature fusion is achieved through channel mixing and the channel features of different groups are rearranged in a specific order to promote the interaction of features of poppy leaves, poppy flowers and poppy fruits.
6. The method for identifying different growth stages of poppies based on attention enhancement according to claim 5, characterized in that, The enhancement of spatial attention weights for poppy seedling stage targets is achieved by generating a two-dimensional attention mask, specifically including: Global average pooling and max pooling are performed on the feature map, and the dimensions are compressed using convolution kernels of a preset size; Based on the compressed feature map, an activation function is used to output a spatial weight matrix to enhance the weight of the target during the poppy seedling stage.
7. The method for identifying different growth stages of poppies based on attention enhancement according to claim 5, characterized in that, The enhanced channel feature response to the poppy fruiting stage is achieved through channel statistical feature modeling, specifically including: Calculate the mean and variance of each group of channel features and map them through a fully connected network; Based on the mapping results, the channel weight vector is output through the activation function to enhance the response intensity of the poppy fruit feature channel.
8. The method for identifying different growth stages of poppies based on attention enhancement according to claim 1, characterized in that, The setting of training rounds includes: assigning loss weights to poppy seedling stage targets and setting a first training round and a second training round; enabling data augmentation in the first training round to improve the model's generalization ability; and disabling data augmentation in the second training round to avoid distortion in the splicing of small targets; and the first training round is longer than the second training round. The method of using positive sample matching strategy to improve recall and using loss function to optimize bounding box localization accuracy includes: improving the recall of poppy bud stage targets through positive sample matching strategy, and optimizing the bounding box localization accuracy of poppy fruiting stage targets and closely related crops by combining loss function with complete intersection-union loss function. The adjustment of hyperparameters through the validation set includes: adjusting the learning rate and anchor frame size; wherein, a first set of anchor frame sizes is set for the poppy seedling stage target, and a second set of anchor frame sizes is set for the poppy fruiting stage target, and the first set of anchor frame sizes is smaller than the second set of anchor frame sizes.
9. The method according to claim 2, characterized in that, The sample sizes of the training set, validation set, and test set are set according to a preset number to cover poppy samples at different growth stages under different scenarios and lighting conditions; wherein, the sample size of the training set is greater than that of the validation set, and the sample size of the validation set is greater than that of the test set. The feature-level annotation includes: using annotation tools to annotate poppy flowers, poppy fruits, and stems and leaves, and setting preset labels for each to generate annotation files that conform to the YOLO format; The channel shuffling includes: using depthwise separable convolution for feature recombination, and setting the convolution kernel size and stride to predetermined values to avoid information loss during cross-group feature fusion.
10. A poppy growth cycle identification system based on attention enhancement, used to implement the poppy growth cycle identification method based on attention enhancement as described in any one of claims 1-9, characterized in that, The system includes: The data acquisition and preprocessing module is used to construct a multi-cycle poppy dataset. During the construction of the multi-cycle poppy dataset, for poppy seedling stage targets, target copy-paste and background replacement are used for specific enhancement. For poppy bud stage targets, a preset proportion of occlusion samples are added to the occlusion scene. For poppy fruiting stage targets, dual feature annotation of capsule outline and pedicel position is performed. The model building module is used to select a basic detection model; the architecture of the basic detection model includes a backbone network, a feature fusion network, and a detection head; the backbone network is used to enhance the gradient flow and feature reuse at different growth stages of poppies, the feature fusion network is used to achieve cross-scale feature fusion, and the detection head is used to separate poppy classification and localization tasks. The training optimization module is used to construct a recognition model based on the basic detection model by embedding attention modules in several feature layers of the feature fusion network. The attention modules are used to divide the channel feature maps into groups to establish a correspondence with poppy morphological features, strengthen the spatial attention weight for poppy seedling stage targets, strengthen the channel feature response for poppy fruiting stage targets, balance the spatial and channel attention weights for poppy bud stage targets, and achieve cross-group feature fusion through channel shuffling. The identification output module is used to train an identification model using a multi-growth-cycle dataset of poppies, and output the poppy growth cycle category, morphological feature location coordinates, and confidence level through the trained identification model. The training of the identification model includes setting the number of training rounds, using a positive sample matching strategy to improve the recall rate, using a loss function to optimize the bounding box localization accuracy, adjusting hyperparameters through a validation set, and using a test set to verify the identification performance of different growth cycles of poppies.