Method for processing map, electronic device and storage medium
A method for processing a map, an electronic device, and a storage medium, which relate to a technical field of computer technology, in particular to computer vision technology and high-definition map technology. The method includes: segmenting a first road line to obtain a plurality of first sub-road lines, wherein the first road line is obtained according to a segmentation mask for an image, and the image corresponds to a target region; segmenting a second road line to obtain a plurality of second sub-road lines, wherein the second road line is obtained according to a trajectory information corresponding to the target region; and determining a target road line according to first similarities between the plurality of first sub-road lines and the plurality of second sub-road lines.
1 . A computer-implemented method for processing a map, comprising:
segmenting a first road line to obtain a plurality of first sub-road lines, wherein the first road line is obtained by
inputting an image corresponding to a target region into a semantic segmentation model to obtain a segmentation mask for the image;
performing a morphological processing on the segmentation mask for the image corresponding to the target region, so as to obtain a first initial road line; and
compressing the first initial road line to obtain the first road line using Douglas-Peucker algorithm;
segmenting a second road line to obtain a plurality of second sub-road lines, wherein the second road line is obtained according to a trajectory information corresponding to the target region, and the trajectory information is denoised and filtered;
determining a target road line according to first similarities between the plurality of first sub-road lines and the plurality of second sub-road lines, wherein the first similarities are based on geometric features of first and second sub-road lines; and
updating a current map according to the target road line, so as to obtain an updated map,
wherein the method further comprises:
segmenting a current road line to obtain a plurality of current sub-road lines;
calculating second similarities between the plurality of current sub-road lines and the plurality of first sub-road lines; and
deleting a first sub-road line whose second similarity with the plurality of current sub-road lines is greater than a preset second similarity threshold, so as to obtain at least one remaining first sub-road line,
wherein the determining the target road line according to first similarities between the plurality of first sub-road lines and the plurality of second sub-road lines comprises:
determining the target road line according to first similarities between the at least one remaining first sub-road line and the plurality of second sub-road lines,
wherein the method further comprises:
calculating third similarities between the plurality of current sub-road lines and the plurality of second sub-road lines; and
deleting a second sub-road line whose third similarity with the plurality of current sub-road lines is greater than a preset third similarity threshold, so as to obtain at least one remaining second sub-road line,
wherein the determining the target road line according to first similarities between the at least one remaining first sub-road line and the plurality of second sub-road lines comprises:
determining the target road line according to a first similarity between the at least one remaining first sub-road line and the at least one remaining second sub-road line.
2 . The method according to claim 1 , wherein the determining the target road line according to first similarities between the plurality of first sub-road lines and the plurality of second sub-road lines comprises:
calculating a first similarity between each of the plurality of first sub-road lines and each of the plurality of second sub-road lines;
according to a second sub-road line having the greatest first similarity with each first sub-road line,
determining the second sub-road line corresponding to the first sub-road line;
obtaining K first sub-road line and K second sub-road line corresponding to the K first sub-road line, according to the first similarities and a preset first similarity threshold, wherein K is an integer greater than or equal to 1; and
determining the target road line according to the K first sub-road line and the K second sub-road line.
3 . The method according to claim 2 , wherein the determining the target road line according to the K first sub-road line and the K second sub-road line comprises:
determining a m th target sub-road line according to a length of a k th first sub-road line and a length of a second sub-road line corresponding to the k th first sub-road line, wherein k is an integer less than or equal to K, and m is an integer greater than or equal to 1; and
determining the target road line according to the m th target sub-road line.
4 . The method according to claim 1 , wherein the first road line and the second road line each comprise at least one vector point,
the method further comprising:
for the at least one vector point of each of the first road line and the second road line,
obtaining an i th first vector according to an i th vector point and an (i−1) th vector point, wherein i is an integer greater than or equal to 2;
obtaining an i th second vector according to the i th vector point and an (i+1) th vector point;
determining an i th angle according to the i th first vector and the i th second vector; and
determining a segmentation point according to the i th vector point, in response to the i th angle being greater than a preset angle threshold,
so as to obtain a plurality of segmentation points.
5 . The method according to claim 4 , wherein the segmenting a first road line to obtain a plurality of first sub-road lines comprises:
segmenting the first road line according to the plurality of segmentation points for the first road line, so as to obtain the plurality of first sub-road lines.
6 . The method according to claim 4 , wherein the segmenting a second road line to obtain a plurality of second sub-road lines comprises:
segmenting the second road line according to the plurality of segmentation points for the second road line, so as to obtain the plurality of second sub-road lines.
7 . An electronic device, comprising:
at least one processor; and
a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions, when executed by the at least one processor, are configured to cause the at least one processor to at least:
segment a first road line to obtain a plurality of first sub-road lines, wherein the first road line is obtained by
inputting an image corresponding to a target region into a semantic segmentation model to obtain a segmentation mask for the image;
performing a morphological processing on the segmentation mask for the image corresponding to the target region, so as to obtain a first initial road line; and
compressing the first initial road line to obtain the first road line using Douglas-Peucker algorithm;
segment a second road line to obtain a plurality of second sub-road lines, wherein the second road line is obtained according to a trajectory information corresponding to the target region, and the trajectory information is denoised and filtered;
determine a target road line according to first similarities between the plurality of first sub-road lines and the plurality of second sub-road lines;
update a current map according to the target road line, so as to obtain an updated map,
wherein the instructions are further configured to cause the at least one processor to at least:
segment a current road line to obtain a plurality of current sub-road lines;
calculate second similarities between the plurality of current sub-road lines and the plurality of first sub-road lines; and
delete a first sub-road line whose second similarity with the plurality of current sub-road lines is greater than a preset second similarity threshold, so as to obtain at least one remaining first sub-road line, and
wherein the instructions are further configured to cause the at least one processor to at least:
determine the target road line according to first similarities between the at least one remaining first sub-road line and the plurality of second sub-road lines, and
wherein the instructions are further configured to cause the at least one processor to at least:
calculate third similarities between the plurality of current sub-road lines and the plurality of second sub-road lines; and
delete a second sub-road line whose third similarity with the plurality of current sub-road lines is greater than a preset third similarity threshold, so as to obtain at least one remaining second sub-road line, and
wherein the instructions are further configured to cause the at least one processor to at least:
determine the target road line according to a first similarity between the at least one remaining first sub-road line and the at least one remaining second sub-road line.
8 . The electronic device according to claim 7 , wherein the instructions are further configured to cause the at least one processor to at least:
calculate a first similarity between each of the plurality of first sub-road lines and each of the plurality of second sub-road lines;
according to a second sub-road line having the greatest first similarity with each first sub-road line,
determine the second sub-road line corresponding to the first sub-road line;
obtain K first sub-road line and K second sub-road line corresponding to the K first sub-road line, according to the first similarities and a preset first similarity threshold, wherein K is an integer greater than or equal to 1; and
determine the target road line according to the K first sub-road line and the K second sub-road line.
9 . The electronic device according to claim 8 , wherein the instructions are further configured to cause the at least one processor to at least:
determine a m th target sub-road line according to a length of a k th first sub-road line and a length of a second sub-road line corresponding to the k th first sub-road line, wherein k is an integer less than or equal to K, and m is an integer greater than or equal to 1; and
determine the target road line according to the m th target sub-road line.
10 . The electronic device according to claim 7 , wherein the first road line and the second road line each comprise at least one vector point,
wherein the instructions are further configured to cause the at least one processor to at least:
for the at least one vector point of each of the first road line and the second road line,
obtain an i th first vector according to an i th vector point and an (i−1) th vector point, wherein i is an integer greater than or equal to 2;
obtain an i th second vector according to the i th vector point and an (i+1) th vector point;
determine an i th angle according to the i th first vector and the i th second vector; and
determine a segmentation point according to the i th vector point, in response to the i th angle being greater than a preset angle threshold,
so as to obtain a plurality of segmentation points.
11 . The electronic device according to claim 10 , wherein the instructions are further configured to cause the at least one processor to at least:
segment the first road line according to the plurality of segmentation points for the first road line, so as to obtain the plurality of first sub-road lines.
12 . The electronic device according to claim 10 , wherein the instructions are further configured to cause the at least one processor to at least:
segment the second road line according to the plurality of segmentation points for the second road line, so as to obtain the plurality of second sub-road lines.
13 . A non-transitory computer-readable storage medium having computer instructions therein, wherein the computer instructions are configured to cause a computer system to at least:
segment a first road line to obtain a plurality of first sub-road lines, wherein the first road line is obtained by
inputting an image corresponding to a target region into a semantic segmentation model to obtain a segmentation mask for the image;
performing a morphological processing on the segmentation mask for the image corresponding to the target region, so as to obtain a first initial road line; and
compressing the first initial road line to obtain the first road line using Douglas-Peucker algorithm;
segment a second road line to obtain a plurality of second sub-road lines, wherein the second road line is obtained according to a trajectory information corresponding to the target region, and the trajectory information is denoised and filtered;
determine a target road line according to first similarities between the plurality of first sub-road lines and the plurality of second sub-road lines,
update a current map according to the target road line, so as to obtain an updated map,
wherein the computer instructions are further configured to cause the computer system to at least:
segment a current road line to obtain a plurality of current sub-road lines;
calculate second similarities between the plurality of current sub-road lines and the plurality of first sub-road lines; and
delete a first sub-road line whose second similarity with the plurality of current sub-road lines is greater than a preset second similarity threshold, so as to obtain at least one remaining first sub-road line, and
wherein the computer instructions are further configured to cause the computer system to at least:
determine the target road line according to first similarities between the at least one remaining first sub-road line and the plurality of second sub-road lines, and
wherein the computer instructions are further configured to cause the computer system to at least:
calculate third similarities between the plurality of current sub-road lines and the plurality of second sub-road lines; and
delete a second sub-road line whose third similarity with the plurality of current sub-road lines is greater than a preset third similarity threshold, so as to obtain at least one remaining second sub-road line, and
wherein the computer instructions are further configured to cause the computer system to at least:
determine the target road line according to a first similarity between the at least one remaining first sub-road line and the at least one remaining second sub-road line.