Next Article in Journal
Climate Change Risks and Green Low-Carbon Development in Agriculture: Evidence from China on the Regulatory Role of Agricultural Insurance and Spatial Spillover Effects
Previous Article in Journal
Soybean Yield Prediction with High-Throughput Phenotyping Data and Machine Learning
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Crop Row Line Detection for Rapeseed Seedlings in Complex Environments Based on Improved BiSeNetV2 and Dynamic Sliding Window Fitting

1
College of Engineering, Huazhong Agricultural University, Wuhan 430070, China
2
Key Laboratory of Agricultural Equipment in Mid-Lower Yangtze River, Ministry of Agriculture and Rural Affairs, Wuhan 430070, China
*
Author to whom correspondence should be addressed.
Agriculture 2026, 16(1), 23; https://doi.org/10.3390/agriculture16010023
Submission received: 14 November 2025 / Revised: 13 December 2025 / Accepted: 18 December 2025 / Published: 21 December 2025
(This article belongs to the Section Artificial Intelligence and Digital Agriculture)

Abstract

Crop row line detection is essential for precision agriculture, supporting autonomous navigation, field management, and growth monitoring. To address the low detection accuracy of rapeseed seedling rows under complex field conditions, this study proposes a detection framework that integrates an improved BiSeNetV2 with a dynamic sliding-window fitting strategy. The improved BiSeNetV2 incorporates the Efficient Channel Attention (ECA) mechanism to strengthen crop-specific feature representation, an Atrous Spatial Pyramid Pooling (ASPP) decoder to improve multi-scale perception, and Depthwise Separable Convolutions (DS Conv) in the Detail Branch to reduce model complexity while preserving accuracy. After semantic segmentation, a Gaussian-filtered vertical projection method is applied to identify crop-row regions by locating density peaks. A dynamic sliding-window algorithm is then used to extract row trajectories, with the window size adaptively determined by the row width and the sliding process incorporating both a lateral inertial-drift strategy and a dynamically adjusted longitudinal step size. Finally, variable-order polynomial fitting is performed within each crop-row region to achieve precise extraction of the crop-row lines. Experimental results indicate that the improved BiSeNetV2 model achieved a Mean Pixel Accuracy (mPA) of 87.73% and a Mean Intersection over Union (MIoU) of 79.40% on the rapeseed seedling dataset, marking improvements of 9.98% and 8.56%, respectively, compared to the original BiSeNetV2. The crop row detection performance for rapeseed seedlings under different environmental conditions demonstrated that the Curve Fitting Coefficient (CFC), Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE) were 0.85, 1.57, and 1.27 pixels on sunny days; 0.86, 2.05 and 1.63 pixels on cloudy days; 0.74, 2.89, and 2.22 pixels on foggy days; and 0.76, 1.38, and 1.11 pixels during the evening, respectively. The results reveal that the improved BiSeNetV2 can effectively identify rapeseed seedlings, and the detection algorithm can identify crop row lines in various complex environments. This research provides methodological support for crop row line detection in precision agriculture.

1. Introduction

Rapeseed is a crucial crop for producing edible oils worldwide, ranking as the second-largest source of vegetable oil globally. It plays an important role in the agricultural economic system [1]. With the development of the smart agriculture model, agriculture is gradually transforming into mechanization, automation, and unmanned operations. The accurate identification of crop rows by agricultural machines has become a key prerequisite for conducting intelligent operations such as autonomous navigation [2,3], field control [4,5], and growth detection [6,7]. Traditional field navigation technologies mainly include satellite navigation and machine vision techniques [8]. Given the highly complex nature of field environments, satellite navigation faces limitations such as signal blockage and multipath effects [9]. Conversely, machine vision provides greater flexibility in navigation and allows for comprehensive image acquisition, laying a solid foundation for accurate crop row recognition [10,11]. Moreover, crop row line detection enables the identification of problems such as seedling gaps and missing plants, allowing for the timely detection of seeding anomalies or pest-affected areas. This approach facilitates precise replanting and pest control, thereby improving field management efficiency and crop yield.
In the field of crop row detection, researchers have made significant advances through traditional image processing techniques. Montalvo et al. [12] introduced a dual thresholding and least squares linear regression based on Otsu’s method for detecting maize crop rows, which proved effective in detecting maize crop rows with a high presence of weeds. Guerrero et al. [13] designed an automatic expert system to improve the accuracy of crop row detection using vegetation index combination, image thresholding, and Theil–Sen estimator. Moreover, García-Santillán et al. [14] proposed a crop row detection algorithm based on micro-Region of Interest (micro-ROI) analysis, referred to as Detection Based on Micro-ROIs, which enables the simultaneous detection of curved and straight crop rows in maize fields. Zhang et al. [15] proposed an automatic robust cornfield crop row detection method based on improved vegetation index with particle swarm optimization dual threshold segmentation, feature point location clustering, and shortest path confirmation. They reported a detection accuracy of 0.5° under weed interference and row gap. Meanwhile, Zhao et al. [16] achieved recognition of various crop rows based on fan scanning, structural parameter modeling, and logistic regression, achieving high recognition rates in complex backgrounds. These methods have made advances in solving the problems of crop row identification. However, there are problems such as limited accuracy and a lack of adaptability when facing complex and changing field environments, particularly in the presence of light interference.
The application of deep learning techniques in crop row recognition has become increasingly widespread. Zhang et al. [17] utilized an improved U-Net network, referred to as ResC-Unet, for maize crop row segmentation. They implemented adaptive perspective transformation and width fitting methods to improve segmentation accuracy and the precision of row line detection. Guo et al. [18] proposed a crop row parameter prediction model, CRPP, based on the Transformer architecture, which provides end-to-end crop row shape parameter output and demonstrates good detection performance in complex scenarios. Additionally, Basso et al. [19] developed a UAV guidance system based on image processing techniques to achieve autonomous navigation of UAVs in agricultural fields through crop row detection algorithms and line tracking algorithms. Li et al. [20] introduced an end-to-end deep learning crop row detection network called E2CropDet, which achieved a centerline lateral deviation of 5.945 pixels and a detection speed of 166 FPS. Furthermore, Afzaal et al. [21] presented a crop row detection and GSD estimation framework that combines multiple encoders with Depth Pro depth modeling, achieving an F1 score of 0.8012 on the validation set. Gong et al. [22] developed an improved YOLOX-Tiny method for maize crop row navigation line detection, achieving 92.2% average accuracy and 0.59° angular error, significantly improving detection speed and accuracy. Zhang et al. [23] introduced a visual navigation path extraction method for maize canopy based on improved Mask R-CNN and Gaussian process regression. This method achieved an average deviation of 0.7 pixel for the navigation line, with a single-frame processing time of 227 ms, and it can adapt to complex environments while avoiding obstacles. The above deep learning-based methods have improved in recognition accuracy and efficiency. Recently, new advancements in smart agricultural technology have further demonstrated the potential of advanced algorithms in enhancing field operation efficiency [24]. However, crop row line detection in complex environments remains a challenge. Moreover, most existing detection algorithms focus primarily on navigation lines, often neglecting the extraction of fine-grained crop features required for downstream tasks such as within-row seedling counting and yield estimation [25]. This limitation hinders their applicability in comprehensive field management systems.
To address the problems mentioned, this article proposes a crop row line detection method for rapeseed seedling crop rows in complex environments. The method is based on an improved BiSeNetV2 and a dynamic sliding window fitting approach. The improvements to the original BiSeNetV2 network model aimed to increase the accuracy and speed of rapeseed seedling detection. A vertical projection-based segmentation method was implemented to delineate the crop row areas. The extraction of crop row curves was achieved using a dynamic sliding window fitting algorithm for crop row lines in conjunction with the size of the crop row area. The structure of this paper is as follows: Section 2 discusses the dataset used in this study and the relevant algorithms involved; Section 3 presents the experimental results and provides a discussion of the findings. Finally, the study concludes with a summary and an outlook on future work.

2. Materials and Methods

2.1. Data Acquisition

2.1.1. Image Data Acquisition

