Generative adversarial network-based rural area road network construction method and device, and medium
By using adversarial training and loss function optimization of the T2R-GAN model, the problem of rural road extraction from sparse trajectory data in existing technologies is solved, generating high-precision rural road images suitable for complex rural terrain.
Patent Information
- Application Number
- CN202510267960.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-10-31
AI Technical Summary
Existing methods for extracting rural roads are ineffective when dealing with sparse, low-quality agricultural machinery trajectory data. In particular, remote sensing image methods struggle to identify narrow dirt roads, and trajectory methods are unable to capture sparse trajectory features. Furthermore, they suffer from overfitting and generating redundant roads.
The T2R-GAN model based on generative adversarial networks is adopted. Through adversarial training of the ELAU-Net generator and the PatchGAN discriminator, combined with the bilateral hinge loss function, the generator learns to generate realistic road images from sparse trajectory data, and the discriminator judges the authenticity of the generated images, reducing the risk of overfitting and extracting rural roads.
It significantly improves the accuracy and applicability of road extraction in rural areas, can generate realistic road images in sparse trajectory environments, reduces noise interference, avoids redundant road generation, and improves the accuracy and robustness of road extraction.
Smart Images

Figure CN120877083A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of road network construction technology, and specifically to a method, device, and medium for constructing rural road networks based on generative adversarial networks. Background Technology
[0002] Existing rural road extraction techniques are mainly divided into two categories: remote sensing image-based methods and trajectory-based methods. Remote sensing image-based methods rely on high-resolution satellite or aerial imagery, combined with machine learning or deep learning models, to extract roads by analyzing their topology, geometry, and texture features. For example, MSAU-Net, which combines U-Net and a multi-attention mechanism, can accurately extract road edge features from high-resolution remote sensing images. Another method, IDANet, combines D-LinkNet and an attention mechanism, improving the accuracy of road extraction through iterative training. However, these methods perform poorly in rural areas because rural roads are often narrow, low-quality dirt roads, and easily obscured by trees or vegetation, resulting in a very blurry and complex representation of roads in remote sensing images, affecting the extraction results. Trajectory-based methods first convert GPS trajectory data of agricultural machinery or vehicles into raster images, and then use deep learning models to extract road information. RING-Net utilizes GPS trajectory data, combined with a deep convolutional network and a self-attention mechanism, to more effectively extract road features when processing urban vehicle trajectories. The DeepMG method generates road centerlines from vehicle trajectories and extracts urban road features using a deep learning model. However, these methods are primarily designed for the high-density vehicle trajectories in urban environments and show significant limitations when processing agricultural machinery trajectories. Due to the low trajectory density and uneven sampling frequency of agricultural machinery, existing trajectory segmentation models struggle to effectively capture road features.
[0003] Both of these methods have significant limitations. Their application in rural roads and agricultural machinery tracking suffers from the following shortcomings:
[0004] Limitations of remote sensing image methods: Rural roads are often narrow dirt roads, easily covered by tree canopies or vegetation, making it difficult to identify road features in remote sensing images and resulting in poor extraction results. Furthermore, the complex road topology in rural areas makes it difficult for traditional remote sensing image extraction methods to effectively capture these intricate details.
[0005] Limitations of trajectory methods: Existing trajectory-based road extraction methods are usually designed for high-density, high-sampling-rate vehicle trajectories in cities, while agricultural machinery trajectories have low density and uneven sampling frequency, resulting in traditional trajectory methods performing poorly when processing agricultural machinery data and failing to accurately capture road features in sparse trajectories.
[0006] Overfitting and Redundant Road Generation: Some existing methods risk overfitting when processing agricultural machinery trajectories, generating a large number of redundant roads. For example, some models may incorrectly generate non-existent roads when faced with sparse trajectories or complex road intersections, reducing the model's accuracy and applicability. Summary of the Invention
[0007] In view of this, the present invention provides a method, device and medium for constructing rural road networks based on generative adversarial networks, which can effectively capture trajectory features of different densities and can handle sparse agricultural machinery trajectories and complex rural roads.
[0008] To achieve the above objectives, the technical solution of the present invention is as follows:
[0009] A method for constructing rural road networks based on generative adversarial networks includes the following steps:
[0010] Step 1: Convert the GNSS trajectory points of agricultural machinery into a two-dimensional trajectory raster image;
[0011] Step 2: The trajectory raster image is encoded and decoded using the ELAU-Net generator to generate a road image; wherein, the ELAU-Net generator introduces an ELA module and captures long-distance dependencies through a strip pooling mechanism;
[0012] (4) Use the PatchGAN discriminator to perform adversarial training between the generated road images and real road images;
[0013] (5) The training process of the generator and discriminator is constrained by a two-sided hinge loss function to reduce overfitting;
[0014] (6) After training is complete, extract and output the road results:
[0015] Rural roads are automatically extracted from the input raster image of agricultural machinery tracks, and clear road extraction results are generated.
[0016] The ELA module embeds a strip pooling layer between the encoder and decoder.
[0017] The bilateral hinge loss function simultaneously constrains the discriminator's confidence output for both the real and generated images, and its specific formula is as follows:
[0018]
[0019] Where D(x) is the score of the discriminator for the real image, and D(G(z)) is the score of the discriminator for the generated image; The output P represents the confidence level of the real image. real Represents the confidence interval of a real image; P represents the confidence output of the generated image. gen This represents the confidence interval of the generated image.
[0020] Step 1 further includes rotating and mirroring the trajectory raster image to expand the dataset.
[0021] In the trajectory rasterization process, each GNSS trajectory point is mapped to fixed grid coordinates to form a raster image with a resolution of 0.5 meters to 2 meters.
[0022] The ELAU-Net generator and PatchGAN discriminator are iteratively optimized through adversarial training until the generated road image cannot be distinguished from the real road image by the discriminator.
[0023] The present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory. When the computer program is executed by the processor, it implements the rural road network construction method based on generative adversarial networks described in the present invention.
[0024] The device integrates a BeiDou GNSS module for real-time acquisition of agricultural machinery trajectory data and execution of the road network construction process described in claim 1.
[0025] The present invention also provides a computer-readable storage medium storing computer program instructions, which, when executed by an electronic device, implement the rural road network construction method based on generative adversarial networks described in the present invention.
[0026] Beneficial effects:
[0027] 1. Traditional road extraction methods based on trajectories and remote sensing images perform poorly when dealing with sparse, low-quality trajectories. This invention proposes a CGAN-based road extraction model—T2R-GAN. T2R-GAN employs a Conditional Generative Adversarial Network (CGAN) architecture, where the generator and discriminator are continuously optimized through adversarial training. The generator learns to generate realistic road images from sparse trajectory data, while the discriminator judges whether the generated road images are realistic. This adversarial training approach enables the model to effectively capture fuzzy road features in agricultural machinery trajectories and generate images highly similar to real roads. Therefore, CGAN, through adversarial training, can better learn complex trajectory-to-road mapping relationships, making it particularly suitable for handling trajectory data with uneven density, significantly improving the accuracy of road extraction. This invention's method utilizes generative adversarial networks to construct road networks around agricultural machinery trajectories, generating realistic road images in sparse trajectory environments. This enables effective road extraction from sparse and complex agricultural machinery trajectory data, significantly improving the accuracy and applicability of road extraction in rural areas.
[0028] 2. Existing methods for extracting urban vehicle trajectories perform poorly when dealing with sparse trajectories of agricultural machinery. The T2R-GAN model used in this invention adapts to trajectory data of varying densities and complexities through adversarial training, making it particularly suitable for processing low-frequency, unevenly sampled agricultural machinery trajectories. This significantly improves the applicability and accuracy of rural road extraction. When processing low-density, unevenly sampled agricultural machinery trajectories, T2R-GAN combines trajectory rasterization and adversarial learning, enabling it to adaptively handle trajectories of different densities when generating road images and to perform reasonable road extraction at complex road intersections.
[0029] 3. While existing U-Net structures can transmit low-level semantic information, they also transmit a significant amount of noise, affecting the accurate extraction of road features. In this invention, by introducing an ELA module, ELAU-Net can better capture road features in sparse trajectory regions, reducing noise interference and thus improving the accuracy of road extraction. Specifically, ELAU-Net is a highly efficient encoder-decoder network that introduces a novel ELA (Efficient Local Attention) module. The ELA module, through strip pooling, can capture long-range dependencies in trajectory images, effectively overcoming noise in the low-level semantic information of trajectory data and enhancing road feature extraction in sparse trajectory regions.
[0030] 4. Existing generative models are prone to overfitting when processing sparse trajectory data, resulting in the generation of numerous redundant roads. This invention, through a bilateral hinged loss function, enables T2R-GAN to better balance the generation and discrimination processes during adversarial training, avoiding the generation of redundant roads and improving the model's accuracy and generalization ability. The bilateral hinged loss function is an improvement on the traditional hinged loss function; it not only penalizes low-confidence outputs from the discriminator for generated road images but also penalizes excessively high-confidence outputs. This design effectively reduces the risk of overfitting by the discriminator, thereby promoting the generation of more accurate road images.
[0031] 5. The device of this invention is used to implement the method of this invention. It constructs a road network based on agricultural machinery trajectories using a generative adversarial network (GAN), overcoming the technical shortcomings of existing technologies that struggle to effectively extract roads from sparse and complex agricultural machinery trajectory data. This significantly improves the accuracy and robustness of rural road extraction. Through the GAN approach, the model can adaptively process complex agricultural machinery trajectory data, particularly performing exceptionally well in scenarios involving sparse trajectories, low-quality data, and vegetation-covered dirt roads.
[0032] 6. The medium of this invention is used to implement the method of this invention. It constructs a road network around agricultural machinery trajectories using generative adversarial networks (GANs), overcoming the technical shortcomings of existing technologies that struggle to effectively extract roads from sparse and complex agricultural machinery trajectory data. The ELAU-Net generator, combined with the ELA module, successfully captures road features between sparse trajectories, effectively reducing low-level semantic noise and significantly improving the accuracy of road extraction.
[0033] 7. This invention introduces a two-sided hinge loss function, which significantly reduces the risk of overfitting and improves generalization ability, thereby ensuring the model's effectiveness in various terrains, data densities, and complex road environments. Practical verification has shown that this model exhibits excellent performance in agricultural machinery trajectory data from Nanyang, Henan Province, generating road images that highly match real roads, demonstrating broad practical application prospects. Attached Figure Description
[0034] Figure 1 This is a flowchart of a method according to an embodiment of the present invention.
[0035] Figure 2 This is an example of the error correction process in an embodiment of the present invention.
[0036] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0037] Figure 4 The road extraction performance of different models is compared from left to right: (a) Trajectory, (b) Realroad, (c) T2Rnet, (d) SPBAM-LinkNet, (e) AD-LinkNet, (f) ELA-GAN, and (g) T2R-GAN. Detailed Implementation
[0038] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0039] This invention provides a method for constructing rural road networks based on generative adversarial networks. It constructs rural road networks based on BeiDou GNSS trajectories and extracts rural roads from agricultural machinery trajectories. The process is as follows: Figure 1 As shown, it includes the following steps:
[0040] Step 1, Data Processing Stage.
[0041] Trajectory Rasterization: This stage converts the GNSS trajectory points of agricultural machinery into raster images, forming a two-dimensional trajectory representation. Each trajectory point is mapped to fixed grid coordinates, transforming it into a trajectory raster image for model training. Examples of trajectories and their rasterization are shown below. Figure 2 As shown.
[0042] Data augmentation: Data augmentation operations such as rotation and mirroring are performed on trajectory images to expand the dataset size and improve the model's generalization ability. This invention's method is based on the T2R-GAN model, which includes a generator (ELAU-Net) and a discriminator (PatchGAN). It achieves feature mapping from trajectory to road through adversarial training. The generator uses ELAU-Net to generate realistic road images, while the discriminator uses PatchGAN to evaluate the realism of the generated images.
[0043] Furthermore, during the trajectory rasterization process, each GNSS trajectory point is mapped to fixed grid coordinates to form a raster image with a resolution of 0.5 meters to 2 meters.
[0044] Step 2, Generator (ELAU-Net) Training Phase:
[0045] Specifically, the rasterized trajectory image is input into the ELAU-Net generator. The generator consists of an encoder-decoder network; the encoder extracts trajectory features, and the decoder converts the extracted features into a road image. This invention introduces an ELA (Efficient Local Attention) module between the encoder and decoder. This module captures long-range dependencies through strip pooling, enhancing the ability to capture road features between sparse trajectories and suppressing low-level semantic noise. The generator outputs a simulated road image.
[0046] Step 3, Discriminator (PatchGAN) training phase:
[0047] The input to PatchGAN's discriminator includes real road images and virtual road images generated by the generator. The discriminator extracts features from the input images using a convolutional network and determines the similarity between the generated road images and the real road images.
[0048] The discriminator scores the virtual road images generated by the generator, prompting the generator to continuously optimize during adversarial training and generate road images that are closer to reality.
[0049] Step 4, Loss Function Optimization and Adversarial Training:
[0050] A two-sided hinge loss function is employed to reduce the risk of overfitting by simultaneously constraining the discriminator's scores on both real and generated images, ensuring that the generator produces more accurate road images. Adversarial training between the generator and discriminator involves continuously adjusting the weight parameters until the generator's images are almost indistinguishable from real road images, ultimately producing high-quality road images.
[0051] The bilateral hinge loss function simultaneously constrains the discriminator's confidence output for both real and generated images, and the specific formula is as follows:
[0052]
[0053] Where D(x) is the score of the discriminator for the real image, and D(G(z)) is the score of the discriminator for the generated image; The output P represents the confidence level of the real image. real Represents the confidence interval of a real image; P represents the confidence output of the generated image. gen This represents the confidence interval of the generated image.
[0054] Step 5: After training is complete, extract and output the road results:
[0055] This method automatically extracts rural roads from input raster images of agricultural machinery trajectories and generates clear road extraction results. These results can be used for the construction of rural road networks and applications in geographic information systems.
[0056] The T2R-GAN model improves the precision, recall, and F1 score of road extraction in sparse agricultural machinery trajectory data by at least 5%.
[0057] This application also provides an electronic device. Figure 3The structure of an electronic device provided in an embodiment of the present invention is illustrated. For example, the electronic device 30 may include a processor 31, a memory 32, and a transmission device 33. The processor 31 is used to execute the rural road network construction method based on generative adversarial networks mentioned in the above embodiments. The processor and the memory can be connected via a bus or other means, taking a bus connection as an example. The transmission device can be connected to the processor and the memory via wired or wireless means. The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the rural road network construction method based on generative adversarial networks in the embodiments of this application. The processor executes various functional applications and data processing by running the non-transitory software programs, instructions, and modules stored in the memory, thereby implementing the rural road network construction method based on generative adversarial networks in the above method embodiments. The memory may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The one or more modules stored in the memory, when executed by the processor, perform the rural road network construction method based on generative adversarial networks in the embodiments.
[0058] In another aspect, this application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus described in the above embodiments; or it may be a standalone computer-readable storage medium not assembled into the device. The computer-readable storage medium may be a tangible storage medium, such as random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, floppy disk, hard disk, removable storage disk, CD-ROM, or any other form of storage medium known in the art. The computer-readable storage medium stores one or more programs, which are used by one or more processors to execute the rural road network construction method based on generative adversarial networks described in this application.
[0059] To verify the performance of the T2R-GAN model used in this invention, agricultural machinery trajectory data collected in Henan Province, China in June 2021 were employed. After data processing, model training, and testing, the experimental results are shown in Table 1.
[0060] Table 1 Experimental Results
[0061]
[0062] The results show that T2R-GAN outperforms other models in terms of precision, recall, F1 score, and PCC, especially in F1 score, where it improves by 5.53%, indicating that this method performs better in the road extraction task of agricultural machinery trajectory data.
[0063] In addition, the performance of different models in rural road extraction was compared. Figure 4 The comparison of different models in rural road extraction is shown. It can be seen that the road images generated by T2R-GAN are closer to real road images, especially in sparse trajectory regions, where T2R-GAN successfully captures road connectivity and details. In contrast, images generated by other models show obvious redundant roads or missing road features.
[0064] Furthermore, to verify the effectiveness of the proposed T2R-GAN model in practical applications, agricultural machinery trajectory data collected in Nanyang City, Henan Province, China in June 2021 was used for experimental verification. The rural areas of Nanyang City have complex terrain, and the agricultural machinery trajectories are sparse and uneven, making them representative and effectively validating the model's road extraction performance in complex rural environments. In the rural road extraction experiment in Nanyang City, Henan Province, the T2R-GAN model generated realistic road images using this real dataset. The extracted roads were then overlaid and compared with remote sensing images of Nanyang City. The results show that the model can accurately extract rural roads. The experimental results further demonstrate the efficiency of this invention in handling sparse trajectories and complex rural roads, improving the accuracy and applicability of existing technologies.
[0065] The experimental data results above demonstrate that the T2R-GAN model of this invention can better extract complex rural roads when processing sparse agricultural machinery trajectory data, thus solving the shortcomings of existing technologies in road extraction tasks.
[0066] In summary, the above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for constructing rural road networks based on generative adversarial networks, characterized in that, Includes the following steps: Step 1: Convert the GNSS trajectory points of agricultural machinery into a two-dimensional trajectory raster image; Step 2: The trajectory raster image is encoded and decoded using the ELAU-Net generator to generate a road image; wherein, the ELAU-Net generator introduces an ELA module and captures long-distance dependencies through a strip pooling mechanism; (4) Use the PatchGAN discriminator to perform adversarial training between the generated road images and real road images; (5) The training process of the generator and discriminator is constrained by a two-sided hinge loss function to reduce overfitting; (6) After training is complete, extract and output the road results: Rural roads are automatically extracted from the input raster image of agricultural machinery tracks, and clear road extraction results are generated.
2. The method according to claim 1, characterized in that, The ELA module embeds a strip pooling layer between the encoder and decoder.
3. The method according to claim 1, characterized in that, The bilateral hinge loss function simultaneously constrains the discriminator's confidence output for both real and generated images, and the specific formula is as follows: Where D(x) is the score of the discriminator for the real image, and D(G(z)) is the score of the discriminator for the generated image; The output P represents the confidence level of the real image. real Represents the confidence interval of a real image; P represents the confidence output of the generated image. gen This represents the confidence interval of the generated image.
4. The method according to any one of claims 1-3, characterized in that, Step 1 further includes rotating and mirroring the trajectory raster image to expand the dataset.
5. The method according to claim 4, characterized in that, During the trajectory rasterization process, each GNSS trajectory point is mapped to fixed grid coordinates to form a raster image with a resolution of 0.5 meters to 2 meters.
6. The method according to any one of claims 1-3, characterized in that, The ELAU-Net generator and PatchGAN discriminator are iteratively optimized through adversarial training until the generated road images cannot be distinguished from real road images by the discriminator.
7. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory. When the computer program is executed by the processor, it implements the rural road network construction method based on generative adversarial networks as described in any one of claims 1-5.
8. The electronic device according to claim 7, characterized in that, The device integrates a BeiDou GNSS module for real-time acquisition of agricultural machinery trajectory data and execution of the road network construction process described in claim 1.
9. A computer-readable storage medium, characterized in that, The device stores computer program instructions, which, when executed by an electronic device, implement the rural road network construction method based on generative adversarial networks as described in any one of claims 1-6.