Flax, also known as oilseed flax, is one of the most important economic crops in northern China, due to its short growth cycle and broad adaptability. However, the frequent occurrence of diseases, pests, and weeds has severely reduced flax yield and quality under global warming. Conventional manual detection is also time-consuming, labor-intensive, and prone to subjective errors. Computer vision and deep learning have made significant advancements in pest detection. Existing models have also posed great challenges, such as low recognition accuracy for flax-specific biotic stresses, large computational complexity, and low adaptability to resource-constrained scenarios. Most models focus only on diseases or pests in recent years. In this study, a lightweight target detection model was proposed to simultaneously identify the flax diseases, pests, and weeds using improved YOLOv11n. A dataset was also constructed after field collection in two major flax-producing regions of Gansu Province, China. 1296 high-resolution (4 032×3024) original images were captured using iPhone 14 ProMax and iPad Pro devices, thereby covering 8 categories: 5 pests (Meloidae, Shield bug, Colasposoma dauricum, Formicidae, and Helicoverpa armigera), 2 diseases (Verticillium dahliae, and Yellow leaf disease), and 1 weed category (Chenopodiaceae-dominated weeds). After data preprocessing to remove blurred or occluded images, offline augmentation techniques (rotation, flipping, random cropping, brightness/contrast adjustment, and Gaussian blur) and online Mosaic augmentation were applied to expand the dataset to 7 146 images, which were split into training (5 002), validation (1 429), and test (715) sets at a 7:2:1 ratio. Three improvements were implemented to optimize the YOLOv11n model: First, the original C3k2 module was replaced with a lightweight C3k2_S (C3k2_Star) module in the backbone network. Bottleneck layers are also substituted with StarBlock, indicating a star-shaped topology with multi-branch feature interaction. Initial lightweighting was then achieved to maintain feature extraction. Second, a neck network, named DWE_BiFPN (Depthwise Separable Convolution and Efficient Channel Attention-Bidirectional Feature Pyramid Network), was designed to integrate BiFPN for bidirectional multi-scale feature fusion. Standard convolutions with depthwise separable convolutions (DWConv) were replaced to reduce computational overhead. Efficient Channel Attention (ECA) mechanisms were added at the P3, P4, and P5 feature layers for the high sensitivity to critical features. Third, the conventional detection head was replaced with a lightweight LSCD (Lightweight Shared Convolutional Detection) head. Grouped convolutions and parameter sharing were used to reduce model complexity while fitting into the improved lightweight architecture. Experimental results demonstrated that the improved model achieved significant performance gains. On the self-built dataset, the precision, recall, and mean average precision (mAP@0.5) reached 89.3%, 91.6%, and 88.1%, respectively, which increased by 1.8, 5.4, and 2.8 percentage point, compared with the baseline YOLOv11n. In terms of resource efficiency, the parameters were reduced to 1.6M, computational complexity to 5.1GFLOPs, and model size to 3.4 MB, with a detection speed of 98.6 frames per second. Comparative analysis with mainstream models (Faster R-CNN, SSD, YOLOv5n, YOLOv8n, and YOLOv12n) showed that the improved model outperformed competitors in both accuracy and lightweight performance, particularly in small target detection and complex background suppression, as verified by GradCAM++ heatmap visualization. The model was evaluated on a public wheat disease dataset, thus achieving 83.2% precision, 85.9% recall, and 79.6% mAP@0.5—outperforming the baseline YOLOv11n by 4.4, 5.6, and 4.3 percentage point, respectively. Generalization was validated for different crop disease detection. In conclusion, the improved YOLOv11n model achieved a balance between detection accuracy and lightweight, suitable for real-time deployment on resource-constrained devices in field environments. The finding can provide a scientific basis for the precise identification and green control of flax diseases, pests, and weeds. Future work can be expected to expand the dataset into more flax biotic stress for the high robustness under extreme field conditions, such as heavy occlusion.
- Article type
- Year
- Co-author
Lodging is a major agronomic constraint that adversely affects both yield and quality in field crops, with flax (Linum usitatissimum L.) being especially vulnerable due to its slender stems and susceptibility to wind and rainfall. Precise delineation of lodged areas from field imagery remains a significant challenge owing to the complex and heterogeneous morphology of lodging patterns, irregular and blurred boundaries, and substantial background interference from upright plants, weeds, and soil textures. These factors necessitate the development of a segmentation framework that combines high precision and strong boundary adherence with computational efficiency, enabling deployment on resource-constrained agricultural monitoring platforms. In response to this need, a lightweight accurate lodging segmentation approach based on improved YOLOv11n-seg architecture was proposed to enhance finegrained feature sensitivity, multi-scale representation capability, and boundary precision, while markedly reducing parameter count, giga floating-point operations (GFLOPs), and model size.
The proposed architecture integrated targeted modifications across the backbone, neck, and output stages. In the backbone, standard C3k2 modules were replaced with C3k2_SDW blocks, which combined a StarBlock structure with depthwise separable convolutions to reduce redundancy and computation without sacrificing spatial and contextual representational capacity. To counteract potential reductions in channel discrimination resulting from light-weighting, a multi-scale efficient channel attention (MS-ECA) mechanism was embedded within selected backbone layers, yielding C3k2_SDW_MS-ECA modules. These modules incorporated parallel convolution branches with varying kernel sizes to capture channel-wise dependencies across multiple receptive fields, thereby adaptively recalibrating lodging-related features with minimal computational overhead. In the neck, a bidirectional feature pyramid network (BiFPN) was introduced to facilitate efficient bidirectional information exchange between scales. By assigning normalized, trainable fusion weights, the BiFPN adaptively balanced contributions from low-and high-level feature maps, while a multi-stage semantic fusion strategy further enriched the integration of spatial details and contextual semantics, thereby improving the detection of small and fragmented lodged patches. At the output stage, a boundary refinement procedure was applied to the predicted masks, improving contour sharpness, enhancing boundary compactness, and mitigating false detections in complex visual environments. The experimental dataset comprised unmanned aerial vehicle (UAV) RGB imagery at a resolution of 4032×2268 pixels, acquired from flax fields in Dingxi, Gansu province. Lodged regions were manually annotated with polygonal masks. To increase robustness against variability in illumination, background complexity, and lodging morphology, data augmentation techniques, including random rotation, brightness and contrast adjustment, and blurring were employed, expanding the dataset to 3852 images. The dataset was divided into training, validation, and testing subsets in a 75%, 15% and 10% split. Model training was conducted with 640×640 pixel inputs for 300 epochs using stochastic gradient descent (initial learning rate 0.01, momentum 0.937, weight decay 0.0005) in PyTorch 2.0.0. Evaluation involved comparison with YOLACT, YOLOv7-seg, YOLOv8n-seg, and the original YOLOv11n-seg using precision (P), recall (R), mAP@0.5, mAP@0.5: 0.95, parameter count, GFLOPs, and model size.
Ablation experiments demonstrated the incremental contributions of each architectural component. Substituting C3k2 with C3k2_SDW reduced parameters from 2.83 M to 2.14 M and computation from 10.2 to 8.1 GFLOPs, with slight performance improvements. Incorporating BiFPN further lowered complexity to 1.68 M parameters and 7.7 GFLOPs, accompanied by notable gains in detection metrics. The addition of MS-ECA attention achieved the highest performance, delivering P of 92.6%, R of 92.0%, and mAP@0.5 of 95.2%, corresponding to improvements of 3.7 percentage points in Precision and 2.1 percentage points in mAP@0.5 over the YOLOv11n-seg baseline, without increasing model size. Qualitative Grad-CAM visualizations revealed more precise focus on lodging regions and reduced false activations in upright stems and non-lodged soil areas. Generalization capability was further validated on the public WE3 DS agricultural segmentation dataset, where the proposed model achieved average improvements of 4.3, 1.9, and 2.6 percentage points in precision, recall, and mAP@0.5, respectively, compared to the baseline.
The improved YOLOv11n-seg architecture achieves a superior balance between accuracy and efficiency for flax lodging segmentation by combining the C3k2_SDW_MS-ECA backbone, BiFPN with multi-stage semantic fusion in the neck, and output boundary refinement. This combination of high accuracy, lightweight design, and robust boundary delineation renders the model highly applicable to real-time, in-field deployment for intelligent lodging monitoring and precision agriculture. The results further suggest that the approach is transferable to broader agricultural segmentation tasks, providing a practical and scalable solution for modern smart farming applications.
Accurate lodging detection is often required to the harvester operations. The missed or false detections can directly affect the stubble height control, leading to the low harvesting efficiency and crop wastes. Although remote sensing data has been widely applied in various fields, such data cannot be directly used in crop harvesting operations with the harvesters. Alternatively, the artificial intelligence and machine vision can be expected to detect the crop lodging in recent years. Most deep learning-based studies have been identified the crop lodging areas of the staple crops, such as wheat, corn, and rice. It is still lacking on the flax. In this study, the industrial cameras were installed on the harvesters, in order to collect the real-time image data from flax fields. The visual data was captured to guide the harvesting operations. Precise lodging detection was realized to optimize the harvesting performance. A lightweight model was also proposed to detect the flax lodging under the complex backgrounds and high computational costs using DeepLabV3+s. The MobileNetV2 was adopted as the lightweight backbone network. Training time was significantly shortened for the feature extraction using inverted residual structures and linear bottleneck layers. The MobileNetV2 was substantially reduced both training time and computational costs. The hardware deployment was feasible for the real-time detection on the rice lodging. The flax lodging areas were identified to effectively simulate the spatial location and long-range dependencies. Therefore, a Coordinate Attention (CA) mechanism was incorporated into the encoder-decoder structure of DeepLabV3+. The feature maps were then decomposed along the horizontal and vertical directions. Spatial features were individually captured to enhance the lodging areas using attention mechanisms. Experimental results demonstrated that the CA was significantly improved the recognition accuracy of the lodging areas, particularly for the detection performance under the complex backgrounds. The conventional Cross-Entropy Loss (CE_Loss) was replaced with the Focal Loss, in order to balance the data class. The sample weights were dynamically adjusted to detect the hard-to-classify lodging. Additionally, the Dice Loss was integrated into the total loss function, in order to further improve the precision of the segmentation boundaries. The Intersection over Union (IoU) was directly optimized to enhance the performance of the segmentation. In training with 200 epochs, the improved DeepLabV3+ model was enhanced both accuracy and efficiency in the recognition of the flax lodging. The average precision reached as high as 95.96%, with the mean Intersection over Union (mIoU) and mean Pixel Accuracy (mPA) of 92.55% and 96.11%, respectively. Compared with the HRNet, PSPNet, U-Net, SegNeXt-S, and the original DeepLabV3+ models, the mIoU of the improved model increased by 1.08, 3.74, 3.06, 11.79, and 1.59 percentage points, respectively, while its mPA increased by 0.92, 2.80, 1.58, 8.68, and 1.17 percentage points, respectively. The training time was reduced from 27.3 h (original DeepLabV3+) to 14.2 h, fully meeting the real-time recognition requirements with an average detection frame rate of 83 frames per second. The backbone network was replaced with the MobileNetV2. The training efficiency was significantly improved, where the training time was reduced by 12.4 h, while the mIoU and mPA decreased by only 0.49 and 0.20 percentage points, respectively. The training cost was substantially reduced with the minimal precision loss. Furthermore, the training time increased slightly under CA attention mechanism, but the mIoU and mPA increased by 1.30 and 0.81 percentage points, respectively, indicating the high accuracy. The loss function was also significantly improved the model performance. The training time reached the minimum of 14.2 h, while the mIoU and mPA reached 92.55% and 96.11%, respectively. The mIoU increased by 1.59, 2.08, and 0.78 percentage points, respectively, while the mPA increased by 1.17, 1.37, and 0.56 percentage points, respectively. Therefore, the intelligent flax harvesting can be expected to identify the lodging areas. This finding can provide the feasible technical solution to the real-time lodging detection and harvester optimization in modern agriculture.
京公网安备11010802044758号