Model training method and device, lane line detection method and device, vehicle and medium
Through the combination of feature extraction network and encoding and decoding network, detection branch and bird's-eye view image processing, the problem of lane line detection in changing lane number and complex scenes is solved, and the detection accuracy and applicability are improved.
Patent Information
- Application Number
- CN202410668046.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-23
AI Technical Summary
Existing lane line detection models based on deep learning cannot effectively handle changes in the number of lane lines and complex traffic scenes, and are not effective at recognizing distant lane lines, and the detection accuracy needs to be improved.
Using a combination method of feature extraction network, detection branch and encoding and decoding network, through feature extraction, starting point detection and encoding and decoding operations, the starting point and position information of the lane line is obtained, and iterative training is performed to generate a trained lane line detection model. And improve detection performance through bird's-eye view images.
It realizes the detection of the starting points of all lane lines and the output of continuous and complete lane line information. It is suitable for complex scenes, avoids the limit on the number of preset lane lines, and improves the accuracy and applicability of lane line detection.
Smart Images

Figure CN118537679A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a model training method, a lane line detection method, a device, a vehicle and a medium. Background Art
[0002] Lane detection is an important part of environmental perception in autonomous driving technology. It mainly identifies the position and shape of lane lines from the image obtained in front of the vehicle. Lane detection is crucial for lane departure warning and lane keeping control systems of subsequent vehicles. With the development of deep learning technology, lane detection methods based on deep learning have made significant progress.
[0003] However, the current deep learning-based lane detection model can only detect a preset number of lane lines and cannot handle changes in the number of lane lines well. Summary of the invention
[0004] The present invention provides a model training method, a lane line detection method, a device, a vehicle and a medium, aiming to effectively solve the technical problem of the accuracy of lane line information detection.
[0005] According to a first aspect of the present invention, the present invention provides a model training method, comprising:
[0006] Acquire a training image, and input the training image into a lane line detection model to be trained, wherein the lane line detection model to be trained includes at least a feature extraction network, a detection branch, and a codec network;
[0007] Using the feature extraction network to extract features from the training image to obtain lane line features;
[0008] Predicting the lane line feature using the detection branch to obtain a first prediction result, where the first prediction result is used to indicate whether the lane line feature includes a starting point of the lane line;
[0009] Based on the first prediction result, using the encoding and decoding network to perform an encoding and decoding operation on the lane line feature to obtain a second prediction result, where the second prediction result includes lane line information;
[0010] The lane line detection model to be trained is iteratively trained based on the first prediction result and the second prediction result to obtain a trained lane line detection model.
[0011] Furthermore, the lane line detection model to be trained also includes an existence branch and a positioning branch;
[0012] After extracting features from the training image using the feature extraction network to obtain lane line features, the method further includes:
[0013] Predicting the lane line feature using the existing branch to obtain a third prediction result, wherein the third prediction result is used to indicate whether the lane line feature includes a lane line;
[0014] Using the positioning branch to predict the lane line feature to obtain a fourth prediction result, wherein the fourth prediction result includes lane line position information;
[0015] The lane line detection model to be trained is iteratively trained based on the first prediction result, the second prediction result, the third prediction result and the fourth prediction result to obtain a trained lane line detection model.
[0016] Further, before iteratively training the lane line detection model to be trained based on the first prediction result, the second prediction result, the third prediction result, and the fourth prediction result, the method further includes:
[0017] Calculate the losses between the first prediction result, the second prediction result, the third prediction result, the fourth prediction result and the label value respectively, and obtain a first loss value, a second loss value, a third loss value and a fourth loss value accordingly;
[0018] The lane line detection model to be trained is iteratively trained based on the first loss value, the second loss value, the third loss value, and the fourth loss value.
[0019] Furthermore, the first loss value is calculated based on the first prediction result and the label value using a cross entropy function.
[0020] Furthermore, the codec network includes an encoder and a decoder;
[0021] The step of encoding and decoding the lane line feature using the encoding and decoding network based on the first prediction result to obtain a second prediction result includes:
[0022] The position coding information is respectively integrated with the lane line feature and the first prediction result to obtain a first position embedding feature and a second position embedding feature respectively;
[0023] Using the encoder to perform an encoding operation on the first position embedded feature to obtain an encoded feature;
[0024] The decoder is used to perform a decoding operation on the encoded feature and the second position embedded feature to obtain a second prediction result.
[0025] Furthermore, the feature extraction network includes a backbone network and a multi-layer perception network;
[0026] The step of extracting features from the training image using the feature extraction network to obtain lane line features includes:
[0027] The backbone network is used to extract deep features from the training image, and the multi-layer perception network is used to map the deep features into lane line features.
[0028] Furthermore, after the step of acquiring the training image, the method further comprises:
[0029] The training image is projected into a bird's-eye view image using calibration parameters of a camera device, and the bird's-eye view image is input into a lane line detection model to be trained.
[0030] According to a second aspect of the present invention, the present invention further provides a lane line detection method, comprising:
[0031] Acquire an image to be detected, and input the image to be detected into a trained lane line detection model, wherein the trained lane line detection model includes a feature extraction network, a detection branch, and an encoding and decoding network;
[0032] Using the feature extraction network to extract features from the image to be detected to obtain lane line features;
[0033] Using the detection branch to predict the lane line feature to obtain a lane line starting point prediction result;
[0034] Based on the lane line starting point prediction result, the lane line feature is encoded and decoded using the encoding and decoding network to obtain a lane line prediction result;
[0035] The trained lane line detection model is obtained by training based on the model training method described above.
[0036] According to a third aspect of the present invention, the present invention further provides a model training device, comprising:
[0037] A first image acquisition and input module, used to acquire a training image and input the training image into a lane line detection model to be trained, wherein the lane line detection model to be trained includes a feature extraction network, a detection branch, and a codec network;
[0038] A first feature extraction module, used to extract features from the training image using the feature extraction network to obtain lane line features;
[0039] A detection prediction module, used to predict the lane line feature using the detection branch to obtain a first prediction result, wherein the first prediction result is used to indicate whether the lane line feature includes the starting point of the lane line;
[0040] A codec module, configured to encode and decode the lane line feature using the codec network based on the first prediction result to obtain a second prediction result, wherein the second prediction result includes lane line information;
[0041] A training module is used to iteratively train the lane line detection model to be trained based on the first prediction result and the second prediction result to obtain a trained lane line detection model.
[0042] According to a fourth aspect of the present invention, the present invention further provides a lane line detection device, comprising:
[0043] A second image acquisition and input module, used to acquire an image to be detected and input the image to be detected into a trained lane line detection model, wherein the trained lane line detection model includes a feature extraction network, a detection branch, and a codec network;
[0044] A second feature extraction module uses the feature extraction network to extract features from the image to be detected to obtain lane line features;
[0045] A starting point prediction module, used to predict the lane line feature using the detection branch to obtain a lane line starting point prediction result;
[0046] The lane line prediction module is used to encode and decode the lane line features using the encoding and decoding network based on the lane line starting point prediction result to obtain the lane line prediction result.
[0047] According to a fifth aspect of the present invention, the present invention also provides a vehicle, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the lane line detection method as described above when executing the computer program.
[0048] According to the sixth aspect of the present invention, the present invention also provides a storage medium, in which a plurality of instructions are stored, and the instructions are suitable for being loaded by a processor to execute the steps of the model training method as described above or the lane line detection method as described above.
[0049] Through one or more of the above embodiments of the present invention, at least the following technical effects can be achieved: in the model training method, deep lane line features are extracted from the training image through the feature extraction network, and then the starting points of all lane lines are detected from the lane line features using the detection branch. Further, according to the starting point information of the lane line, all lane line features are encoded and decoded using the codec network to obtain continuous and complete lane line information. Since the detection branch can detect the starting points of all lane lines, there is no need to set the number of lane line detections, and the performance of the lane line detection model will not be affected by the preset number of lane lines during actual application. At the same time, the codec network can output complete, continuous and smooth lane lines based on the starting point information, so that the lane line detection model is suitable for complex lane line scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The technical solutions and other beneficial effects of the present invention will be made apparent by describing in detail the specific embodiments of the present invention in conjunction with the accompanying drawings.
[0051] Figure 1 Shown is a flow chart of the model training method provided in an embodiment of the present application;
[0052] Figure 2 The figure is a schematic diagram of the structure of the lane detection model provided in the embodiment of the present application;
[0053] Figure 3 Shown is a flow chart of a lane line detection method provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of the structure of the model training device provided in this application;
[0055] Figure 5 This is a schematic diagram of the structure of the lane detection device provided in this application. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0057] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship.
[0058] UFLDv2 (Ultra-Fast-Lane-Detection, an improved version of UFLD) is a lane detection model based on deep learning. Compared with similar deep learning models such as LaneAF (Lane with Affinity Fields), UFLDv2 has a fast calculation speed and is also competitive in other evaluation indicators such as precision and recall. However, the UFLDv2 model also has certain limitations. Specifically, the following defects are included:
[0059] 1. The number of lane lines needs to be preset. The UFLDv2 model predicts each lane line as a group, which requires a fixed number of lane lines. If too few lane lines are set, and the number of lane lines that need to be predicted is more than the preset number, the extra lane lines cannot be detected; if too many lane lines are set, some redundant image processing processes will be added, and the training difficulty of the UFLDv2 model will be increased.
[0060] 2. There is no correlation between adjacent points of lane lines. The lane lines predicted by UFLDv2 are composed of several anchor points, but in the model, there is no direct connection between the anchor points. Therefore, in some special scenarios, the lane lines are easily jagged, and even jump from one lane to another, resulting in lane line information recognition errors.
[0061] 3. Unable to cover situations where lane lines change significantly. For example, at an intersection, when the lane line changes from a 3-lane driving lane to a 4-lane queuing solid line, the UFLDv2 algorithm cannot handle lane line detection in these complex scenarios.
[0062] 4. The recognition effect of distant lane lines is weakened. Conventional viewing angles are generally used by on-board cameras and traffic monitoring cameras. The road surface is photographed at an angle, and the road surface appears larger near and smaller far away in the image. The lane lines at a distance are affected by factors such as low image resolution and the size of the model's receptive field, resulting in inaccurate lane line information detection.
[0063] In summary, the existing lane line detection methods based on deep learning have problems such as limited number of lane lines, inapplicability to complex traffic scenes, and detection accuracy needs to be improved. In response to these problems, the present application provides a model training method, lane line detection method, device, vehicle and medium. The following introduces a model training method, lane line detection method, device, vehicle and medium provided by the present application in conjunction with the accompanying drawings.
[0064] Figure 1 FIG. 1 is a flow chart of a model training method provided in an embodiment of the present application. Figure 1 As shown, a model training method includes the following steps:
[0065] S101, obtaining a training image, and inputting the training image into a lane detection model to be trained.
[0066] The lane line detection model to be trained includes at least a feature extraction network, a detection branch and an encoding and decoding network.
[0067] The training image is a road image containing lane lines, and in addition, it also includes label information corresponding to the training image, and the label information at least includes a label value of whether the training image contains a starting point of the lane line and a label value of the position of the lane line in the training image.
[0068] S102, using the feature extraction network to perform feature extraction on the training image to obtain lane line features.
[0069] Among them, the feature extraction network mainly includes a convolutional neural network, which is used for feature extraction. The convolutional neural network in the feature extraction network can be a ResNet series, a DarkNet series, a MobileNet, a VGG series, and the like.
[0070] S103: predict the lane line feature using the detection branch to obtain a first prediction result, where the first prediction result is used to indicate whether the lane line feature includes a starting point of the lane line.
[0071] Among them, the detection branch includes a fully connected layer and an activation function layer. The starting points of all lane lines are detected through the detection branch, and there is no need to preset the number of lane line detections.
[0072] S104: Based on the first prediction result, use the encoding and decoding network to perform encoding and decoding operations on the lane line feature to obtain a second prediction result, where the second prediction result includes lane line information.
[0073] The codec network includes an encoder and a decoder, the encoder is used to further extract lane line features, and the decoder is used to decode the features output by the encoder according to the first prediction result to obtain complete lane line information.
[0074] The encoding and decoding network encodes and decodes all lane line features according to the lane line starting point information in the first prediction result to obtain complete and continuous lane line information.
[0075] The encoder-decoder network can be a neural network with encoders and decoders, such as Transformer, BERT, Reformer, etc.
[0076] S105: Iteratively train the lane line detection model to be trained based on the first prediction result and the second prediction result to obtain a trained lane line detection model.
[0077] In this step, the network parameters in the lane line detection model to be trained are iteratively trained according to the first prediction result, the second prediction result and the label information corresponding to the training image until a preset number of iterations is reached or the lane line detection model to be trained reaches a convergence state, or other iteration stopping conditions are met, thereby obtaining a trained lane line detection model.
[0078] In the model training method provided in the embodiment of the present application, the feature extraction network extracts deep lane line features from the training image, and then uses the detection branch to detect the starting points of all lane lines from the lane line features. Furthermore, based on the starting point information of the lane lines, the encoding and decoding network is used to encode and decode all lane line features to obtain continuous and complete lane line information. Since the detection branch can detect the starting points of all lane lines, there is no need to set the number of lane line detections, and the performance of the lane line detection model will not be affected by the preset number of lane lines during actual application. At the same time, the encoding and decoding network can output complete, continuous and smooth lane lines based on the starting point information, so that the lane line detection model is suitable for complex lane line scenarios.
[0079] In order to further improve the performance of the codec network, in some embodiments of the present application, the lane line detection model to be trained also includes an existence branch and a positioning branch. The structure of the lane line detection model in the specific training process is as follows: Figure 2 shown.
[0080] In this embodiment, the feature extraction network may be a feature extraction network in UFLD or UFLDv2, and the existence branch and the positioning branch may be the existence branch and the positioning branch in UFLD or UFLDv2.
[0081] Preferably, the feature extraction network, the existence branch and the positioning branch are all corresponding structures in UFLDv2.
[0082] After extracting features from the training image using the feature extraction network to obtain lane line features, the method further includes:
[0083] The lane line feature is predicted using the existing branch to obtain a third prediction result, where the third prediction result is used to characterize whether the lane line feature includes a lane line.
[0084] Among them, there are branches including fully connected layers and activation function layers.
[0085] In the UFLDv2 network, there is a branch for classifying whether the lane line feature of each grid contains the lane line. That is, the anchor point feature corresponding to each grid of the lane line feature is connected to the fully connected network layer, and then the two types of problems are classified. The third prediction result output by the branch can show whether the lane line corresponding to the current grid exists.
[0086] The lane line feature is predicted using the positioning branch to obtain a fourth prediction result, wherein the fourth prediction result includes lane line position information.
[0087] Among them, the positioning branch also includes a fully connected layer and an activation function layer.
[0088] In the UFLDv2 network, if there is a branch that determines that there are lane lines in the current grid, the positioning branch further locates the relative position of the lane lines in each grid.
[0089] It should be noted that since the lane line is a line type, it is not applicable to describe the lane line position in the form of a commonly used detection bounding box. Therefore, this application uses the center of mass position of the lane line as the position of the lane line.
[0090] The lane line detection model to be trained is iteratively trained based on the first prediction result, the second prediction result, the third prediction result and the fourth prediction result to obtain a trained lane line detection model.
[0091] That is, according to the first prediction result, the second prediction result, the third prediction result, the fourth prediction result and the corresponding label values, the network parameters in the feature extraction network, the detection branch, the positioning branch, the existence branch and the encoding and decoding network are iteratively updated to obtain the final trained lane line detection model.
[0092] The model training method provided in the embodiment of the present application utilizes the positioning branch and the existence branch to assist in training the codec network to improve the performance of the codec network.
[0093] In some embodiments of the present application, before iteratively training the lane line detection model to be trained based on the first prediction result, the second prediction result, the third prediction result, and the fourth prediction result, the method further includes:
[0094] The losses between the first prediction result, the second prediction result, the third prediction result, the fourth prediction result and the label value are calculated respectively, and a first loss value, a second loss value, a third loss value and a fourth loss value are obtained accordingly.
[0095] The lane line detection model to be trained is iteratively trained based on the first loss value, the second loss value, the third loss value, and the fourth loss value.
[0096] The label information includes not only the label value of whether the lane line starting point is included and the label value of the lane line position in the training image, but also the label value of whether the lane line exists in the training image.
[0097] The first loss value L det It is calculated based on the first prediction result and whether the label value of the lane line starting point is included, and is obtained by using the cross entropy function. Specifically:
[0098]
[0099] In the formula, B is the batch size, N is h and N w The number of grids divided in the height and width directions corresponding to the lane line features of each grid, y[b,n h ,n w ] is the segmentation of the nth training image in each batch. h ,n w ] The label value of the grid part, p det [b,n h ,n w ] is the corresponding prediction value, which is the first prediction result.
[0100] The second loss value L trans It is calculated based on the second prediction result and the label value of the lane line position using the cross entropy function, that is, the mean cross entropy between the lane line at the grid position and the second prediction result output by the encoder-decoder network.
[0101] Specifically, in this embodiment, the codec network is a Transformer, and the specific second loss value is calculated as the loss function used in the Transformer. The calculation object is the relative position information of the lane line in each grid in the label information and the second prediction result. The specific calculation process will not be repeated here.
[0102] The third loss value L ext It is calculated based on the third prediction result and whether the label value of the lane line is included, and the cross entropy function.
[0103] Specifically, in this embodiment, the existence branch is an existence branch in the UFLDv2 network, and its specific loss value calculation process is not repeated here.
[0104] The fourth loss value L loc It is calculated based on the fourth prediction result and the label value of the lane line position, and using the L1 loss function, that is, the absolute error between the lane line centroid position in the label information and the lane line position in the fourth prediction result is smoothed as the loss of the positioning branch. It should be noted that the label value of the lane line position here refers to the relative position of the lane line in the current grid.
[0105] Similarly, in this embodiment, the positioning branch is an existing branch in the UFLDv2 network, and its specific loss value calculation process is not repeated here.
[0106] After obtaining the first loss value L det , the second loss value L trans , the third loss value L ext and the fourth loss value L loc Afterwards, the total loss L can be calculated according to the following formula:
[0107] L=L trans +αL ext +βL loc +γL det ;
[0108] In the formula, α, β, and γ are weighting parameters, which can be set and adjusted according to actual conditions or experience, for example, they can be set to α=1, β=2, and γ=4. In other embodiments of the present application, they can also be set to other values, which are not limited to this.
[0109] The total loss calculated above is used for back propagation to iteratively update the network parameters of the entire lane line detection model. After the iteration stop condition is reached, a trained lane line detection model is obtained.
[0110] It should be noted that the positioning branch and the existence branch only exist during the model training process. The network parameter training and updating of the entire lane detection model are realized through the loss values corresponding to the positioning branch, the existence branch, the detection branch and the codec network, so as to improve the detection performance of the entire lane detection model. After the training is completed, the trained lane detection model only includes the feature extraction network, the detection branch and the codec network. The deep image features are extracted through the feature extraction network. The detection branch detects the starting points of all lanes based on the deep image features. The codec network predicts the complete lanes based on the lane starting point information and the deep image features.
[0111] In some embodiments of the present application, the codec network includes an encoder and a decoder. Preferably, the codec network can be a Transformer.
[0112] The step of encoding and decoding the lane line feature using the encoding and decoding network based on the first prediction result to obtain a second prediction result includes:
[0113] The position coding information is fused with the lane line feature and the first prediction result respectively to obtain a first position embedded feature and a second position embedded feature accordingly.
[0114] Using the encoder to perform an encoding operation on the first position embedded feature to obtain an encoded feature;
[0115] The decoder is used to perform a decoding operation on the encoded feature and the second position embedded feature to obtain a second prediction result.
[0116] Specifically, before the lane line features are input to the encoder, the position encoding information is first added to the lane line features so that the lane line features are integrated with the position information. Schematically, the lane line feature topology output by the feature extraction network is B×N h ×N w ×N l , that is, the lane line features corresponding to each training image include N h ×N w embedding features, N l is the length of the embedded feature, and the position corresponding to each embedded feature is (n h ,n w ), using location information (n h ,n w ) generates position codes and adds them to the embedded features of the corresponding positions respectively, so as to obtain the first position embedded features.
[0117] Similarly, the position information of the starting point of the lane line in the first prediction result is fused to obtain the second position embedded feature. Specifically, an embedded feature mapping operation is performed on each starting point, and the position coding information is added to the embedded feature after mapping, so as to obtain the second position embedded feature.
[0118] After obtaining the first position embedding feature and the second position embedding feature, an encoder is used to perform multiple encoding operations on the first position embedding feature to obtain an encoding feature matrix.
[0119] The first position embedded features and the second position embedded features are input into the decoder, and the decoder performs a decoding operation to obtain a complete lane line.
[0120] The model training method provided in the embodiment of the present application associates the anchor point of each lane line with the anchor points before and after, or even the anchor points of the entire lane line, through a codec network, thereby obtaining a lane line prediction result with better smoothness and continuity.
[0121] In some embodiments of the present application, the feature extraction network includes a backbone network and a multi-layer perception network.
[0122] The step of extracting features from the training image using the feature extraction network to obtain lane line features includes:
[0123] The backbone network is used to extract deep features from the training image, and the multi-layer perception network is used to map the deep features into lane line features.
[0124] Among them, the backbone network is a convolutional neural network, which can be ResNet18, ResNet50, ResNet101, DarkNet53, etc., without limitation.
[0125] The topological structure corresponding to the deep features extracted by the backbone network is B×N b ×H×W, where B is the batch size; N b is the dimension of the deep feature; H and W are the height and width of the deep feature map.
[0126] The depth features are then flattened, and the topological structure of the flattened depth features becomes B×N f , N f is the number of deep features after flattening, N f =N b ×H×W. The flattened features are mapped through a multi-layer perception network to obtain lane line features. At this time, the topological structure of the lane line features is B×N m , and then the lane line features are organized into a rasterized format. The topological structure corresponding to the rasterized lane line features is B×Nh ×N w ×N l Where N m =N h ×N w ×N l ; N l is the characteristic length of the anchor point corresponding to each grid; N h and N w are the number of grids divided in the height and width directions of the grid, schematically, if N h =20, N w =20, if the size of the training image is 640*640, then each grid after segmentation corresponds to each 32×32 area in the input image.
[0127] After the step of acquiring the training image, the method further comprises:
[0128] The training image is projected into a bird's-eye view image using calibration parameters of a camera device, and the bird's-eye view image is input into a lane line detection model to be trained.
[0129] In daily lane line detection scenarios, a vehicle-mounted camera is usually used to obtain training images. However, due to the angle of the training images obtained by the vehicle-mounted camera, the lane lines in the distance are small, resulting in poor overall lane line detection results. Therefore, this embodiment converts the perspective of the training images obtained by the vehicle-mounted camera to a bird's-eye view, so as to more clearly display the lane lines in the distance and improve detection accuracy.
[0130] Specifically, the perspective of the training image is transformed based on perspective transformation to obtain a bird's-eye view image. More specifically, calibration information of the vehicle-mounted camera device is obtained, the calibration information includes the internal and external parameters of the camera device, and the training image is mapped and projected using the calibration information to obtain a bird's-eye view image.
[0131] The model training method provided in the embodiment of the present application converts the training image into a bird's-eye view image, and then performs model training based on the bird's-eye view image to improve the detection performance of lane line detection, especially the detection performance of distant lane lines.
[0132] Another embodiment of the present application also provides a lane line detection method, such as Figure 3 As shown, the lane line detection method includes the following steps:
[0133] S301, obtaining an image to be detected, and inputting the image to be detected into a trained lane line detection model, wherein the trained lane line detection model includes a feature extraction network, a detection branch, and a codec network.
[0134] The image to be detected is a road image, and the trained lane line detection model is trained based on the model training method provided in any of the above embodiments.
[0135] S302, using the feature extraction network to extract features from the image to be detected to obtain lane line features.
[0136] S303, using the detection branch to predict the lane line features to obtain a lane line starting point prediction result, that is, to detect and obtain all lane line starting point information in the image to be detected.
[0137] S304: Based on the lane line starting point prediction result, the lane line feature is encoded and decoded using the encoding and decoding network to obtain a lane line prediction result.
[0138] In this step, the encoding and decoding network encodes and decodes the lane line features according to the lane line starting point prediction result, thereby obtaining a lane line prediction result containing complete lane line information.
[0139] The lane line detection method provided in the embodiment of the present application detects the starting point information of all lane lines through the detection branch, thereby eliminating the need to pre-set the number of lane lines. Furthermore, the codec network is used to predict the complete, continuous and smooth lane lines to adapt to complex lane line scenarios.
[0140] In some other embodiments of the present application, after obtaining the image to be detected, the method further includes:
[0141] The image to be detected is projected into a bird's-eye view image using calibration parameters of the camera device, and the bird's-eye view image is input into a trained lane line detection model.
[0142] In actual lane line detection scenarios, the image to be detected is usually obtained by taking pictures with a vehicle-mounted camera. In the image to be detected, the lane lines in the distance are usually small, which affects the detection accuracy. In order to improve the overall lane line detection accuracy, the image to be detected is projected into a bird's-eye view image, thereby increasing the resolution of distant scenes and improving recognition accuracy.
[0143] It should be noted that after the training is completed, the lane detection model only retains the feature extraction network, detection branch and encoding and decoding network for lane detection. The positioning branch and existence branch in the training process are not used in subsequent reasoning applications.
[0144] In addition, the specific feature extraction process of the feature extraction network and the encoding and decoding process of the encoding and decoding network in this embodiment are the same as the feature extraction network and the encoding and decoding network mentioned in the above embodiments, and will not be repeated here.
[0145] Based on any of the above embodiments of the model training method, another embodiment of the present application further provides a model training device, Figure 4 A schematic diagram of the structure of the model training device provided in this application, such as Figure 4 As shown, the model training device includes:
[0146] The first image acquisition and input module 401 is used to acquire a training image and input the training image into a lane line detection model to be trained, wherein the lane line detection model to be trained includes a feature extraction network, a detection branch and a codec network.
[0147] The first feature extraction module 402 is used to extract features from the training image using the feature extraction network to obtain lane line features.
[0148] The detection prediction module 403 is used to predict the lane line feature using the detection branch to obtain a first prediction result, where the first prediction result is used to indicate whether the lane line feature includes the starting point of the lane line.
[0149] The encoding and decoding module 404 is used to encode and decode the lane line feature using the encoding and decoding network based on the first prediction result to obtain a second prediction result, where the second prediction result includes lane line information.
[0150] The training module 405 is used to iteratively train the lane line detection model to be trained based on the first prediction result and the second prediction result to obtain a trained lane line detection model.
[0151] The model training device corresponds to the above-mentioned model training method and will not be described in detail here.
[0152] Based on any of the above lane line detection method embodiments, another embodiment of the present application further provides a lane line detection device, Figure 5 This is a schematic diagram of the structure of the lane detection device provided in this application, such as Figure 5 As shown, the lane line detection device includes:
[0153] The second image acquisition and input module 501 is used to acquire the image to be detected and input the image to be detected into a trained lane line detection model, wherein the trained lane line detection model includes a feature extraction network, a detection branch and a codec network.
[0154] The second feature extraction module 502 uses the feature extraction network to extract features from the image to be detected to obtain lane line features.
[0155] The starting point prediction module 503 is used to predict the lane line feature using the detection branch to obtain a lane line starting point prediction result.
[0156] The lane line prediction module 504 is used to encode and decode the lane line features using the encoding and decoding network based on the lane line starting point prediction result to obtain the lane line prediction result.
[0157] The lane line detection device corresponds to the above-mentioned lane line detection method, which will not be repeated here.
[0158] On the other hand, an embodiment of the present application further provides a vehicle, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned lane line detection method when executing the computer program.
[0159] On the other hand, an embodiment of the present application also provides a storage medium on which multiple instructions are stored, and the instructions are suitable for being loaded by a processor to execute the model training method or lane line detection method provided in the above embodiments.
[0160] In addition, the logic instructions in the above-mentioned storage medium can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0161] On the other hand, an embodiment of the present application also provides a computer program product, which, when the program code contained in the computer program product is executed by a processor in an electronic device, implements the model training method provided in the above embodiments.
[0162] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0164] In summary, although the present application has been disclosed as above with preferred embodiments, the above preferred embodiments are not intended to limit the present application. Ordinary technicians in this field can make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined in the claims.
Claims
1. A model training method, characterized in that: include: Acquire a training image, and input the training image into a lane line detection model to be trained, wherein the lane line detection model to be trained includes at least a feature extraction network, a detection branch, and a codec network; Using the feature extraction network to extract features from the training image to obtain lane line features; Predicting the lane line feature using the detection branch to obtain a first prediction result, where the first prediction result is used to indicate whether the lane line feature includes a starting point of the lane line; Based on the first prediction result, using the encoding and decoding network to perform an encoding and decoding operation on the lane line feature to obtain a second prediction result, where the second prediction result includes lane line information; The lane line detection model to be trained is iteratively trained based on the first prediction result and the second prediction result to obtain a trained lane line detection model.
2. The model training method according to claim 1, characterized in that: The lane line detection model to be trained also includes an existence branch and a positioning branch; After extracting features from the training image using the feature extraction network to obtain lane line features, the method further includes: Predicting the lane line feature using the existing branch to obtain a third prediction result, wherein the third prediction result is used to indicate whether the lane line feature includes a lane line; Using the positioning branch to predict the lane line feature to obtain a fourth prediction result, wherein the fourth prediction result includes lane line position information; The lane line detection model to be trained is iteratively trained based on the first prediction result, the second prediction result, the third prediction result and the fourth prediction result to obtain a trained lane line detection model.
3. The model training method according to claim 2, characterized in that: Before iteratively training the lane line detection model to be trained based on the first prediction result, the second prediction result, the third prediction result, and the fourth prediction result, the method further includes: Calculate the losses between the first prediction result, the second prediction result, the third prediction result, the fourth prediction result and the label value respectively, and obtain a first loss value, a second loss value, a third loss value and a fourth loss value accordingly; The lane line detection model to be trained is iteratively trained based on the first loss value, the second loss value, the third loss value, and the fourth loss value.
4. The model training method according to claim 3, characterized in that: The first loss value is based on the first prediction result and the label value, and is calculated using a cross entropy function.
5. The model training method according to claim 1, characterized in that: The codec network includes an encoder and a decoder; The step of encoding and decoding the lane line feature using the encoding and decoding network based on the first prediction result to obtain a second prediction result includes: The position coding information is respectively integrated with the lane line feature and the first prediction result to obtain a first position embedding feature and a second position embedding feature respectively; Using the encoder to perform an encoding operation on the first position embedded feature to obtain an encoded feature; The decoder is used to perform a decoding operation on the encoded feature and the second position embedded feature to obtain a second prediction result.
6. The model training method according to claim 1, characterized in that: The feature extraction network includes a backbone network and a multi-layer perception network; The step of extracting features from the training image using the feature extraction network to obtain lane line features includes: The backbone network is used to extract deep features from the training image, and the multi-layer perception network is used to map the deep features into lane line features.
7. The model training method according to any one of claims 1 to 6, characterized in that: After the step of acquiring the training image, the method further comprises: The training image is projected into a bird's-eye view image using calibration parameters of a camera device, and the bird's-eye view image is input into a lane line detection model to be trained.
8. A lane line detection method, characterized in that: include: Acquire an image to be detected, and input the image to be detected into a trained lane line detection model, wherein the trained lane line detection model includes a feature extraction network, a detection branch, and an encoding and decoding network; Using the feature extraction network to extract features from the image to be detected to obtain lane line features; Using the detection branch to predict the lane line feature to obtain a lane line starting point prediction result; Based on the lane line starting point prediction result, the lane line feature is encoded and decoded using the encoding and decoding network to obtain a lane line prediction result; The trained lane line detection model is obtained by training based on the model training method according to any one of claims 1 to 7.
9. A model training device, characterized in that: include: A first image acquisition and input module, used to acquire a training image and input the training image into a lane line detection model to be trained, wherein the lane line detection model to be trained includes a feature extraction network, a detection branch, and a codec network; A first feature extraction module, used to extract features from the training image using the feature extraction network to obtain lane line features; A detection prediction module, used to predict the lane line feature using the detection branch to obtain a first prediction result, wherein the first prediction result is used to indicate whether the lane line feature includes the starting point of the lane line; A codec module, configured to encode and decode the lane line feature using the codec network based on the first prediction result to obtain a second prediction result, wherein the second prediction result includes lane line information; A training module is used to iteratively train the lane line detection model to be trained based on the first prediction result and the second prediction result to obtain a trained lane line detection model.
10. A lane line detection device, characterized in that: include: A second image acquisition and input module, used to acquire an image to be detected and input the image to be detected into a trained lane line detection model, wherein the trained lane line detection model includes a feature extraction network, a detection branch, and a codec network; A second feature extraction module uses the feature extraction network to extract features from the image to be detected to obtain lane line features; A starting point prediction module, used to predict the lane line feature using the detection branch to obtain a lane line starting point prediction result; The lane line prediction module is used to encode and decode the lane line features using the encoding and decoding network based on the lane line starting point prediction result to obtain the lane line prediction result.
11. A vehicle comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to claim 8 are implemented.
12. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Lane line and lane area detection method based on road scene
CN116152766A
Lane line detection method and device
CN116503827A
Lane line rapid detection method and device and readable medium
CN116778446A
Cited By
3D lane line detection model training method and 3D lane line detection method
CN119206648A
