Map generation method, model training method, readable medium and electronic equipment

CN118613792AActive Publication Date: 2024-09-06HUAWEI TECH CO LTD

Patent Information

Application Number
CN202280090751.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2024-09-06
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

When the existing technology uses neural network models to generate vector maps, it is difficult to adapt to the differences in geographical environments and geometric characteristics of map elements in different regions, resulting in low accuracy of vector maps and complex vectorization rule settings, making it unsuitable for large-scale vector map modeling.

Method used

The geometric features of regional map elements are learned through the neural network model, and the image is converted into a vector map using the shape initialization network, shape regression network, and topology reconstruction network to avoid relying on vectorization rules set by technicians and improve the accuracy and adaptability of the vector map.

Benefits of technology

It improves the accuracy and generation efficiency of vector maps, is suitable for map elements in different areas, simplifies the setting and parameter adjustment of vectorization rules, and is suitable for large-scale map modeling scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118613792A
    Figure CN118613792A
Patent Text Reader

Abstract

The invention discloses a map generation method, a model training method, a readable medium and electronic equipment. In the process of generating the vector map by using the neural network model, the contour mask of the map element is converted into the vector map by learning the geometric features of the map element in the sample image of the target area instead of setting a vectorization rule by a technician, so that the precision of the obtained vector map can be improved. Besides, according to the method provided by the invention, for different target areas, after the neural network model is retrained through the sample images of the different target areas, the vector maps of the different areas can be obtained by using the retrained neural network, and complex parameter adjustment and calibration and vectorization rule setting do not need to be carried out; the efficiency of generating the vector map is improved while the precision is ensured, and the method is more suitable for generating a scene of a large-scale map.
Need to check novelty before this filing date? Find Prior Art

Description

Map generation method, model training method, readable medium and electronic device Technical Field

[0001] The present application relates to the field of image processing, and in particular to a map generation method, a model training method, a readable medium, and an electronic device. Background Art

[0002] With the development of artificial intelligence (AI) technology, neural network models are increasingly being used. For example, neural network models can be used to generate a vector map of a region based on remote sensing images of that region. Currently, neural network models are typically used to infer the initial outlines of map elements (such as houses, lakes, roads, rivers, etc.) in remote sensing images. These initial outlines are then adjusted using vectorization rules set by the developer, such as adjusting the angles between lines, to convert the outlines of the map elements into vector maps.

[0003] However, due to the diversity of geographical environments and map elements, such as the varying geography of different regions and the significant differences in the geometric features of buildings and roads, the vectorization rules set by developers are difficult to match with the geographical environments and map elements of different regions. Therefore, vectorizing images of different regions using the same vectorization rules will result in low vector map accuracy. Setting different contour acquisition methods and vectorization rules for different regions is a complex process and unsuitable for large-scale vector map modeling scenarios.

[0004] Summary of the Invention

[0005] In light of this, embodiments of the present application provide a map generation method, model training method, readable medium, and electronic device. By using a neural network model to learn the geometric features of map elements in a certain area, the outlines of these map elements are converted into corresponding vector maps. This improves the accuracy of the resulting vector map and is more suitable for large-scale vector map modeling scenarios.

[0006] In a first aspect, an embodiment of the present application provides a map generation method, which is applied to an electronic device, and the method includes: acquiring an image of a certain area, the image including map elements, wherein the map elements are elements in the image to be converted into a vector map; using a first model to infer the image to obtain a first geometric figure corresponding to the map element, the first geometric figure including geometric primitives; inputting a second model based on the first geometric figure to obtain the direction of each geometric primitive, and obtaining a second geometric figure corresponding to the map element based on the first geometric figure, the second geometric figure including the same geometric primitives as the first geometric figure, and the position arrangement of the geometric primitives in the second geometric figure is different from the position arrangement of the geometric primitives in the first geometric figure; using a third model, based on the direction of the geometric primitives and the second geometric figure, obtaining a topological relationship between each geometric primitive; based on the topological relationship between each geometric primitive, the direction of each geometric primitive, and the second geometric figure, obtaining a vector map corresponding to the image.

[0007] In an embodiment of the present application, the electronic device may first use a first model (such as the shape initialization network described below) to infer the outline of a map element in an image of a certain area to obtain a first geometric figure corresponding to the map element (such as the initial shape described below), and then use a second model (such as the shape regression network described below) to adjust the first geometric figure to obtain a second geometric shape with higher accuracy and more regular shape (such as the regression shape described below), and then use a third model (such as the topology reconstruction network described below) to infer the topological relationship between the geometric primitives in the second geometric shape (for example, when the second geometric shape is a broken line, the topological relationship between the points that make up the broken line is inferred), and then obtain a vector map corresponding to the image based on the topological relationship between the geometric primitives. In this way, the electronic device converts the map element into a vector map based on the pre-trained first model, second model, and third model, rather than obtaining the vector map based on the vectorization rules set by the technician, which is conducive to improving the accuracy of the obtained vector map. Moreover, in the scenario of large-scale vector map modeling, retraining at least one of the first model, the second model, and the third model for different areas can well adapt to the geometric characteristics of map elements in different areas without the need to set vectorization rules and complex parameter adjustments, which is conducive to improving the efficiency of vector map modeling.

[0008] It can be understood that geometric primitives are the basic components of geometric figures. For example, when the first geometric figure is a polygon, the geometric primitives can be the line segments that make up the polygon. When the first geometric figure is a broken line, the geometric primitives can be the points of each line segment in the broken line.

[0009] In a possible implementation of the first aspect, at least one of the first model, the second model, and the third model is trained based on geometric features of map elements in a certain area.

[0010] In this embodiment, at least one of the first model, the second model, and the third model can be trained based on the geometric features of the map elements of the above-mentioned area. That is, the electronic device uses the geometric features of the map elements of the certain area to vectorize the map elements, which is conducive to improving the accuracy of the obtained vector map.

[0011] In a possible implementation of the first aspect above, when the geometric primitives are line segments, the second geometric figure also includes a connection order of the geometric primitives; and based on the topological relationship between the geometric primitives, the directions of the geometric primitives, and the second geometric figure, a vector map corresponding to the image is obtained, including: adjusting the direction of the first geometric primitive in the second geometric figure to be the same as the direction corresponding to the first geometric primitive, wherein the direction of the first geometric primitive in the second geometric figure is different from the direction corresponding to the first geometric primitive; connecting the first geometric primitive and the second geometric primitive to obtain a polygon corresponding to the second geometric figure, wherein the connection order of the second geometric primitives is adjacent to that of the first geometric primitives.

[0012] In a possible implementation of the first aspect above, the polygon corresponding to the second geometric figure includes a first line segment, a second line segment, and a third line segment connected in sequence; and based on the topological relationship between the geometric primitives, the direction of the geometric primitives, and the second geometric figure, a vector map corresponding to the image is obtained, which also includes: when the length of the second line segment is less than a preset side length threshold, deleting the second line segment; and when the topological relationship between the first line segment and the third line segment is collinear or parallel, merging the first line segment and the second line segment into one line segment; when the topological relationship between the first line segment and the third line segment is not collinear or parallel, extending the first line segment and / or the third line segment so that the first line segment and the third line segment intersect.

[0013] In a possible implementation of the first aspect above, when the geometric primitives are points, the above-mentioned vector map corresponding to the image is obtained based on the topological relationship between the geometric primitives, the direction of the geometric primitives, and the second geometric figure, including: connecting the points with connected topological relationships to obtain corresponding vectorized polylines.

[0014] In a possible implementation of the first aspect, the above-mentioned reasoning on the image using the first model to obtain the first geometric figure corresponding to the map element includes: performing semantic segmentation on the image to obtain a contour mask of the map element, where the contour mask is used to indicate the area in the image where the map element is located; extracting the mask edge of the contour mask; and simplifying the mask edge to obtain the first geometric figure.

[0015] For example, the electronic device can use the semantic segmentation network described below to obtain the contour mask of the area where the map elements in the image are located, and use the edge extraction network described below to extract the edges of the contour mask to obtain the mask edge, and then use the DP algorithm to simplify multiple edges or use the NMS algorithm to simplify the broken line to obtain a first geometric figure including fewer geometric primitives, thereby reducing the number of geometric primitives in the first geometric figure, which is beneficial to improving the speed of the electronic device in reasoning based on the first geometric figure.

[0016] In a possible implementation of the first aspect above, the map elements include at least one of houses, roads, lakes, oceans, rivers, forests, and deserts; and the first geometric figures corresponding to the houses, lakes, oceans, forests, and deserts are polygons; and the first geometric figures corresponding to the roads and rivers are broken lines.

[0017] In the embodiments of the present application, an image may include one or more map elements. The electronic device may represent map elements that require specific shapes, such as houses, lakes, oceans, forests, and deserts, as polygons, and roads and rivers as polylines.

[0018] In a possible implementation of the first aspect, the method further includes: training the first model in the following manner:

[0019] Acquire sample data, the sample data including a set of sample images of a certain area and a reference contour corresponding to a map element in each sample image in the sample image set; utilize a first model to perform image features on each sample image, and obtain a contour mask of the map element in each sample image based on the image features, wherein the contour mask indicates the area of ​​the map element in the corresponding sample image; obtain a first predicted geometric figure corresponding to the map element in each sample image based on the contour mask; train the first model based on a first loss function value and a second loss function value, wherein the first loss function is used to indicate the accuracy of the contour mask, and the second loss function is used to indicate the similarity between the first predicted geometric figure and the reference contour.

[0020] That is, in the embodiment of the present application, the first model is trained based on a set of sample images of the certain area, so that the contour mask and the first predicted geometric shape extracted by the first model for the map elements in the sample images have a high degree of similarity with the reference contour corresponding to the map elements. The geometric features of the map elements in the sample images are learned, so that the first geometric shapes of the map elements in the images of the certain area inferred by the first model are more consistent with the geometric features of the map elements in the certain area, which is beneficial to improving the accuracy of the first geometric shape and further beneficial to improving the accuracy of the obtained vector map.

[0021] For example, in some embodiments, the first loss function may be the cross entropy loss L below:11-12-CEL The second loss function can be the L2 loss L below 13-L2 .

[0022] In a possible implementation of the first aspect above, the method further includes: training the second model in the following manner: obtaining sample data, the sample data including a reference contour corresponding to a map element in each sample image in a sample image set of a certain area, a reference direction corresponding to each geometric primitive in the reference contour, and a third geometric figure corresponding to the map element in each sample image obtained using the first model; using the second model, obtaining a second predicted geometric figure corresponding to each map element in each sample image, and a predicted direction of the geometric primitive in the third geometric figure, wherein the second predicted geometric figure includes the same geometric primitive as the third geometric figure, and the arrangement of the geometric primitives in the second predicted geometric figure is different from that of the third geometric figure; training the second model based on a third loss function and a fourth loss function, wherein the third loss function is used to indicate the similarity between the predicted direction of the geometric primitive in the third geometric figure and the corresponding reference direction, and the fourth loss function is used to indicate the similarity between the second predicted geometric figure and the corresponding reference contour.

[0023] For example, in some embodiments the third loss function may be the L2 loss L below 23-L2 , the fourth loss function can be the relative shape loss below.

[0024] In a possible implementation of the first aspect above, the method further includes: obtaining sample data, the sample data including a reference topological relationship between geometric primitives in a reference contour corresponding to map elements of each sample image in a set of sample images of a certain area, and a fourth geometric figure corresponding to the map elements in each sample image obtained using the first model, and the direction of the geometric primitives in the fourth geometric figure; using the third model, determining the latent space features of each geometric primitive in the fourth geometric figure, and determining the predicted topological relationship between the geometric primitives in the fourth geometric figure based on the latent space features; training the third model based on a fifth loss function and a sixth loss function, wherein the fifth loss function is used to indicate the degree of matching between the predicted topological relationship between the geometric primitives in the fourth geometric figure and the corresponding reference topological relationship, and the sixth loss function is used to indicate the similarity of the latent space features between geometric primitives whose predicted topological relationship is parallel, collinear or connected.