The data acquisition process for this study is shown in Figure 1. Figure 1a presents a hypsometric map of the research area, where the dataset was collected at the unmanned experimental demonstration farm in Xiangzhou District, Xiangyang City, Hubei Province, China, with early rapeseed seedlings as the study subject. Figure 1b illustrates the drone data collection process and its timing. The data was collected over six time periods: 19 November 2023; 30 November 2023; 13 December 2023; 8 November 2024; 19 November 2024; and 5 December 2024. At these times, the rapeseed was growing well but not densely, making the crop rows easy to observe. In order to obtain diverse data, the collection was carried out under different environmental conditions, including sunny, cloudy, foggy, and evening conditions, as shown in Figure 1c. To achieve high-precision detection of the rapeseed seedling crop rows, DJI Mavic 3 UAV equipment (DJI, Shenzhen, China) was employed. The UAV flew at a vertical altitude of 3–9 m above the ground, capturing video data with a resolution of 1920 × 1080 pixels at a frame rate of 30 FPS.

2.1.2. Dataset Construction

In this study, 186 videos with a total video duration of 2143 s were acquired by UAV, and 7963 images were obtained by frame extraction. Due to weather, light, and other factors, some of the image data obtained encountered problems such as underexposure, distorted image edges, blurred images, and others. The images were deleted and selected to meet the requirements, and 6856 images were obtained. Following the 3:1 ratio, 5142 of the above images were randomly selected for the semantic segmentation dataset construction. The rest of the images were used for evaluating the effect of crop row line detection in complex environments.
To construct the semantic segmentation dataset, 5142 images were manually annotated using the Labelme tool. And to strictly prevent data leakage and ensure the independence of the evaluation, the dataset partition was conducted at the video sequence level. Specifically, all frames belonging to a specific video sequence were assigned exclusively to either the training, validation, or test set. The dataset was divided into the training set, the validation set, and the test set in the ratio of 7:2:1. This strategy guarantees that the test images represent unseen environments, thereby objectively evaluating the model’s generalization performance.
Subsequently, data augmentation was applied to the training set to enhance the generalization capability of the model. The specific augmentation parameters were set as follows, (1) Gaussian blurring was applied with a kernel size of 5 × 5 to simulate motion blur during UAV flight; (2) exposure adjustment was performed by varying the brightness factor randomly between 0.8 and 1.2 to simulate different lighting conditions; (3) random cropping was used to resize images to 512 × 512 pixels; (4) random rotation was applied within the range of [−15°, 15°] to account for UAV jitter; (5) salt-and-pepper noise was added with a noise density of 0.02 to simulate sensor noise. Finally, about 8742 images were obtained. This yielded a final training set of 7200 images, a validation set of 1028 images, and a test set of 514 images. To construct a dataset for crop row line detection in complex environments, the remaining 1714 images were selected and classified into four environments: Sunny, cloudy, foggy, and evening. Crop row lines were labeled for each of the four environments. To improve the quality of the labeling and reduce the negative impact on the model recognition performance due to labeling errors, the labeling was performed independently by three researchers and cross-checked after the initial labeling. Finally, 200 images were labeled for each environment. Furthermore, to evaluate the practical effectiveness of the proposed crop row line detection algorithm in random scenarios, 400 images were randomly selected and labeled from the remaining images to construct an independent test set. This test set was used for algorithmic performance testing and verification of generalization ability. The specific data distribution is outlined in Table 1.

2.2. Algorithm Design

According to the characteristics of rapeseed seedling growth, this research aimed to develop a crop line row detection algorithm specifically for rapeseed seedlings. This algorithm is based on an improved BiSeNetV2 real-time semantic segmentation model. The specific steps of the algorithm are as follows:
(1)
Improved BiSeNetV2-based rapeseed seedling segmentation. To address the problem of insufficient segmentation efficiency due to the complex field environment and high density of rapeseed planting, the model was improved based on the original BiSeNetV2 model to determine the optimal rapeseed seedling segmentation model.
(2)
Extraction of crop row areas based on the vertical projection crop row area extraction method. Vertical projection was used to count the information of rapeseed seedling pixel points, and Gaussian filtering and multi-dimensional threshold screening methods were used to extract the crop row area.
(3)
Detection of crop row lines based on a dynamic sliding window fitting algorithm for crop row lines. Dynamic adjustment of window parameters was achieved by constructing an adaptive model of window width, step length, and region width, combined with the lateral inertial drift strategy and the dynamic adjustment of longitudinal step length strategy. Finally, variable-order polynomial fitting was used to adaptively characterize changes in crop row curvature and detect crop row lines with high accuracy (Figure 2).

2.2.1. Rapeseed Seedling Extraction Method Based on Improved BiSeNetV2

The BiSeNetV2 network model was proposed by Yu et al. [26]. Its innovative architecture maintains a balance between computational efficiency and segmentation accuracy by separating the processing of spatial details and semantic information. The model features a dual-branch architecture. The Detail Branch preserves high-resolution features through a wide-channel shallow network, capturing low-level information such as boundaries and textures. In contrast, the Semantic Branch performs rapid downsampling using a narrow-channel deep network to extract high-level semantic features through Depthwise Separable Convolutions (DS Conv) and a Context Embedding Block (CE). A Bilateral Guided Aggregation Layer is introduced to merge information from both branches via a bidirectional feature interaction mechanism, significantly enhancing the complementarity of multi-scale features. However, when applied to UAV-based rapeseed seedling monitoring, the original architecture still faces challenges such as weak small-target perception, insufficient multi-scale representation, and suboptimal feature enhancement under complex field conditions. And the BiSeNetV2 architecture has three main limitations that this study aims to address through the following improvements: (1) The global dimensionality reduction strategy used by the channel attention mechanism introduces additional computational overhead during enhancement of channel dependencies, while failing to effectively focus on the features of rapeseed seedlings due to the high similarity in color and texture between seedlings and background weeds. To address this issue, the Efficient Channel Attention (ECA) mechanism was adopted to pinpoint the important channel information of rapeseed seedlings without introducing complexity and to better distinguish crops from weeds. Furthermore, integrating ECA enables fine-grained enhancement of discriminative channels under weak contrast conditions, improving robustness against illumination variation, shadow occlusion, and weed interference. (2) The multi-scale feature fusion relies on a single cavity convolution layer, which has insufficient ability to capture the significant scale variations of rapeseed seedlings caused by different growth stages and UAV flight altitudes (3–9 m). To address this issue, the Atrous Spatial Pyramid Pooling (ASPP) decoding architecture was adopted to improve the scale sensitivity of rapeseed seedling small target detection. By providing parallel multi-receptive field aggregation, the enhanced ASPP allows the network to effectively capture both fine local structures and large-scale canopy distribution patterns, thereby improving the stability of segmentation across varying observation heights. (3) Using standard convolution operations in the detail branch leads to excessive model parameters, limiting deployment efficiency on resource-constrained UAV mobile devices. For this problem, a lightweight transformation of DS Conv was utilized to decrease the number of model parameters and the computational complexity. This modification further improves onboard inference speed and makes the model more suitable for real-time monitoring scenarios in precision agriculture.
ECA captures cross-channel interaction information through an adaptive one-dimensional convolutional kernel, which enhances the weight response of important channels without dimensionality reduction [27]. Compared with the traditional channel attention mechanism, this module effectively preserves the nonlinear relationship between channels by avoiding the dimensionality reduction operation [28], so that the model can more accurately focus on the subtle texture features of the key regions by specifically distinguishing seedling leaves from similar background noise in the segmentation task, suppress the image noise and shadow interference, and improve the robustness and efficiency of complex structure segmentation. To further enhance feature discrimination, the ECA module is embedded at the end of CE and the BGALayer, enabling the network to strengthen attention to the morphological edges and fine structural characteristics of rapeseed seedlings.
The ASPP architecture builds a hierarchical feature fusion mechanism by cascading null convolutional layers with different expansion rates. This structure draws inspiration from the multi-scale contextual modeling concept of Spatial Pyramid Pooling (SPP), dynamically adjusting the dilation rates of convolutional kernels to significantly expand the receptive field while maintaining computational efficiency. Compared to traditional encoder–decoder architectures, the ASPP structure processes multi-scale features through parallel branches, avoiding the loss of spatial information caused by pooling operations. This makes it particularly well-suited for segmentation tasks involving targets with complex morphological features [29]. To address the issues of drastic scale changes caused by varying UAV heights as well as the small object size and partial overlap of rapeseed seedlings in images, this study integrates the ASPP architecture into the BGALayer. This integration allows the fused features to retain richer contextual semantics and improves the detection of dense and partially occluded seedlings, ensuring more accurate field-scale monitoring results.
DS Conv decomposes standard convolution into Depthwise Convolution (DW Conv) and Pointwise Convolution (PW Conv), which are used to extract spatial and channel features, respectively. This approach reduces the number of parameters while preserving the model’s ability to capture detailed features [30]. In this study, the standard convolutions in the Detail Branch are replaced with DS Conv, enabling faster inference when processing rapeseed seedling images and enhancing the model’s real-time performance on UAV platforms. At the same time, it effectively captures detailed information such as boundaries and textures of the seedlings. This lightweight transformation strengthens the model’s inference efficiency and provides the structural basis for deploying the proposed segmentation method in practical precision agricultural applications. The improved BiSeNetV2 network structure is shown in Figure 3.

