Lane line editing method, model training method and related equipment
By training a generative model using a generative adversarial network, and utilizing lane line editing methods to process lane line edge information, noise maps, and color maps, the problem of poor lane line detection accuracy is solved, lane line editing and repair are realized, and the lane line detection performance of autonomous driving systems is improved.
Patent Information
- Application Number
- CN202310931348.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-26
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-07-26
AI Technical Summary
In autonomous driving scenarios, the accuracy of lane line detection results is poor, mainly due to the complex changes in lane lines, the obstruction by foreign objects, and the influence of lighting, which leads to poor clarity and integrity of lane lines, resulting in a low recognition rate of difficult samples by the model.
A lane line editing method is adopted, which trains a generative model through a generative adversarial network. The generative adversarial network is used to edit lane lines by utilizing the lane line binary mask and category information, including the processing of edge information, noise map, mask map and color map, so as to realize the editing and repair of lane lines.
It effectively generates texture characteristics on lane lines, maintains a specific contextual style, and enables editing functions such as lane line conversion, addition, and erasure, thereby improving the accuracy of lane line detection.
Smart Images

Figure CN116778033B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a lane line editing method, a model training method, and related equipment. Background Technology
[0002] In the field of autonomous driving, in order to ensure the safety of autonomous vehicles during operation, the autonomous driving system needs to keep the vehicle moving along the lane lines on the road. This requires the autonomous driving system to have accurate perception of the lane lines. Therefore, lane line detection in autonomous driving scenarios needs to ensure a certain level of accuracy.
[0003] In real-world autonomous driving scenarios, lane detection accuracy is poor due to issues such as complex lane line variations, lane line occlusion by objects, and lighting conditions affecting the acquired road images. This results in poor clarity and completeness of lane lines in the road images, leading to lane line class imbalance in the acquired image data and consequently, low recognition rates for difficult samples by the model.
[0004] Editing lane lines to address lane line category imbalance and enhance difficult samples is a feasible solution for improving lane line detection performance. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a lane line editing method, a model training method, and related equipment to solve the above problems.
[0006] In a first aspect, the present invention provides a lane line editing model training method, the model training method comprising: acquiring original road images;
[0007] The original road image is segmented to obtain a lane line semantic map, which includes a lane line binary mask and lane line categories.
[0008] Based on the lane line binary mask and lane line category, preset lane line attribute parameters are obtained. The preset lane line attribute parameters include lane line edge information, lane line noise map, lane line mask map, lane line semantic map, and lane line color map.
[0009] A generative adversarial network (GAN) comprising a generative model and a discriminative model is constructed. The GAN is trained based on the lane line semantic map and the preset lane line attribute parameters. The generative model in the trained GAN is used as the lane line editing model.
[0010] In another implementation of the present invention, the image segmentation of the original road image includes: inputting the original road image into a pre-trained lane line segmentation model to obtain the lane line semantic map.
[0011] In another implementation of the present invention, obtaining preset lane line attribute parameters based on the lane line binary mask and lane line category includes: performing edge detection on the original road image based on the lane line binary mask and lane line category to obtain lane line edge information; generating a random noise binary image with the same size as the original road image; multiplying the random noise binary image with the lane line binary mask to obtain the lane line noise image; and inverting the lane line binary mask and multiplying it with the original road image to obtain the lane line mask image.
[0012] In another implementation of the present invention, obtaining preset lane line attribute parameters based on the lane line binary mask and lane line category further includes: obtaining the lane line color map based on the lane line binary mask, the lane line category and the lane line edge information.
[0013] In another implementation of the present invention, training the generative adversarial network based on the lane line semantic map and the preset lane line attribute parameters includes: using the lane line semantic map and the preset lane line attribute parameters as input to the generative model, and the generative model outputting a generated image; using the original road image and the generated image as input to the discriminative model; and simultaneously training the generative model and the discriminative model until the generative adversarial network converges.
[0014] Secondly, the present invention provides a lane line editing method, comprising:
[0015] Perform region segmentation on the road image to be edited to obtain a binary mask for lane lines;
[0016] Based on the lane line binary mask, a pre-editing operation is performed on the region to be edited to obtain the edited lane line semantic map and the edited lane line attribute parameters. The edited lane line attribute parameters include the edited lane line edge information, the edited lane line noise map, the edited lane line mask map, and the edited lane line color map.
[0017] The edited lane line semantic map and the edited lane line attribute parameters are input into a pre-trained lane line editing model to obtain the edited road image.
[0018] Thirdly, the present invention provides an apparatus for constructing a lane line editing model, the apparatus comprising:
[0019] The acquisition unit is used to acquire raw road images;
[0020] The data processing unit is configured to perform image segmentation on the original road image to obtain a lane line semantic map, the lane line semantic map including a lane line binary mask and a lane line category; and to obtain preset lane line attribute parameters based on the lane line binary mask and the lane line category, the preset lane line attribute parameters including lane line edge information, lane line noise map, lane line mask map and lane line color map.
[0021] Building units are used to construct generative adversarial networks that include generative and discriminative models;
[0022] The training unit is used to train the generative adversarial network based on the lane line semantic map and the preset lane line attribute parameters, and to use the generative model in the trained generative adversarial network as the lane line editing model.
[0023] Fourthly, the present invention provides a lane line editing device, the editing device comprising:
[0024] Image acquisition module: used to acquire images of the road to be edited;
[0025] Image processing module: used to perform region segmentation on the road image to be edited to obtain a lane line binary mask; and used to perform pre-editing operations on the region to be edited based on the lane line binary mask to obtain a lane line semantic map and lane line attribute parameters after editing, wherein the lane line attribute parameters after editing include lane line edge information after editing, lane line noise map after editing, lane line mask map after editing, and vehicle-to-line color map after editing;
[0026] Image editing module: includes a pre-trained lane line editing model, which takes the edited lane line semantic map and the edited lane line attribute parameters as input and outputs the edited road image.
[0027] Fifthly, the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the lane line editing model training method and the steps of the lane line editing method described above.
[0028] In a sixth aspect, the present invention provides a computer storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the lane line editing model training method and the steps of the lane line editing method described above.
[0029] By using the model training method provided by this invention, a lane line editing model can be obtained. Then, lane line editing can be performed based on the lane line editing model, which can realize the editing and repair of lane lines on road images. It can effectively generate texture characteristics on lane lines while maintaining a specific contextual style, and can realize editing functions such as lane line conversion, adding lane lines, and erasing lane lines. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. By reading the detailed description of the embodiments below, the advantages and benefits of the solutions will become clear to those skilled in the art. The accompanying drawings are only for illustrating preferred embodiments and are not intended to limit the present invention.
[0031] In the picture:
[0032] Figure 1 The flowchart illustrates the steps of a lane line editing model training method provided by this invention.
[0033] Figure 2 This is a flowchart of one step in a lane line editing model training method provided by the present invention.
[0034] Figure 3 The present invention provides a flowchart of the steps of a lane line editing method.
[0035] Figure 4 This invention provides an example of a network structure for a generative model.
[0036] Figure 5 This is a schematic diagram of a spectral normalized Markov discriminant model provided by the present invention. Detailed Implementation
[0037] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and thoroughly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art should fall within the protection scope of the present invention.
[0038] Figure 1 A flowchart illustrating the steps of a lane line editing model training method provided in this embodiment of the invention is shown below. Figure 1 As shown, this embodiment mainly includes the following steps:
[0039] S101. Acquire raw road images;
[0040] S102. Perform image segmentation on the original road image to obtain a lane line semantic map, wherein the lane line semantic map includes a lane line binary mask and lane line categories.
[0041] S103. Based on the lane line binary mask and lane line category, obtain preset lane line attribute parameters, which include lane line edge information, lane line noise map, lane line mask map, and lane line color map.
[0042] S104. Construct a generative adversarial network (GAN) that includes a generative model and a discriminative model. Train the GAN based on the lane line semantic map and the preset lane line attribute parameters. Use the generative model in the trained GAN as the lane line editing model.
[0043] The lane line editing model trained through the above steps in this application can edit and repair lane lines on road images. It can effectively generate texture characteristics on lane lines while maintaining a specific contextual style, and can realize editing functions such as lane line conversion, adding lane lines, and erasing lane lines.
[0044] The original road image is an RGB color image that displays the road surface and lane lines. Specifically, it can be captured using a vehicle-mounted camera or a roadside camera. Then, a lane line segmentation model can be used to segment the original road image, obtaining a binary lane line mask and lane line categories. Lane line categories include: solid white line, solid yellow line, dashed white line, and dashed yellow line.
[0045] In one possible embodiment, to perform image segmentation on the original road image, a lane line segmentation model can be pre-trained. Then, step S102 can be performed, whereby the original road image is input into the lane line segmentation model to perform image segmentation and obtain a lane line semantic map. Specifically, a lane line segmentation model can be trained based on existing lane line segmentation algorithms such as LaneNet. The lane line segmentation model can coarsely segment the lane lines into binary masks, thereby enabling batch lane line editing operations, such as color conversion.
[0046] In one possible embodiment, reference Figure 2 In step S103, preset lane line attribute parameters are obtained based on the lane line binary mask and lane line category, including:
[0047] S1031. Based on the lane line binary mask and the lane line category, perform edge detection on the original road image to obtain the lane line edge information;
[0048] S1032. Generate a random noise binary image with the same size as the original road image, and multiply the random noise binary image with the lane line binary mask to obtain the lane line noise image.
[0049] S1033. Invert the lane line binary mask and multiply it with the original road image to obtain the lane line mask image. That is, invert the lane line binary mask to obtain the lane line binary I-mask, and multiply the I-mask with the original road image to obtain the lane line mask image.
[0050] It should be clarified here that there is no mandatory order among steps S1031, S1032 and S1033. These four steps can be performed simultaneously or any one of them can be performed first.
[0051] In step S1031, the method for edge detection of the original road image includes edge detection algorithms based on traditional image processing, such as the Canny algorithm and the Sobel algorithm, as well as the HED (Holistically-nested Edge Detection) algorithm based on deep learning. Taking the Sobel algorithm as an example, the edge information of the original road image is obtained through Sobel edge detection. The lane line binary mask is then morphologically dilated. The dilated image is multiplied with the edge information of the original road image to obtain the lane line edge information.
[0052] In step S1032, the lane noise map is obtained by multiplying the random noise binary map with the lane binary mask (i.e., the lane area value is 1 and the non-lane area value is 0). Therefore, in the lane noise map obtained after multiplication, the non-lane area value is 0 and the lane area value is random noise value.
[0053] The lane line semantic map can include five channels. The first channel is a binary mask for lane lines, with lane line areas set to 1 and non-lane line areas set to 0. The second channel is a mask for solid white lane lines, with solid white lane line areas set to 1 and non-solid white lane line areas set to 0. The third channel is a mask for solid yellow lane lines, with solid yellow lane line areas set to 1 and non-solid yellow lane line areas set to 0. The fourth channel is a mask for dashed white lane lines, with dashed white lane line areas set to 1 and non-dashed white lane line areas set to 0. The fifth channel is a mask for dashed yellow lane lines, with dashed yellow lane line areas set to 1 and non-dashed yellow lane line areas set to 0.
[0054] In one possible embodiment, step S103 further includes: obtaining a lane line color map based on the lane line binary mask, the lane line category, and the lane line edge information. Due to varying lighting conditions and the age of the lane lines, lane lines of the same type can have different colors; for example, new lane lines are brighter than older ones. Therefore, a lane line color map can be generated to meet the user's requirement for specifying lane line colors. If the user does not specify a color, lane line colors with corresponding hues and brightness can be generated based on the overall style of the image, thus obtaining a lane line color map. The initialized lane line color map can be an RGB three-channel image. The lane line color map can be a constant, for example, white RGB is (255, 255, 255), and yellow RGB is (255, 186, 76).
[0055] Specifically, the lane line color map is first initialized. This can be done manually based on the lane line binary mask, the lane line category, and the lane line edge information. The white lane line area is assigned RGB values of (255, 255, 255), the yellow lane line area is assigned RGB values of (255, 186, 76), and the non-lane line area is assigned RGB values of (0, 0, 0). Then, based on the lane line edge information, the lane line binary mask, and the lane line category, the lane line binary mask is eroded, and the original road image is filtered. The filtered image is multiplied by the eroded lane line binary mask, and then subjected to color RGB adaptive threshold segmentation to calculate the average color of each lane line, thus providing the given or generated lane line color map. A bilateral filtering method can be used to filter the original road image.
[0056] In one example, before executing step S104, data augmentation operations such as image inversion, rotation, and scaling can be used to improve the data effect, and the lane line mask image can be normalized. This can achieve the following effect: when training the generative adversarial network based on the lane line semantic map and the preset lane line attribute parameters, the training of the generative model can be made more stable.
[0057] In one possible embodiment, step S104, training the generative adversarial network based on the lane line semantic map and the preset lane line attribute parameters, includes:
[0058] S1041. The lane line semantic map and the preset lane line attribute parameters are used as inputs to the generation model, and the generation model outputs a generated image.
[0059] S1042. Use the original road image and the generated image as input to the discrimination model;
[0060] S1043. Simultaneously train the generative model and the discriminative model until the generative adversarial network converges.
[0061] Specifically, in step S1041, the sizes of the lane line edge information, lane line noise map, lane line mask map, and lane line color map are all adjusted to fit the requirements of the channel layer through a scaling operation. These are then input into the channel layer of the generative model and concatenated there. The concatenated result serves as the input to the convolutional features in the generative model. The lane line semantic map is used as the input to the modulation features in the generative model to modulate the convolutional features. The final output of the generative model is the generated image, which is an RGB color image. The output resolution of the generative model is the same as the input resolution.
[0062] In step S1042, the original road image and the lane line semantic map are stitched together at the channel layer, and the generated image and the lane line semantic map are stitched together at the channel layer. Both stitching results are used as inputs to the discrimination model.
[0063] In step S1043, the generative model and the discriminative model are trained simultaneously. During model training, the lane line category is not changed, and the generative model learns the image style and lane line features of the real image (i.e., the original road image). That is, the lane line image style should inherit the overall image style under different weather and lighting conditions; the features of shadows and road damage caused by trees, buildings, or vehicles on the lane lines should be preserved; and the structure, style, texture, and other features of the non-road background area should be consistent with the real image.
[0064] The goal of the generative model is to make the generated image as similar as possible to the original road image, so that the discriminative model cannot distinguish between the generated image and the original real road image. Therefore, the objective function of the generative model includes, but is not limited to, perceptual loss, discriminative loss, and L1 distance loss. The goal of the discriminative model is to be able to determine whether the generated image is real or fake compared to the original road image. Therefore, the objective function of the discriminative model includes, but is not limited to, hinge discriminative loss. When training the generative model, the training strategy includes: updating the model parameters, calculating its loss function, and receiving gradient feedback from the discriminative model. When the loss function of the generative model is minimized (i.e., when the generative adversarial network converges), the model parameters of the generative model (the weights and biases of each neuron) are saved, and training ends.
[0065] In one possible implementation, the network structure of the generative model can adopt a U-shaped encoder-decoder structure, where the encoding structure is a downsampling process. Figure 4 This is an example of a network structure for a generative model. The preprocessed lane line mask image I is shown below. masked Lane line color diagram I colormap Lane line edge information I skechLane line noise diagram I noise After concatenation at the channel layers, the images are used as input to the generative model, and the lane line semantic map Ms and the convolutional operation Conv are used to modulate the convolutional features. Finally, the generative model outputs the generated image I. gout .
[0066] In this embodiment of the patent, the coding structure consists of 9 coding layers. The first coding layer first performs a set of convolution operations with a kernel size of 3 and a stride of 1 to generate a feature coding map F. i To enable editing of a given region while preserving the image's specific contextual style, the feature-encoded map F... i SPM (style-preserved modulation) is performed to obtain the modulated feature map. SPM modulation consists of two stages. The first stage of modulation utilizes the convolution operation Conv to generate two pairs of parallel modulation parameters (γ) from the semantic map of the lane lines. s1 ,β s1 ), (γ s2 ,β s2 ), generating a pair of modulation parameters (γ) from the feature map. c ,β c These three pairs of modulation parameters are fused through modulation operations to generate context-aware modulation parameters (γ). f ,β f ), as shown in calculation formulas (1) and (2). The second-stage modulation uses context-aware modulation parameters (γ). f ,β f ) to modulate the feature mapping, as calculated by formula (3).
[0067] β f =(1+γ) s1 )⊙β c +β s1 (Formula 1)
[0068] γ f =(1+γ) s2 )⊙γ c +β s2 (Formula 2)
[0069]
[0070] In this embodiment of the invention, the normalization Norm operation employs instance normalization (IN). This is applied to the modulated feature map. Next, the LeakyReLU activation function is applied. The second to eighth coding layers have convolutional kernels of size 3 and a stride of 2, followed by SPM modulation and the LeakyReLU activation function. The last coding layer has a convolutional kernel of size 3 and a stride of 1, followed by SPM modulation and the LeakyReLU activation function.
[0071] The decoding part is similar to the encoding part. The first seven decoding layers also use convolutional layers with a kernel size of 3 and a stride of 1, and SPM modulation to modulate the decoded feature maps. The feature maps are upsampled through deconvolution. Skip connections are used between the encoding and decoding layers to pass the feature maps from the encoding layer to the corresponding upsampled decoding layer. The last decoding layer consists of convolutions with a kernel size of 3 and a stride of 1, and a Tanh activation function, outputting the generated image. The resolution of the generated image is the same as the resolution of the input image.
[0072] In this patent embodiment, the network structure of the discrimination model can adopt the spectral normalized Markov discrimination model (SNPatchDiscriminator). The reason for using SNPatchDiscriminator is that SNPatchDiscrimination has spectral normalization, better stability and performance, is suitable for irregular masks of any shape and position, and the combination of simple SNPatchDiscriminator loss and pixel-by-pixel L1 loss has a good repair effect. Figure 5 This is a schematic diagram of a spectral normalized Markov discrimination model. The original road image I is used as the model. gt The lane line semantic map Ms is concatenated with the channel layer and then input into the discriminative model, and the generated image I is also used. gout The lane line semantic map Ms is concatenated with the lane line semantic map at the channel layer and then input into the discriminant model; the discriminant model discriminates and generates image I. gout Is it real or fake? Figure 5 In this context, H represents the vertical pixel count of the image, and W represents the horizontal pixel count of the image.
[0073] In this embodiment of the patent, the objective function of the generative model is... (See Formula 4) The adversarial loss -E[D(I) is adopted. gout The sum of the losses of the generated image and the real image in the target region and background region is the L1 loss. (See Equation 5), Perceptual loss with fixed parameters of the VGG19 pre-trained model (See Formula 6) and style loss (See Formulas 7, 8 and 9).
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080] Among them, style loss and perceived loss All require a VGG intermediate layer for construction. Referring to formulas (7), (8), and (9), the style loss... The Gram matrix is commonly used for construction. G is the feature map selected from VGG, and the pairwise inner product of the c channels of G is Gc. T G can be used to obtain the Gram matrix.
[0081] In this embodiment of the patent, the objective function of the discriminant model is... As in formula (10):
[0082]
[0083] By training the above generative and discriminative models, we can obtain a trained generative model, which is also the lane line editing model.
[0084] In this embodiment of the patent, the generative model uses 8 channels for inputting lane line edge information, lane line noise map, lane line mask map, lane line color map, and the original road image, with a resolution of 512*768; and 5 channels for inputting the lane line semantic map, with a resolution of 512*768. The output of the generative model is a 3-channel RGB image. The output resolution of the generative model is the same as the input resolution.
[0085] In this patent embodiment, the number of input channels of the discrimination model is 5+3=8, and the resolution is 512*768.
[0086] Secondly, this application provides a lane line editing method that can use the lane line editing model trained above, with reference to... Figure 3 The lane line editing method includes the following steps:
[0087] S201. Perform image segmentation on the road image to be edited to obtain a binary mask for lane lines;
[0088] S202. Based on the lane line binary mask, perform a pre-editing operation on the area to be edited to obtain the lane line attribute parameters and the lane line semantic map after editing. The lane line attribute parameters after editing include lane line edge information, lane line noise map, lane line mask map, and lane line color map after editing.
[0089] S203. Input the edited lane line semantic map and the edited lane line attribute parameters into the pre-trained lane line editing model to obtain the edited road image.
[0090] Of course, before performing step S201, it is necessary to acquire lane surface images to be used as the road image to be edited. The acquired lane surface images are RGB color images, displaying the road surface and lane lines. Specifically, vehicle-mounted cameras or roadside cameras can be used to acquire road surface images for editing.
[0091] In one possible embodiment, to perform image segmentation on the road image to be edited, a lane line segmentation model can be pre-trained. Then, step S201 can be performed, which specifically includes inputting the road image to be edited into the lane line segmentation model to perform image segmentation and obtain a lane line binary mask. Specifically, a lane line segmentation model can be trained based on an existing lane line segmentation algorithm (e.g., LaneNet), which can coarsely segment the lane line binary mask. In one example, the lane line segmentation model can perform batch image segmentation, that is, batch segment multiple regions to be edited and non-edited regions on an image, or batch process multiple images. Of course, users can also manually segment images to distinguish between regions to be edited and non-edited regions.
[0092] Then, step S202 can be performed, which is to perform a pre-editing operation based on the lane line binary mask obtained in step S201.
[0093] The pre-editing operations include at least one of the following: category conversion, lane line erasure, and lane line addition. Category conversion refers to changing the category of one or more lane lines in the area to be edited; lane line addition refers to adding one or more lane lines to the area to be edited; and lane line erasure refers to erasing one or more lane lines in the area to be edited. Lane line categories include: solid white line, solid yellow line, dashed white line, and dashed yellow line.
[0094] Step S202 specifically includes: performing a pre-editing operation on the area to be edited to obtain the lane line category after editing; and obtaining the lane line semantic map and lane line attribute parameters after editing based on the lane line binary mask and the lane line category after editing. In other words, after the pre-editing operation, the lane line category of the area to be edited will change accordingly, thereby obtaining the lane line category after editing. Then, the lane line semantic map and lane line attribute parameters after editing can be obtained based on the lane line binary mask and the lane line category after editing.
[0095] In this patent embodiment, the lane line color can be changed by altering the lane line category and lane line color map. For example, switching between a solid white line and a solid yellow line can change the lane line color, as can switching between a dashed white line and a dashed yellow line. When adding a new lane line of a certain category, the newly added lane line should have a color corresponding to its category. Erasing lane lines can transform the lane line area into a non-lane line area on the road surface. For example, the area where the original white lane line was located becomes a gray roadside.
[0096] In one example, the edited lane line attribute parameters are obtained, including:
[0097] Based on the lane line binary mask and the edited lane line category, edge detection is performed on the road image to be edited to obtain the edited lane line edge information;
[0098] Generate a random noise binary image with the same size as the original road image to be edited, and multiply the random noise binary image with the lane line binary mask to obtain the edited lane line noise image;
[0099] The edited lane line mask is obtained by inverting the binary lane line mask and multiplying it by the original road image. In other words, the edited lane line mask is obtained by multiplying the inverted binary lane line mask by the original road image.
[0100] In one example, the method for obtaining the edited lane line color map includes: First, initializing the lane line color map by assigning RGB values of (255, 255, 255) to the white lane line area, (255, 186, 76) to the yellow lane line area, and (0, 0, 0) to the non-lane line area. Then, based on lane line edge information, the lane line binary mask, and lane line category, the lane line binary mask is eroded, and the original road image is filtered. The filtered image is multiplied by the eroded lane line binary mask, and then subjected to color RGB adaptive thresholding to calculate the average color of each lane line, thereby updating the lane line color map and generating the edited lane line color map. A bilateral filtering method can be used to filter the original road image.
[0101] In step S203, the edited lane line semantic map and the edited lane line attribute parameters are input into a pre-trained lane line editing model. The output image of the lane line editing model is the edited road image. The content displayed in the edited road image includes the non-edited area content and the edited area content corresponding to the pre-editing operation.
[0102] Thus, the lane line editing model provided in this application can be used, and the lane line editing method provided in this application can be used to achieve functions such as lane line color conversion, lane line category conversion, adding lane lines, and erasing lane lines. On the other hand, road images can be repaired, that is: if lane lines are obscured by vehicles or other objects, lane lines in the obscured area can be repaired; or when the lane line dashed mask is continuously marked, new lane line dashed lines can be generated.
[0103] Specifically, the class of one or more lane lines on the road image to be edited can be modified. Based on the modified lane line class and an initial color map, the trained lane line editing model will generate the corresponding road image according to the modified lane line class and the background style of non-lane line areas. For example, if the original white lane lines are converted to yellow lane lines, the transformed lane lines will generate lane lines with corresponding brightness, hue, and saturation according to the overall style of the image, and will still be able to generate lane line texture features, such as tree shadows and tire tracks on the lane lines.
[0104] Thirdly, this application also provides an apparatus for constructing a lane line editing model. The apparatus includes an acquisition unit, a data processing unit, a construction unit, and a training unit. The acquisition unit is used to acquire original road images; the data processing unit is used to perform image segmentation on the original road images to obtain a lane line semantic map, the lane line semantic map including a lane line binary mask and lane line categories; and to obtain preset lane line attribute parameters based on the lane line binary mask and lane line categories, the preset lane line attribute parameters including lane line edge information, lane line noise map, lane line mask map, and lane line color map; the construction unit is used to construct a generative adversarial network (GAN) containing a generative model and a discriminative model; the training unit is used to train the GAN based on the lane line semantic map and the preset lane line attribute parameters, and uses the generative model in the trained GAN as the lane line editing model.
[0105] The apparatus for constructing a lane line editing model provided in this application can be used to execute the steps of the lane line editing model training method described above. The acquisition unit may include a vehicle-mounted camera or a roadside camera for acquiring road surface images as the original road images. The functional implementation of the data processing unit can be found in the descriptions of steps S102 and S103 above. The functional implementation of the construction unit can be found in the descriptions of the generative and discriminative model network structures above. The functional implementation of the training unit can be found in steps S1041, S1042, and S1043 above.
[0106] Fourthly, this application also provides a lane line editing device, which includes an image acquisition module, an image processing module, and an image editing module. The image acquisition module is used to acquire a road image to be edited; the image processing module is used to perform region segmentation on the road image to be edited to obtain a lane line binary mask; and to perform pre-editing operations on the region to be edited based on the lane line binary mask to obtain an edited lane line semantic map and edited lane line attribute parameters, wherein the edited lane line attribute parameters include edited lane line edge information, edited lane line noise map, edited lane line mask map, and edited lane line color map; the image editing module includes a pre-trained lane line editing model, and the image editing module is used to take the lane line semantic map and the edited lane line attribute parameters as input and output the edited road image.
[0107] The lane line editing device provided in this application can be used to perform the steps of the lane line editing method described above. The functionality of the image processing module can be found in the descriptions of steps S201 and S202 above, and the functionality of the image editing module can be found in the description of step S203 above.
[0108] Fifthly, this application also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the lane line editing model training method and the steps of the lane line editing method described above.
[0109] Sixthly, this application also provides a computer storage medium storing a computer program, which, when executed by a processor, can implement the steps of the lane line editing model training method and the lane line editing method described above.
[0110] The methods described above according to embodiments of the present invention can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code originally stored on a remote recording medium or a non-transitory machine-readable medium and subsequently stored on a local recording medium, downloaded via a network. Thus, the methods described herein can be processed by software stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., RAM, ROM, flash memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the methods shown herein.
[0111] Specific embodiments of the invention have now been described. Other embodiments are within the scope of the appended claims. In some cases, the actions described in the claims can be performed in a different order and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing can be advantageous.
[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for training a lane line editing model, characterized in that, include: Acquire raw road images; The original road image is segmented to obtain a lane line semantic map, which includes a lane line binary mask and lane line categories. Based on the lane line binary mask and lane line category, preset lane line attribute parameters are obtained. The preset lane line attribute parameters include lane line edge information, lane line noise map, lane line mask map and lane line color map. A generative adversarial network (GAN) containing a generative model and a discriminative model is constructed. The GAN is trained based on the lane line semantic map and the preset lane line attribute parameters. The generative model in the trained GAN is used as the lane line editing model. The step of training the generative adversarial network based on the lane line semantic map and the preset lane line attribute parameters includes: The lane line semantic map and the preset lane line attribute parameters are used as inputs to the generation model, and the generation model outputs a generated image. The original road image and the generated image are used as inputs to the discrimination model; The generative model and the discriminative model are trained simultaneously until the generative adversarial network converges.
2. The model training method as described in claim 1, characterized in that, The step of segmenting the original road image includes: inputting the original road image into a pre-trained lane line segmentation model to obtain the lane line semantic map.
3. The model training method as described in claim 1, characterized in that, The step of obtaining preset lane line attribute parameters based on the lane line binary mask and lane line category includes: Based on the lane line binary mask and the lane line category, edge detection is performed on the original road image to obtain the lane line edge information; Generate a random noise binary image with the same size as the original road image, and multiply the random noise binary image with the lane line binary mask to obtain the lane line noise image; The lane line binary mask is inverted and multiplied with the original road image to obtain the lane line mask image.
4. The model training method as described in claim 3, characterized in that, The step of obtaining preset lane line attribute parameters based on the lane line binary mask and lane line category further includes: obtaining the lane line color map based on the lane line binary mask, the lane line category and the lane line edge information.
5. A lane line editing method, characterized in that, include: Perform region segmentation on the road image to be edited to obtain a binary mask for lane lines; Based on the lane line binary mask, a pre-editing operation is performed on the region to be edited to obtain the edited lane line semantic map and the edited lane line attribute parameters. The edited lane line attribute parameters include the edited lane line edge information, the edited lane line noise map, the edited lane line mask map, and the edited lane line color map. The edited lane line semantic map and the edited lane line attribute parameters are input into the lane line editing model trained by the lane line editing model training method as described in any one of claims 1 to 4 to obtain the edited road image.
6. An apparatus for constructing a lane line editing model, characterized in that, include: The acquisition unit is used to acquire raw road images; The data processing unit is used to perform image segmentation on the original road image to obtain a lane line semantic map, wherein the lane line semantic map includes a lane line binary mask and lane line categories. And for obtaining preset lane line attribute parameters based on the lane line binary mask and lane line category, the preset lane line attribute parameters including lane line edge information, lane line noise map, lane line mask map and lane line color map; Building units are used to construct generative adversarial networks that include generative and discriminative models; The training unit is used to train the generative adversarial network based on the lane line semantic map and the preset lane line attribute parameters, and to use the generative model in the trained generative adversarial network as the lane line editing model. The step of training the generative adversarial network based on the lane line semantic map and the preset lane line attribute parameters includes: The lane line semantic map and the preset lane line attribute parameters are used as inputs to the generation model, and the generation model outputs a generated image. The original road image and the generated image are used as inputs to the discrimination model; The generative model and the discriminative model are trained simultaneously until the generative adversarial network converges.
7. A lane line editing device, characterized in that, include: Image acquisition module: used to acquire images of the road to be edited; Image processing module: used to segment the road image to be edited and obtain a binary mask for lane lines; And for performing pre-editing operations on the region to be edited based on the lane line binary mask, to obtain the edited lane line semantic map and the edited lane line attribute parameters, the edited lane line attribute parameters including the edited lane line edge information, the edited lane line noise map, the edited lane line mask map and the edited lane line color map; Image editing module: includes a lane line editing model trained by the lane line editing model training method as described in any one of claims 1 to 4, wherein the image editing module is used to input the edited lane line semantic map and the edited lane line attribute parameters into the lane line editing model and output the edited road image.
8. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the lane line editing model training method as described in any one of claims 1 to 4 and the steps of the lane line editing method as described in claim 5.
9. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, implements the steps of the lane line editing model training method as described in any one of claims 1 to 4 and the steps of the lane line editing method as described in claim 5.
Citation Information
Patent Citations
Rain and snow sky lane line detection method and system based on generative adversarial network
CN115272995A
Training method of lane line detection model, lane line detection method and electronic equipment
CN116129382A