[0025] In an embodiment of the present application, when training the third model, the sixth loss function (such as the supervised contrast loss mentioned below) indicates the similarity of the latent space features between the geometric primitives whose topological relationships are parallel, collinear or connected, so that when the third model is used to infer the second geometric figure, the similarity of the latent space features of the geometric primitives with parallel, collinear or connected characteristics is also high, which is beneficial to improving the accuracy of the topological relationship between the geometric primitives in the obtained second geometric figure, and further beneficial to improving the accuracy of the vector map obtained based on the topological relationship. For example, in some embodiments, the fifth loss function can be the cross entropy loss L below. CEL The sixth loss function can be the supervised contrast loss L below SCL .

[0026] In a second aspect, an embodiment of the present application provides a model training method, which is applied to an electronic device, and the method includes:

[0027] Obtaining sample data, the sample data including a reference contour corresponding to a map element in each sample image in a set of sample images of a certain area, a fifth geometric figure or a sixth geometric figure corresponding to each map element, directions of geometric primitives in the fifth geometric figure, and image features of the geometric primitives in the fifth geometric figure, wherein the image features of the geometric primitives in the fifth geometric figure are generated when the fifth geometric figure of each map element is obtained by inference using the fourth model, a similarity between the fifth geometric figure and the corresponding reference contour is lower than a similarity between the sixth geometric figure and the corresponding reference contour, and the fifth geometric figure and the sixth geometric figure have the same geometric primitives;

[0028] Based on inputting the fifth geometric figure or the sixth geometric figure, the image features of the geometric primitives in the fifth geometric figure, and the directions of the geometric primitives in the fifth geometric figure into a fifth model having the first network parameters, latent space features corresponding to each geometric primitive are obtained, and based on the latent space features corresponding to each geometric primitive, predicted topological relationships between the geometric primitives are inferred;

[0029] Based on the predicted topological relationship between the geometric primitives in the fifth geometric figure and the corresponding reference topological relationship, the seventh loss function and the eighth loss function are determined, wherein the reference topological relationship can be determined based on the reference contour corresponding to the map element in each sample image, the seventh loss function is used to indicate the matching degree between the predicted topological relationship between the geometric primitives in the fifth geometric figure and the corresponding reference topological relationship, and the eighth loss function is used to indicate the similarity of the latent space features between the geometric primitives whose predicted topological relationship is parallel, collinear or connected; when the seventh loss function and the eighth loss function meet the termination condition, the fifth model with the first network parameters is saved; when the seventh loss function and the eighth loss function do not meet the termination condition, the network parameters of the fifth model are adjusted to the second network parameters, and the next round of training is carried out.

[0030] In an embodiment of the present application, the fifth model may be used to obtain the characteristics of the geometric figures corresponding to the map elements and the directions of the geometric primitives in the geometric figures, such as the third model in the first aspect described above, the topological reconstruction network described below, etc. During the training process of this model, the fifth geometric figure with lower precision may be used as input to train the fifth model, so that the predicted topological relationship between the geometric primitives in the fifth geometric figure obtained by the fifth model has a higher degree of regionality than the corresponding reference topological relationship. That is, the fifth model obtains higher-precision output data with lower-precision input data, which is beneficial to improving the noise resistance of the fifth model. Thus, even if the precision of the second geometric figure obtained by the second model described above is lower, a more accurate topological relationship between the geometric primitives can be obtained, thereby improving the precision of the vector map obtained based on the topological relationship between the geometric primitives.

[0031] For example, in some embodiments, the seventh loss function may be the cross entropy loss L below: CEL The eighth loss function can be the supervised contrast loss L below SCL .

[0032] In a possible implementation of the second aspect, when the geometric primitives in the fifth geometric figure are line segments, determining whether the seventh loss function and the eighth loss function satisfy the termination condition is performed in the following manner: based on the directions of the geometric primitives in the fifth geometric figure, determining the directional relationship between the geometric primitives and the reference directional relationship corresponding to the topological relationship, and determining a ninth loss function, where the ninth loss function is used to indicate the consistency of the predicted topological relationship and direction of each geometric primitive;

[0033] When the seventh loss function, the eighth loss function, and the ninth loss function all converge, or the seventh loss function, the eighth loss function, and the ninth loss function are all less than the corresponding preset loss function values, or the total loss function converges, or the total loss function is less than the corresponding preset total loss function value, it is determined that the termination condition is met, where the total loss function includes the weighted sum of the seventh loss function, the eighth loss function, and the ninth loss function.

[0034] For example, in some embodiments, the ninth loss function may be the consistency loss L between geometric attributes and relationships as follows: C .

[0035] In a possible implementation of the second aspect, the latent space features corresponding to each geometric primitive are obtained based on the fifth geometric figure or the sixth geometric figure, the image features of the geometric primitives in the fifth geometric figure, and the directions of the geometric primitives in the fifth geometric figure, including: when the geometric primitives of the fifth geometric figure are points, the latent space features corresponding to each geometric primitive are obtained based on the fifth geometric figure, the image features of the geometric primitives in the fifth geometric figure, and the directions of the geometric primitives in the fifth geometric figure; when the geometric primitives of the fifth geometric figure are line segments, the latent space features corresponding to each geometric primitive are obtained based on the sixth geometric figure, the image features of the geometric primitives in the fifth geometric figure, and the directions of the geometric primitives in the fifth geometric figure.

[0036] In an embodiment of the present application, since the complexity of a polyline is lower than that of a polygon, when training the fifth model, when the fifth geometric figure is a polyline, the fifth geometric figure is used as the input of the fifth model; when the fifth geometric figure is a polygon, the sixth geometric image with higher precision is used as the input of the fifth model. This ensures the accuracy of the fifth model's reasoning of the topological relationship of geometric primitives in more complex polygons while improving the noise resistance of simpler polyline input data.

[0037] In a third aspect, an embodiment of the present application provides a map generation device, which includes: a data acquisition unit, used to acquire an image of a certain area, wherein the image includes map elements, wherein the map elements are elements in the image to be converted into a vector map; an initial shape generation unit, used to use a first model to infer the image to obtain a first geometric figure corresponding to the map element, wherein the first geometric figure includes geometric primitives; a shape regression unit, used to input a second model based on the first geometric figure to obtain the direction of each geometric primitive, and to obtain a second geometric figure corresponding to the map element based on the first geometric figure, wherein the second geometric figure includes the same geometric primitives as the first geometric figure, and the position arrangement of the geometric primitives in the second geometric figure is different from the position arrangement of the geometric primitives in the first geometric figure; a topology reconstruction unit, used to use a third model to obtain a topological relationship between each geometric primitive based on the direction of the geometric primitive and the second geometric figure; and a post-processing unit, used to obtain a vector map corresponding to the image based on the topological relationship between each geometric primitive, the direction of each geometric primitive, and the second geometric figure.

[0038] In an embodiment of the present application, the electronic device may first use a first model (such as the shape initialization network described below) to infer the outline of a map element in an image of a certain area to obtain a first geometric figure corresponding to the map element (such as the initial shape described below), and then use a second model (such as the shape regression network described below) to adjust the first geometric figure to obtain a second geometric shape with higher accuracy and more regular shape (such as the regression shape described below), and then use a third model (such as the topology reconstruction network described below) to infer the topological relationship between the geometric primitives in the second geometric shape (for example, when the second geometric shape is a broken line, the topological relationship between the points that make up the broken line is inferred), and then obtain a vector map corresponding to the image based on the topological relationship between the geometric primitives. In this way, the electronic device converts the map element into a vector map based on the pre-trained first model, second model, and third model, rather than obtaining the vector map based on the vectorization rules set by the technician, which is conducive to improving the accuracy of the obtained vector map. Moreover, in the scenario of large-scale vector map modeling, retraining at least one of the first model, the second model, and the third model for different areas can well adapt to the geometric characteristics of map elements in different areas without the need to set vectorization rules and complex parameter adjustments, which is conducive to improving the efficiency of vector map modeling.

[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes instructions. When the instructions are executed by an electronic device, the electronic device implements any one of the methods provided in the above-mentioned first aspect, various possible implementations of the above-mentioned first aspect, the above-mentioned second aspect, and various possible implementations of the above-mentioned second aspect.

[0040] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing instructions executed by one or more processors of the electronic device; and a processor, which is one of the processors of the electronic device, for executing the instructions stored in the memory to implement any one of the methods provided in the above-mentioned first aspect, various possible implementations of the above-mentioned first aspect, the above-mentioned second aspect, and various possible implementations of the above-mentioned second aspect.

[0041] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program / instruction. When the computer program / instruction is executed by a processor, it implements any one of the methods provided in the above-mentioned first aspect, various possible implementations of the above-mentioned first aspect, the above-mentioned second aspect, and various possible implementations of the above-mentioned second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] FIG1A is a schematic diagram showing a process of obtaining a vector map from an image according to some embodiments of the present application;

[0043] FIG1B shows a schematic diagram of an image including only one map element according to some embodiments of the present application;

[0044] FIG1C shows a schematic diagram of an image including multiple map elements according to some embodiments of the present application;

[0045] FIG2 is a schematic diagram showing a process of generating a map using a neural network model according to some embodiments of the present application;

[0046] FIG3 shows a schematic structural diagram of a shape initialization network 1 according to some embodiments of the present application;

[0047] FIG4 shows a schematic diagram of a training process of a shape initialization network 1 according to some embodiments of the present application.

[0048] FIG5 is a schematic diagram showing a house in an image IM2 and a corresponding contour mask according to some embodiments of the present application;

[0049] FIG6A is a schematic diagram showing coordinate distances between points in an edge region of a contour mask and a reference contour according to some embodiments of the present application;

[0050] FIG6B is a schematic diagram showing the coordinate distance between a point in the edge region of a contour mask and an outermost pixel of the contour mask according to some embodiments of the present application;

[0051] FIG7 shows a schematic structural diagram of a shape regression network 2 according to some embodiments of the present application;

[0052] FIG8 shows a schematic diagram of a training process of a shape regression network 2 according to some embodiments of the present application;

[0053] FIG9 shows a schematic structural diagram of a topology reconstruction network 3 according to some embodiments of the present application;

[0054] FIG10 shows a schematic diagram of a training process of a topology reconstruction network 3 according to some embodiments of the present application;

[0055] FIG11 is a schematic diagram showing a process of calculating a topological relationship and a cross entropy loss according to some embodiments of the present application;

[0056] FIG12 is a schematic diagram showing a process of training and reasoning according to some embodiments of the present application;

[0057] FIG13 is a schematic diagram showing a flow chart of a map generation method according to some embodiments of the present application;

[0058] FIG14 shows a schematic diagram of post-processing a polygon according to some embodiments of the present application;

[0059] FIG15 is a schematic diagram showing the result of vectorizing houses in a portion of a remote sensing image using a neural network model 0 according to some embodiments of the present application;

[0060] FIG16 is a schematic diagram showing the result of vectorizing roads in a remote sensing image using a neural network model 0 according to some embodiments of the present application;

[0061] FIG17A is a schematic diagram showing the effect of reconstructing a road in a relatively complex remote sensing image using a neural network model 0 according to some embodiments of the present application;

[0062] FIG17B is a schematic diagram showing the effect of reconstructing a road in another complex remote sensing image using a neural network model 0 according to some embodiments of the present application;

[0063] FIG18 shows a schematic structural diagram of a map generating device according to some embodiments of the present application;

[0064] FIG19 shows a schematic structural diagram of an electronic device 100 for executing embodiments of the present application according to some embodiments of the present application. DETAILED DESCRIPTION