2.2.2. Vertical Projection-Based Crop Row Area Extraction

To address the problem of low detection accuracy of crop row area caused by dense and uneven distribution of rapeseed seedlings, this study proposes a crop row area extraction algorithm based on vertical projection and a multi-dimensional threshold screening method. The flowchart of the algorithm is displayed in Figure 4. The actual operating scenario of crop rows approximates the vertical distribution characteristics in the image [31]. A vertical projection along the horizontal axis was employed for counting the segmented rapeseed seedling pixel points. This process generated a histogram reflecting the distribution of pixel densities. However, the original projection histogram is affected by irregularity of plant morphology, local occlusion, among others, making it difficult to effectively distinguish between different crop row areas. This leads to abnormal peaks triggered by noise, such as non-targeting factors in the projection histogram. To address this problem, the Gaussian kernel function was used for filtering the projection curves [32], as illustrated in Equation (1).
G ( x ) = 1 σ 2 π exp x μ 2 2 σ 2
where σ represents the standard deviation of the Gaussian distribution, and its optimal value is determined to be σ = 5 by the cross-validation method to balance the denoising ability and feature retention effect. Simultaneously, the problem of accurate detection of crop row areas existing at the left and right boundaries of the image was solved based on the mirror-filled boundary method. The rapeseed seedling crop rows at the edges of the image may have problems with missing vertical projection statistics due to camera field of view limitations. Consequently, the segmented image was mirrored to extend the left and right boundaries along the horizontal direction. Additionally, the plant area was extended outward by 50 pixels in width, respectively, to enhance the continuity of the crop boundary area and improve the crop edge row detection capability.
To enhance the extraction of crop row areas for each rapeseed seedling row, this study employed a multi-dimensional threshold screening method. This method considered multiple factors such as amplitude, spacing, and morphological features to filter the wave crests. A peak height threshold was established to eliminate local extreme points with heights lower than the global average peak, avoiding interference from low-density noise regions. Additionally, a peak spacing constraint was implemented to ensure that the horizontal spacing between neighboring peaks was greater than the minimum row width Dmin (set to 50 pixels by field measurements). This step helps exclude abnormal peaks caused by dense plants. Moreover, a prominent criterion was introduced to measure the sharpness of wave peaks using the full width at half maxima (FWHM). Significant peaks with an FWHM less than the maximum effective width of the crop row Wmax were retained, reducing the effect of the wide, slow-change signal. To further enhance edge localization of crop rows, a lower limit constraint was applied to peak width, requiring the FWHM to be greater than the minimum effective width Wmin. This approach effectively filtered out abnormal narrow-amplitude signals and worked in conjunction with the prominence criterion to improve the robustness of crop row edge localization.
Through the joint screening conducted above the threshold, the FWHM of the retained waveforms was used to determine the width of each crop row. The width interval was then extended vertically to encompass the upper and lower boundaries of the image, resulting in a defined rectangular area for each crop row. The method effectively overcomes the ambiguity and uncertainty of crop row area extraction in complex environments by integrating vertical projection and multi-dimensional threshold screening. Furthermore, it provides highly robust positional benchmarks for subsequent crop row lines fitting.

2.2.3. Dynamic Sliding Window-Based Crop Row Lines Fitting

Traditional crop row line detection methods primarily assume linear patterns, which are inadequate for capturing the nonlinear characteristics of rapeseed seedling crop rows. While some existing dynamic window methods attempt to address this by adjusting window size based on geometric perspective, they often struggle with the irregular growth widths of seedlings. These perspective-based methods assume a uniform row width, which leads to tracking failures when seedlings are sparse or unevenly distributed. To address this problem, this study introduces a dynamic sliding window fitting algorithm that adjusts based on the width of the region. This approach maintains a dynamic balance between computational efficiency and fitting accuracy.
In analyzing the spatial characteristics of the crop row area discussed in Section 2.2.2, we observed a tendency for the plant distribution to become discrete as the width of the crop row area Wi increased. Since traditional fixed window sizes struggle to accommodate the dynamic distribution of the crop row area, this study proposes a nonlinear mapping model for the window parameters and the width of the area, as presented in Equations (2)–(4).
W w i d t h = min max 30 + 0.4 W i , W i
h s t e p = min max 50 0.6 W i , 15 , W i
T p i x e l = W i · h s t e p 4
Wwidth in equations denotes the dynamic window width (pixel), hstep is the vertical scanning step (pixel), Tpixel represents the effective pixel threshold, and Wi indicates the current crop row area width (pixel). To determine the coefficients, we sampled crop rows at varying distances and manually calibrated the optimal window width Wwidth and scanning step hstep required to fully cover the seedlings. By fitting these manually calibrated optimal values against the extracted row widths Wi, we obtained the mapping relationships in Equations (2) and (3). Specifically, the intercept terms “30” and “50” correspond to the minimum window width and scanning step (in pixels) required to ensure reliable detection of narrow rows affected by perspective distortion at larger viewing distances. The scaling factors “0.4” and “0.6” represent the slopes of the linear regressions and determine the adaptive adjustment rate of each window parameter in response to variations in crop-row width. Finally, the denominator “4” in Equation (4) establishes a minimum density constraint, empirically requiring that valid pixels occupy at least 25% of the estimated window area before a detection is accepted, thereby suppressing isolated noise responses.
The algorithm implementation process is illustrated in Figure 5. First, the starting point of the window was determined based on the peak point of the vertical projection histogram. The human eye observation behavior was simulated by sliding the window from the bottom to the top of the region via the number and distribution of rapeseed seedling pixel points in the window. Simultaneously, the boundary effect was avoided by setting the scanning margin, addressing the problem of detecting crop row lines caused by the dense planting of rapeseed seedlings. Finally, a variable-order polynomial fitting algorithm was employed to detect the crop row lines.
In sliding window scanning, problems such as trajectory shift, tracking failure, and slower detection speed can arise. To improve the accuracy and efficiency of window tracking, this study proposes lateral inertial drift and dynamic adjustment of longitudinal step length strategies to achieve effective window sliding.
A lateral inertial drift strategy is employed to tackle the issue that conventional window movement relies on the midpoint of the pixel within the front window. This strategy develops a prediction model for the lateral position of the window using the Exponentially Weighted Moving Average (EWMA) algorithm and incorporates a confidence mechanism, as displayed in Equation (5).
x t = α x t 1 + ( 1 α ) x ^ t x t = α x t 1 + ( 1 α ) v t 1 t N p T p i x e d N p < T p i x e d
The xt in the equation represents the lateral position of the window; xt−1 denotes the lateral position of the window at the previous moment; x ^ t refers to the position of the center of the rapeseed seedling pixel point in the window; vt−1 indicates the moving speed of the previous window. Additionally, Δt signifies the time step; α is the attenuation weight, which is constrained within the range α ∈ [0, 1). The α is initialized at a value of 0.6 in this study.
The dynamic adjustment of longitudinal step length addresses the issues of target omission and computational redundancy caused by the fixed longitudinal moving step length of the traditional window. This approach allows the scanning step length to vary according to the confidence level. In regions of high confidence, a larger step length is used to improve efficiency, while in areas of low confidence, the step length is reduced to enhance detail capture. This adjustment maintains the balance between computational efficiency and fitting accuracy. Equation (6) is as follows:
y t = y t 1 β h s t e p
where yt signifies the longitudinal position of the bottom of the window; yt−1 denotes the longitudinal position of the bottom of the window at the previous moment; and β represents the confidence adjustment coefficient, which is used to dynamically control the degree of adjustment of the longitudinal step size with the degree of confidence. In this study, we established a range of β ∈ (0, 1], where β = 1 indicates high confidence, and the integrated effect of the adjustment of the parameter and the stability of the experiment. Conversely, the low confidence is represented by β = 0.7.
To prevent the boundary effects and the detection blurring caused by the overlapping of neighboring crop rows, the window sliding range Ω was determined based on the window position (xt−1, yt−1) and Wwidth, as presented in Equation (7).
Ω = x t 1 δ W w i d t h , x t 1 + δ W w i d t h × y t 1 2 h s t e p , y t 1
The δ in the equation signifies the boundary expansion factor, which controls the extent to which the sliding window can extrapolate the boundary. Additionally, a smaller δ may lead to missing information, while a larger δ introduces unnecessary noise.
A variable-order polynomial fitting model was applied to the center point of the high-confidence sliding window in each crop row area to improve the fit to the crop rows, as illustrated in Equations (8) and (9).
f ( x ) = k = 0 K ( w ) a k x k
k = min W i 30 , 3
The polynomial order k is dynamically determined based on the crop row width Wi to balance fitting flexibility with stability. As shown in Equation (9), Wi serves as a key indicator of the available spatial information. When Wi is small (<60 pixels), the visual features are compressed and appear linear. In this case, a lower-order polynomial is selected to prevent overfitting and jitter. When Wi is large (≥60 pixels), corresponding to the near-field area, the crop rows exhibit richer morphological details and clearer curvature. Consequently, a higher-order polynomial is employed to accurately capture the nonlinear characteristics of the path. The denominator ‘30’ in Equation (9) is an empirical scaling factor derived from the average minimum row width observed in the dataset.

