Lane line detection method, related device, and computer-readable storage medium
A method comprises: first, obtaining a to-be-recognized lane line image; then determining, based on the lane line image, a candidate pixel used to recognize a lane line region, to obtain a candidate point set, where the lane line region is a region of a location of a lane line in the lane line image and a surrounding region of the location of the lane line; then selecting a target pixel from the candidate point set, and obtaining at least three location points associated with the target pixel in a neighborhood, where the at least three location points are on one lane line; and finally, performing extension by using the target pixel as a start point and based on the at least three location points associated with the target pixel, to obtain a lane line point set corresponding to the target pixel.
1 . A lane line detection method, comprising: obtaining a lane line image; determining, based on the lane line image, a candidate pixel used to recognize a lane line region, to obtain a candidate point set, wherein the lane line region comprises a location of a lane line in the lane line image and a surrounding region of the location of the lane line; selecting a target pixel row from the lane line image based on a confidence map, wherein the target pixel row has a largest quantity of target confidence maximums in a neighborhood in which a first pixel is located, the first pixel is a pixel whose confidence value is greater than a second confidence threshold, each of the target confidence maximums are greater than the second confidence threshold, the confidence map comprises the confidence value of each pixel in the lane line image, and the confidence value indicates confidence of each pixel in the lane line image belonging to the lane line region; selecting, from the target pixel row as a target pixel, all pixels whose confidence values are greater than the second confidence threshold, or selecting, as the target pixel, a pixel whose confidence value is greater than the second confidence threshold corresponding to a confidence maximum in a neighborhood; selecting a target pixel from the candidate point set, and obtaining at least three location points associated with the target pixel in a neighborhood, wherein the at least three location points are on one lane line; and performing extension by using the target pixel as a start point and the at least three location points associated with the target pixel, to obtain a lane line point set corresponding to the target pixel.
2 . The method according to claim 1 , wherein the determining the candidate pixel used to recognize the lane line region, to obtain the candidate point set comprises:
generating the confidence map of the lane line image, wherein the confidence map comprises a confidence value of each pixel in the lane line image, and wherein the confidence value indicates a confidence of each pixel in the lane line image belonging to the lane line region; and
determining, in the confidence map, the candidate pixel used to recognize the lane line region.
3 . The method according to claim 1 , wherein the at least three location points comprise a first location point, a second location point, and a third location point; N rows above a pixel row in which the target pixel is located are pixel rows in which the first location point is located; the pixel row in which the target pixel is located is the same as the pixel row in which the second location point is located; M rows under the pixel row in which the target pixel is located are pixel rows in which the third location point is located; M and N are integers greater than 0; and wherein the performing extension by using the target pixel as the start point and the at least three location points associated with the target pixel comprises:
adjusting a start location of the target pixel based on a first offset, to obtain a new pixel, wherein the first offset is from the target pixel to the second location point; and replacing the target pixel with the new pixel to obtain a final location of the target pixel;
obtaining, by using the final location of the target pixel as a start point, a first lane line point obtained by performing extension on the target pixel based on a second offset, and obtaining a second lane line point obtained by performing extension on the target pixel based on a third offset, wherein the second offset is from the target pixel to the first location point, and the third offset is from the target pixel to the third location point;
when a confidence value corresponding to the first lane line point is greater than a first confidence value, performing, by using the first lane line point as a current target pixel, an operation of obtaining a new first lane line point obtained by performing extension on the target pixel based on the second offset, until a confidence value corresponding to the new first lane line point obtained through extension is not greater than the first confidence value; and
when a confidence value corresponding to the second lane line point is greater than the first confidence value, performing, by using the second lane line point as a current target pixel, an operation of obtaining a new second lane line point obtained by performing extension on the target pixel based on the third offset, until a confidence value corresponding to the new second lane line point obtained through extension is not greater than the first confidence value.
4 . The method according to claim 3 , wherein the selecting the target pixel from the candidate point set comprises:
selecting a target pixel row from the lane line image based on the confidence map, wherein the target pixel row is a plurality of pixel rows in which a quantity of second pixels is greater than a target value, the second pixel is a pixel whose confidence value is greater than a second confidence threshold, the confidence map comprises the confidence value of each pixel in the lane line image, and the confidence value indicates the confidence of each pixel in the lane line image belonging to the lane line region; and
selecting, from the target pixel row as the target pixel, all pixels whose confidence values are greater than the second confidence threshold.
5 . The method according to claim 4 , wherein when the target pixel comes from the plurality of pixel rows, the method further comprises:
obtaining an intersection over union between two lane line point sets; and
if the intersection over union between the two lane line point sets is greater than a target threshold, deleting either of the two lane line point sets.
6 . A lane line detection apparatus, comprising: a processor; and a memory coupled to the processor to store instructions, which when executed by the processor, cause the apparatus to perform operations, the operations comprising: obtaining a lane line image; determining, based on the lane line image, a candidate pixel used to recognize a lane line region, to obtain a candidate point set, wherein the lane line region comprises a location of a lane line in the lane line image and a surrounding region of the location of the lane line; selecting a target pixel row from the lane line image based on a confidence map, wherein the target pixel row has a largest quantity of target confidence maximums in a neighborhood in which a first pixel is located, the first pixel is a pixel whose confidence value is greater than a second confidence threshold, each of the target confidence maximums are greater than the second confidence threshold, the confidence map comprises the confidence value of each pixel in the lane line image, and the confidence value indicates confidence of each pixel in the lane line image belonging to the lane line region; selecting, from the target pixel row as a target pixel, all pixels whose confidence values are greater than the second confidence threshold, or selecting, as the target pixel, a pixel whose confidence value is greater than the second confidence threshold corresponding to a confidence maximum in a neighborhood; obtain at least three location points associated with the target pixel in a neighborhood, wherein the at least three location points are on one lane line; and performing extension by using the target pixel as a start point and the at least three location points associated with the target pixel, to obtain a lane line point set corresponding to the target pixel.
7 . The apparatus according to claim 6 , wherein the operations further comprise:
generating the confidence map of the lane line image, wherein the confidence map comprises a confidence value of each pixel in the lane line image, and wherein the confidence value indicates a confidence of each pixel in the lane line image belonging to the lane line region; and
determining, in the confidence map, the candidate pixel used to recognize the lane line region.
8 . The apparatus according to claim 6 , wherein the at least three location points comprise a first location point, a second location point, and a third location point; N rows above a pixel row in which the target pixel is located are pixel rows in which the first location point is located; the pixel row in which the target pixel is located is the same as the pixel row in which the second location point is located; M rows under the pixel row in which the target pixel is located are pixel rows in which the third location point is located; M and N are integers greater than 0; and wherein programming instructions instruct the processor to perform:
adjusting a start location of the target pixel based on a first offset, to obtain a new pixel, wherein the first offset is from the target pixel to the second location point; and replacing the target pixel with the new pixel to obtain a final location of the target pixel;
obtaining, by using the final location of the target pixel as a start point, a first lane line point obtained by performing extension on the target pixel based on a second offset, and obtain a second lane line point obtained by performing extension on the target pixel based on a third offset, wherein the second offset is from the target pixel to the first location point, and the third offset is from the target pixel to the third location point;
when a confidence value corresponding to the first lane line point is greater than a first confidence value, performing, by using the first lane line point as a current target pixel, an operation of obtaining a new first lane line point obtained by performing extension on the target pixel based on the second offset, until a confidence value corresponding to the new first lane line point obtained through extension is not greater than the first confidence value; and
when a confidence value corresponding to the second lane line point is greater than the first confidence value, performing, by using the second lane line point as a current target pixel, an operation of obtaining a new second lane line point obtained by performing extension on the target pixel based on the third offset, until a confidence value corresponding to the new second lane line point obtained through extension is not greater than the first confidence value.
9 . The apparatus according to claim 6 , wherein the operations further comprise:
selecting a target pixel row from the lane line image based on the confidence map, wherein the target pixel row is a plurality of pixel rows in which a quantity of second pixels is greater than a target value, the second pixel is a pixel whose confidence value is greater than a second confidence threshold, the confidence map comprises the confidence value of each pixel in the lane line image, and the confidence value indicates the confidence of each pixel in the lane line image belonging to the lane line region; and
selecting, from the target pixel row as the target pixel, all pixels whose confidence values are greater than the second confidence threshold.
10 . The apparatus according to claim 9 , wherein when the target pixel comes from the plurality of pixel rows, the operations further comprise:
obtaining an intersection over union between two lane line point sets; and if the intersection over union between the two lane line point sets is greater than a target threshold, deleting either of the two lane line point sets.
11 . A non-transitory computer-readable storage medium having instructions stored therein, which when executed by a processor, cause an apparatus to perform operations, the operations comprising: obtaining a lane line image; determining, based on the lane line image, a candidate pixel used to recognize a lane line region, to obtain a candidate point set, wherein the lane line region comprises a location of a lane line in the lane line image and a surrounding region of the location of the lane line; selecting a target pixel row from the lane line image based on a confidence map, wherein the target pixel row has a largest quantity of target confidence maximums in a neighborhood in which a first pixel is located, the first pixel is a pixel whose confidence value is greater than a second confidence threshold, each of the target confidence maximums are greater than the second confidence threshold, the confidence map comprises the confidence value of each pixel in the lane line image, and the confidence value indicates confidence of each pixel in the lane line image belonging to the lane line region; selecting, from the target pixel row as a target pixel, all pixels whose confidence values are greater than the second confidence threshold, or selecting, as the target pixel, a pixel whose confidence value is greater than the second confidence threshold corresponding to a confidence maximum in a neighborhood; obtaining at least three location points associated with the target pixel in a neighborhood, wherein the at least three location points are on one lane line; and performing extension by using the target pixel as a start point and the at least three location points associated with the target pixel, to obtain a lane line point set corresponding to the target pixel.
12 . The non-transitory computer-readable storage medium according to claim 11 , wherein the operations further comprise:
generating the confidence map of the lane line image, wherein the confidence map comprises a confidence value of each pixel in the lane line image, and wherein the confidence value indicates a confidence of each pixel in the lane line image belonging to the lane line region; and
determining, in the confidence map, the candidate pixel used to recognize the lane line region.
13 . The non-transitory computer-readable storage medium according to claim 11 , wherein the at least three location points comprise a first location point, a second location point, and a third location point; N rows above a pixel row in which the target pixel is located are pixel rows in which the first location point is located; the pixel row in which the target pixel is located is the same as the pixel row in which the second location point is located;
M rows under the pixel row in which the target pixel is located are pixel rows in which the third location point is located; M and N are integers greater than 0; and wherein programming instructions instruct the processor to perform:
adjusting a start location of the target pixel based on a first offset, to obtain a new pixel, wherein the first offset is from the target pixel to the second location point; and replacing the target pixel with the new pixel to obtain a final location of the target pixel;
obtaining, by using the final location of the target pixel as a start point, a first lane line point obtained by performing extension on the target pixel based on a second offset, and obtain a second lane line point obtained by performing extension on the target pixel based on a third offset, wherein the second offset is from the target pixel to the first location point, and the third offset is from the target pixel to the third location point;
when a confidence value corresponding to the first lane line point is greater than a first confidence value, performing, by using the first lane line point as a current target pixel, an operation of obtaining a new first lane line point obtained by performing extension on the target pixel based on the second offset, until a confidence value corresponding to the new first lane line point obtained through extension is not greater than the first confidence value; and
when a confidence value corresponding to the second lane line point is greater than the first confidence value, performing, by using the second lane line point as a current target pixel, an operation of obtaining a new second lane line point obtained by performing extension on the target pixel based on the third offset, until a confidence value corresponding to the new second lane line point obtained through extension is not greater than the first confidence value.
14 . The non-transitory computer-readable storage medium according to claim 11 , wherein the operations further comprise:
selecting a target pixel row from the lane line image based on the confidence map, wherein the target pixel row is a plurality of pixel rows in which a quantity of second pixels is greater than a target value, the second pixel is a pixel whose confidence value is greater than a second confidence threshold, the confidence map comprises the confidence value of each pixel in the lane line image, and the confidence value indicates the confidence of each pixel in the lane line image belonging to the lane line region; and
selecting, from the target pixel row as the target pixel, all pixels whose confidence values are greater than the second confidence threshold.
15 . The non-transitory computer-readable storage medium according to claim 14 , wherein when the target pixel comes from the plurality of pixel rows, the operations further comprise:
obtaining an intersection over union between two lane line point sets; and if the intersection over union between the two lane line point sets is greater than a target threshold, deleting either of the two lane line point sets.