[0065] Illustrative embodiments of the present application include, but are not limited to, map generation methods, model training methods, readable media, program products, apparatuses, and electronic devices.

[0066] For ease of understanding, the terms involved in this application are first explained.

[0067] (1) Loss function

[0068] During neural network model training, the goal is to make the model's output as close as possible to the desired predicted value. This is done by comparing the network's predictions with the desired target values ​​and then updating the weight vectors of each layer based on the difference between the two. (Of course, before the first update, there's usually an initialization process, which pre-configures the parameters for each layer in the neural network model.) For example, if the network's predictions are too high, the weight vectors are adjusted to lower them. This process continues until the neural network model predicts the desired target value, or a value very close to it. Therefore, it's necessary to predefine how to compare the difference between the predicted and target values. This is known as the loss function, or objective function. These are crucial equations used to measure the difference between the predicted and target values. For example, a higher loss function indicates a greater difference, so training the neural network model becomes a process of minimizing this loss. Therefore, the appropriateness of the loss function directly impacts the quality of neural network model training.

[0069] The technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0070] As mentioned above, the method of converting the outlines of map elements obtained by neural network model inference into vector maps using vectorization rules may result in low accuracy of the resulting vector maps if the same vectorization rules are used to vectorize images of different regions. For example, for different cities or regions, the outline features of buildings vary greatly due to different architectural styles. For example, if the vectorization rules optimize the corners of the geometric outline of a house to right angles, the incorrect house outline will be obtained for areas where the geometric outline of the house is circular or an irregular polygonal image. If different outline acquisition methods and vectorization rules need to be set for different regions, the process is complicated, resulting in low efficiency in generating vector maps, which is not suitable for large-scale vector map modeling scenarios.

[0071] It can be understood that vectorization rules refer to rules set by technicians to adjust the relationship between lines or points in the outline of map elements in order to obtain a more reasonable vectorized map. For example, two lines with an angle greater than a preset value are set to be parallel or collinear, two lines with an angle in a certain interval are set to be perpendicular, and all points with a distance less than a preset value from a certain straight line are moved to the straight line, etc. It is not difficult to understand that the effectiveness of the setting of vectorization rules depends on the experience of technicians and the outline of the referenced map elements and the complexity of the adjustment process. When the geometric features of the map elements used as a reference for setting vectorization rules are significantly different from the features of the map elements of the area to be vectorized, a vector map with lower accuracy will be obtained. For example, the angles of the sides of houses in the referenced map elements are mostly right angles, while the houses in a certain area are mainly circular. In this case, the vectorization rules may result in a vector map with a significant difference in appearance from the actual map elements.

[0072] In order to solve the above problems, an embodiment of the present application provides a map generation method, which is implemented based on a neural network model. In the neural network model, map elements are represented by geometric figures (for example, broken lines are used to represent roads, polygons are used to represent houses, etc.), and the geometric features of the map elements in the sample image of the target area are learned to ensure that the geometric figures inferred by the neural network model based on the contours of the map elements can match the geometric features of the map elements in the target area. Then, based on the trained neural network model, the predicted image of the target area is inferred to obtain the geometric figures corresponding to the map elements in the target area, thereby obtaining a vector map. That is to say, in the embodiment of the present application, the map elements in the image are vectorized based on the learning of the geometric features of the map elements in the target area, rather than vectorizing the map elements by setting vectorization rules by the developer, which can improve the accuracy of the vector map. In addition, when performing vector map inference on different areas, it is only necessary to retrain the neural network model using sample images of each area to adapt well to the geometric characteristics of the map elements in that area without the need for complex vectorization rule setting and adjustment. In large-scale map construction scenarios, such as map vectorization of an area including multiple regions, cities or countries, the efficiency of vector map generation can be improved while ensuring the accuracy of the vector map.

[0073] For example, referring to FIG1A , in some embodiments, a semantic segmentation network can be used to obtain contour masks of map elements (such as houses, roads, etc.) in an image, and then the contours of the map elements can be converted into a vector map based on heuristic rules (i.e., vectorization rules) set by the developer. In some embodiments of the present application, geometric feature learning and topological reconstruction can be used to replace heuristic rules, and a neural network model can be used to learn the geometric features of map elements in a sample image of a target area, so that the geometric figures of the map elements obtained by the neural network model can more accurately reflect the geometric features of the map elements of the target area. Secondly, the neural network model is used to determine the topological relationship between the geometric primitives in the geometric figures, and then the geometric primitives of the geometric figures are topologically connected to obtain a vector map, for example, connecting points into broken lines to represent roads or rivers, and connecting lines into polygons to represent houses or lakes.

[0074] It can be understood that geometric primitives refer to the basic components of various geometric figures. For example, the geometric primitives of a polyline can be points, and the geometric primitives of a polygon can be ordered line segments.

[0075] It is understood that map elements may include, but are not limited to, houses, lakes, oceans, roads, rivers, forests, deserts, and the like. Map elements that require specific shapes on a map, such as houses, lakes, oceans, forests, and deserts, can be represented using polygons. Map elements that do not require specific shapes on a map, such as roads and rivers, can be represented using polylines. For ease of description, the following embodiments illustrate map elements represented by polygons as houses and map elements represented by polylines as roads.

[0076] It is understood that an image may include at least one map element. For example, referring to Figure 1B , image IM11 includes only road RD1, which can be represented by a polyline in a vector map. For another example, referring to Figure 1C , image IM12 includes house HE1, road RD2, and river RR1. House HE1 can be represented by a polygon, while road RD2 and river RR1 can be represented by polylines.

[0077] To facilitate understanding, we first introduce the process of converting remote sensing images into vector maps using a neural network model.

[0078] FIG2 shows a schematic diagram of a process for generating a map using a neural network model according to some embodiments of the present application. As shown in FIG2 , converting a remote sensing image into a vector map using a neural network model 0 generally includes the following steps:

[0079] S21: Marking features. Map elements, such as houses, roads, and lakes, in a portion of the remote sensing image of the target area are marked to obtain reference outlines of the map elements in the portion of the image (e.g., vectorized outlines of houses, vectorized centerlines of roads, etc.). The portion of the image and the corresponding reference outlines of the map elements can be used as a sample image set.

[0080] S22: Model training. The sample image set is used to train the neural network model 0, so that the neural network model 0 can vectorize the map elements in each sample image in the sample image set and obtain a predicted shape with a high degree of similarity to the reference contour of each map element;

[0081] S23: Map reasoning. Using the trained neural network model 0, reasoning is performed on the predicted image set (i.e., images other than the sample image set) in the remote sensing image of the target area to obtain the predicted shape of the map elements in each predicted image, where the predicted shape includes the geometric primitives of the predicted shape and the topological relationships between the geometric primitives.

[0082] S24: Post-processing. Post-process the predicted shapes output by the neural network model 0, for example, by connecting geometric primitives in each predicted shape to obtain a vectorized shape of a map element, or by splicing vectorized shapes of map elements in different remote sensing images, to obtain a predicted vector map.

[0083] S25: Correction. Surveying and mapping personnel correct the predicted vector map to obtain a vector map of the target area to ensure the accuracy of the vector map.

[0084] Continuing to refer to FIG. 2 , in some embodiments, the neural network model 0 may include a shape initialization network 1 , a shape regression network 2 , and a topology reconstruction network 3 .

[0085] The shape initialization network 1 is used to extract the initial shapes of each map element in the remote sensing image. For example, the shape initialization network 1 may extract houses in the remote sensing image IM2 as polygons and roads as polylines. In some embodiments, the shape initialization network 1 is also used to determine key points in roads and rivers, such as intersections (roads), diverging and converging points in rivers, etc.

[0086] The shape regression network 2 is used to optimize the initial shape obtained by the shape initialization network 1 to obtain the regression shape of each map element and the direction data of each geometric primitive in the regression shape to improve the accuracy of the geometric figures of each map element.

[0087] The topology reconstruction network 3 is used to infer the topological relationships between geometric primitives in the regressed shapes of each map element. For example, the geometric primitives of a map element described by a polygon can be line segments, and the topological relationships between line segments can include but are not limited to collinearity and parallelism. For another example, a map element described by a broken line can be a point, and the topological relationships between points can include connection and disconnection.

[0088] After obtaining the topological relationships between the geometric primitives of each map element, post-processing module 4 can be used to perform post-processing operations such as connecting the geometric primitives and splicing the map elements based on the topological relationships between the geometric primitives of each map element to obtain a vector map. It will be understood that in some embodiments, post-processing module 4 can be implemented as a neural network or other processing logic, which is not limited here.

[0089] It can be understood that each network of the neural network model 0 may include one or more neural network layers, including but not limited to semantic segmentation network, convolutional network, pooling network, classification network, activation network, attention mechanism network, fully connected network, recurrent neural network, batch normalization (BN) network, etc.

[0090] It is understood that the structure of the neural network model 0 shown in FIG2 is merely an example. In other embodiments, the neural network model 0 may include more or fewer networks, or may combine or split some networks, without limitation herein. For example, in some embodiments, a post-processing module 4 implemented as a neural network may be included in the neural network model 0.

[0091] The following describes the training process of each network in the neural network model 0.

[0092] First, we introduce the training process of shape initialization network 1.

[0093] FIG3 shows a schematic structural diagram of a shape initialization network 1 according to some embodiments of the present application.

[0094] As shown in FIG3 , the shape initialization network 1 includes a semantic segmentation network 11 , a mask generation network 12 , an edge extraction network 13 and a shape generation network 14 .

[0095] The semantic segmentation network 11 is used to extract image features (Image Embedding) from each sample image in the sample image set. In some embodiments, the semantic segmentation network 11 may include a target detection network (Feature Pyramid Networks, FPN).

[0096] The mask generation network 12 is used to obtain the contour mask of each map element based on the image features of each sample image in the sample image set. For example, in some embodiments, the mask generation network 12 may include a serially connected convolutional network, a batch normalization (BN) network, and an activation network (such as a rectified linear unit (ReLU)).

[0097] The edge extraction network 13 is used to extract the edges of the contour mask based on the contour mask and image features of each map element, thereby obtaining the mask edge of each map element. The mask edge is used to describe the outline of the map element. In some embodiments, the edge extraction network 13 may include a serial convolutional network, a batch normalization (BN) network, and an activation network (e.g., a linear rectifier function).

[0098] The shape generation network 14 is used to simplify the mask edges of each map element to obtain the initial shape of each map element. This reduces the number of geometric primitives included in the initial shape, such as reducing the number of line segments included in a polygon and the number of points included in a polyline, thereby increasing the speed of inference on the input image using the neural network model 0. In some embodiments, algorithms such as Douglas Peucker (DP) can be used to simplify polygons, and algorithms such as non-maximum suppression (NMS) can be used to simplify polylines.

[0099] It can be understood that the structure of the shape initialization network 1 shown in FIG3 is only an example. In other embodiments, the shape initialization network 1 may adopt other structures, and each network may also be implemented using other types of neural networks, which are not limited here.

[0100] The following describes the training process of the shape initialization network 1 in conjunction with the structure of the shape initialization network 1 shown in FIG3 .

[0101] Specifically, FIG4 shows a schematic diagram of a training process of a shape initialization network 1 according to some embodiments of the present application. The execution subject of the process is an electronic device, as shown in FIG4 , and the process includes the following steps:

[0102] S401: Acquire a sample image set.

[0103] The electronic device obtains a sample image set in a target area, where the sample image set includes a reference outline of a map element in each sample image.

[0104] In some embodiments, the sample image set may include N sample images, each sample image has a size of H×W (i.e., H pixels high and W pixels wide), and each pixel in the sample image may include n channels (n is the number of color channels of the sample image, for example, assuming that the sample image is an RGB image, then n=3), so that the sample image set can be represented as a 4-dimensional matrix P, the size of the matrix P is N×n×H×W, and the element P(i,j,k,m) of the matrix P represents the value of the j-th color channel of the element in the k-th row and m-th column of the i-th sample image.