2.3. Test Platform

In this study, the deep learning framework PyTorch (version 1.10.0) was used, operating under the Windows 11 system, to perform semantic segmentation detection and construct a growth assessment model. The computer CPU was a 13th Gen Intel(R) Core(TM) i5-KF running at 3.50 GHz, 32 GB of RAM, and an NVIDIA GeForce RTX4060 Ti GPU. We employed Python (version 3.7.16) as the editing language, and the model training was conducted using Torch (version 1.10.0). The input image resolution was set at 1920 × 1080 pixels. To accelerate the training of the neural network, we utilized a GPU, leveraging the CUDA (version 11.7.1) and cuDNN (version 8.4.1) acceleration platforms.

2.4. Evaluation Indicators

2.4.1. Evaluation Metrics for Semantic Segmentation

To assess the effectiveness of the semantic segmentation model for achieving planted row segmentation in complex environments, the following evaluation metrics were used in this study: The F1 Score, the mean Pixel Accuracy (mPA), the Mean Intersection over Union (MIoU) and the accuracy. The main formulas are displayed in Equations (10)–(15).
P r e c i s i o n = T P T P + F P
R e c a l l = T P T P + F N
F 1 = 2 P r e c i s i o n R e c a l l P r e c i s i o n + R e c a l l
m P A = 1 N i = 1 N P r e c i s i o n i
M I o U = 1 N + 1 i = 0 N T P T P + F P + F N
A c c u r a c y = T P + T N T P + T N + F P + F N
True Positive (TP) indicates the number of samples correctly classified as positive, True Negative (TN) signifies the number of samples correctly classified as negative, False Positive (FP) indicates the number of samples incorrectly classified as positive, and False Negative (FN) represents the number of samples incorrectly classified as negative.

2.4.2. Evaluation Indicators for Crop Row Line Detection

To assess the performance of algorithms for detecting rapeseed seedling crop row lines in complex environments, this study utilized a curve fitting evaluation index. It introduces several indices, including Curve Fitting Coefficient (CFC), Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), and the number of missed and incorrect tests. The formulae for CFC, RMSE, and MAE are displayed in Equations (16)–(18).
C F C = 1 i = 1 n x i x ^ i 2 i = 1 n x i x ¯ 2
R M S E = 1 n i = 1 n x i x ^ i 2
M A E = 1 n i = 1 n x i x ^ i
In the equation, n indicates the number of sampling points on the curve; xi signifies the horizontal coordinate at the ith sampling point of the real curve; x ^ i denotes the horizontal coordinate of the algorithm’s detection curve at the corresponding y ^ i position, and x ¯ represents the average value of the horizontal coordinate of the real curve. A larger value of CFC, closer to 1, indicates better model performance, whereas smaller values of RMSE and MAE, approaching 0, suggest improved accuracy in the model’s detection capabilities.
In addition, to evaluate the algorithm’s ability to correctly identify the presence of crop rows and to avoid false positives and missed detections, the detection accuracy Dacc was defined as shown in Equation (19).
D a c c = ( 1 N m i s s + N f a l s e N t o t a l ) × 100 %
where Nmiss represents the number of missed crop rows, Nfalse denotes the number of incorrectly identified rows, and Ntotal is the total number of actual crop rows in the test set.

3. Results

3.1. Analysis of Rapeseed Seedling Segmentation Results Based on Real-Time Semantic Segmentation Model

This study employed a divided training set to learn model parameters, while using a validation set to adjust hyperparameters and monitor the convergence process of the model. Once the model achieved stable performance and convergence on the validation set, test set No. 1 was used to independently evaluate the model to verify the effectiveness and robustness of the algorithm in real-world applications.

3.1.1. Analysis of Test Results Before and After Model Segmentation Improvements

To compare the performance before and after the model improvement, the BiSeNetV2 and the Improved BiSeNetV2 models were trained based on the rapeseed seedling dataset. The loss function during the model training process is illustrated in Figure 6. The figure displays that the loss of BiSeNetV2 before the improvement decreased rapidly during the first nine epochs. As the number of iterations increased, the decrease in the rate of loss slowed down, ultimately oscillating between 3.5 and 3.8. Conversely, the improved BiSeNetV2 converged to a lower loss value more quickly than the original model, stabilizing in the range of 3.3 to 3.6, thereby demonstrating the effectiveness of the improvements.
After model convergence, the statistical analysis was conducted on the test results of BiSeNetV2 before and after improvement. The test results are presented in Table 2. The F1 score of the improved model was 87.99%, the MloU was 79.40%, and the accuracy was 92.91%. Compared to the model before improvement, the F1 score increased by 6.45%, MloU increased by 8.56%, accuracy increased by 2.45%, and mPA increased by 9.98%. Additionally, the overall model size was reduced.

3.1.2. Comparison of Performance Improvements in the BiSeNetV2 Model

To validate the segmentation performance of the improved BiSeNetV2 and ensure the statistical reliability of the results, all models were evaluated on the test set using five different random seeds (42, 45, 123, 210, and 325). The final results are reported as “Mean ± Standard Deviation” in Table 3 to eliminate the influence of random initialization. As shown in the table, the incorporation of the ECA mechanism noticeably enhances the representational capability of BiSeNetV2. Compared with the baseline, BiSeNetV2 + ECA improves F1, MIoU, and Accuracy by 4.31%, 5.50%, and 1.30%, respectively, while maintaining nearly identical computational cost: 3.3415 million parameters, 97.65 GFLOPs, and 35.85 FPS. After integrating the ASPP module, the model further improves its multi-scale perception ability, reaching an F1 of 82.29% and an MIoU of 71.76%. However, the dilated convolutions significantly increase the computational burden, resulting in 112.45 GFLOPs and a reduced speed of 29.40 FPS.
In the final model, the combination of ECA, ASPP, and Depthwise Separable Convolutions (DS-Conv) achieves the best overall balance between accuracy and efficiency. DS-Conv effectively offsets the computational cost introduced by ASPP by reducing redundant operations, lowering the total computation to 69.93 GFLOPs. This optimization increases the inference speed to 40.55 FPS, which represents a 12.26% improvement over the baseline. In terms of segmentation performance, the improved BiSeNetV2 achieves the highest results across all metrics, with 87.99% F1, 79.40% MIoU, and 92.91% Accuracy. The consistently low standard deviations further indicate strong stability. These results demonstrate that the improved BiSeNetV2 achieves a relatively good balance among segmentation accuracy, computational efficiency, and real-time UAV deployment capability.
To visually validate the effectiveness of the ASPP module, we analyzed the qualitative segmentation results. As verified in the comparison of segmentation masks, the original model often produces fragmented row predictions due to limited local context. In contrast, the improved BiSeNetV2 generates continuous and smooth crop row lines that span across the entire image height. This continuity serves as empirical evidence that the ASPP module successfully expands the receptive field to capture the global structural dependencies of the crop rows, thereby solving the problem of disconnected segmentation in complex scenarios.

