Bolov8-based wine making vineyard navigation center line extraction method
By collecting multi-dimensional historical visual images in wine vineyards and optimizing the YOLOv8s-seg model, the problem of unstable centerline extraction in wine vineyards was solved, and a continuous and smooth center line was generated, overcoming the influence of light, plant and environmental interference.
Patent Information
- Application Number
- CN202510855906.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-03
Smart Images

Figure CN120747902A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method for extracting a navigation centerline of a wine-making vineyard based on Yolov8. Background Art
[0002] With the rapid development of intelligent agricultural equipment, agricultural machinery has begun to be widely used for intelligent work in complex field environments such as orchards and vineyards. That is, the work path and navigation are first determined based on the identification and extraction of the orchard, vineyard and other environments. Then, the agricultural machinery performs orchard management and automated operations based on autonomous navigation and closed-loop path tracking between rows.
[0003] In recent years, the application of deep learning-based target detection algorithms (such as the YOLO series) in agricultural scenarios has made certain progress, providing new ideas for vineyard navigation. However, in actual wine vineyards, the influencing factors are far more complex than those in traditional gardens. First, there is light interference, such as strong light reflection at noon and low illumination at dusk, which will cause drastic changes in image pixel values, making it difficult to stably extract road features; second, there is plant interference, plant morphological changes in different growth stages (such as dense leaves during the fruiting period), and the color / texture overlap of vines and road surfaces, which can also cause local loss of path areas or feature confusion; finally, there is environmental interference, such as surface reflections, soil texture changes, and accumulation of debris (such as fallen fruit, branches and leaves), which will destroy the visual consistency of the road surface and increase the difficulty of segmentation. In summary, the mutual interference of multiple factors brings detection instability and path deviation problems to the extraction of the navigation centerline. Summary of the Invention
[0004] The present invention provides a wine vineyard navigation centerline extraction method based on Yolov8, which is used to solve the problems of detection instability and path deviation caused by multi-factor interference.
[0005] In a first aspect, the present invention provides a method for extracting a wine vineyard navigation centerline based on Yolov8, comprising:
[0006] Obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different weather conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement on the historical visual images to obtain a training dataset;
[0007] Based on the training dataset, the YOLOv8s-seg instance segmentation model optimized by transfer learning was trained to obtain an improved instance segmentation model suitable for segmenting the paths between rows in wine vineyards.
[0008] Input the acquired target visual image into the improved instance segmentation model to obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result;
[0009] Edge extraction is performed on the binary mask, and the edge extraction result is fitted to obtain the center line of the road area.
[0010] In a second aspect, the present invention also provides a winery vineyard navigation centerline extraction system based on Yolov8, which is applied to the winery vineyard navigation centerline extraction method based on Yolov8 in the first aspect; the winery vineyard navigation centerline extraction system based on Yolov8 includes:
[0011] The annotation and enhancement module is used to obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different meteorological conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement on the historical visual images to obtain a training dataset;
[0012] The model training module is used to train the YOLOv8s-seg instance segmentation model optimized by transfer learning based on the training dataset, and obtain an improved instance segmentation model suitable for segmenting the roads between rows in wine vineyards;
[0013] A segmentation mask module is used to input the acquired target visual image into the improved instance segmentation model, obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result;
[0014] The extraction and fitting module is used to extract the edge of the binary mask and perform fitting processing on the edge extraction result to obtain the center line of the road area.
[0015] In a third aspect, the present invention further provides an electronic device comprising: a memory for storing a computer software program; and a processor for reading and executing the computer software program, thereby implementing any of the above-mentioned methods for extracting the centerline of a winery navigation based on yolov8.
[0016] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, wherein the storage medium stores a computer software program, and when the computer software program is executed by a processor, it implements any of the above-mentioned methods for extracting the centerline of a winery navigation based on yolov8.
[0017] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-mentioned methods for extracting the centerline of a winery navigation based on yolov8.
[0018] The YOLOv8-based winery navigation centerline extraction method provided in an embodiment of the present invention can comprehensively cover the complex scenes of winery vineyards by collecting multi-dimensional historical visual images within vineyards and other parks. The historical images are accurately annotated at the pixel level, improving the model's recognition accuracy of road surface details. Combined with image enhancement processing, the road surface texture features are further enhanced, reducing the impact of environmental interference such as light reflection and soil texture changes, thereby solving the problem of unstable feature extraction caused by image quality fluctuations in traditional methods. Secondly, transfer learning optimizes the YOLOv8s-seg instance segmentation model to achieve customized training for winery vineyard scenarios, which can effectively solve the problem of insufficient generalization ability of traditional YOLO series algorithms in complex agricultural environments. Finally, the road segmentation results output by the improved model are used to generate a binary mask, which can clearly separate the road surface area from the complex background and avoid path interruptions caused by local feature loss. Combined with edge extraction and centerline fitting on the binary mask, a continuous and smooth centerline can be generated even when the road segmentation results contain a small amount of noise or local missing points. In summary, the present invention achieves targeted optimization of problems such as light interference, plant morphological changes, and environmental debris, and solves the problems of detection instability and path deviation caused by multi-factor interference. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a flow chart of a method for extracting a centerline of a winery navigation system based on Yolov8 provided in an embodiment of the present invention;
[0020] Figure 2 Schematic diagram of the structure of the wine vineyard navigation centerline extraction system based on yolov8 provided in an embodiment of the present invention;
[0021] Figure 3 An embodiment diagram of an electronic device provided by an embodiment of the present invention;
[0022] Figure 4 An embodiment diagram of a computer-readable storage medium provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.
[0024] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more features. In the description of the present invention, "plurality" means two or more, unless otherwise specifically defined.
[0025] In the description of the present invention, the term "for example" is used to mean "used as an example, illustration or explanation". Any embodiment of the present invention described as "for example" is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any person skilled in the art to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed herein.
[0026] See Figure 1 , Figure 1 This is a flow chart of a method for extracting a navigation centerline of a winery based on Yolov8 provided by the present invention. In an embodiment of the present invention, the method for extracting a navigation centerline of a winery based on Yolov8 is executed by a navigation centerline extraction system. Therefore, the method for extracting a navigation centerline of a winery based on Yolov8 includes:
[0027] Step 10: Obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different meteorological conditions, and different grape growth cycles, and perform pixel-level annotation and image enhancement processing on the historical visual images to obtain a training dataset.
[0028] Optionally, in actual wine vineyard scenes, the light intensity and angle vary greatly at different times (such as early morning, noon, and evening). The light in the early morning is soft but low in brightness, direct sunlight at noon is prone to reflections and shadows, and the light in the evening is warm and dim. In terms of meteorological conditions, the clarity, contrast, and color of the image will change significantly under sunny, cloudy, rainy, foggy and other environments. The grape growth cycle includes budding, flowering, fruit setting, and ripening. The coverage and density of grape branches and leaves are different at each stage. These factors will affect the visual characteristics of the road surface between rows. Therefore, the navigation centerline extraction system uses a wide-angle camera with a resolution of ≥1920×1080 and a frame rate of 30fps. It collects images in three time periods: morning (9:00-10:00), noon (12:00-14:00), and dusk (17:00-18:00), covering meteorological conditions such as sunny, cloudy, rainy, and foggy days, as well as the four growth stages of grape budding, flowering, fruit setting, and ripening. At the same time, it records environmental parameters such as light intensity (lx), temperature and humidity (℃ / %RH), and collects no less than 1,000 frames in a single time, with an overall sample size of ≥30,000 frames to obtain historical visual images.
[0029] Furthermore, after obtaining the historical visual image, the navigation centerline extraction system uses the CVAT tool to perform pixel-level annotation on the historical visual image, distinguishing between shadow areas and illuminated areas, and then performs enhancement processing on the original image to obtain an enhanced training data set, as described in steps 101 to 105. By implementing enhancement based on annotated data, the distribution of interference types and intensities can be accurately controlled (such as generating samples with different occlusion rates according to the growth period balance), avoiding the randomness of enhancement leading to imbalanced data distribution. Moreover, the original annotation results can be reused by annotating first and then enhancing, without the need to repeatedly annotate each enhanced image. For example, to enhance an original image with 10 different interference intensities, only one manual annotation is required, which greatly reduces the annotation workload.
[0030] Step 20: Based on the training dataset, the YOLOv8s-seg instance segmentation model optimized by transfer learning is trained to obtain an improved instance segmentation model suitable for segmenting inter-row roads in wine vineyards.
[0031] Optionally, after receiving the training dataset, the navigation centerline extraction system first embeds the CBAM attention mechanism in the C3 module at the end of each stage of the YOLOv8s-seg backbone network. This mechanism includes channel attention (generating channel weights through global pooling and full connectivity) and spatial attention (generating a spatial weight matrix through 7×7 convolutions), improving the model architecture. Then, using transfer learning techniques, the parameters and feature extraction capabilities of the YOLOv8s-seg model pre-trained on another large-scale dataset (COCO) are applied to the winery vineyard road segmentation task. Since the model trained on the COCO dataset has learned to recognize common features of various objects, such as edges and texture, these features are also helpful for identifying winery vineyard pavement. Each image is pixel-wise annotated, categorizing shadow and light areas. Therefore, during training, the parameters of the early layers of the model (which primarily extract common low-level features) are frozen, and only the later layers are trained, allowing the model to focus on learning the unique features of winery vineyard pavement. During training, a loss function is used to measure the difference between the model's predictions and the labeled data. Backpropagation is then used to adjust model parameters to minimize the loss function. Ultimately, an improved instance segmentation model suitable for segmenting inter-row roads in winery vineyards is obtained. Leveraging transfer learning significantly reduces the amount of data and time required for training. Furthermore, leveraging the powerful feature extraction capabilities of the pre-trained model, the model can more quickly learn the characteristics of winery vineyard roads, improving training efficiency and segmentation accuracy.
[0032] In step 30 , the acquired target visual image is input into the improved instance segmentation model to obtain a road segmentation result output by the improved instance segmentation model, and based on the road segmentation result, a binary mask corresponding to the road area is determined.
[0033] Optionally, the navigation centerline extraction system utilizes an improved instance segmentation model adapted for segmenting paths between rows in winery vineyards. As the agricultural robot navigates the vineyard, its camera captures real-time visual images of the target and feeds them into the trained improved instance segmentation model. The model classifies each pixel in the image, determining whether it belongs to an illuminated or shadowed area, and outputs an image containing the class probability for each pixel, representing the path segmentation result.
[0034] Furthermore, the navigation centerline extraction system converts the road segmentation results into a binary mask to more clearly represent the road area. Specifically, based on the output segmentation mask, the "shadow area" and "illuminated area" are identified separately, and then a pixel-level bitwise OR operation is performed to combine them, ultimately forming a complete binary mask of the traffic path. This mask not only achieves high segmentation accuracy but also exhibits good robustness in low-light and high-contrast conditions, providing clear regional definition for subsequent boundary and centerline analysis.
[0035] Step 40: perform edge extraction on the binary mask and perform fitting processing on the edge extraction result to obtain the center line of the road area.
[0036] Optionally, the navigation centerline extraction system uses the Suzuki85 boundary tracking algorithm based on the obtained binary mask, scans the binary mask line by line, tracks the boundaries of the eight-connected neighborhood, filters out small area noise contours, retains the left and right boundary point sets of the largest connected domain, sorts them vertically and averages them to obtain the initial centerline point, then uses the dynamic RANSAC algorithm to eliminate abnormal points, and performs least squares straight line fitting through principal component analysis (PCA) to obtain the centerline of the road area, as described in steps 401 to 405.
[0037] Furthermore, it's important to note that the navigation centerline extraction system also calculates core parameters required for navigation based on the path centerline parameters obtained through real-time fitting. For example, for lateral deviation, the lateral distance error between the vehicle and the path center is output in real time by directly comparing the abscissa position of the vehicle's body center in the image coordinate system with the average x-coordinate of the fitted centerline at the bottom cross-section. For angular deviation, the angle between the fitted line and the image's vertical axis (y-axis) is calculated to determine the angular offset between the current heading of the agricultural machinery and the ideal path. Navigation parameters, including lateral deviation and heading angle, are then encapsulated into messages via the standard CAN bus protocol (CAN version 2.0B, 1Mbps), and transmitted in real time to the agricultural machinery's underlying control system. The control end utilizes a high-precision PID (proportional-integral-differential) algorithm, dynamically adjusting the driving direction and wheelbase with a 10ms control cycle. PID parameters are automatically adjusted based on range calibration, enabling closed-loop control of the agricultural machinery's steering motor, ensuring a stable lateral tracking error within ±5cm. Simultaneously, CAN communication status and execution feedback are monitored in real time. If an anomaly occurs, the system proactively switches to manual mode via redundant safety protocols, ensuring both driving safety and control system robustness from both hardware and protocol perspectives. The entire closed-loop control chain has a response delay of less than 50ms, meeting the dynamic control requirements of autonomous field operation.
[0038] The embodiment of the present invention can fully cover the complex scenes of wine vineyards by collecting multi-dimensional historical visual images in parks such as vineyards, and accurately annotate the historical images at the pixel level, thereby improving the model's recognition accuracy of road surface detail features. Combined with image enhancement processing, it further strengthens the road surface texture features and reduces the influence of environmental interference such as light reflection and soil texture changes, thereby solving the problem of unstable feature extraction caused by image quality fluctuations in traditional methods. Secondly, transfer learning optimizes the YOLOv8s-seg instance segmentation model to achieve customized training for wine vineyard scenes, which can effectively solve the problem of insufficient generalization ability of traditional YOLO series algorithms in complex agricultural environments; finally, a binary mask is generated by the road segmentation results output by the improved model, which can clearly separate the road surface area from the complex background and avoid the path interruption problem caused by the lack of local features. Combined with edge extraction and midline fitting of the binary mask, it can achieve the generation of a continuous and smooth center midline even when there is a small amount of noise or local missing in the road surface segmentation results. In summary, the present invention realizes targeted optimization of problems such as light interference, plant morphological changes, and environmental debris, and solves the problems of detection instability and path deviation caused by multi-factor interference.
[0039] In one embodiment, steps 101 to 105 are described as follows:
[0040] Step 101: align the RGB image and the NIR image to obtain the spectral characteristic value of each pixel.
[0041] In a wine vineyard scenario, the navigation centerline extraction system optionally uses an RGB camera to record visible light information (showing the color and texture of the grapes and road surface), while a NIR (near-infrared) camera captures near-infrared information (vegetation and road surface reflect significantly differently in the near-infrared, with grapevines reflecting strongly and road surface reflecting weakly). However, slight differences in the camera's mounting position and angle can lead to pixel mismatches. Therefore, the RGB and NIR images must first be registered to precisely align them spatially. This ensures that each pixel contains both RGB and near-infrared information. Feature point matching methods, such as the SIFT (Scale-Invariant Feature Transform) algorithm, can be employed. Feature points, such as corners and edges, are first extracted from each RGB and NIR image. Then, the feature point descriptors are used for matching, establishing a correspondence between pixels in the two images. Pixels at the same physical location are aligned, resulting in the spectral characteristic values of each pixel. This registration allows each pixel to incorporate multispectral information, providing the basis for subsequent use of multispectral differences to distinguish different regions.
[0042] Step 102: Determine a spectral threshold based on the grayscale distribution of the local area, compare the spectral feature value with the spectral threshold, and generate an initial mask according to the comparison result.
[0043] Optionally, the navigation centerline extraction system uses multispectral features (RGB+NIR) to distinguish different areas (such as shadow areas and illuminated areas) based on the obtained multispectral information. Specifically, a sliding window (such as 15*15 pixels) can be used to divide the image into multiple small local blocks. For each local block, the grayscale statistics of the pixels therein are calculated. First, according to the formula Calculate the average grayscale of RGB, and then multiply by The grayscale statistics are obtained, where α is the spectral weight coefficient, which is used to adjust the degree of influence of the near infrared. It is determined by experimental parameter adjustment. For example, in the vineyard scene, α takes a value between 0.5 and 2. Then compare this calculation result with the adaptive threshold function T(x, y). T(x, y) can be expressed as an adaptive threshold (such as using the Otsu algorithm of the local block to calculate the optimal threshold in the local area to maximize the inter-class variance of the foreground and background). When When the initial mask S mask =1, otherwise 0. Based on this, an initial mask is generated, with 1s and 0s in the mask preliminarily distinguishing different areas. By combining multispectral and local adaptive thresholding, NIR's ability to distinguish vegetation and the adaptability of local grayscale distribution can more accurately distinguish target areas under different lighting conditions (low light in the early morning, strong light at noon) and different growth cycles (sparse / dense grape leaves).
[0044] Step 103: Modify the boundary of the initial mask based on the polygon tool of CVAT to obtain a modified initial mask.
[0045] Optionally, after the navigation centerline extraction system generates the initial mask, since the initial mask is the result of automatic segmentation by the algorithm, it may be affected by noise and complex scenes, and the boundaries may be inaccurate. Therefore, CVAT is used as a annotation tool. CVAT's polygon tool can manually or semi-automatically adjust the boundaries. Specifically, the operator checks the segmentation results of the initial mask on the CVAT platform and uses the polygon tool to re-outline the accurate boundaries in places where the boundaries are incorrect. For example, the boundary between the shadow area and the illuminated area in the initial mask is not accurately segmented by the algorithm due to the complex shape of the grapevine. In this case, the polygon tool is used to redraw the boundary along the actual grapevine and road surface to correct the incorrectly segmented part and obtain a corrected initial mask that better fits the real scene.
[0046] Step 104 : Map the corrected initial mask to a category label; the category label includes a shadow area label and an illuminated area label.
[0047] Optionally, the navigation centerline extraction system maps the corrected initial mask into specific semantic labels, including shadow area labels and illuminated area labels. Specifically, shadow areas are areas with significantly insufficient lighting, low RGB grayscale, and a specific pattern in NIR response; illuminated areas are areas with normal lighting and high RGB grayscale. Therefore, based on the distribution of 1s and 0s in the corrected mask and the actual scene, the corresponding areas are mapped into one of these two labels.
[0048] Step 105: Perform image enhancement processing on the RGB image based on the category label and the image interference type to obtain a training data set.
[0049] Optionally, after determining the category labels, the navigation centerline extraction system considers different image issues corresponding to different category labels, such as low brightness caused by shadowed areas and excessive reflection in illuminated areas. Image interference types also include lighting interference (strong light, weak light), plant interference (different plant growth cycles), and environmental interference (ground debris, etc.). Therefore, an enhancement method is designed based on different category labels and interference types to obtain a training dataset. This is described in detail in steps 1051 to 1054.
[0050] The embodiment of the present invention aligns RGB and NIR and integrates multispectral information. Compared with single-spectral labeling, it can better distinguish different areas, cope with lighting changes, and solve the problem of blurred shadow boundaries. In addition, the algorithm automatically generates the initial mask, and then manually corrects it using the CVAT tool. This combines algorithm efficiency and manual precision to more accurately process the boundaries of complex scenes.
[0051] In one embodiment, steps 1051 to 1054 are described as follows:
[0052] Step 1051: Perform image enhancement processing on the RGB image based on the category label and illumination interference to obtain a first enhanced image.
[0053] Optionally, the navigation centerline extraction system enhances the image according to the category label and the type of light interference, combined with the temporal lighting patterns of the vineyard (such as changes in light intensity in the morning and evening, and dynamic flickering of light spots), to obtain a first enhanced image, as specifically described in steps 10511-10514.
[0054] Step 1052 : Perform image enhancement processing on the RGB image based on the category label and plant interference to obtain a second enhanced image.
[0055] Optionally, when the navigation centerline extraction system performs image enhancement on the RGB image based on the category labels and plant interference, existing plant occlusion enhancement is not correlated with the grape growth cycle (branch and leaf density and occlusion patterns vary significantly across different cycles). Therefore, the occlusion intensity and pattern are dynamically adjusted based on the growth stage to align with the changing patterns of plant interference in the real field, as described in steps 10521-10524.
[0056] Step 1053 : Perform image enhancement processing on the RGB image based on the category label and environmental interference to obtain three enhanced images.
[0057] Optionally, when the navigation centerline extraction system performs image enhancement on the RGB image based on the category labels and environmental interference, the existing environmental interference enhancement does not distinguish between surface types (sand and gravel have different effects on the attachment and appearance of debris). Therefore, by customizing the debris generation rules based on surface characteristics, the interaction characteristics between debris and the surface in a real field environment can be restored, improving the image enhancement effect, as described in steps 10531-10534.
[0058] Step 1054 : Integrate the first enhanced image, the second enhanced image, and the third enhanced image to obtain a training data set.
[0059] Optionally, after obtaining the first, second, and third enhanced images, the navigation centerline extraction system calculates the pixel ratios of each category label in the three enhanced images and uses weighted sampling to ensure a balanced number of samples in the "shadow area" and "illuminated area" in the training set. Based on the different focuses of the three enhanced images (the first enhancement deals with illumination, the second deals with plants, and the third deals with the environment), these images are fused into the final training data. Fusion is performed based on the needs of the scenario, allowing the different enhancements to complement each other.
[0060] The embodiment of the present invention separates and processes light, plant, and environmental interference to avoid confusion between different types of interference, so that the model can specifically learn the feature invariance under various types of interference, thereby enhancing efficiency and accuracy.
[0061] In one embodiment, steps 10511 to 10514 are described as follows:
[0062] Step 10511: Analyze the light intensity of the vineyard at different times to obtain the brightness fluctuation range and light spot flickering frequency.
[0063] Optionally, the navigation centerline extraction system first performs statistical analysis on the light intensity data I(t) collected by the arranged light sensors at different time periods in the vineyard, and calculates the mean value of different time periods. Standard deviation σ I . Then use the formula: Calculate the brightness fluctuation amplitude α. And count the period of light intensity fluctuation, through Fourier transform The frequency corresponding to the peak of the power spectrum is used as the frequency of the simulated light spot flicker. For example, the flicker frequency of a light spot at noon on a sunny day may be 0.2-0.5Hz. Based on long-term light data from real vineyards, we can accurately simulate the actual light fluctuations in the vineyard. Compared with setting parameters based on experience, the enhanced light interference is more realistic.
[0064] Step 10512: Select the center of the light spot according to the boundary of the illuminated area and the boundary of the shadow area of the category label, and generate a spatial light spot distribution function by combining the gap characteristics of the grape leaves.
[0065] Optionally, the navigation centerline extraction system uses images that have been labeled with category labels (illuminated area, shadow area) within the boundary of the illuminated area, through random sampling or based on grapevine distribution feature point detection (such as using Harris corner detection to find the typical position of the gap between grape leaves in the illuminated area), to select multiple spot centers (x0, y0). For example, in the illuminated area image, light spots are easily formed at the gaps between grape leaves. The corner points of these gaps are detected as candidate points for the light spot center, and then a part of them are randomly selected as the actual light spot center. Based on the actual images of grape leaves collected in the vineyard, the average size and shape of the leaf gaps are measured (approximately elliptical or circular), and its blur radius σ is calculated. Then, by calculating the grayscale distribution of the leaf gap area, Gaussian blur fitting is used to find the σ value that minimizes the fitting error. The formula is:
[0066] SSE=∑ (x,y) [G(x,y;σ)-G real (x,y)] 2 ;
[0067] Among them, G(x,y;σ) represents the Gaussian blur function; G real (x, y) represents the actual grayscale distribution of the leaf gap. The optimal σ is found through iterative optimization. Assuming that the statistical σ is between 3 and 8 pixels, the spatial spot distribution function is:
[0068]
[0069] Based on the selected spot center and σ, a corresponding spot distribution is generated. By combining the true leaf gap characteristics with the class label boundaries, the generated spatial spot distribution more closely matches the actual light penetration conditions in the vineyard (such as spot shape, size, and position). The enhanced interference is more realistic, helping the model learn road surface characteristics under complex lighting conditions.
[0070] Step 10513: Adjust the pixel brightness of the RGB image based on the brightness fluctuation range, the light spot flickering frequency, and the spatial light spot distribution function to obtain a light-enhanced image.
[0071] Optionally, the navigation centerline extraction system converts the time dimension illumination fluctuation coefficient Combined with the spatial light spot S(x,y), adjust the brightness of the original image L(x,y). Among them, t represents the simulation timestamp (unit ms, for example, to simulate a 1-second interval, t is 0-1000ms), f is the light spot frequency, and α is the brightness fluctuation amplitude coefficient. The enhanced brightness L′(x,y,t)=L(x,y)·[1+T(t)]+S(x,y)·β; where β represents the light spot intensity coefficient, with a value of 0.2-0.5, and is adjusted through experiments to ensure that the light spot brightness does not overwhelm the road surface features; T(t) is calculated by time stamp (such as taking a step size of 1ms to simulate the illumination changes within 1 second, a total of 1000 time stamps). For example, at t=500ms, If f = 0.3 Hz, then T(500) = sin(0.3π)·α≈0.809·α, which is then multiplied by the original brightness and superimposed on the spot brightness to obtain the enhanced brightness at the timestamp, that is, the light-enhanced image.
[0072] Step 10514: fine-tune the category label based on the illumination-enhanced image to obtain a first enhanced image.
[0073] Optionally, after the navigation centerline extraction system obtains the illumination-enhanced image, if the enhanced image has dynamic light spots, the original category labels (illuminated area, shadow area) may not match the new image (for example, the brightness of the area covered by the light spot becomes higher and closer to the illuminated area), so the label needs to be fine-tuned. Specifically, the light spot area belongs to the illumination change, and the original semantic label of the illuminated area and shadow area is maintained as a whole. However, for the pixel boundary covered by the light spot, the brightness mean of the light spot area is calculated. and the mean brightness of the shadow area Set brightness threshold Where k2 is an empirical coefficient, ranging from 0.8 to 1.2. Traverse the pixels covered by the light spot, if the pixel brightness L p >T L , it is determined to still belong to the illumination area and the original label is retained; if L p ≤T L , fine-tuned to the shadow area label (this is because the spot coverage causes the pixel brightness to be close to the shadow area). Based on this, it ensures that the label matches the brightness distribution of the enhanced image.
[0074] The embodiment of the present invention collects real vineyard lighting data, simulates dynamic light spots, and then adapts labels, fully restoring the "dynamic spatiotemporal coupling" characteristics of lighting (temporal light intensity fluctuations, spatial light spot distribution, and both changing over time), making the enhanced image closer to the actual operation scene and the features learned by the model more practical.
[0075] In one embodiment, steps 10521 to 10524 are described as follows:
[0076] Step 10521: Convert the marked plant growth cycle into a coding value, and determine the growth cycle occlusion coefficient based on the coding value and the typical occlusion ratio range of each growth stage.
[0077] Optionally, the navigation centerline extraction system codes the vineyard plant growth cycles (such as budding, leafing, flowering, fruiting, and ripening) in sequence, setting them as s = 1, 2, 3, 4, 5. It also collects historical image data and calculates the typical occlusion ratio R for each growth stage. stage (i.e. the proportion of the plant occlusion area to the image road surface), calculate the minimum proportion s of all stages min and the maximum proportion s max For example, if 500 historical images are counted, the average occlusion ratio in the budding period (s=1) is 10%, and the average occlusion ratio in the mature period (s=5) is 35%, then s min =0.1,s max =0.35. Then the growth period shading coefficient formula is: Where γ is the occlusion gain coefficient (empirical value, 0.5-1.5, tuned by the validation set, for example, set γ = 1.2). min (germination period), then G(s) = 0; the occlusion ratio remains basically unchanged; when s = s max (fruiting period), then G(s) = γ, and the shading ratio is maximized. Dynamically adjusting the shading intensity through the growth cycle better reflects the actual shading changes in the vineyard compared to a fixed shading mode.
[0078] Step 10522: Analyze the distribution direction of plant leaves based on the marked occlusion area mask, and construct a random leaf occlusion probability based on the analysis result.
[0079] Optionally, the navigation centerline extraction system counts the long axis direction of the grape leaves in the annotated occlusion area mask (for example, the direction along the vine is horizontal, with an angle of 0°; the direction perpendicular to the vine is 90°), and measures the aspect ratio of the real grape leaves (for example, length: width = 3:1) and edge jaggedness (using Fourier descriptors to simulate jagged outlines), generating a leaf shape mask in the image. Subsequently, a Bernoulli distribution is used to simulate whether the leaves are occluded, with the formula P(x,y) = Bernoulli(0.5)*Mask(x,y). Mask(x,y) represents the annotated plant area mask (1 represents the plant area, 0 represents the road surface), and Bernoulli(0.5) represents a 50% probability of occlusion (simulating random distribution of leaves). Based on the combination of leaf morphology templates, the occluded "leaves" have a real shape and direction.
[0080] Step 10523: Enhance the RGB image based on the growth cycle occlusion coefficient and the random leaf occlusion probability to obtain enhanced images of plants at different growth stages and different occlusion densities.
[0081] Optionally, the navigation centerline extraction system combines the occlusion coefficient G(s) of the growth cycle and the random leaf occlusion probability P(x,y) to enhance the occlusion coverage using the following formula:
[0082] R new =R init ·[1+G(s)]·P(x,y);
[0083] Specifically, first calculate the basic occlusion: R init [1+G(s)], such as in the embryonic stage (G(s) = 0), the basic occlusion is R init (Ratio of original occlusion); fruiting period (G(s) = 1.5), then the basic occlusion is R init ×2.5 to simulate the changes in occlusion density caused by the growth cycle. Random leaf occlusion is then superimposed: multiplying by P(x, y) randomly distributes the occluded area according to leaf morphology and probability, generating images with different growth stages and occlusion densities. For example, in an image during the fruiting period, the base occlusion changes the road surface from 40% to 100% occlusion. Multiplying by P(x, y) (50% probability), the final occlusion coverage is 100% × 50% = 50%, meaning that 50% of the road surface in the enhanced image is obscured by plants.
[0084] Step 10524: Correct the road area label based on the plant enhanced image to obtain a second enhanced image.
[0085] Optionally, after the navigation centerline extraction system obtains the enhanced image of the plant, the original road area label may be destroyed by the occlusion due to the newly added occlusion in the enhanced image (simulating leaves blocking the road surface), so it needs to be corrected. Specifically, in the enhanced image, the newly added occlusion area (generated by P(x,y)) belongs to the plant and is marked as a non-path label. Morphological operations are performed on the original road area label along the occlusion edge (such as dilation and then erosion). Dilation is to expand the road area boundary to cover the obscured fragmented road surface; corrosion is to shrink back to the true boundary to remove false positives caused by expansion. Through dilation-erosion, the narrowing of the road boundary caused by occlusion is corrected to obtain the path integrity, and a second enhanced image is obtained.
[0086] The embodiment of the present invention uses encoding mapping and occlusion coefficients to accurately simulate occlusion changes in different growth stages (such as budding stage → maturity stage, and occlusion changes from sparse to dense), allowing the model to learn the full-cycle plant interference characteristics and adapt to the year-round operation needs of the vineyard. Then, from leaf morphology (aspect ratio, serrations) to distribution direction (along the vine), and then to random probability, highly realistic plant occlusion is constructed, solving the "false occlusion" problem of traditional enhancement and improving the model's generalization ability for real scenes. Finally, road labels are dynamically corrected through morphological operations to ensure that the enhanced image and labels are updated synchronously, avoiding erroneous supervision and ensuring the effectiveness of model training.
[0087] In one embodiment, steps 10531 to 10534 are described as follows:
[0088] Step 10531: annotate the RGB image based on the environmental interference type, and extract texture features from the annotated image to obtain surface type features.
[0089] Alternatively, because vineyards have diverse surface types (sand, gravel, and weeds), and the debris attached to different surfaces (fallen fruit on sand, dead leaves in gravel) varies in form, the navigation centerline extraction system first labels the surface type and then extracts texture features. Specifically, in the RGB image, the surface type T(x, y) is labeled with a category label (e.g., T=1 for sand and T=2 for gravel). Next, for each surface type region, the gray-level co-occurrence matrix (GLCM) is used to extract texture roughness and calculate the mean and variance of the color distribution. For example, the GLCM statistics for the sandy soil region are: at 0°, with a step size of 3 pixels and a grayscale level of 256, features such as contrast and entropy are calculated. The color mean is khaki (RGB mean [180, 120, 80]) with low variance (uniform color). The gravel region has a mixed color, with a mean of [150, 150, 150], high variance, and high GLCM contrast (the gravel has many angular features), ultimately resulting in the surface type characteristics. Through these characteristics, the generation parameters of debris corresponding to different surface types are determined.
[0090] Step 10532: Determine a debris area mask based on the surface type characteristics and the preset surface debris probability distribution.
[0091] Optionally, different surface types correspond to different debris (sand, fallen fruit, gravel, and dead leaves). Therefore, the navigation centerline extraction system presets the probability distribution of debris D(T) and uses Gaussian distribution to determine:
[0092] D(T)=Gauss(μ T ,σ T ); where μ T It is expressed as the mean value of debris generation. For example, in the sandy soil area, there are more fallen fruits, μ1=0.6; in the gravel area, there are fewer dead leaves, μ2=0.3, σ Tis the variance (controls the dispersion of debris distribution, σ1 = 0.1 in the sand area and σ2 = 0.2 in the gravel area). Then, in the corresponding surface type area, a mask is randomly generated according to the probability D(T). For example, in the sand area (T = 1), for each pixel, a 60% probability is marked as a debris area (Mask debris =1), 40% reserved surface (Mask debris = 0); gravel areas (T = 2) are marked as debris areas with a 30% probability. At the same time, the actual debris size is calculated (fallen fruit diameter 3-5 cm → 30-50 pixels in the image; dead leaves area 10-20 square centimeters → 100-200 pixels in the image) to control the size and density of debris so that the debris blocks in the mask match the actual size.
[0093] Step 10533: Based on the debris area mask, the debris texture of the RGB image is fused with the surface texture to obtain an environmental interference enhanced image.
[0094] Optionally, the navigation centerline extraction system collects real vineyard debris textures (fruit drop image Texture, surface original texture → Texture ground ). For example, the texture of the sandy area ground The texture is sandy soil (yellowish, rough), the texture is fruit drop texture (dark red, round); the texture of gravel area ground is gravel texture (grey, multi-angled), Texture is dead leaf texture (brown, irregular). Then, for each pixel, if Mask debris (x,y)=1 (clutter area), use the clutter texture; otherwise use the surface texture ground Then use the formula:
[0095] Textures are fused and then enhanced using the image I′ = I·F(x,y). For example, if a pixel in a sandy area is a fallen fruit area, F(x,y) takes the fallen fruit texture and multiplies it with the original image I. This allows the fallen fruit to blend into the sandy surface, keeping the grayscale difference within 15% (for example, the RGB mean values for sand are [180, 120, 80], while the fallen fruit are [160, 100, 60], resulting in an 11% difference, achieving a natural transition). This texture fusion formula allows for a natural transition between debris and the surface, avoiding the unrealistic illusion of "floating debris" and improving the fidelity of environmental interference enhancement.
[0096] Step 10534: Correct the road area label based on the environmental interference enhanced image to obtain a third enhanced image.
[0097] Optionally, the navigation centerline extraction system marks the debris-covered area as "non-path". Use a contour detection algorithm (such as Canny edge detection, with the threshold set to an appropriate value, such as a low threshold of 50 and a high threshold of 150) to extract the boundary between the debris and the road. The original "road area" label is corrected along the boundary. For example, when debris covers the edge of the road, the road label is shrunk to ensure that the road area label is consistent with the debris distribution in the enhanced image. Specifically, the Canny algorithm is used to detect the edge of the debris in the enhanced image to obtain the edge contour C. The original road label Road old The part intersecting with the contour C is subjected to morphological corrosion operation (kernel size 3 pixels) to shrink the road boundary and obtain the corrected road label Road new , that is, the third enhanced image is obtained.
[0098] The embodiment of the present invention distinguishes different surface types (sand, gravel, etc.), extracts texture and color features, and associates them with debris generation parameters, so that the debris enhancement fits the actual field patterns (such as more fallen fruits in sandy soil and more dead leaves in gravel), thereby improving the authenticity of environmental interference simulation. Then, the debris texture and surface texture are naturally transitioned through a fusion formula to solve the "abrupt superposition" problem of traditional enhancement, allowing the model to learn more realistic environmental interference features and improve its ability to distinguish complex scenes. Finally, contour detection and morphological operations are combined to correct road labels to ensure that the labels are consistent with the enhanced images, avoid erroneous supervision, ensure the model training effect, and improve the subsequent road segmentation accuracy.
[0099] In one embodiment, steps 401 to 405 are described as follows:
[0100] Step 401 : Scan the binary mask line by line, perform eight-connected neighborhood tracking on each unmarked foreground pixel, and generate a closed contour sequence.
[0101] Optionally, in the binary mask, the navigation centerline extraction system has the road as the foreground (value 1) and the background as 0. By scanning the pixels line by line and tracking with the eight-connected neighborhood, the boundary of the road is found. Specifically, starting from the upper left corner of the image, scan to the right row by row, and when you encounter an unmarked foreground pixel (value 1), use it as the starting point to check its neighbor pixels in eight directions (up, down, left, right, upper left, upper right, lower left, lower right). If the neighbor is also a foreground pixel and has not been marked, add the neighbor to the contour point set, and continue to check its eight-connected neighbors from this neighbor until a closed contour is formed. Each time a closed contour is found, record it to form a contour sequence {C1, C2, ..., C i}.
[0102] Step 402: sort and filter the closed contour sequence according to the contour area to obtain a main contour point set.
[0103] Optionally, the navigation centerline extraction system filters out the true road contour based on the found contour sequence. Specifically, for each contour C i , calculate the area using Green's formula Where (x next ,y next ) represents the next point on the contour at (x, y). For example, the contour C1 of a Bordeaux vineyard road has a perimeter of 1000 pixels, and the calculated area A1 is 5000 pixels². The contour C2 of a small pebble has a perimeter of 20 pixels and an area A2 of 30 pixels². The calculated contours are sorted by area from largest to smallest, and a threshold is set (for example, 10% of the maximum area). Contours with areas greater than the threshold are retained as the main contour point set.
[0104] Step 403: Group the main contour point set according to the X coordinate and arrange them in ascending order according to the Y coordinate to obtain the left boundary and the right boundary.
[0105] Optionally, since the road is long, after the navigation centerline extraction system obtains the main contour point set, it separates the main contour point set into the left and right boundaries of the road. Specifically, the points in the main contour point set are sorted from small to large by x-coordinate, and then divided into two groups, left and right. For example, the roads in the Bordeaux vineyards are slanted from the upper left to the lower right. The points with small x-coordinates in the main contour point set (the left part) are the left boundary, and the points with large x-coordinates (the right part) are the right boundary. Then, the left and right groups of points are sorted from small to large by Y-coordinate to obtain an ordered left boundary point set. and the right boundary point set So that each Y coordinate corresponds to the left and right boundary points. After separating the left and right boundaries, we can find the corresponding left and right boundary points for each Y coordinate, preparing for the subsequent calculation of the midline.
[0106] Step 404: For each row of Y coordinates, an initial midline point set is obtained based on the mean of the midpoints of the left boundary and the right boundary.
[0107] Optionally, the navigation centerline extraction system takes the midpoint of the left and right boundary points for each Y coordinate to obtain the initial centerline point. Specifically, for each Y coordinate, find the left boundary point (x L ,y) and the right boundary point (x R ,y), then the midpoint For example, in the Bordeaux vineyard image, Y=100 rows, the left boundary point is (150,100), and the right boundary point is (200,100), then the midpoint is It's important to note that if there are multiple left and right boundary point pairs at the same Y coordinate (for example, if the road forks), the mean of all midpoints is taken. For example, in the Y=200 row, there are two pairs of left and right boundary points: (140,200) and (210,200), (150,200) and (200,200), with midpoints at (175,200) and (175,200), respectively, and the mean is (175,200). The midpoints of the left and right boundaries are the centerline of the road. This calculation is simple and direct, and can quickly obtain the initial centerline point set. Furthermore, the mean processing can handle complex situations such as road forks, allowing the centerline to be correctly calculated under various road conditions.
[0108] Step 405 , removing abnormal points from the initial centerline point set, and performing analysis and fitting on the removed point set to obtain the centerline of the road area.
[0109] Optionally, the initial centerline point set of the navigation centerline extraction system may have abnormal points (such as the centerpoint offset caused by the misjudgment of the left and right boundaries), which should be removed before fitting. Specifically, a statistical method is used to calculate the distance between each centerline point and the adjacent points. If d i Greater than a threshold (such as the mean of all distances 3 times of the distance between adjacent points) is considered an outlier and is removed. For example, in the Bordeaux vineyard image, most adjacent points are 1-3 pixels apart. If a point is 20 pixels away from the previous point, this point is removed. Then, the least squares method is used to fit the remaining points, the formula f(y) = a·y 2 +b·y+c, where a, b, c are parameters, by minimizing the error Solution: If the road in the Bordeaux vineyard is a curve, and the fitted values are a=0.001, b=0.5, c=100, the midline equation is f(y)=0.001y 2 +0.5y+100. Finally, the center line of the road area is obtained.
[0110] The embodiment of the present invention can fully capture the road boundary through eight-connected neighborhood tracking, regardless of whether the boundary is vertical, horizontal or diagonal, and will not be missed, ensuring the accuracy of the contour. Area screening can eliminate small interference (pebbles, weeds), focus on the main road, and improve the reliability of centerline extraction; then, grouping by X coordinate and sorting by Y coordinate can clearly separate the left and right boundaries, so that the left and right boundary points corresponding to each Y coordinate are correctly paired, laying the foundation for centerline calculation; finally, the midpoint calculation is simple and direct, and the initial centerline can be quickly obtained; outlier removal and least squares fitting make the centerline smoother and more consistent with the actual road direction. Even if the road is curved or there is a small interference, the final fitted centerline can accurately represent the center of the road, providing an accurate navigation path for the agricultural robot.
[0111] Furthermore, the winery vineyard navigation centerline extraction system based on yolov8 provided by the present invention is described below. The winery vineyard navigation centerline extraction system based on yolov8 described below and the winery vineyard navigation centerline extraction method based on yolov8 described above can correspond to each other.
[0112] Optional, see Figure 2 , Figure 2 This is a schematic diagram of the structure of the winery vineyard navigation centerline extraction system based on Yolov8 provided by the present invention. The winery vineyard navigation centerline extraction system based on Yolov8 includes:
[0113] The annotation and enhancement module 210 is used to obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different meteorological conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement processing on the historical visual images to obtain a training data set;
[0114] A model training module 220 is configured to train a YOLOv8s-seg instance segmentation model optimized by transfer learning based on a training dataset to obtain an improved instance segmentation model suitable for segmenting inter-row roads in wine vineyards;
[0115] The segmentation mask module 230 is used to input the acquired target visual image into the improved instance segmentation model, obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result;
[0116] The extraction and fitting module 240 is used to perform edge extraction on the binary mask and perform fitting processing on the edge extraction result to obtain the center line of the road area.
[0117] The embodiment of the present invention can fully cover the complex scenes of wine vineyards by collecting multi-dimensional historical visual images in parks such as vineyards, and accurately annotate the historical images at the pixel level, thereby improving the model's recognition accuracy of road surface detail features. Combined with image enhancement processing, it further strengthens the road surface texture features and reduces the influence of environmental interference such as light reflection and soil texture changes, thereby solving the problem of unstable feature extraction caused by image quality fluctuations in traditional methods. Secondly, transfer learning optimizes the YOLOv8s-seg instance segmentation model to achieve customized training for wine vineyard scenes, which can effectively solve the problem of insufficient generalization ability of traditional YOLO series algorithms in complex agricultural environments; finally, a binary mask is generated by the road segmentation results output by the improved model, which can clearly separate the road surface area from the complex background and avoid the path interruption problem caused by the lack of local features. Combined with edge extraction and midline fitting of the binary mask, it can achieve the generation of a continuous and smooth center midline even when there is a small amount of noise or local missing in the road surface segmentation results. In summary, the present invention realizes targeted optimization of problems such as light interference, plant morphological changes, and environmental debris, and solves the problems of detection instability and path deviation caused by multi-factor interference.
[0118] See also Figure 3 , Figure 3 This is a diagram of an embodiment of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, an embodiment of the present invention provides an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented:
[0119] Obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different weather conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement on the historical visual images to obtain a training dataset;
[0120] Based on the training dataset, the YOLOv8s-seg instance segmentation model optimized by transfer learning was trained to obtain an improved instance segmentation model suitable for segmenting the paths between rows in wine vineyards.
[0121] Input the acquired target visual image into the improved instance segmentation model to obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result;
[0122] Edge extraction is performed on the binary mask, and the edge extraction result is fitted to obtain the center line of the road area.
[0123] See also Figure 4 , Figure 4Detailed description of an embodiment of a computer-readable storage medium provided by an embodiment of the present invention. Figure 4 As shown, this embodiment provides a computer-readable storage medium 400 on which a computer program 311 is stored. When the computer program 311 is executed by a processor, the following steps are implemented:
[0124] Obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different weather conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement on the historical visual images to obtain a training dataset;
[0125] Based on the training dataset, the YOLOv8s-seg instance segmentation model optimized by transfer learning was trained to obtain an improved instance segmentation model suitable for segmenting the paths between rows in wine vineyards.
[0126] Input the acquired target visual image into the improved instance segmentation model to obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result;
[0127] Edge extraction is performed on the binary mask, and the edge extraction result is fitted to obtain the center line of the road area.
[0128] On the other hand, the present invention further provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the wine vineyard navigation centerline extraction method based on YOLOv8 provided by the above methods, which includes:
[0129] Obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different weather conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement on the historical visual images to obtain a training dataset;
[0130] Based on the training dataset, the YOLOv8s-seg instance segmentation model optimized by transfer learning was trained to obtain an improved instance segmentation model suitable for segmenting the paths between rows in wine vineyards.
[0131] Input the acquired target visual image into the improved instance segmentation model to obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result;
[0132] Edge extraction is performed on the binary mask, and the edge extraction result is fitted to obtain the center line of the road area.
[0133] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. That is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0134] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or certain parts of the embodiment.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A wine vineyard navigation centerline extraction method based on yolov8, characterized in that: include: Obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different weather conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement on the historical visual images to obtain a training dataset; Based on the training dataset, the YOLOv8s-seg instance segmentation model optimized by transfer learning was trained to obtain an improved instance segmentation model suitable for segmenting the paths between rows in wine vineyards. Input the acquired target visual image into the improved instance segmentation model to obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result; Edge extraction is performed on the binary mask, and the edge extraction result is fitted to obtain the center line of the road area.
2. The wine vineyard navigation centerline extraction method based on yolov8 according to claim 1, characterized in that: Historical visual images include RGB images and NIR images. Pixel-level annotation and image enhancement are performed on the historical visual images to obtain a training dataset, including: The RGB image and the NIR image are registered to obtain the spectral characteristic value of each pixel; Based on the grayscale distribution of the local area, the spectral threshold is determined, and the spectral feature value is compared with the spectral threshold, and an initial mask is generated according to the comparison result; The boundary of the initial mask is corrected using the polygon tool based on CVAT to obtain the corrected initial mask; Mapping the corrected initial mask to a category label; the category label includes a shadow area label and an illuminated area label; Image enhancement is performed on RGB images based on category labels and image interference types to obtain a training dataset.
3. The wine vineyard navigation centerline extraction method based on yolov8 according to claim 2 is characterized in that: Image interference types include light interference type, plant interference type, and environmental interference type. Image enhancement processing is performed on RGB images based on category labels and image interference types to obtain a training dataset, including: Performing image enhancement processing on the RGB image based on the category label and the illumination interference to obtain a first enhanced image; Perform image enhancement processing on the RGB image based on the category label and plant interference to obtain a second enhanced image; Perform image enhancement on the RGB image based on the category label and environmental interference to obtain three enhanced images; The first enhanced image, the second enhanced image and the third enhanced image are integrated to obtain a training data set.
4. The wine vineyard navigation centerline extraction method based on yolov8 according to claim 3 is characterized in that: Performing image enhancement processing on the RGB image based on the category label and the illumination interference type to obtain a first enhanced image, including: Analyze the light intensity of the vineyard at different times to obtain the brightness fluctuation range and light spot flicker frequency; According to the boundary of the illuminated area and the shadow area of the category label, the center of the light spot is selected, and the spatial light spot distribution function is generated by combining the gap characteristics of the grape leaves; The pixel brightness of the RGB image is adjusted based on the brightness fluctuation range, light spot flickering frequency and spatial light spot distribution function to obtain a light-enhanced image. The category label is fine-tuned based on the illumination enhanced image to obtain a first enhanced image.
5. The wine vineyard navigation centerline extraction method based on yolov8 according to claim 3 is characterized in that: The RGB image is enhanced based on the category label and the plant interference type to obtain a second enhanced image, including: Convert the marked plant growth cycle into a coded value, and determine the growth cycle occlusion coefficient based on the coded value and the typical occlusion ratio range of each growth stage; Analyze the distribution direction of plant leaves based on the marked occlusion area mask, and construct the random leaf occlusion probability based on the analysis results; The RGB image is enhanced based on the growth cycle occlusion coefficient and random leaf occlusion probability to obtain enhanced images of plants at different growth stages and different occlusion densities. The road area label is corrected based on the plant enhanced image to obtain a second enhanced image.
6. The wine vineyard navigation centerline extraction method based on yolov8 according to claim 3 is characterized in that: Performing image enhancement processing on the RGB image based on the category label and the environmental interference type to obtain a first enhanced image includes: The RGB image is annotated based on the environmental interference type, and texture features are extracted from the annotated image to obtain surface type features; Determine the debris area mask based on the surface type characteristics and the preset surface debris probability distribution; The debris texture of the RGB image is fused with the surface texture based on the debris area mask to obtain the environmental interference enhanced image; The road area label is corrected based on the environmental interference enhanced image to obtain a third enhanced image.
7. The method for extracting the centerline of a winery navigation system based on Yolov8 according to claim 3, characterized in that: Perform edge extraction on the binary mask and perform fitting processing on the edge extraction results to obtain the center line of the road area, including: Scan the binary mask line by line, track the eight-connected neighborhood of each unlabeled foreground pixel, and generate a closed contour sequence; Sort and filter the closed contour sequence according to the contour area to obtain the main contour point set; Group the main contour point set by X coordinate and sort them in ascending order by Y coordinate to obtain the left boundary and the right boundary; For each row of Y coordinates, the initial midline point set is obtained based on the mean of the midpoints of the left and right boundaries; The abnormal points in the initial centerline point set are eliminated, and the eliminated point set is analyzed and fitted to obtain the centerline of the road area.
8. A wine vineyard navigation centerline extraction system based on yolov8, characterized in that: A method for extracting a centerline for navigation in a wine vineyard based on yolov8 as claimed in any one of claims 1 to 7; The wine vineyard navigation centerline extraction system based on yolov8 includes: The annotation and enhancement module is used to obtain historical visual images of the road surface between rows of wine vineyards at different time periods, different meteorological conditions, and different grape growing cycles, and perform pixel-level annotation and image enhancement on the historical visual images to obtain a training dataset; The model training module is used to train the YOLOv8s-seg instance segmentation model optimized by transfer learning based on the training dataset, and obtain an improved instance segmentation model suitable for segmenting the roads between rows in wine vineyards; A segmentation mask module is used to input the acquired target visual image into the improved instance segmentation model, obtain the road segmentation result output by the improved instance segmentation model, and determine the binary mask corresponding to the road area based on the road segmentation result; The extraction and fitting module is used to extract the edge of the binary mask and perform fitting processing on the edge extraction result to obtain the center line of the road area.
9. An electronic device comprising: Memory for storing computer software programs; A processor for reading and executing a computer software program, wherein the processor implements the wine vineyard navigation centerline extraction method based on yolov8 as claimed in any one of claims 1 to 7 when executing the computer software program.
10. A non-transitory computer-readable storage medium having a computer software program stored therein, characterized in that: When the computer software program is executed by a processor, it implements the wine vineyard navigation centerline extraction method based on yolov8 as claimed in any one of claims 1 to 7.