[0105] It can be understood that in some embodiments, the reference contours of the map elements in the sample image set may include vector data of each map element determined manually, such as roads represented by broken lines, houses represented by polygons, etc., so that during the training process of the neural network model 0, the reference contours can be used to evaluate the quality of the results inferred by the neural network model 0, and the network parameters of the neural network model 0 can be adjusted according to the evaluation results.

[0106] S402: Obtain image features of map elements in the sample image set using the semantic segmentation network 11.

[0107] The electronic device uses a semantic segmentation network 11, such as an FPN network, to extract features from the sample image set to obtain image features of the sample image set.

[0108] In some embodiments, the electronic device can input the matrix P into the semantic segmentation network 11 to obtain an image feature matrix F for the sample image set. The size of the matrix F is N×C×H×W, where C is the number of image features extracted by the semantic segmentation network 11 for each sample image. The element P(i,j,k,m) in the matrix F represents the value of the jth feature of the element in the kth row and mth column of the i-th sample image, which is predetermined by the type of the semantic segmentation network 11 or preset by the developer.

[0109] S403: Based on the image features of the sample image set, the mask generation network 12 is used to obtain the contour mask of each map element, and the edge extraction network 13 is used to obtain the mask edge of each contour mask.

[0110] In some embodiments, the electronic device can input the image feature matrix F of the sample image into the mask generation network 12 to obtain the contour mask of each map element. For example, in some embodiments, the contour mask of each map element can be represented as a matrix M, with a size of N×p×H×W, where p represents the number of categories of the map element (hereinafter, the classification is described as two categories). For example, map elements can be divided into map elements represented by polygons (p=1) and map elements represented by polylines (p=2). Therefore, for given p and N, a submatrix of size 1×1×H×W in the matrix M represents the contour mask of the p-th category of map elements in the N-th sample image. For example, in this 1×1×H×W submatrix, the values ​​of elements belonging to the same category of map elements can be the same. Referring to FIG. 5 , for sample image IM2, in the 1×1×H×W submatrix, the values ​​of the pixels where houses are located can all be 1, and the values ​​of other pixels can be 0.

[0111] After obtaining the contour mask of the map element, in some embodiments, the electronic device may input the contour mask and the corresponding reference contour into the edge extraction network 13 to obtain the mask edge of the contour mask. For example, referring to FIG6A , the edge extraction network 13 may infer the coordinate distance DT between each pixel within the edge region of the contour mask and the reference contour. The size of DT is N×2×H×W, and the element DT(i,j,k,m) in DT represents the coordinate distance between the pixel in the kth row and mth column of the jth type map element in the i-th sample image and the reference contour. DT(i,j,k,m) may include two elements dx and dy, representing the coordinate distance in the H direction and the W direction, respectively. For example, B1 is a point within the edge region of the contour mask shown in FIG6A , with coordinates (x,y). The distance DT from B1 to the reference contour is (dx,dy). Then, the coordinates of the point on the mask edge corresponding to B1(x,y) are (x+dx,y+dy). In this way, the coordinates of all points in the edge area are added to the corresponding coordinate distances to obtain the coordinates of the points on the edge of the contour mask. Assuming that there are L pixels in the edge area of ​​the contour mask, the mask contour of the contour mask obtained by the L pixels can be expressed as a point set (x i +dx i ,y i +dy i )(i=1,2,……,L).

[0112] It is understood that the size of the edge area of ​​the contour mask can be preset. For example, the edge area can be an area consisting of pixels whose distance from the outermost pixel of the contour mask is less than a preset edge distance threshold.

[0113] It can be understood that in some embodiments, the coordinate distance between a pixel point in the edge area and the reference contour may be the difference between the coordinates of the point on the reference contour closest to the pixel point and the coordinates of the pixel point.

[0114] It can be understood that in the process of extracting the mask edge corresponding to the contour mask of the map element using the trained shape initialization network 1, since there is no reference contour, the above-mentioned DT can be the coordinate distance between the point within the edge region of the contour mask and the contour composed of the outermost pixels of the contour mask. For example, referring to Figure 6B, if the coordinate distance between point E1 (x, y) within the edge region of the contour mask and the contour composed of the outermost pixels of the contour mask is (dx, dy), then the coordinates of point E1 corresponding to point E1' on the mask edge of the contour mask are (x+dx, y+dy).

[0115] It is understandable that in other embodiments, the mask edge of the contour mask may be obtained by other methods, such as directly using the outermost point of the contour mask as the mask edge of the contour mask, which is not limited here.

[0116] S404: Simplify the mask edge using the shape generation network 14 to obtain an initial shape.

[0117] The electronic device simplifies the mask edges of the contour mask of each map element to obtain an initial shape of each map element, thereby reducing the number of geometric primitives included in the initial shape and improving the speed at which the electronic device can infer remote sensing images using the neural network model 0. For example, a polygon simplification algorithm, such as the DP algorithm, is used to simplify polygons to obtain an initial polygon shape including fewer line segments. For another example, a line simplification algorithm, such as the NMS algorithm, is used to thin out points on a polyline to obtain an initial polyline shape including fewer points.

[0118] It can be understood that the above simplification of the mask edge by using the DP algorithm or the NMS algorithm is only an example. In other embodiments, other algorithms may also be used for simplification, which will not be described in detail here.

[0119] It can be understood that, in some embodiments, the initial shape obtained by the electronic device may further include image features of each geometric primitive in the initial shape.

[0120] S405: Calculate the loss function and determine whether the termination condition is met based on the loss function.

[0121] The electronic device calculates the loss function according to the coordinates of each predicted point in the initial shape and the coordinates of the corresponding reference points on the reference contour, and determines whether the termination condition is met based on the loss function. If so, it means that the initial shape obtained by the shape initialization network 1 meets the requirements, and go to step S406; otherwise, it means that the shape initialization network 1 cannot obtain the required initial shape based on the current network parameters, and go to step S407.

[0122] It can be understood that, in some embodiments, different loss functions can be used for each network in the shape initialization network 1.

[0123] In some embodiments, for the semantic segmentation network 11 and the mask generation network 12, the loss function can be a cross entropy loss function, a focal loss function, a 0-1 loss, entropy and cross entropy loss, a softmax loss, etc.

[0124] For example, assuming that an image includes N1 pixels, the semantic segmentation network 11 and the mask generation network 12 classify N1 pixels into M1 categories (i.e., into M1 map elements), then the cross entropy loss L between the semantic segmentation network 11 and the mask generation network 12 is 11-12-CEL It can be expressed as the following formula (1).

[0125]

[0126] In formula (1), y ij is a 0-1 variable. When the i-th pixel is within the contour mask area of ​​the j-th map element, y ij =1, otherwise y ij =0;p ij The probability that the i-th pixel point is within the contour mask area of ​​the j-th type of map element determined by the mask generation network 12. From formula (1), we can see that the cross entropy loss L 11-12-CEL It is used to indicate the accuracy of the contour mask obtained by the mask generation network 12, L 11-12-CEL The smaller it is, the higher the accuracy of the contour mask obtained by the mask generation network 12 is.

[0127] It can be understood that the cross entropy loss L of the semantic segmentation network 11 and the mask generation network 12 11-12-CEL It reflects the accuracy of the contour mask obtained by using the semantic segmentation network 11 and the mask generation network 12, L 11-12-CEL The smaller it is, the higher the accuracy is.

[0128] In some embodiments, corresponding to the edge extraction network 13 , the loss function may include mean squared error (MSE, also known as L2 loss).

[0129] Assume that an initial shape includes N2 prediction points, and the coordinates of the i-th prediction point are (x i ,y i ), the coordinates of the reference point corresponding to the i-th prediction point in the reference contour are (x si ,y si ), then the L2 loss L of the edge extraction network 13 13-L2 It can be expressed as the following formula (2):

[0130]

[0131] It can be understood that the L2 loss L of the edge extraction network 13 13-L2 It reflects the similarity between the mask edge of the contour mask obtained by the edge extraction network 13 and the corresponding reference contour, L 13-L2 The smaller it is, the higher the similarity is and the higher the accuracy of the edge extraction network 13 is.

[0132] It is understandable that in other embodiments, other types of loss functions may be used to determine whether the termination condition is met.

[0133] It is understood that the termination condition may include at least one of the following conditions: the loss function corresponding to each network converges, and the loss function value corresponding to each network is less than the corresponding preset loss function value. For example, the termination condition is determined to be satisfied when both the cross entropy loss function converges and the L2 loss converges; for another example, the termination condition is determined to be satisfied when the cross entropy loss function is less than the corresponding first preset loss function value and the L2 loss value is less than the corresponding second preset loss function value.

[0134] It is understood that in other embodiments, the termination condition may also include other conditions, which are not limited here. For example, in some embodiments, the loss functions of each network may be weighted and summed (i.e., the loss functions of each network are multiplied by their corresponding weight values ​​and then added together) to obtain a total loss function. When the total loss function converges or is less than the preset total loss function value, the termination condition is determined to be satisfied. For example, when the loss function includes the aforementioned L 11-12-CEL and L 13-L2 In the case of , the total loss function can be expressed as λ1L 11-12-CEL +λ2L 13-L2 , where λ1 represents the weight of the cross entropy loss and λ2 represents the weight of the L2 loss. λ1 and λ2 can be preset by the developer.

[0135] S406: Store the network parameters and obtain the shape initialization network 1.

[0136] The electronic device stores the network parameters currently used by the shape initialization network 1 to obtain the shape initialization network 1.

[0137] S407: Adjust network parameters and proceed to the next round of training.

[0138] When the electronic device determines that the termination condition is not met, it adjusts the network parameters of the shape initialization network 1 and performs the next round of training. For example, when the loss functions corresponding to all networks do not meet the corresponding termination condition, the network parameters of all networks are adjusted and the next round of training is performed. For another example, when the loss functions of some networks meet the corresponding termination condition and the loss functions of other networks do not meet the corresponding termination condition, the network parameters of the networks whose loss functions do not meet the corresponding termination condition are adjusted and the next round of training is performed. For another example, when the total loss function does not meet the corresponding termination condition, the network parameters of at least some networks are adjusted and the next round of training is performed.

[0139] From the training process of the above-mentioned shape initialization network 1, it can be seen that the shape initialization network 1 performs semantic segmentation on the image based on the learning of the reference contours of each map element in the sample image of the target area, that is, the learning of the geometric features of the map elements in the target area, and obtains the initial shape of each map element. This can better adapt to the geometric features of the map elements in the target area and improve the accuracy of the initial shape of each map element.

[0140] For the trained shape initialization network 1, the electronic device can input the remote sensing image into the network to obtain the initial shape and image features of the map elements in the remote sensing image.

[0141] The following describes the training process of shape regression network 2.

[0142] FIG7 shows a schematic structural diagram of a shape regression network 2 according to some embodiments of the present application.

[0143] As shown in FIG7 , the shape regression network 2 includes a pooling network 21 , a feature encoding network 22 , a direction generation network 23 and a shape adjustment network 24 .

[0144] Among them, the pooling network 21 is used to pool and interpolate the feature parameters of each geometric primitive in the initial shape to obtain the pooled features of each geometric primitive. For example, the image features of the sample image extracted by the aforementioned semantic segmentation network 11 are in pixels, but after passing through the aforementioned shape generation network 13, the coordinates of each geometric primitive in the initial shape and the image features obtained by the semantic segmentation network 11 do not have a one-to-one correspondence. At this time, the pooling network 21 can be used to obtain the features of each geometric primitive in the initial shape by interpolation based on the image features of the pixels adjacent to each geometric primitive in the initial shape. For example, for an initial shape represented by a polygon, the image features of the geometric primitives can be interpolated by the line feature interpolation (LOI) method. For an initial shape represented by a broken line, the image features can be interpolated by the point feature interpolation (POI) method. The specific examples will be given below and will not be repeated here.