3.1.3. Comparison of the Performance of Different Segmentation Models

To evaluate the overall performance of the improved BiSeNetV2 model compared to mainstream image segmentation models, this study selected mainstream models such as FastSeg, CGNet, and ENet for comparison. After model convergence, each model was tested and evaluated, with the results outlined in Table 4. The results indicate that the improved BiSeNetV2 model demonstrated the best performance. Compared to BiSeNetV1, BiSeNetV2, FastSeg, CGNet, and ENet, the improved BiSeNetV2 achieved an increase of 15.76%, 8.56%, 10.25%, 32.72%, and 25.61% in MloU, respectively, and an increase of 5.73%, 9.98%, 11.81%, 9.18%, and 25.37% in mPA, respectively. In summary, the improved BiSeNetV2 demonstrated excellent performance in this research.

3.2. Analysis of Rapeseed Seedling Crop Row Line Detection Algorithm

3.2.1. Analysis of the Results of Crop Row Area Detection Using the Vertical Projection Crop Row Area Extraction Method for Rapeseed Seedlings

To assess the effectiveness of the vertical projection crop row area extraction method proposed in this article, three improved methods were selected to compare the curve detection of rapeseed seedlings crop rows. The detection results are illustrated in Figure 7.
Figure 7a displays the detection results without Gaussian filtering. This method relies on vertical projection and threshold constraints, without Gaussian smoothing of the vertical projection histogram. The original histogram contains many high-frequency jitter abnormal peaks due to plant morphology variation, field shadows, and noise pixels. Although some low-significance peaks are eliminated by threshold constraints, the remaining peaks still suffer from positional drift issues. Moreover, the detection error between adjacent rows is significant, particularly in the dense rapeseed area, where three abnormal peaks appear.
Figure 7b illustrates the detection results without boundary widening. This method retains the threshold constraint and Gaussian filtering strategy without expansion of the image boundary area. Due to the truncation of the rapeseed seedling crop rows at the image boundary, the crop rows at the boundary cannot be effectively detected.
Figure 7c displays the detection results of the algorithm in this paper using a comprehensive improvement strategy. This strategy combines Gaussian filtering, multi-dimensional threshold screening, and boundary widening techniques. It balances curve smoothness and structural constraints, resulting in prominent peaks, accurate counts, and stable positions. Consequently, the algorithm enhances detection accuracy and robustness. In areas with dense rapeseed or broken seedlings, it effectively identifies the main structure of crop rows, demonstrating excellent detection performance.

3.2.2. Analysis of Dynamic Sliding Window Crop Row Line Fitting Detection Results

To assess the effectiveness and applicability of the algorithm, this article compares the proposed algorithm with the Hough transform [33], the least squares method [34], and the ordinary sliding window method [35]. Images of rapeseed crops taken at different heights were used as test objects. Figure 8 illustrates the results of crop row line detection.
To comprehensively evaluate the algorithm, we selected two scenes for verification: Scene 1, with a shooting height of 3–6 m, and Scene 2, with a shooting height of 6–9 m. In scene 1, the spacing between rapeseed rows is narrow, leading to inter-row overlap. The Hough transform, which depends on a global voting mechanism for edge points, struggles in these densely overlapping areas, resulting in misjudgment of the spatial distribution of crop rows. This is evident in Figure 8b, where the detection line segments are broken due to incorrect segmentation. The conventional sliding window method maintains a certain level of robustness when encountering broken seedlings or sparse seedling distributions. This is because it resets the starting point based on the number of valid seedlings within the window. However, in Scene 2, the rapeseed seedlings exhibit significant scarification and increased breaks. As the number of valid samples within the window consistently falls below the preset threshold, the algorithm misjudges and terminates the detection task. This results in large areas of missing lines, as illustrated in Figure 8d. Its fixed threshold strategy makes it challenging to balance detection continuity and noise resistance in sparse scenes.
In the least squares method, linear fitting is appropriate when the seedling distribution is relatively continuous, as displayed in Figure 8c. However, this method uses global data for quadratic polynomial fitting, which can lead to significant bending and insufficient fitting precision when dealing with scenarios where crop rows vary considerably. This issue is particularly pronounced when capturing images from low heights, where there are notable fluctuations in the spatial distribution of crop rows.
The algorithm in this article effectively avoids the problem of excessive smoothing caused by global fitting through the dynamic optimization mechanism of the sliding window. As illustrated in Figure 8e, this framework ensures detection continuity and suppresses misjudgments caused by noise interference, achieving complete and accurate extraction of crop row lines in complex environments.

3.3. Analysis of Rapeseed Seedling Crop Row Line Detection Results

To evaluate the performance of the crop row line detection algorithm, we utilized test set No. 2 to evaluate the proposed algorithm for detecting rapeseed seedling crop row lines and compared it with three traditional methods. Since the pixels in the dataset are of the same size, all target curves are represented in the same coordinate system and exhibit similar characteristics. Therefore, there is no significant difference in the data distribution. The average value of the single curve evaluation index was used to measure the overall level of the dataset. The test results are outlined in Table 5. The comparison results indicate that the proposed algorithm outperforms the three selected traditional methods in all evaluation metrics, achieving CFC, RMSE, and MAE values of 0.80, 1.97, and 1.56 pixels, respectively. When compared to the general sliding window algorithm, which also performed well, our proposed algorithm improved the CFC by 0.08, reduced the RMSE by 0.28 pixel, and decreased the MAE by 0.26 pixel. These improvements are primarily due to the dynamic sliding window mechanism, which better adapts to the local changes in crop row lines, making it effective for detecting rapeseed seedling crop row lines.

3.4. Performance Analysis of Crop Row Line Detection Algorithms in Different Environments

To evaluate the performance of the proposed detection algorithm under various environmental conditions, test set No. 3 was used to conduct tests for sunny, cloudy, foggy, and evening scenarios. The test results are presented in Table 6. The results demonstrate that under sunny, cloudy, foggy, and evening conditions, the algorithm achieved CFC values of 0.85, 0.86, 0.74 and 0.76, respectively. The RMSE values were 1.57, 2.05, 2.89 and 1.38 pixels, while the MAE values were 1.27, 1.63, 2.22 and 1.11 pixels, respectively. Furthermore, the Dacc values were 99.5%, 98.2%, 96.5%, and 97.8% for the four scenarios, respectively, remaining excellent numerical values in complex environments. A comprehensive comparison reveals that detection accuracy is relatively higher under sunny conditions. Overall, the algorithm exhibits strong robustness and detection accuracy across different environments, demonstrating good adaptability to varying conditions.
To effectively demonstrate the algorithm’s detection performance in complex environments, this study selected four different scenarios: Sunny, cloudy, foggy and evening. Crop row line detection tests were conducted for each scenario. As illustrated in Figure 9, comparative analysis was performed using three-channel visualization data of the original RGB image, vertical projection histogram, and the detection results. In various complex environments, after vertical projection of the rapeseed seedling pixels, each crop row area was accurately divided into accurate crop row positions. Crop row line detection was successful, regardless of sunny, cloudy, foggy, or evening conditions, matching well with the actual crop row paths. The results indicate that the detection method proposed in this article exhibits stable environmental adaptability under various lighting conditions and meteorological disturbances, achieving high detection accuracy.
In summary, the algorithm developed in this study successfully meets the accuracy requirements for detecting crop row lines in various environments. This paper integrates techniques such as vertical projection for crop row area segmentation and dynamic sliding window fitting for crop row lines. These methods provide technical support for subsequent agricultural robots to perform autonomous crop row line detection in multimodal environments.

3.5. Parameter Sensitivity Analysis

3.5.1. Sensitivity Analysis of the Boundary Expansion Factor δ

The boundary expansion factor δ in the dynamic sliding window algorithm plays a crucial role in balancing tracking flexibility and noise suppression. To determine the optimal value of δ and evaluate its impact on detection performance, a sensitivity analysis was conducted using the validation set.
As illustrated in Figure 10, we tested δ values ranging from 0.1 to 0.9 with a step size of 0.1. The results indicate that the algorithm’s performance is sensitive to changes in δ. When δ is small (δ < 0.3), the search range is insufficient to cover the lateral displacement of crop rows, especially in curved sections. This leads to tracking failures and “broken lines”, resulting in a lower CFC and higher RMSE. As δ increases (0.4 < δ < 0.6), performance stabilizes. Specifically, at δ = 0.5, the algorithm achieves the best balance, with the highest CFC of 0.85 and the lowest RMSE of 1.61 pixels. This value allows the window to effectively track natural crop row curvature while bridging minor gaps between seedlings. However, excessively large values (δ > 0.7) cause the window to capture environmental noise or drift into adjacent rows, leading to a decline in detection accuracy.
Based on this analysis, δ = 0.5 was selected as the optimal parameter for all subsequent experiments, ensuring robustness across different environmental conditions.

3.5.2. Sensitivity Analysis of the Gaussian Smoothing Parameter σ

The Gaussian smoothing parameter σ in Equation (1) plays a decisive role in extracting valid crop row areas by determining the degree of smoothing applied to the vertical projection histogram. This parameter directly affects the algorithm’s ability to distinguish true crop rows from background noise; an inappropriate σ value leads to deviations in the number of detected crop rows. Consequently, the detection accuracy Dacc was employed to evaluate parameter sensitivity. For this evaluation, we randomly selected 50 images from each of the different environments within Test set No. 3, resulting in a total of 200 images for testing, and varied the σ value within the range of 1 to 20.
Experimental results, as illustrated in Figure 11, indicate that the detection performance is highly sensitive to σ. Specifically, when σ is small (σ < 6), the filter fails to eliminate high-frequency fluctuations caused by weed clusters or irregular leaf textures, resulting in the emergence of numerous false positive peaks and a reduction in detection accuracy. Conversely, when σ is excessively large (σ > 14), the aggressive smoothing causes adjacent peaks to merge into a single broad peak, leading to missed detections. The algorithm demonstrates stable and efficient performance within the range of 8 to 12, with the detection accuracy peaking at σ = 10. At this optimal value, the filter achieves an effective balance between noise suppression and feature preservation; therefore, σ = 10 was selected as the fixed parameter for this study”.

3.5.3. Sensitivity Analysis of the Attenuation Weight α

The attenuation weight α in Equation (5) is critical for the Lateral Inertial Drift strategy. It determines how much historical momentum the sliding window retains when the visual signal of the crop row is lost. We evaluated the tracking performance by varying α from 0 to 0.9.
As shown in Figure 12. When α < 0.4, the updating window exhibits insufficient inertia, lacking historical momentum, making the trajectory highly sensitive to local irregularities and prone to jitter, which results in increased RMSE. When α > 0.8, excessive inertia causes the window to lag behind rapid changes in crop-row geometry and drift outward when encountering curved row segments, thus reducing the CFC. Within the intermediate range of 0.4 ≤ α ≤ 0.80, the algorithm maintains a stable balance between responsiveness and smoothness, but α = 0.6 yields the best trade-off, achieving both low RMSE and high CFC.

3.5.4. Sensitivity Analysis of the Confidence Adjustment Coefficient β

The confidence adjustment coefficient β in Equation (6) plays a pivotal role in balancing the algorithm’s fitting precision with its computational efficiency by regulating the longitudinal scanning step size in low-confidence regions. We evaluated the performance by varying β from 0.1 to 1.0.
As illustrated in Figure 13, the results demonstrate distinct behaviors at the extremes of the parameter range. Specifically, when β is small (β < 0.5), the sliding window moves in minute increments, which ensures a high resolution and high fitting accuracy by capturing detailed curvature; however, this fine-grained search creates excessive computational redundancy, significantly reducing the inference speed and increasing the processing time per frame. Conversely, when β is excessively large (β > 0.8), although the detection speed increases due to larger scanning jumps, the sparse scanning resolution risks skipping over valid seedling clusters or missing inflection points in curved rows, leading to a sharp decline in fitting precision and a higher RMSE. The experimental results indicate that β = 0.7 provides the optimal equilibrium, achieving high fitting accuracy without compromising the real-time processing capability required for field navigation, and was therefore selected as the fixed parameter.

4. Conclusions

To address the challenges of poor robustness and high false detection and missed detection rates in rapeseed seedling crop row detection methods, particularly in complex environments, this study proposes a novel algorithm for detecting rapeseed seedling crop rows in drone remote sensing images, built upon an improved BiSeNetV2 model. First, the BiSeNetV2 model was enhanced to improve the segmentation and extraction of rapeseed seedlings. Subsequently, the crop row area was obtained based on the vertical projection crop row area extraction method. Finally, the crop row lines were identified using a dynamic sliding window algorithm for crop row line fitting. The main conclusions of this study are as follows.
(1)
To determine the optimal rapeseed seedling segmentation model, the standard convolution in the Detail Branch was replaced with DS Conv based on the original BiSeNetV2 model. The model was further improved by integrating the ECA mechanism and ASPP decoding architecture. The results reveal that the improved BiSeNetV2 network outperforms the original BiSeNetV2 during testing. The F1 score increased from 81.54% to 87.99%, marking an improvement of 6.45%. Furthermore, mPA increased from 77.75% to 87.73%, indicating an improvement of 9.98%. The MIoU increased from 70.84% to 79.40%, suggesting an increase of 8.56%. Additionally, the accuracy increased from 90.46% to 92.91%, with an increase of 2.45%. The improved BiSeNetV2 can be effectively applied to rapeseed seedling segmentation.
(2)
To determine the rapeseed seedling crop row area, a vertical projection crop row area extraction method was employed. This method involved vertically projecting the rapeseed seedling pixels onto the x-axis. After Gaussian filtering, a multi-dimensional threshold screening strategy was used to identify local peaks, which allowed for the division of the target crop row area based on the width of these peaks.
(3)
By applying a dynamic sliding window fitting algorithm to the pixel points of rapeseed seedlings in the crop area, the window size was dynamically adjusted according to the width of the target area. The window was then slid via a lateral inertial drift strategy and by dynamically adjusting the longitudinal step length. Finally, a variable-order polynomial fitting was applied to the center point of the window to obtain the crop row curve. The overall crop row line CFC was 0.80, RMSE was 1.97, and MAE was 1.56, indicating a high level of detection accuracy. This method can effectively identify crop row lines and support crop row detection in navigation tasks.
However, it is worth noting that the vertical projection method may have limitations. Specifically, the vertical projection method may struggle in scenarios with extremely high planting density or severe occlusion, where boundary gaps become indistinct. In the future, we aim to address the challenge of high-density adhesion by exploring advanced instance segmentation techniques. Simultaneously, we plan to expand the dataset to include multi-source data from different geographic regions and UAV platforms to further verify the model’s performance in broader agricultural applications. Additionally, research on the identification of obstacles such as ridges and roads will be conducted to reduce interference from complex field environments, thereby further improving the robustness and accuracy of the navigation system.

Author Contributions

Conceptualization, W.D. and R.W.; methodology, R.W. and F.Z.; software, R.W., F.Z. and Y.J.; validation, W.D., R.W., F.Z., Y.J., Y.Z., Q.S., Z.L. and W.X.; formal analysis, R.W.; investigation, F.Z.; resources, W.D.; data curation, W.D.; writing—original draft preparation, R.W.; writing—review and editing, W.D., R.W. and F.Z.; visualization, R.W.; supervision, W.D., Y.Z., Q.S. and Z.L.; project administration, W.D.; funding acquisition, W.D. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Key R&D Program of China (Grant No. 2023YFD2001001 and 2023YFD2001001-1), and the Hubei Province Agricultural Science and Technology Research Project (Grant No. HBSNYT202211).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