[0145] The feature encoding network 22 is used to re-encode the pooled features of each geometric primitive in the initial shape to obtain regression encoding features of each geometric primitive. The regression encoding features can be used to infer the orientation data of each geometric primitive, adjust the initial shape, etc. In some embodiments, the feature encoding network 22 may include a multi-head attention network.

[0146] The direction generation network 23 is used to obtain the direction data of each geometric primitive based on the regression encoding features of each geometric primitive. When the geometric primitive is a point, the direction of the geometric primitive can be the tangent direction of the point; when the geometric primitive is a line segment, the direction of the geometric primitive can be the direction of the line segment. In some embodiments, the direction generation network 23 may include a concatenated convolutional network, a batch normalization network, and an activation network.

[0147] It can be understood that in some embodiments, during the training of the shape regression network 2, the direction data obtained by the direction generation network 23 can be used to calculate the angle constraint loss and L2 loss of the direction data, and the network parameters of the shape regression network 2 can be adjusted according to the obtained angle constraint loss and L2 loss to improve the accuracy of the direction data of the geometric primitives obtained by the direction generation network 23. The specific calculation method will be introduced below and will not be repeated here.

[0148] The shape adjustment network 24 is used to adjust the positions of each geometric primitive in the initial shape based on the regression encoding features of each geometric primitive to obtain a more accurate regression shape. It also calculates the residual coordinates of the predicted points in each geometric primitive in the regression shape relative to the corresponding points on the reference contour for use in calculating the loss function. In some embodiments, the direction generation network 23 may include a convolutional network, a batch normalization network, and an activation network connected in series.

[0149] It can be understood that in some embodiments, the regression shape generated by the shape adjustment network 24 can be used to calculate the relative shape loss (Relative Shape Loss), and the network parameters of the shape regression network 2 are adjusted according to the relative shape loss to improve the accuracy of the regression shape obtained by the shape adjustment network 24. The specific calculation method will be introduced below and will not be repeated here.

[0150] Specifically, FIG8 shows a schematic diagram of a training process of a shape regression network 2 according to some embodiments of the present application. The execution subject of the process is an electronic device, and as shown in FIG8 , the process includes the following steps.

[0151] S801: Perform feature pooling on the image features and classification features of the geometric primitives in the initial shape to obtain pooled features of the initial shape.

[0152] As mentioned above, the image features and classification features of the sample image obtained by the aforementioned shape initialization network 1 are all obtained based on pixel points, and there is no one-to-one correspondence between the points included in the initial shape and the pixel points. Therefore, the image features and classification features of the geometric primitives in the initial shape can be pooled, interpolated, etc. to obtain the pooled features of each geometric primitive.

[0153] For example, for an initial shape represented by a broken line, whose geometric primitives are points, the POI algorithm can be used to obtain the pooled features of each geometric primitive in the initial shape. Specifically, assuming that the vector corresponding to the image feature of point A obtained by the semantic segmentation network 11 is c0, and the vector corresponding to the image feature of point B is c1, then in the initial shape, the vector corresponding to the image feature of point C located on line segment AB is c0+(c1-c0)l AC / l AB , where l AC is the length of line segment AC, l AB is the length of line segment AB.

[0154] For another example, for an initial shape represented by a polygon, whose geometric primitives are line segments, the LOI algorithm can be used to obtain the pooled features of each geometric primitive in the initial shape. Specifically, multiple points on the line segment (for example, 32 points) can be obtained, and then the multiple points can be divided into several groups (for example, 32 points can be divided into 4 groups), and the pooled features of the multiple points can be obtained by the POI algorithm. The pooled features of the points in each group are averaged to obtain the pooled features of the group (for example, the vectors corresponding to the pooled features of the 4 groups are n1, n2, n3, n4). The pooled features of each group are connected to obtain the pooled features of the line segment (for example, the aforementioned vectors n1, n2, n3, n4 are connected to obtain the vector n5 = [n1n2n3n4] corresponding to the pooled features of the line segment).

[0155] It is understandable that in other embodiments, the pooling features of each geometric primitive in the initial shape may also be determined by other methods, which are not limited here.

[0156] S802: Encode the pooled features of the initial shape using the feature encoding network 22 to obtain regression encoding features.

[0157] The electronic device uses the feature encoding network 22 to re-encode the pooled features of the initial shape, such as discarding features in the pooled features that have little impact on shape adjustment and direction data, and re-extracting features that have a greater impact on shape adjustment and direction data, etc., to obtain regression encoding features.

[0158] In some embodiments, the feature encoding network 22 can be an encoding network based on a global attention mechanism, such as the aforementioned multi-head attention network.

[0159] S803: Based on the regression coding features of the initial shape, the direction generation network 23 is used to obtain the predicted direction data of the initial shape, and the shape adjustment network 24 is used to adjust the initial shape to obtain the regression shape.

[0160] The electronic device inputs the encoded features of each geometric primitive of the initial shape into the direction generation network 23 and the shape adjustment network 24 to obtain the predicted direction data and the regression shape of each geometric primitive in the initial shape respectively.

[0161] It can be understood that in some embodiments, when the initial shape is a polygon, the geometric primitive is a line segment, and the direction of the geometric primitive is the direction of the line segment; when the initial shape is a broken line, the geometric primitive is a point, and the direction of the geometric primitive is the tangent direction of the point.

[0162] It can be understood that in some embodiments, the obtained regression shape includes the direction data of each geometric primitive, the coordinate data of the points in each geometric primitive, the order of each geometric primitive, etc.

[0163] S804: Regressing the shape and the orientation data of the geometric primitives and calculating the loss function.

[0164] The electronic device calculates a loss function based on the orientation data of each geometric primitive in the initial shape and the regressed shape.

[0165] For example, in some embodiments, the loss function may include an L2 loss between the predicted direction data of each geometric primitive and the direction data of the point or line corresponding to the geometric primitive in the reference contour, which is used to indicate the accuracy of the direction of each geometric primitive obtained by the direction generation network 23. The smaller the L2 loss, the more accurate the direction data of the geometric primitive obtained by the direction generation network 23. Specifically, assuming that a certain initial shape includes N3 primitives, the direction data of the i-th primitive is dr i , the direction data of the point or line corresponding to the i-th primitive in the reference contour is dr si , then the L2 loss L of the direction generation network 23 23-L2 It can be expressed as the following formula (3):

[0166]

[0167] For another example, in some embodiments, the loss function may include a relative shape loss (Relative Shape Loss) obtained based on the coordinate residuals of each geometric primitive in the regression shape and the corresponding point or line in the reference contour, which is used to evaluate the accuracy of the regression shape. The relative shape loss can be represented by the average value, sum, etc. of the shape losses of all points in the initial shape, wherein the shape loss of a non-intersection point in a broken line can be the projected distance from the point to the reference contour, the shape loss of an intersection point in a broken line can be the distance from the point to the corresponding reference intersection point in the reference contour, and the shape loss of a point in a polygon can be the projected distance from the point to the reference contour. The relative shape loss is used to indicate the similarity between the regression shape of a map element and the reference contour. The lower the relative shape loss, the higher the similarity between the regression shape obtained using the shape regression network 2 and the corresponding reference contour, and the higher the accuracy of the regression shape.

[0168] For another example, in some embodiments, the loss function may include an angle constraint loss to improve the regularity of the regression shape. In some embodiments, the angle constraint loss L TV It can be expressed as the following formula (4).

[0169]

[0170] In formula (4), N4 is the number of corners in the initial shape, is the average angle of each corner in the initial shape, α k is the angle of the kth angle. It can be understood that L TVThe smaller it is, the more regular the regression shape is.

[0171] It is understandable that in other embodiments, the loss function may further include other losses, such as smoothness constraint loss for improving the smoothness of the regression shape, etc., which is not limited here.

[0172] S805: Determine whether the termination condition is met based on the loss function.

[0173] The electronic device determines whether the termination condition is met based on the loss function. If so, it means that the regression shape meets the requirements, and the process goes to step S806; otherwise, it means that the regression shape does not meet the requirements, and the process goes to step S807.

[0174] It can be understood that the termination condition may include at least one of the following conditions: the loss function of each network converges, and the loss function value of each network is less than the corresponding preset loss function value.

[0175] It can be understood that the termination condition may also include that the total loss function is less than the total loss function threshold or the total loss function converges, wherein the total loss function can be obtained by the weighted sum of the loss functions in the aforementioned step S805.

[0176] It is understandable that in other embodiments, the termination condition may also include other conditions, which are not limited here.

[0177] S806: Store the network parameters to obtain the shape regression network 2.

[0178] The electronic device stores the network parameters of the shape regression network 2 to obtain the shape regression network 2.

[0179] S807: Adjust network parameters and proceed to the next round of training.

[0180] When the electronic device determines that the termination condition is not met, it adjusts the network parameters of the shape regression network 2 and performs the next round of training. For example, when the loss function of each network in the shape regression network 2 does not meet the corresponding termination condition, the network parameters of each network can be adjusted. For another example, when the loss function of only some networks does not meet the corresponding termination condition, only the network parameters of these networks can be adjusted and the next round of training can be performed. For another example, when the total loss function does not meet the corresponding termination condition, at least some of the network parameters of each network can be adjusted and the next round of training can be performed.

[0181] The training process of the topology reconstruction network 3 is introduced below.

[0182] FIG9 shows a schematic diagram of the structure of a topology reconstruction network 3 according to some embodiments of the present application. As shown in FIG9 , the topology reconstruction network 3 includes a pooling network 31 , a feature encoding network 32 , and a relational reasoning network 33 .

[0183] The pooling network 31 is used to interpolate the image features and direction data of each geometric primitive in the initial shape to obtain the pooled features of each geometric primitive. For details, please refer to the relevant description of the pooling network 21 above, which will not be repeated here.

[0184] The feature encoding network 32 is used to re-encode the pooled features of each geometric primitive in the initial shape, for example, by discarding features that have little impact on topological relationship reasoning and extracting features that have a greater impact on topological relationship reasoning, to obtain the reasoning encoding features of each geometric primitive. In some embodiments, the feature encoding network 32 may include a multi-head attention network.

[0185] The relational reasoning network 33 is used to derive topological relationships between each pair of geometric primitives in the initial shape based on the inference encoding features of each geometric primitive. When the initial shape is a polygon, the geometric primitives are line segments, and the topological relationships between each pair of geometric primitives include collinearity, parallelism, etc. When the initial shape is a polyline, the geometric primitives are points, and the relationships between each pair of geometric primitives include connected / disconnected. In some embodiments, the relational reasoning network 33 may include a convolutional network, a batch normalization network, an activation network, etc.

[0186] It can be understood that in some embodiments, in the process of training the topology reconstruction network 3, the predicted topological relationship between geometric primitives obtained by the relational reasoning network 33 can be used to calculate cross entropy loss and supervised contrast loss, and used to combine with the direction data of the geometric primitives to calculate loss functions such as geometric attributes and relationship consistency loss, and adjust the network parameters of the topology reconstruction network 3 based on the loss function to improve the accuracy of the predicted topological relationship between geometric primitives obtained by the topology reconstruction network 3. The specific calculation method will be introduced below and will not be repeated here.

[0187] Specifically, Figure 10 shows a schematic diagram of a training process of a topology reconstruction network 3 according to some embodiments of the present application. The execution subject of the process is an electronic device, as shown in Figure 10, and the process includes the following steps.

[0188] S1001: Perform feature pooling on the image features and direction data of the geometric primitives to obtain pooled features of the geometric primitives.

[0189] The electronic device performs feature pooling on the image features and direction data of the geometric primitives in the initial shape to obtain pooled features of each geometric primitive. For details, please refer to the relevant description of step S801 and will not be repeated here.

[0190] It can be understood that for map elements represented by polygons, the electronic device can perform feature pooling on the image features and direction data of the regressed shapes to obtain pooled features of geometric primitives.

[0191] S1002: Encode the pooled features of the geometric primitives using the feature encoding network 32 to obtain inference encoding features.

[0192] The electronic device uses the feature encoding network 32 to encode the pooled features of the initial shape to obtain the inference encoding features of each geometric primitive. For details, please refer to the aforementioned step S802 and will not be repeated here.

[0193] S1003: Based on the inference coding features, the relational reasoning network 33 is used to obtain the predicted topological relationship between the geometric primitives.

[0194] The electronic device inputs the encoded features of each geometric primitive into the relational reasoning network 33 to obtain the predicted topological relationship between each geometric primitive in the initial shape.

[0195] In some embodiments, the predicted topological relationship between the geometric primitives in the initial shape can be represented by a matrix R, the size of which is K×K, where K is the number of geometric primitives in the initial shape, and the element R(i,j) in the matrix R is used to indicate the topological relationship between the i-th geometric primitive and the j-th geometric primitive, such as connection, collinearity, parallelism, etc.

[0196] For example, referring to Figure 11, the predicted topological relationship between the geometric primitives of the initial shape composed of 8 points P1, P2, P3, P4, P5, P6, P7, and P8 can be a matrix of size 8×8, where the element R(i,j) in the i-th row and j-th column represents the topological relationship between point Pi and point Pj. For example, R(3,5)=0 indicates that the topological relationship between point P3 and point P5 is not connected, R(3,4)=1 indicates that the topological relationship between point P3 and point P4 is connected, and R(1,1)=-1 indicates that point P1 has no topological relationship with itself.

[0197] It can be understood that in some embodiments, for the initial shape represented by a broken line, the relational reasoning network 33 can perform feature extraction again based on the reasoning coding features of each geometric primitive to obtain the features of each geometric primitive in the hidden space (also called feature space) (hereinafter referred to as latent space features), and calculate the distance between each geometric primitive and the latent space features of a certain primitive, and set the topological relationship between a preset number of geometric primitives with the smallest latent space distance to the geometric primitive and the geometric primitive as a connection.

[0198] S1004: Calculate a loss function based on the predicted topological relationship between geometric primitives in the initial shape.

[0199] The electronic device calculates the loss function based on the topological relationship between the geometric primitives obtained by the relational reasoning network 33.

[0200] For example, referring to FIG11 , in some embodiments, the loss function may include a cross entropy loss L between the predicted topological relationship and the reference topological relationship of each geometric primitive. CEL , which is determined based on the predicted topological relationship between the geometric primitives in the initial shape and the reference topological relationship between the geometric primitives. For example, in some embodiments, L CEL It can be calculated by the following formula (5).

[0201]

[0202] In formula (5), N5 is the number of geometric primitives in the initial shape, R ij is the predicted topological relationship value between the i-th geometric primitive and the j-th geometric primitive (for example, the element value of the i-th row and j-th column of the aforementioned matrix R), R0 ij is the reference topological relationship between the i-th geometric primitive and the j-th geometric primitive. For example, based on formula (5), the geometric attribute and relationship consistency loss L of the polyline pair in Figure 11 is CEL =-18.

[0203] For example, in some embodiments, when the initial shape is a polygon, the loss function may further include a consistency loss L between geometric attributes and relationships. C , used to characterize the consistency of the properties of geometric primitives and the topological relationships between geometric primitives. During the training process, by reducing L C , can improve the accuracy of the predicted topological relationship determined by the relational reasoning network 33. In some embodiments, L C It can be calculated by the following formula (6).

[0204]

[0205] In formula (6), N6 is the number of geometric primitives in the initial shape; c i is the attribute of the i-th geometric primitive; c j is the attribute of the jth geometric primitive; tr is the ideal distance corresponding to the attributes of two geometric primitives whose topological relationship is r. For example, when r indicates that the topological relationship between the two geometric primitives is parallel or collinear, the attributes of the geometric primitives may include the direction data of the geometric primitives, such as the tangent direction. When two line segments are parallel or collinear, the tangent directions of the two line segments should be the same, so tr should be 0.

[0206] For another example, in some embodiments, the loss function may further include a supervised contrast loss (Supervised Contrastive Loss) so as to improve the consistency of the topological relationship between the latent space features of each geometric primitive extracted by the relational reasoning network 33 and the geometric primitives obtained by reasoning in the process of determining the topological relationship between geometric primitives based on the reasoning coding features of each geometric primitive. That is to say, by making the supervised contrast loss meet the termination conditions, such as being less than the preset supervised contrast loss or the convergence of the supervised contrast loss function, the latent space features of geometric primitives with topological relationships such as connection and collinearity can also be similar, so that when the reasoning coding features corresponding to the geometric primitives of the map elements in the predicted image set are input into the relational reasoning network 33, the latent space features of each geometric primitive extracted by the relational reasoning network 33 are more consistent with the reasoning results, thereby improving the accuracy of the predicted topological relationship. Specifically, in some embodiments, the supervised contrast loss L SCL It can be calculated using the following formula (7).

[0207]

[0208] In formula (7), I represents the set of geometric primitives; P(i) represents the set of geometric primitives that are connected or collinear with the i-th geometric primitive; |P(i)| represents the cardinality of the set P(i) (i.e., the number of elements included in the set P(i)); A(i) represents the set of geometric primitives that are not connected or collinear with the i-th geometric primitive; z i Represents the vector corresponding to the latent space feature of geometric primitive i; z p Represents the vector corresponding to the latent space feature of the geometric primitive p; z α Represents the vector corresponding to the latent space feature of the geometric primitive α; τ is the scalar temperature parameter, which is a positive real domain hyperparameter (i.e., τ∈R + ), which can be pre-set by the developer; · represents the vector dot product. From formula (7), we can see that the smaller the value of the supervised contrast loss, the greater the similarity of the vectors corresponding to the latent space features of geometric primitives with connected or collinear relationships, and the smaller the similarity of the vectors corresponding to the latent space features of geometric primitives without connected or collinear relationships.

[0209] It is understandable that in other embodiments, the supervised contrast loss may be calculated in other ways, which are not limited here.

[0210] It is understandable that in other embodiments, the loss function may also include more loss functions, which are not limited here.

[0211] It can be understood that in some embodiments, the reference topological relationship of each geometric primitive can be dynamically calculated, that is, the reference points of the points in each geometric primitive in the reference contour are first determined, and the topological relationship between the reference points is used as the topological relationship of each geometric primitive.

[0212] S1005: Determine whether the termination condition is met based on the loss function.

[0213] The electronic device determines whether the termination condition is met based on the loss function. If so, it means that the predicted topological relationship obtained by the topology reconstruction network 3 meets the requirements, and the process goes to step S1006; otherwise, it means that the predicted topological relationship obtained by the topology reconstruction network 3 does not meet the requirements, and the process goes to step S1007.

[0214] It can be understood that in some embodiments, the electronic device may determine that the termination condition is satisfied when each loss function converges or each loss function value is less than the corresponding preset loss function value.

[0215] In other embodiments, when there are multiple loss functions determined by the electronic device in step S1005, the termination condition may be determined to be satisfied when the total loss function obtained by weighted summation of the multiple loss functions converges or is less than a preset total loss function value. For example, when the loss function includes the cross entropy loss L CEL , consistency loss L between geometric attributes and relationships C and supervised contrast loss L SCL In the case of , the total loss function can be expressed as λ3L CEL +λ4L C +λ5L SCL , where λ3 represents the cross entropy loss L CEL The weight of λ4 represents the consistency loss L between geometric attributes and relationships. C The weight of λ5 represents the supervised contrast loss L SCL The weights of λ3, λ4, and λ5 can be preset by the developer.

[0216] S1006: Store the network parameters and obtain the topology reconstruction network 3.

[0217] When determining that the termination condition is met, the electronic device stores the network parameters of the topology reconstruction network 3 to obtain the topology reconstruction network.

[0218] S1007: Adjust network parameters and proceed to the next round of training.

[0219] When determining that the termination condition is not met, the electronic device adjusts the network parameters of the topology reconstruction network 3 and performs the next round of training.

[0220] Through the training process described in the embodiments illustrated in Figures 3 to 11 above, the network parameters of the neural network model 0 are trained. Based on these network parameters, inference is performed on the predicted images in the predicted image set of the target area to obtain a vectorized map of each predicted image. Specifically, the shape initialization network 1 is first used to obtain the initial shape of the map elements in the predicted image. The shape regression network 2 then adjusts the initial shape to obtain a more accurate regression shape. The topological reconstruction network 3 then determines the topological relationship between the geometric primitives in the regression shape. Finally, the post-processing module 4 connects the geometric primitives in the regression shape to obtain a vectorized map of the map elements.

[0221] As can be seen from FIG12 , the training process of the neural network model 0 and the process of inferring an image using the trained neural network model 0 can be asymmetric. For map elements represented by polygons, since polygons are more complex than polylines, during the training process, the regression shape is used as the input of the topology reconstruction network 3 to train the topology reconstruction network 3. For the input of map elements represented by polylines, since the polylines are relatively simple, the polylines of the initial shape are used as the input of the topology reconstruction network 3 to train the topology reconstruction network 3. Since the initial shape is less accurate than the regression shape, the topology reconstruction network 3 can still obtain correct prediction results even when the input data accuracy is low. This can improve the noise resistance of the topology reconstruction network 3 and enhance the stability of the topology reconstruction network 3.

[0222] The following describes the process of generating a vector map using the previously trained neural network model 0.

[0223] Figure 13 shows a flowchart of a map generation method according to some embodiments of the present application. The execution subject of the process is an electronic device, as shown in Figure 13, and the process includes the following steps.

[0224] S1301: Use the shape initialization network 1 to obtain the initial shape of the map element in the predicted image.

[0225] The electronic device inputs the predicted image into the shape initialization network 1. The semantic segmentation network 11 extracts image features from the predicted image. The mask generation network 12 then generates contour masks for the map elements in the predicted image. The edge extraction network 13 extracts mask edges from the contour masks. Finally, the shape generation network 14 simplifies the mask edges to obtain the initial shapes of the map primitives. For example, referring to Figure 2 above, when image IM2 is input into the shape initialization network 1, the initial shapes of the houses and roads in image IM2 are obtained.

[0226] S1302: Use the shape regression network 2 to infer the initial shape to obtain the regression shape of the initial shape and the direction data of the geometric primitives.

[0227] The electronic device inputs the initial shape of the map element into the shape regression network 2, uses the pooling network 21 and the feature encoding network 22 to obtain the regression encoding features of the geometric primitives in the initial shape, then uses the direction generation network 23 to obtain the direction data of the geometric primitives, and uses the shape adjustment network 24 to adjust the initial shape to obtain a regression shape with higher accuracy and more regular shape.

[0228] S1303: Using the topology reconstruction network 3, obtain the topological relationship between geometric primitives in the regressed shape.

[0229] The electronic device inputs the regressed shape into topology reconstruction network 3. Pooling network 31 and feature encoding network 32 are used to obtain inference encoding features for each geometric primitive in the regressed shape. Relational inference network 33 is then used to obtain the topological relationships between the geometric primitives in the regressed shape. For example, when the regressed shape of the road in image IM2 is input into topology reconstruction network 3, the topological relationship shown in Figure 11 can be obtained.

[0230] S1304: Based on the regressed shape, the topological relationship between the geometric primitives, and the direction data of the geometric primitives, a vector map is obtained using the post-processing module 4.

[0231] The electronic device obtains a vector map using a post-processing module 4 based on the regression shape, the topological relationship between the geometric primitives, and the direction data of the geometric primitives.

[0232] In some embodiments, when the regression shape is a polygon, the post-processing module 4 can first rotate each line segment in the regression shape to be the same as the direction data of the line segment. For example, referring to Figure 14, the directions of line segments S1S2 and S2S3 in the regression shape are inconsistent with the direction (horizontal) generated by the aforementioned shape regression network 2. The post-processing module can rotate line segment S1S2 clockwise to horizontal and rotate line segment S2S3 counterclockwise to horizontal.

[0233] Then, the post-processing module 4 is used to connect the line segments that are no longer connected due to the adjustment of the line segment direction (that is, the endpoint of each line segment is connected to the point closest to the endpoint in the line segment adjacent to its endpoint) to obtain a closed polygon. For example, referring to Figure 14, after the line segment S1S2 and the line segment S2S3 are rotated to the horizontal, the line segment S1S2', the line segment S2S3' and the line segment S3S4 are no longer connected. The post-processing module 4 connects the endpoint S2' of the line segment S1S2' with the endpoint S2 of the adjacent line segment S2S3', and connects the endpoint S3' of the line segment S2S3' with the endpoint S3 of the adjacent line segment S3S4.

[0234] Finally, the post-processing module 4 can delete the line segments in the obtained closed polygon whose length is less than the preset side length threshold. When deleting a line segment, it can be determined whether the two lines connected at both ends are parallel / collinear. If they are parallel / collinear, the two line segments are merged into one line segment; otherwise, the two line segments are extended until they intersect. In this way, the simplicity of the output polygon can be adjusted by setting different preset side length thresholds. For example, referring to Figure 14, the lengths of line segments S2'S2, line segments S3S3', line segments S6S7, and line segments S9S10 are less than the preset edge length threshold. Line segments S2'S2, line segments S3S3', line segments S6S7, and line segments S9S10 can be deleted. Since line segments S1S2', line segments S2S3', and line segments S3S4 have the same direction, they can be merged into a line segment S1S4. Since line segments S5S6 and S7S8 are neither parallel nor collinear, and line segments S8S9 and S10S11 are not parallel, line segment S7S8 is extended to intersect with line segment S5S6 to obtain line segment S6S8, and line segment S10S11 is extended to intersect with line segment S8S9 to obtain line segment S9S11, thereby obtaining a vector map with a regular shape.

[0235] In some embodiments, when the regression shape is a polyline, the post-processing module 4 may connect points with a connection relationship based on the points in the regression shape and the topological relationship between the points to obtain a vector polyline.

[0236] Through the method provided in the embodiment of the present application, since the neural network model 0 is obtained based on the geometric features of the map elements of the target area, a more accurate vector map can be obtained based on the remote sensing image of the target area. In addition, for different target areas, by marking the reference outlines of the map elements in the remote sensing image of the different target area and retraining the neural network model 0, the trained neural network model 0 can be used to obtain the vector map of the different target area based on the remote sensing image of the different target area, without the need for complex heuristic rule settings and parameter adjustments. In large-scale map construction scenarios, such as scenarios where a map of an area including multiple regions, cities or countries is vectorized, the efficiency of vector map generation can be improved while ensuring the accuracy of the vector map.

[0237] In order to further verify the accuracy of the map generation method provided in this application, remote sensing images in public datasets were used for verification.

[0238] First, based on the dataset in the open source dataset CrowdAI, the vectorization results of the house by the map generation method provided in the embodiment of the present application are compared with the effects of the current SOTA algorithm with higher accuracy. The results are shown in Table 1.

[0239] Table 1 Test results on the CrowdAI dataset

[0240] Method average tangent angle error SOTA algorithm 31.9° This application 26.7°

[0241] As can be seen from Table 1, the mean max tangent angle errors of the vectorized results of the SOTA algorithm for houses is 31.9°, while the mean max tangent angle errors of the vectorized results of houses by the map generation method provided in this application is 26.7°, which is an improvement of 16.3%. The mean tangent angle error refers to the average value of the tangent angle errors between the lines in the vector maps of different remote sensing images obtained by inference and the corresponding reference lines. The lower the error value, the higher the accuracy of the model in vectorizing houses. For example, assuming that a certain model is used to vectorize N6 remote sensing images, and the maximum value of the direction difference between each line segment in each remote sensing image and the corresponding reference line segment is dtan(i), then the mean tangent angle error of the model for the N6 remote sensing images can be recorded as

[0242] Furthermore, FIG15 illustrates a schematic diagram of the results of vectorizing houses in a portion of a remote sensing image using a neural network model 0, according to some embodiments of the present application. FIG15 shows that the contour mask of the map element in the image obtained by the semantic segmentation network 11 differs significantly from the actual outline of the house. However, the regressed shape obtained by the shape regression network 2 has a high similarity to the actual outline of the house, and the house in the resulting vector map also has a high similarity to the actual shape of the house.

[0243] In addition, based on the open source dataset SpaceNet3_Road, the vectorization results of the road by the map generation method provided in the embodiment of the present application were compared with the current more accurate Sat2Graph algorithm. The results are shown in Table 2.

[0244] Table 2 Test results on the SpaceNet3_Road dataset

[0245] Method Model size Topology similarity Average path length Similarity Sat2Graph algorithm 200M 80.97 64.43 This application 100M 86.63 67.67

[0246] As can be seen in Table 2, the neural network model of this application occupies less space than the Sat2Graph algorithm model, and the resulting vector map has a higher topology similarity (Topology Similarity) and average path length similarity (APLS) with the reference vector map. Topology similarity refers to the similarity between the topology of the vector road network inferred by the model and the reference vector road network; a higher score indicates a higher precision of the vector road network derived by the model; APLS indicates the similarity between the lines in the vector road network inferred by the model and the lines in the reference vector road network; a higher score indicates a higher precision of the vector road network derived by the model.

[0247] Furthermore, FIG16 shows a schematic diagram of the results of vectorizing roads in a remote sensing image using neural network model 0 according to some embodiments of the present application. FIG16 shows that the directions of the points in the polyline obtained by neural network model 0 are highly consistent with the directions of the reference roads.

[0248] Figures 17A and 17B illustrate the effects of reconstructing roads in some complex remote sensing images using Neural Network Model 0, according to some embodiments of the present application. As can be seen from Figures 17A and 17B , the vector road network generated by the map generation method provided in embodiments of the present application has a high degree of overlap with the road centers in the remote sensing map, indicating that the resulting vector map is highly accurate.

[0249] It can be understood that the use of remote sensing images in the aforementioned embodiments to introduce the technical solution of the present application is only an example. The technical solution of the embodiments of the present application can also be applied to vectorizing map elements in any other images that include map elements (such as photos, aerial images, etc.).

[0250] Furthermore, an embodiment of the present application also provides a map generation device for implementing the map generation method provided in the aforementioned embodiments.

[0251] Specifically, FIG18 shows a schematic diagram of the results of a map generation device 200 according to some embodiments of the present application. As shown in FIG18 , the map generation device 200 includes: a data acquisition unit 201, an initial shape generation unit 202, a shape regression unit 203, a topology reconstruction unit 204, and a post-processing unit 205.

[0252] The data acquisition unit 201 is used to acquire an image of a certain area, wherein the image includes map elements, wherein the map elements are elements in the image to be converted into a vector map.

[0253] The initial shape generation unit 202 is configured to use a first model (e.g., the aforementioned shape initialization network 1) to infer the image and obtain a first geometric figure corresponding to the map element. The first geometric figure includes geometric primitives. For details, please refer to the description of step S1301 above and will not be repeated here.

[0254] The shape regression unit 203 is configured to input a second model (e.g., the aforementioned shape regression network 2) based on the first geometric figure to obtain the orientation of each geometric primitive, and to obtain a second geometric figure corresponding to the map element based on the first geometric figure, wherein the second geometric figure includes the same geometric primitives as the first geometric figure, but the arrangement of the geometric primitives in the second geometric figure is different from that in the first geometric figure. For details, please refer to the description of the aforementioned step S1302 and will not be repeated here.

[0255] The topology reconstruction unit 204 is used to obtain the topological relationship between the geometric primitives based on the directions of the geometric primitives and the second geometric figures using the third model (eg, the aforementioned topology reconstruction network 3).

[0256] The post-processing unit 205 obtains a vector map corresponding to the image based on the topological relationship between the geometric primitives, the orientation of the geometric primitives, and the second geometric figure. For example, in some embodiments, the post-processing unit 205 can be used to perform the relevant operations of the aforementioned post-processing module 4. For details, please refer to the relevant description of the aforementioned step S1304, which is not repeated here.

[0257] It is understandable that the structure of the map generating device 200 shown in FIG18 is merely a schematic diagram. In other embodiments, the map generating device 200 may include more or fewer units, or may merge or split some units, which is not limited here.

[0258] It can be understood that in the above embodiments, the electronic device used to train the neural network model 0 or the electronic device used to perform reasoning using the neural network model 0 can be any electronic device capable of performing neural network model training or reasoning, including but not limited to laptop computers, desktop computers, tablet computers, servers, etc., and is not limited here. The following takes the electronic device 100 as an example to illustrate the structure of the electronic device used to train the neural network model 0 or the electronic device used to perform reasoning using the neural network model 0. Specifically, Figure 19 shows a structural schematic diagram of an electronic device 100 for executing an embodiment of the present application according to some embodiments of the present application. The electronic device 100 may include one or more processors 101, system memory 102, non-volatile memory (NVM) 103, input / output (I / O) device 104, communication interface 105, and system control logic 106 for coupling the processor 101, system memory 102, non-volatile memory 103, input / output (I / O) device 104 and communication interface 105. Among them:

[0259] The processor 101 may include one or more processing units, for example: the processor 101 may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices or integrated into one or more processors. In some embodiments, the processor 101 can be used to execute relevant instructions for training the aforementioned neural network model 0 or using the trained neural network model 0 to infer remote sensing images.

[0260] In particular, in some embodiments, the NPU can be used to run relevant instructions of the neural network model 0 to perform semantic segmentation on the image, generate contour masks of map elements, generate mask contours of contour masks, generate initial shapes / regressed shapes of map elements, generate directional data / topological relationships of geometric primitives, etc.

[0261] The system memory 102 is a volatile memory, such as a random-access memory (RAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), etc. The system memory is used to temporarily store data and / or instructions. For example, in some embodiments, the system memory 102 can be used to temporarily store network parameters of the neural network model 0, a sample image set, intermediate data during the training of the neural network model 0 or the inference process using the neural network model 0, and store vector maps.

[0262] The non-volatile memory 103 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the non-volatile memory 103 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as a hard disk drive (HDD), a compact disc (CD), a digital versatile disc (DVD), a solid-state drive (SSD), etc. In some embodiments, the non-volatile memory 103 may also be a removable storage medium, such as a secure digital (SD) memory card, etc. In other embodiments, the non-volatile memory 103 may be used to permanently store network parameters of the neural network model 0, sample image sets, intermediate data in the process of training the neural network model 0 or performing inference using the neural network model 0, store vector maps, etc.

[0263] In particular, the system memory 102 and / or the non-volatile memory 103 may include a copy of the instruction 107. When the instruction 107 is executed by at least one of the processors 101, the electronic device 100 trains all or at least a portion of the neural network model 0 using the method provided in the embodiments of the present application, or performs reasoning using the neural network model 0.

[0264] The input / output (I / O) device 104 may include a user interface, enabling a user to interact with the electronic device 100 , such as selecting or inputting a sample image set, marking a map element in the sample image set, and the like.

[0265] The network interface 105 may include a transceiver for providing a wired or wireless communication interface for the electronic device 100, thereby communicating with any other suitable device via one or more networks. In some embodiments, the electronic device 100 may establish a communication connection with other electronic devices via the network interface 105 to obtain sample image sets, predicted image sets, etc. from the other electronic devices.

[0266] The system control logic 106 may include any suitable interface controller to provide any suitable interface with other modules of the electronic device 100. For example, in some embodiments, the system control logic 106 may include one or more memory controllers to provide an interface for the processor 101 to connect to the system memory 102 and the non-volatile memory 103. For another example, in other embodiments, the system control logic 106 may include at least one Peripheral Component Interconnect (PCI) controller to provide an interface for the processor 101 to connect to devices / devices / modules (e.g., graphics cards, sound cards, etc.) connected to the electronic device 100 via a PCI interface using a PCI bus.

[0267] In some embodiments, at least one of the processors 101 may be packaged together with the logic of one or more controllers for the system control logic 106 to form a system in package (SiP). In other embodiments, at least one of the processors 101 may be integrated with the logic of one or more controllers for the system control logic 106 on the same chip to form a system-on-chip (SoC).

[0268] It can be understood that the electronic device 100 can be any electronic device that can perform deep learning model training, including but not limited to laptop computers, desktop computers, tablet computers, servers, etc., and is not limited here.

[0269] It should be understood that the structure of the electronic device 100 shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The components shown in the illustrations may be implemented in hardware, software, or a combination of software and hardware.

[0270] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0271] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For purposes of this application, a processing system includes any system having a processor such as a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0272] Program code can be implemented with a high-level programming language or an object-oriented programming language to communicate with the processing system. Where necessary, program code can also be implemented in assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0273] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed over a network or through other computer-readable media. Therefore, a machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including but not limited to floppy disks, optical disks, optical discs, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, a machine-readable medium includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).

[0274] In the accompanying drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or order may not be required. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of a structural or method feature in a particular figure does not imply that such feature is required in all embodiments, and in some embodiments, such features may not be included or may be combined with other features.

[0275] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems raised by this application. In addition, in order to highlight the innovative part of this application, the above-mentioned device embodiments of this application do not introduce units / modules that are not closely related to solving the technical problems raised by this application. This does not mean that other units / modules do not exist in the above-mentioned device embodiments.

[0276] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "including a" does not exclude the presence of other identical elements in the process, method, article or device that includes the element.

[0277] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A map generation method, applied to an electronic device, characterized in that: The method comprises: Acquire an image of a certain area, wherein the image includes map elements, wherein the map elements are elements in the image to be converted into a vector map; Reasoning the image using a first model to obtain a first geometric figure corresponding to the map element, wherein the first geometric figure includes geometric primitives; Inputting a second model based on the first geometric figure to obtain a direction of each of the geometric primitives, and obtaining a second geometric figure corresponding to the map element based on the first geometric figure, wherein the second geometric figure includes the same geometric primitives as the first geometric figure, and the position arrangement of the geometric primitives in the second geometric figure is different from the position arrangement of the geometric primitives in the first geometric figure; Using a third model, obtaining a topological relationship between the geometric primitives based on the directions of the geometric primitives and the second geometric figures; Based on the topological relationship between the geometric primitives, the directions of the geometric primitives, and the second geometric figure, a vector map corresponding to the image is obtained.

2. The method according to claim 1, characterized in that At least one of the first model, the second model, and the third model is trained based on geometric features of map elements in the certain area.

3. The method according to claim 1, characterized in that In the case where the geometric primitives are line segments, the second geometric figure further includes a connection sequence of the geometric primitives; and The obtaining of a vector map corresponding to the image based on the topological relationship between the geometric primitives, the directions of the geometric primitives, and the second geometric figure includes: adjusting the direction of a first geometric primitive in the second geometric figure to be the same as the direction corresponding to the first geometric primitive, wherein the direction of the first geometric primitive in the second geometric figure is different from the direction corresponding to the first geometric primitive; The first geometric primitive and the second geometric primitive are connected to obtain a polygon corresponding to the second geometric figure, wherein the connection order of the second geometric primitive is adjacent to that of the first geometric primitive.

4. The method according to claim 3, characterized in that The polygon corresponding to the second geometric figure includes a first line segment, a second line segment, and a third line segment connected in sequence; and obtaining the vector map corresponding to the image based on the topological relationship between the geometric primitives, the directions of the geometric primitives, and the second geometric figure further includes: If the length of the second line segment is less than a preset side length threshold, deleting the second line segment; and When the topological relationship between the first line segment and the third line segment is collinear or parallel, merging the first line segment and the second line segment into one line segment; When the topological relationship between the first line segment and the third line segment is not collinear or parallel, the first line segment and / or the third line segment is extended so that the first line segment and the third line segment intersect.

5. The method according to claim 1, wherein In the case where the geometric primitives are points, obtaining the vector map corresponding to the image based on the topological relationship between the geometric primitives, the directions of the geometric primitives, and the second geometric figure includes: Connect the points with connected topological relationships to obtain the corresponding vectorized polylines.

6. The method according to claim 1, characterized in that The method of using the first model to reason on the image to obtain the first geometric figure corresponding to the map element includes: Performing semantic segmentation on the image to obtain a contour mask of the map element, wherein the contour mask is used to indicate an area in the image where the map element is located; extracting a mask edge of the contour mask; The mask edge is simplified to obtain the first geometric figure.

7. The method according to claim 1, characterized in that The map elements include at least one of houses, roads, lakes, oceans, rivers, forests, and deserts; and The first geometric figures corresponding to houses, lakes, oceans, forests, and deserts are polygons; The first geometric figure corresponding to roads and rivers is a broken line.

8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: The first model is trained in the following way: Acquiring sample data, wherein the sample data includes a sample image set of the certain area and a reference contour corresponding to a map element in each sample image in the sample image set; Using the first model to analyze image features of each sample image, and obtaining a contour mask of the map element in each sample image based on the image features, the contour mask indicating the area of ​​the map element in the corresponding sample image; Based on the contour mask, obtaining a first predicted geometric figure corresponding to the map element in each of the sample images; The first model is trained based on a first loss function value and a second loss function value, wherein the first loss function is used to indicate the accuracy of the contour mask and the second loss function is used to indicate the similarity between the first predicted geometry and the reference contour.

9. The method according to any one of claims 1 to 7, characterized in that The method further comprises: The second model is trained as follows: Acquire sample data, the sample data including a reference contour corresponding to a map element in each sample image in the sample image set of the certain area, a reference direction corresponding to each geometric primitive in the reference contour, and a third geometric figure corresponding to the map element in each sample image obtained using the first model; Using the second model, obtaining a second predicted geometric figure corresponding to each map element in each sample image and a predicted direction of a geometric primitive in the third geometric figure, wherein the second predicted geometric figure includes the same geometric primitives as the third geometric figure, and an arrangement of the geometric primitives in the second predicted geometric figure is different from that in the third geometric figure; The second model is trained based on a third loss function and a fourth loss function, wherein the third loss function is used to indicate the similarity between the predicted direction of the geometric primitive in the third geometric figure and the corresponding reference direction, and the fourth loss function is used to indicate the similarity between the second predicted geometric figure and the corresponding reference contour.

10. The method according to any one of claims 1 to 7, characterized in that The method further comprises: Acquiring sample data, the sample data including a reference topological relationship between geometric primitives in a reference contour corresponding to a map element in each sample image in a set of sample images of the certain area, and a fourth geometric figure corresponding to the map element in each sample image obtained using the first model, and directions of geometric primitives in the fourth geometric figure; Determining, using the third model, latent space features of each of the geometric primitives in the fourth geometric figure, and determining, based on the latent space features, predicted topological relationships between the geometric primitives in the fourth geometric figure; The third model is trained based on a fifth loss function and a sixth loss function, wherein the fifth loss function is used to indicate the degree of matching between the predicted topological relationship between the geometric primitives in the fourth geometric figure and the corresponding reference topological relationship, and the sixth loss function is used to indicate the similarity of the latent space features between the geometric primitives whose predicted topological relationship is parallel, collinear or connected.

11. A model training method, applied to electronic equipment, characterized in that: The method comprises: Obtaining sample data, the sample data including a reference contour corresponding to a map element in each sample image in a set of sample images of a certain area, a fifth geometric figure or a sixth geometric figure corresponding to each map element, directions of geometric primitives in the fifth geometric figure, and image features of the geometric primitives in the fifth geometric figure, wherein the image features of the geometric primitives in the fifth geometric figure are generated when the fifth geometric figure of each map element is obtained by inference using the fourth model, the similarity between the fifth geometric figure and the corresponding reference contour is lower than the similarity between the sixth geometric figure and the corresponding reference contour, and the fifth and sixth geometric figures have the same geometric primitives; Based on inputting the fifth geometric figure or the sixth geometric figure, image features of geometric primitives in the fifth geometric figure, and directions of geometric primitives in the fifth geometric figure into a fifth model having first network parameters, latent space features corresponding to each of the geometric primitives are obtained, and based on the latent space features corresponding to each of the geometric primitives, predicted topological relationships between the geometric primitives are inferred; determining a seventh loss function and an eighth loss function based on the predicted topological relationship between the geometric primitives in the fifth geometric figure and the corresponding reference topological relationship, wherein the reference topological relationship can be determined based on the reference contour corresponding to the map element in each sample image, the seventh loss function is used to indicate the degree of match between the predicted topological relationship between the geometric primitives in the fifth geometric figure and the corresponding reference topological relationship, and the eighth loss function is used to indicate the similarity of the latent space features between the geometric primitives whose predicted topological relationship is parallel, collinear, or connected; When the seventh loss function and the eighth loss function satisfy a termination condition, saving a fifth model having the first network parameters; When the seventh loss function and the eighth loss function do not meet the termination condition, the network parameters of the fifth model are adjusted to the second network parameters and the next round of training is performed.

12. The method according to claim 11, characterized in that When the geometric primitive in the fifth geometric figure is a line segment, the seventh loss function and the eighth loss function are determined to satisfy the termination condition in the following manner: Determining, based on the directions of the geometric primitives in the fifth geometric figure, a directional relationship between the geometric primitives and a reference directional relationship corresponding to the topological relationship, and determining a ninth loss function, wherein the ninth loss function is used to indicate consistency between the predicted topological relationship of each of the geometric primitives and the directions; When the seventh loss function, the eighth loss function, and the ninth loss function all converge, or the seventh loss function, the eighth loss function, and the ninth loss function are all less than the corresponding preset loss function values, or the total loss function converges, or the total loss function is less than the corresponding preset total loss function value, it is determined that the termination condition is met, wherein the total loss function includes the weighted sum of the seventh loss function, the eighth loss function, and the ninth loss function.

13. The method according to claim 11, characterized in that The obtaining of latent space features corresponding to the geometric primitives based on the fifth geometric figure or the sixth geometric figure, image features of the geometric primitives in the fifth geometric figure, and directions of the geometric primitives in the fifth geometric figure includes: When the geometric primitives of the fifth geometric figure are points, obtaining latent space features corresponding to the geometric primitives based on the fifth geometric figure, image features of the geometric primitives in the fifth geometric figure, and directions of the geometric primitives in the fifth geometric figure; When the geometric primitives of the fifth geometric figure are line segments, the latent space features corresponding to each of the geometric primitives are obtained based on the sixth geometric figure, the image features of the geometric primitives in the fifth geometric figure, and the directions of the geometric primitives in the fifth geometric figure.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium includes instructions, which, when executed by an electronic device, enable the electronic device to implement the method according to any one of claims 1 to 13.

15. An electronic device, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the electronic device; as well as The processor is one of the processors of the electronic device, configured to execute the instructions stored in the memory to implement the method according to any one of claims 1 to 13.

16. A computer program product, characterized in that The method comprises a computer program / instruction which, when executed by a processor, implements the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Map display method and device, server, terminal and storage medium

    CN110457512A

  • Remote sensing image building vector extraction and optimization method based on deep learning

    CN111652892A

  • Method and system for exporting high-definition route map

    CN112066997A

  • Building vector contour simplification method based on deep learning, model and model establishment method

    CN113850254A

  • Method and device for pattern recognition

    JP2004253007A

Cited By

  • Method for automatically detecting inconsistency of surface topological relation

    CN119579871A