Data is contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Hu, Q.; Hua, W.; Yin, Y.; Zhang, X.; Liu, L.; Shi, J.; Zhao, Y.; Lu, Q.; Chen, C.; Wang, H. Rapeseed research and production in China. Crop J. 2017, 5, 127–135. [Google Scholar] [CrossRef]
  2. Gai, J.; Guo, Z.; Raj, A.; Tang, L. Robust crop row detection using discrete Fourier transform (DFT) for vision-based in-field navigation. Comput. Electron. Agric. 2025, 229, 109666. [Google Scholar] [CrossRef]
  3. Wang, T.; Chen, B.; Zhang, Z.; Li, H.; Zhang, M. Applications of machine vision in agricultural robot navigation: A review. Comput. Electron. Agric. 2022, 198, 107085. [Google Scholar] [CrossRef]
  4. Yu, F.; Cao, Y.; Xu, T.; Guo, Z.; Wang, D. Precision fertilization by UAV for rice at tillering stage in cold region based on hyperspectral remote sensing prescription map. Trans. CSAE 2020, 36, 103–110. [Google Scholar]
  5. Tellaeche, A.; BurgosArtizzu, X.P.; Pajares, G.; Ribeiro, A.; Fernández-Quintanilla, C. A new vision-based approach to differential spraying in precision agriculture. Comput. Electron. Agric. 2008, 60, 144–155. [Google Scholar] [CrossRef]
  6. Zeng, F.; Wang, R.; Jiang, Y.; Liu, Z.; Ding, Y.; Dong, W.; Xu, C.; Zhang, D.; Wang, J. Growth monitoring of rapeseed seedlings in multiple growth stages based on low-altitude remote sensing and semantic segmentation. Comput. Electron. Agric. 2025, 232, 110135. [Google Scholar] [CrossRef]
  7. Quan, L.; Feng, H.; Lv, Y.; Wang, Q.; Zhang, C.; Liu, J.; Yuan, Z. Maize seedling detection under different growth stages and complex field environments based on an improved Faster R–CNN. Biosyst. Eng. 2019, 184, 1–23. [Google Scholar] [CrossRef]
  8. Yu, G.; Wang, Y.; Gan, S.; Xu, H.; Chen, Y.; Wang, L. Extracting the navigation lines of crop-free ridges using improved deeplabv3+. Trans. Chin. Soc. Agric. Eng. 2024, 40, 168–175. [Google Scholar]
  9. Yang, Y.; Zhou, Y.; Yue, X.; Zhang, G.; Wen, X.; Ma, B.; Xu, L.; Chen, L. Real-time detection of crop rows in maize fields based on autonomous extraction of ROI. Expert Syst. Appl. 2023, 213, 118826. [Google Scholar] [CrossRef]
  10. Pin, J.; Guo, T.; Xv, M.; Zou, X.; Hu, W. Fast extraction of navigation line and crop position based on LiDAR for cabbage crops. Artif. Intell. Agric. 2025, 15, 686–695. [Google Scholar] [CrossRef]
  11. Zhang, S.; Liu, Y.; Xiong, K.; Tian, Y.; Du, Y.; Zhu, Z.; Du, M.; Zhai, Z. A review of vision-based crop row detection method: Focusing on field ground autonomous navigation operations. Comput. Electron. Agric. 2024, 222, 109086. [Google Scholar] [CrossRef]
  12. Montalvo, M.; Pajares, G.; Guerrero, J.M.; Romeo, J.; Guijarro, M.; Ribeiro, A.; Ruz, J.J.; Cruz, J.M. Automatic detection of crop rows in maize fields with high weeds pressure. Expert Syst. Appl. 2012, 39, 11889–11897. [Google Scholar] [CrossRef]
  13. Guerrero, J.M.; Guijarro, M.; Montalvo, M.; Romeo, J.; Emmi, L.; Ribeiro, A.; Pajares, G. Automatic expert system based on images for accuracy crop row detection in maize fields. Expert Syst. Appl. 2013, 40, 656–664. [Google Scholar] [CrossRef]
  14. García-Santillán, I.D.; Montalvo, M.; Guerrero, J.M.; Pajares, G. Automatic detection of curved and straight crop rows from images in maize fields. Biosyst. Eng. 2017, 156, 61–79. [Google Scholar] [CrossRef]
  15. Zhang, X.; Li, X.; Zhang, B.; Zhou, J.; Tian, G.; Xiong, Y.; Gu, B. Automated robust crop-row detection in maize fields based on position clustering algorithm and shortest path method. Comput. Electron. Agric. 2018, 154, 165–175. [Google Scholar] [CrossRef]
  16. Zhao, S.; Zhang, Z. A new recognition of crop row based on its structural parameter model. IFAC-Pap. 2016, 49, 431–438. [Google Scholar] [CrossRef]
  17. Zhang, X.; Wang, Q.; Wang, X.; Li, H.; He, J.; Lu, C.; Yang, Y.; Jiang, S. Automated detection of Crop-Row lines and measurement of maize width for boom spraying. Comput. Electron. Agric. 2023, 215, 108406. [Google Scholar] [CrossRef]
  18. Guo, Z.; Quan, L.; Sun, D.; Lou, Z.; Geng, Y.; Chen, T.; Xue, Y.; He, J.; Hou, P.; Wang, J. Efficient crop row detection using transformer-based parameter prediction. Biosyst. Eng. 2024, 246, 13–25. [Google Scholar] [CrossRef]
  19. Basso, M.; Pignaton de Freitas, E. A UAV guidance system using crop row detection and line follower algorithms. J. Intell. Robot. Syst. 2020, 97, 605–621. [Google Scholar] [CrossRef]
  20. Li, D.; Li, B.; Kang, S.; Feng, H.; Long, S.; Wang, J. E2CropDet: An efficient end-to-end solution to crop row detection. Expert Syst. Appl. 2023, 227, 120345. [Google Scholar] [CrossRef]
  21. Afzaal, H.; Rude, D.; Farooque, A.A.; Randhawa, G.S.; Schumann, A.W.; Krouglicof, N. Improved crop row detection by employing attention-based vision transformers and convolutional neural networks with integrated depth modeling for precise spatial accuracy. Smart Agric. Technol. 2025, 11, 100934. [Google Scholar] [CrossRef]
  22. Gong, H.; Zhuang, W.; Wang, X. Improving the maize crop row navigation line recognition method of YOLOX. Front. Plant Sci. 2024, 15, 1338228. [Google Scholar] [CrossRef]
  23. Zhang, W.; Chen, X.; Qi, J.; Zhou, J.; Li, N.; Wang, S. Deep learning and Gaussian process regression based path extraction for visual navigation under canopy. Trans. Chin. Soc. Agric. 2024, 55, 15–26. [Google Scholar]
  24. Padhiary, M.; Saha, D.; Kumar, R.; Sethi, L.N.; Kumar, A. Enhancing precision agriculture: A comprehensive review of machine learning and AI vision applications in all-terrain vehicle for farm automation. Smart Agric. Technol. 2024, 8, 100483. [Google Scholar] [CrossRef]
  25. Zhang, J.; Zhao, B.; Yang, C.; Shi, Y.; Liao, Q.; Zhou, G.; Xie, J. Rapeseed stand count estimation at leaf development stages with UAV imagery and convolutional neural networks. Front. Plant Sci. 2020, 11, 617. [Google Scholar] [CrossRef]
  26. Yu, C.; Gao, C.; Wang, J.; Yu, G.; Shen, C.; Sang, N. Bisenet v2, Bilateral network with guided aggregation for real-time semantic segmentation. Int. J. Comput. Vis. 2021, 129, 3051–3068. [Google Scholar] [CrossRef]
  27. Wang, Q.; Wu, B.; Zhu, P.; Li, P.; Zuo, W.; Hu, Q. ECA-Net: Efficient channel attention for deep convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition 2020, Seattle, WA, USA, 13–19 June 2020; pp. 11534–11542. [Google Scholar]
  28. Shu, H.; Wang, K.; Guo, L.; Bindelle, J.; Wang, W. Automated collection of facial temperatures in dairy cows via improved UNet. Comput. Electron. Agric. 2024, 220, 108614. [Google Scholar] [CrossRef]
  29. Mehta, S.; Rastegari, M.; Caspi, A.; Shapiro, L.; Hajishirzi, H. Espnet: Efficient spatial pyramid of dilated convolutions for semantic segmentation. In Proceedings of the European Conference on Computer Vision (ECCV) 2018, Munich, Germany, 8–14 September 2018; pp. 552–568. [Google Scholar]
  30. Xu, L.; Ming, D.; Du, T.; Chen, Y.; Dong, D.; Zhou, C. Delineation of cultivated land parcels based on deep convolutional networks and geographical thematic scene division of remotely sensed images. Comput. Electron. Agric. 2022, 192, 106611. [Google Scholar] [CrossRef]
  31. Li, B.; Li, D.; Wei, Z.; Wang, J. Rethinking the crop row detection pipeline: An end-to-end method for crop row detection based on row-column attention. Comput. Electron. Agric. 2024, 225, 109264. [Google Scholar] [CrossRef]
  32. Ito, K.; Xiong, K. Gaussian filters for nonlinear filtering problems. IEEE Trans. Autom. Control 2002, 45, 910–927. [Google Scholar] [CrossRef]
  33. Illingworth, J.; Kittler, J. A survey of the Hough transform. Comput. Vis. Graph. Image Process. 1988, 44, 87–116. [Google Scholar] [CrossRef]
  34. Björck, Å. Least squares methods. Handb. Numer. Anal. 1990, 1, 465–652. [Google Scholar]
  35. Dinakaran, K.; Sagayaraj, A.S.; Kabilesh, S.K.; Mani, T.; Anandkumar, A.; Chandrasekaran, G. Advanced lane detection technique for structural highway based on computer vision algorithm. Mater. Today Proc. 2021, 45, 2073–2081. [Google Scholar] [CrossRef]
Figure 1. Data acquisition display.
Figure 1. Data acquisition display.
Agriculture 16 00023 g001
Figure 2. Algorithm flowchart.
Figure 2. Algorithm flowchart.
Agriculture 16 00023 g002
Figure 3. Segmentation model structure.
Figure 3. Segmentation model structure.
Agriculture 16 00023 g003
Figure 4. Vertical projection crop row area extraction method.
Figure 4. Vertical projection crop row area extraction method.
Agriculture 16 00023 g004
Figure 5. Algorithm for dynamic sliding window crop row lines fitting.
Figure 5. Algorithm for dynamic sliding window crop row lines fitting.
Agriculture 16 00023 g005
Figure 6. Training loss curve chart.
Figure 6. Training loss curve chart.
Agriculture 16 00023 g006
Figure 7. Comparison of detection results for rapeseed seedling crop row areas. (a) Detection results without Gaussian filtering; (b) Detection results without boundary widening; (c) Detection results using the proposed algorithm. In the visualization results, the white pixels represent the detected rapeseed seedlings, and the red shaded regions indicate the extracted crop row areas.
Figure 7. Comparison of detection results for rapeseed seedling crop row areas. (a) Detection results without Gaussian filtering; (b) Detection results without boundary widening; (c) Detection results using the proposed algorithm. In the visualization results, the white pixels represent the detected rapeseed seedlings, and the red shaded regions indicate the extracted crop row areas.
Agriculture 16 00023 g007
Figure 8. Comparison of rapeseed seedling crop row line detection results. The shooting height for scene 1 is 3–6 m, and the shooting height for scene 2 is 6–9 m.
Figure 8. Comparison of rapeseed seedling crop row line detection results. The shooting height for scene 1 is 3–6 m, and the shooting height for scene 2 is 6–9 m.
Agriculture 16 00023 g008aAgriculture 16 00023 g008b
Figure 9. Comparison of detection results in different complex environments.
Figure 9. Comparison of detection results in different complex environments.
Agriculture 16 00023 g009
Figure 10. δ on Detection Performance of the Dynamic Sliding Window.
Figure 10. δ on Detection Performance of the Dynamic Sliding Window.
Agriculture 16 00023 g010
Figure 11. σ on Detection Performance of the Dynamic Sliding Window.
Figure 11. σ on Detection Performance of the Dynamic Sliding Window.
Agriculture 16 00023 g011
Figure 12. α on Detection Performance of the Dynamic Sliding Window.
Figure 12. α on Detection Performance of the Dynamic Sliding Window.
Agriculture 16 00023 g012
Figure 13. β on Detection Performance of the Dynamic Sliding Window.
Figure 13. β on Detection Performance of the Dynamic Sliding Window.
Agriculture 16 00023 g013
Table 1. Rapeseed Seedling Crop Row Line Detection Dataset.
Table 1. Rapeseed Seedling Crop Row Line Detection Dataset.
Data SetDataset UsageInfluence FactorsNumber of Images
Training setRapeseed Seedling Segmentation Model TrainingNone7200
Validation setRapeseed Seedling Segmentation Model ValidationNone1028
Test set No. 1Rapeseed Seedling Segmentation Model TestingNone514
Test set No. 2Crop Row Line Detection Algorithm TestingNone400
Test set No. 3Crop Row Line Detection Algorithm Testing under Different Complex EnvironmentsSunny200
Cloudy200
Foggy200
Evening200
Table 2. Test results before and after BiSeNetV2 improvements.
Table 2. Test results before and after BiSeNetV2 improvements.
ModelMIoU/%mPA/%F1 Score/%Accuracy/%Model Size/MB
BiSeNetV270.8477.7581.5490.4620.01
Improved BiSeNetV279.4087.7387.9992.9119.80
Table 3. Comparison of results for different improvement combinations in BiSeNetV2.
Table 3. Comparison of results for different improvement combinations in BiSeNetV2.
ModelF1 Score/%MIoU/%Accuracy/%mPA/%Params (M)GFLOPsFPS
BiSeNetV281.54 ± 0.4270.84 ± 0.3890.46 ± 0.2577.75 ± 0.453.341297.628536.12
BiSeNetV2 + ECA85.85 ± 0.3576.34 ± 0.3291.76 ± 0.2185.15 ± 0.383.341597.652035.85
BiSeNetV2 + ASPP82.29 ± 0.3971.76 ± 0.3590.70 ± 0.2878.77 ± 0.413.8520112.450029.40
Improved BiSeNetV287.99 ± 0.2879.40 ± 0.3192.91 ± 0.1587.73 ± 0.223.296869.933340.55
Table 4. Test results of mainstream segmentation models.
Table 4. Test results of mainstream segmentation models.
ModelF1 Score/%MIoU/%Accuracy/%mPA/%Model Size/MB
BiSeNetV176.4563.6483.4582.0051.32
BiSeNetV281.5470.8490.4677.7520.01
FastSeg80.1269.1590.0075.921.52
CGNet62.6946.6866.2178.554.30
Enet78.0853.7984.0862.360.93
Improved BiSeNetV287.9979.4092.9187.7319.80
Table 5. Test results of crop row lines of rapeseed seedlings using different algorithms.
Table 5. Test results of crop row lines of rapeseed seedlings using different algorithms.
AlgorithmCFCRMSE/PixelMAE/Pixel
Hoff transformation0.653.623.01
Least squares method0.682.742.10
Ordinary sliding window method0.722.251.82
Our algorithm0.801.971.56
Table 6. Test results for rapeseed seedlings in different environmental crop rows.
Table 6. Test results for rapeseed seedlings in different environmental crop rows.
Different
Environments
Number of
Images
Dacc (%)CFCRMSE/PixelMAE/Pixel
Sunny20099.50.851.571.27
Cloudy20098.20.862.051.63
Foggy20096.50.742.892.22
Evening20097.80.761.381.11
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Dong, W.; Wang, R.; Zeng, F.; Jiang, Y.; Zhang, Y.; Shi, Q.; Liu, Z.; Xu, W. Crop Row Line Detection for Rapeseed Seedlings in Complex Environments Based on Improved BiSeNetV2 and Dynamic Sliding Window Fitting. Agriculture 2026, 16, 23. https://doi.org/10.3390/agriculture16010023

AMA Style

Dong W, Wang R, Zeng F, Jiang Y, Zhang Y, Shi Q, Liu Z, Xu W. Crop Row Line Detection for Rapeseed Seedlings in Complex Environments Based on Improved BiSeNetV2 and Dynamic Sliding Window Fitting. Agriculture. 2026; 16(1):23. https://doi.org/10.3390/agriculture16010023

Chicago/Turabian Style

Dong, Wanjing, Rui Wang, Fanguo Zeng, Youming Jiang, Yang Zhang, Qingyang Shi, Zhendong Liu, and Wei Xu. 2026. "Crop Row Line Detection for Rapeseed Seedlings in Complex Environments Based on Improved BiSeNetV2 and Dynamic Sliding Window Fitting" Agriculture 16, no. 1: 23. https://doi.org/10.3390/agriculture16010023

APA Style

Dong, W., Wang, R., Zeng, F., Jiang, Y., Zhang, Y., Shi, Q., Liu, Z., & Xu, W. (2026). Crop Row Line Detection for Rapeseed Seedlings in Complex Environments Based on Improved BiSeNetV2 and Dynamic Sliding Window Fitting. Agriculture, 16(1), 23. https://doi.org/10.3390/agriculture16010023

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop