Geographic raster image boundary key point extraction method and spatial correction method

By constructing a model with a multi-scale geographical feature encoder and a global decoder combined with a multi-key point prototype attention mechanism module, the problems of long time consumption and wrong matching of the traditional geographical raster image spatial correction method are solved, and automatic and accurate key points are achieved. Recognition and image correction, improving data utilization.

CN118537583APending Publication Date: 2024-08-23NORTHWESTERN POLYTECHNICAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410667293.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Traditional geographic raster image spatial correction methods are time-consuming and can easily lead to missed detection and incorrect matching of key points. Methods based on contour alignment or key point matching are ineffective when processing complex geographic boundaries, resulting in low data utilization.

Method used

A method for extracting key points at the boundary of geographical raster images is proposed. It uses a multi-scale geographical feature encoder, a global geographical feature decoder and a multi-key point prototype attention mechanism module to build a model, and performs the process through Gaussian distribution processing and local Gaussian key point loss function. Automatically identify and correct, and generate a perspective transformation matrix for spatial correction.

Benefits of technology

It achieves automatic and accurate identification of geographical boundary key points, improves identification efficiency and accuracy, avoids the model from converging to a local optimum, ensures even distribution of key points on the image, and realizes automatic spatial correction of geographical raster images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537583A
    Figure CN118537583A
Patent Text Reader

Abstract

In order to overcome the problems of low efficiency and key point missing detection of a traditional manual visual geographic raster image space correction method, and solve the problems of wrong alignment and matching possibly occurring in a space correction method based on contour alignment or key point matching. The invention provides a geographical raster image boundary key point extraction method and a spatial correction method. According to the invention, a geographic boundary key point identification model is constructed, and the geographic boundary key point identification model is trained by using label sample data obtained by a geographic boundary Gaussian key point sample labeling method in combination with a local Gaussian key point loss function; the trained model can automatically and accurately identify the key points on the geographic raster image, and the identification efficiency and precision of the geographic boundary key points are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing and geographic information. Background Art

[0002] Geographic raster images are a form of geographic information data that contains geographic boundaries and thematic attributes. Currently, many geographic raster images are stored in paper atlases or scanned into digital images. However, these images usually do not contain geographic coordinate systems, which brings great difficulties to the storage management, retrieval and layer overlay of image data, resulting in low utilization of geographic raster image data and a large amount of data being idle or wasted.

[0003] In addition, due to the wide range of sources, rich content, and long time span of geographic raster images, there are huge differences in their mapping standards and forms, so they need to be spatially corrected. The traditional spatial correction method of geographic raster images relies on geographical and geological professionals to manually identify, extract and annotate geographic boundary key points one by one, and then calculate the perspective transformation matrix between the boundary key points and the reference geographic coordinates. This method is not only time-consuming, but also prone to missed key points and mismatching, which ultimately affects the spatial correction effect of geographic raster images.

[0004] With the development of image processing and deep learning technologies, many automatic spatial correction methods for raster images have emerged. For example, some technologies achieve spatial alignment with reference images by identifying the contour edges of target objects in raster images, but this method does not work well when processing raster images with unclear contours and complex geographic boundaries. Some other technologies achieve spatial correction by extracting matching key points from raster images and reference images respectively, but due to the diverse content of geographic raster images and the large difference in content from reference images, it is difficult to determine paired key points, which may even lead to failure of spatial correction. Summary of the invention

[0005] In order to overcome the low efficiency and key point missed detection problems of the traditional manual visual geographic raster image spatial correction method, and solve the possible wrong alignment and matching problems of the spatial correction method based on contour alignment or key point matching, the present invention proposes a geographic raster image boundary key point extraction method and a spatial correction method. The application object of the present invention is a raster image with a specific geographical range and clear geographical boundaries, such as elevation, population density, meteorological and geochemical detection results, etc.

[0006] The technical solution of the present invention is:

[0007] The method for extracting boundary key points of geographic raster images is special in that it includes the following steps:

[0008] Step 1: Build a dataset and divide it into training and test sets;

[0009] Step 1.1 Collect geographic raster images with the same geographic or administrative boundaries. If there are paper images, scan them into digital images.

[0010] Step 1.2 Select N reference geographic boundary key points l on the real geographic boundary of the geographic or administrative area corresponding to the geographic raster image in step 1.1 ref ;

[0011] Step 1.3: According to the N reference geographic boundary key points l in step 1.2 ref Annotate the geographic raster image collected in step 1.1 according to the relative position and annotation order of the image to obtain the point labels of the geographic raster image;

[0012] Step 1.4 performs Gaussian distribution processing on the point labels obtained in step 1.3, and obtains N geographic boundary key point sequence labeling samples l with Gaussian distribution for each geographic raster image;

[0013] Step 1.5 constructs a data set using the geographic boundary key point sequence annotation sample l obtained in step 1.4 and its corresponding geographic raster image, and divides it into a training set and a test set;

[0014] Step 2: Construct a geographic boundary key point recognition model;

[0015] The geographic boundary key point recognition model includes a multi-scale geographic feature encoder, a global geographic feature decoder, a multi-key point prototype attention mechanism module and a classifier;

[0016] The multi-scale geographic feature encoder includes M first feature extraction modules and S downsampling modules with a step size of 2, S = M-1, M>3; the M first feature extraction modules are used to extract features of M different scales from the input image The S downsampling modules are used to downsample the features output by the first M-1 first feature extraction modules. 1 / 2 downsampling is performed; M first feature extraction modules and S downsampling modules are connected alternately in sequence; at the same time, the M first feature extraction modules are also connected through a cascade operation, so that the output features of each adjacent two first feature extraction modules are spliced ​​according to the channel to output multi-scale features Finally, the multi-scale geographic feature encoder outputs multi-scale features

[0017] The global geographic feature decoder includes M second feature extraction modules and S upsampling modules with a step size of 2; the M second feature extraction modules are used to identify key point information in the features input therein; the S upsampling modules are used to upsample the features output by the first M-1 second feature extraction modules by 2 times, and output S features of different scales. The deep feature f output by the Mth second feature extraction module D is the output of the global geographic feature decoder;

[0018] Multi-scale geographic feature encoder and global geographic feature decoder skip connection:

[0019] Multi-scale features output by the multi-scale geographic feature encoder The features output by each upsampling module in the global geographic feature decoder are Perform channel splicing to obtain the spliced ​​features Among them, cat(·,·) is a concatenation operation; the concatenated features As the input of the second, third, ..., Mth second feature extraction module in the global geographic feature decoder respectively; the features output by the multi-scale geographic feature encoder As the input of the first second feature extraction module in the global geographic feature decoder;

[0020] The multi-keypoint prototype attention mechanism module is used to analyze the prototype features of N keypoints. and the deep features f output by the multi-scale geographic feature encoder D Processing is performed to generate an attention weight matrix W of N geographical boundary key points; the prototype features of the N key points By the deep feature f D The classifier is based on the deep feature f D Generated pseudo labels Multiply them together to get;

[0021] The classifier is used to transform the deep features f D and the weighted features f of the attention weight matrix W W Converting into prediction results of all geographic boundary key points in the geographic raster image, the prediction results showing the probability of the geographic boundary key points at different positions of the geographic raster image;

[0022] Step 3: Train and test the geographic boundary key point recognition model built in step 2;

[0023] Based on the local Gaussian key point loss function, the geographic boundary key point recognition model constructed in step 2 is trained and tested using the training set and the test set;

[0024] Step 4: Extract geographic raster image boundary points;

[0025] Input the geographic raster image of the boundary points to be extracted into the geographic boundary key point recognition model trained in step 3, and the geographic boundary key point recognition model outputs the recognition prediction results of N geographic boundary key points; the geographic raster image of the boundary points to be extracted and the geographic raster image in the data set in step 1 belong to the same geographic or administrative area.

[0026] Furthermore, in step 2: the first feature extraction module and the second feature extraction module adopt a convolution module, a residual convolution module or a hole convolution module; the downsampling module adopts a pooling module, a difference module or a convolution module with a step size of 2; the upsampling module adopts an interpolation module or a transposed convolution module.

[0027] Furthermore, in step 2: the multi-keypoint prototype attention mechanism module includes N query convolutions and one key convolution; the N query convolutions are used to analyze the prototype features of the N keypoints. Perform nonlinear change processing to obtain N query features Key convolution is used to transform the deep features f D Perform nonlinear mapping to constrain deep features f D The feature distribution of Q , get the key feature f K ; The attention weight calculation module calculates the query feature f through the dot product Q and key feature f K The similarity is then normalized through the SoftMax activation function to obtain the attention weight matrix W of N geographical boundary key points.

[0028] Furthermore, among the attention weight matrices of the N geographical boundary key points, the attention weight matrix W of the nth key point is n The calculation formula is:

[0029]

[0030] Among them, d k is the dimension of the key vector used to scale the dot product result.

[0031] Furthermore, step 3 is specifically as follows:

[0032] Step 3.1 enhances the geographic raster images in the training set;

[0033] Step 3.2: The enhanced geo-raster images in the training set Input the geographic boundary key point recognition model built in step 2 to obtain the geographic raster image The prediction results O of all geographical key points above;

[0034] Step 3.3 Calculate the nth labeled sample l in the sequence of labeled samples l of geographic boundary key points obtained in step 1.4 above n and the input geographic raster image corresponding to the labeled sample l The prediction result of the nth geographic key point in O n The square error between them is L2;

[0035] Step 3.4 calculates the nth labeled sample l in the sequence of labeled samples l of geographic boundary key points obtained in step 1.4 above n and the input geographic raster image corresponding to the labeled sample l The prediction result of the nth geographic key point in O n The key point distance matrix D N×N ;

[0036] Step 3.5 calculates the local Gaussian key point loss function L using the following formula:

[0037] L=L2+λ|D N×N |

[0038] In the formula, |D N×N | is the key point distance matrix D N×N The modulus of , λ is the regularization term sparseness used to control the regularization term weight, λ∈(0,1];

[0039] Step 3.6: Calculate the loss value based on the local Gaussian key point loss function L obtained in step 3.5, use the loss value to calculate the gradient value required for backpropagation of the geographic boundary key point recognition model, and train the geographic boundary key point recognition model based on the Adam optimizer and test it using the test data set until the model converges.

[0040] Furthermore, step 3.1 is specifically as follows:

[0041] First, the original geographic raster image is converted from RGB to the Lab color space based on human vision. lab ;

[0042] Then, based on the Sobel texture extraction method, directional convolution is used to extract T lab Texture gradient map G of the L channel:

[0043]

[0044] G=|G x |+|G y |

[0045] Finally, the texture gradient map G in the L channel is spliced ​​with the original geographic raster image to obtain an enhanced geographic raster image.

[0046] The present invention also provides a method for spatial correction of geographic raster images, which is special in that it comprises the following steps:

[0047] Step 1: Use the above-mentioned geographic raster image boundary key point extraction method to extract the boundary key points O = {O1, ..., O N};

[0048] Step 2: Filter and calculate the pixel coordinates of the boundary key point O extracted in step 1 in the geographic raster image to be corrected I (x, y) and the reference geographic boundary key point l ref A perspective transformation matrix between real geographic coordinates is used, and spatial correction of geographic raster images is achieved based on the perspective transformation matrix.

[0049] Furthermore, step 2 is specifically as follows:

[0050] Step 2.1) Set N reference geographic boundary key points l ref The geographic coordinates of the boundary key points O = {O1,…,O N} Input into the key point screening algorithm, retain 4 pairs of boundary key points with high reliability, and calculate the 3×3 perspective transformation matrix H through these 4 pairs of boundary key points;

[0051] Step 2.2) Multiply the geographic raster image I(x, y) to be corrected by the perspective transformation matrix H obtained in step 2.1) to complete the spatial correction of the geographic raster image I(x, y) and obtain the corrected image I'(x', y').

[0052] Furthermore, the key point screening algorithm described in step 2.1) is a random sampling consensus algorithm.

[0053] Beneficial effects of the present invention:

[0054] 1. Automatic geographic boundary key point identification.

[0055] The present invention uses the labeled sample data obtained by the geographic boundary Gaussian key point sample annotation method, combined with the local Gaussian key point loss function to train the geographic boundary key point recognition model, so that the trained model can automatically and accurately identify the key points on the geographic raster image, thereby improving the recognition efficiency and accuracy of the geographic boundary key points.

[0056] 2. The training efficiency is high.

[0057] It is difficult to accurately define key point label samples by a certain pixel position, and it is difficult to ensure the consistency of annotation when manually annotating data sets. For example, pixels near the target point have similarities with key points. If they are directly marked as negative samples, it may interfere with the subsequent training of the geographic boundary key point recognition model. To solve this problem, the present invention uses a Gaussian function to "softly annotate" the key point labels to simulate the uncertainty of annotation and the variability of actual observations, so that the geographic boundary key point recognition model can accelerate convergence in a direction during the training process and improve training efficiency.

[0058] 3. Improve the prominence of geographic key points.

[0059] The present invention uses the proposed multi-keypoint prototype attention mechanism module to generate similarity features between keypoint prototype features and deep features, effectively measuring the coupling relationship between the two. This similarity feature is used as the deep feature weight output by the multi-scale geographic feature encoder, which enhances the attention to features with high similarity and further improves the recognition accuracy of keypoints.

[0060] 4. Avoid the model from converging to local optimality.

[0061] In order to prevent the model from concentrating key points in a certain local area of ​​the image during training, the present invention designs a key point distance matrix to ensure that the key points are more evenly distributed over the entire geographic raster image. This avoids the problem of the model reaching the optimum in a local area while ignoring other important areas, thereby preventing the model from repeatedly identifying the same key points.

[0062] 5. Automatic spatial correction of geographic raster images.

[0063] The present invention realizes automatic spatial correction of geographic raster images by automatically screening and calculating geographic boundary key points, generating a perspective transformation matrix, and realizing automatic spatial correction of geographic raster images. This method can automatically perform spatial correction and add coordinate systems for a variety of geographic raster images without geographic coordinate systems, thereby improving the efficiency of image storage management, retrieval, and layer overlay. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 This is an example of a basic flow chart of the method for extracting key points from geographic raster images of the present invention.

[0065] Figure 2 The flowchart of the method for spatial correction of geographic raster images of the present invention is an example.

[0066] Figure 3 This is an example of labeling Gaussian key point data in the present invention.

[0067] Figure 4 This is an example of the residual hole convolution module in the present invention.

[0068] Figure 5 This is an example of the multi-keypoint prototype attention mechanism module in the present invention.

[0069] Figure 6 This is an example of the geographic boundary key point identification model in the present invention.

[0070] Figure 7 The following is an example of geographical boundary key points extracted using the present invention. DETAILED DESCRIPTION

[0071] The basic steps of extracting key points of geographic raster images (refer to Figure 1 )yes:

[0072] First, determine a certain geographical or administrative area and select N (N>4) reference geographical boundary key points l in sequence on its real geographical boundary ref , and record its geographic coordinates, annotation order and corresponding geographic coordinate system.

[0073] Then, a certain number of geographic raster images of the above-mentioned areas are collected, and the reference geographic boundary key points l are ref The collected geographic raster images are annotated according to the number and order of points, and the annotated point labels are Gaussian distributed to obtain a data set consisting of the geographic raster images and the annotated samples obtained after Gaussian distribution processing of the point labels, and the data set is divided into a training set and a test set.

[0074] Next, a geographic boundary key point recognition model is constructed, which includes a multi-scale geographic feature encoder, a global geographic feature decoder, a multi-key point prototype attention mechanism module and a classifier.

[0075] Finally, the data in the training set and the test set are preprocessed, and the preprocessed data is used to complete the training and testing of the geographic boundary key point recognition model. The geographic raster image to be processed (which belongs to the same geographic / administrative area as the geographic raster image in the dataset) is input into the trained geographic boundary key point recognition model for prediction to identify the reference geographic boundary key point l ref Approximately consistent geographic boundary key points.

[0076] The present invention performs automatic spatial correction on geographic raster images (refer to Figure 2 ) are:

[0077] Firstly, the geographic boundary key points are extracted from the geographic raster image to be processed by using the geographic boundary key point extraction method of the present invention.

[0078] Then, the extracted geographic boundary key points are screened and iteratively calculated to obtain the perspective transformation matrix between the geographic raster image and the reference geographic coordinate system.

[0079] Finally, the perspective transformation matrix calculated in the previous step is used to automatically complete the spatial correction of the geographic raster image to ensure that the image is accurately mapped to the geographic coordinate system.

[0080] In order to make the purpose and technical solution of the present invention clearer, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0081] Reference Figure 1 The method for extracting key points from geographic raster images provided by the present invention comprises the following steps:

[0082] Step 1: Build a dataset and divide it into training and test sets;

[0083] Step 1.1: Collect georaster images with the same geographic or administrative boundaries and scan them into digital images if they are available in paper format.

[0084] Step 1.2: Manually select N reference geographic boundary key points l on the real geographic boundary of the geographic or administrative area corresponding to the geographic raster image in step 1.1 ref , where N>4. Reference geographic boundary key point l ref They should be distributed as evenly as possible on the real geographic boundary, and the concave or convex parts of the boundary line should be selected first. Each reference geographic boundary key point l ref All of them have the following information: the real geographic coordinates of the key points, the order of annotation and the corresponding geographic coordinate system. ref This will be used as a standard for geographic raster image annotation. ref The larger the number N is, the higher the spatial correction accuracy is, but the workload is greater when labeling the training data. In this embodiment, both accuracy and labeling time cost are taken into consideration, and N=18 is preferably used.

[0085] Step 1.3: In the form of point labels, follow the N reference geographic boundary key points l in step 1.2 ref The relative position and annotation order of the georaster images collected in step 1.1 are manually annotated to obtain the point labels of the georaster images. The annotated point labels are used for subsequent model training.

[0086] Step 1.4: Perform Gaussian distribution processing on the point labels marked in step 1.3. Specifically, perform Gaussian distribution processing on N marked point labels, and perform Gaussian distribution processing N times on N marked point labels. The Gaussian distribution processing method is to represent the actual position of the marked point label with a value of 1, and adjust the value of its neighborhood according to the Gaussian distribution. Finally, N times of Gaussian processing obtain N sequence label samples l of geographical boundary key points with Gaussian distribution. The definition of Gaussian distribution is shown in formula (1), and the visualization diagram of Gaussian distribution can be seen in Figure 3 .

[0087]

[0088] In the formula, (x i ,y i ) is the coordinate of the actual position of the label point; (x, y) is the neighborhood coordinate point; δ is the variance coefficient used to control the radiation range of the hotspot. The larger δ is, the greater the risk of underfitting in model training, and the smaller δ is, the greater the risk of overfitting in model training. After testing, the preferred δ=5.

[0089] Step 1.5: Use the labeled samples obtained after Gaussian processing in step 1.4 and the corresponding geographic raster images to construct a dataset, and divide the dataset into a training set and a test set for model training and robustness verification, respectively.

[0090] Step 2: Construct a geographic boundary key point recognition model;

[0091] The geographic boundary key point recognition model is an end-to-end point detection model, which takes a geographic raster image as input and outputs a predicted probability map of N geographic boundary key points. The predicted probability map of N geographic boundary key points is shown in the following example: Figure 7 As shown, the first image in the figure is the input geographic raster image, and the remaining N=18 images respectively show the probability maps of the prediction results of the geographic boundary key point recognition model for different geographic boundary key points.

[0092] The geographic boundary key point recognition model consists of a multi-scale geographic feature encoder, a global geographic feature decoder, a multi-key point prototype attention mechanism module and a classifier, and the multi-scale encoder features and decoding features are spliced ​​and fused in a cascade manner.

[0093] Reference Figure 6 The multi-scale geographic feature encoder includes M first feature extraction modules and S downsampling modules with a step size of 2, S = M-1, M> 3. The first feature extraction module is used to extract features from the input image, and the M first feature extraction modules output M different scale features. The downsampling module is used to reduce the computational burden and prevent overfitting. The S downsampling modules are used to extract the M-1 different scale features output by the first M-1 feature extraction modules. Perform 1 / 2 downsampling.

[0094] The first feature extraction module can use a convolution module, a residual convolution module, or a dilated convolution module. The downsampling module can use a pooling module, an interpolation module, or a convolution module with a step size of 2. The connection method is:

[0095] The first feature extraction module → the first downsampling module → the second first feature extraction module → the second downsampling module → … → the Sth downsampling module → the Mth first feature extraction module. At the same time, the first feature extraction modules are also connected through a cascade operation, that is, the feature extraction module output by the second first feature extraction module After 2 times upsampling, it is compared with the feature f1 output by the first feature extraction module e Feature f1 is obtained by channel concatenation (i.e., two feature maps of the same size are concatenated into one feature map along the dimension of the channel). c , the feature f1 c The features output by the Sth upsampling module in the global geographic feature decoder will be After splicing by channel, it is input into the Mth second feature extraction module in the global geographic feature decoder; the feature output of the third first feature extraction module After 2 times upsampling, the feature output of the second first feature extraction module is Concatenate by channel to get features This feature The features output by the S-1th upsampling module in the global geographic feature decoder will be compared After splicing by channel, it is input into the M-1th second feature extraction module in the global geographic feature decoder; ...; the feature output by the Mth first feature extraction module After 2 times upsampling, the feature output of the M-1th first feature extraction module is Concatenate by channel to get features This feature It will be compared with the feature f1 output by the first upsampling module in the global geographic feature decoder d After splicing by channel, it is input into the second second feature extraction module in the global geographic feature decoder; the feature output by the Mth first feature extraction module As the input of the first second feature extraction module in the global geographic feature decoder.

[0096] The feature f generated by the cascade operation i c It is expressed as:

[0097]

[0098] Where i is a different scale, i=1,…,M-1; cat(·) is a channel-by-channel concatenation operation; up(·) is a 2x upsampling operation. Preferably, up(·) uses an interpolation method.

[0099] In summary, the multi-scale geographic feature encoder finally outputs multi-scale features

[0100] Reference Figure 6 The global geographic feature decoder includes M second feature extraction modules and S upsampling modules with a step size of 2. The second feature extraction module is used to decode the image features input therein, extract key point information, and output the decoder feature map. The upsampling module is used to gradually restore the decoder feature maps of different stages to the original resolution of the input image. The S upsampling modules are used to upsample the decoder feature maps output by the first M-1 second feature extraction modules by 2 times, and output M-1 features of different scales. The deep feature f output by the last second feature extraction module D is the output feature of the entire global geographic feature decoder. The second feature extraction module can use a convolution module, a residual convolution module or a hole convolution module. The upsampling module can use an interpolation module or a transposed convolution module. The connection method is:

[0101] The first second feature extraction module → the first upsampling module → the second second feature extraction module → the second upsampling module → … → the Sth upsampling module → the Mth second feature extraction module.

[0102] Multi-scale geographic feature encoder and global geographic feature decoder skip connection:

[0103] The first second feature extraction module is used to extract the encoder features output by the Mth first feature extraction module in the multi-scale geographic feature encoder. Decode to obtain key point information, and output the decoder feature map containing the key point information; the input features of the subsequent M-1 second feature extraction modules are multi-scale features And upsampling module output characteristics The features after splicing, that is Among them, cat(·,·) is a channel concatenation operation, that is, two feature maps of the same size are concatenated into one feature map along the dimension of the channel. The decoder feature map containing key point information output by the last second feature extraction module is the deep feature f D , as the output feature of the entire global geographic feature decoder.

[0104] Through jump connections, the spatial details in the multi-scale features output by the multi-scale geographic feature encoder can be used to supplement the decoder features output by the global geographic feature decoder at different stages with more abstract and less localized information, thereby improving the sensitivity to different geographic boundary key points, alleviating the impact of imbalanced labeled samples, and ultimately outputting an accurate prediction probability map of geographic boundary information key points.

[0105] Reference Figure 5 and Figure 6 The multi-keypoint prototype attention mechanism module consists of N query convolutions, a key convolution, and an attention weight calculation module. The input of the multi-keypoint prototype attention mechanism module is the prototype features of N keypoints and the deep features f output by the global geographic feature decoder. D , the output is the attention weight matrix W of N geographical boundary key points.

[0106] First, the deep feature f D Input to classifier F C (·) Generate pseudo labels for N geographic boundary key points Then the pseudo label and deep features f D Multiply to get the prototype features of N key points The pseudo label of the nth geographic boundary key point and the prototype features of the nth geographic boundary key point The calculation formula is:

[0107]

[0108] Among them, p n is the classifier F C (·) Output probability map of the nth geographic boundary key point; Pseudo label of the nth geographic boundary key point It consists of two elements, 0 and 1, where 1 is the location of the nth geographic boundary key point and 0 is the invalid area.

[0109] Then, the prototype features of N key points The query features are input into N query convolutions respectively, and the prototype features are processed nonlinearly through query convolution to improve the generalization representation ability of the prototype features for geographic key points, and the query features are obtained. Query Convolution It is a 1×1 convolution structure, and the query feature generation formula is:

[0110]

[0111] In parallel, the deep features f D Directly input into the key convolution, the key convolution has a direct impact on the deep feature f DPerform nonlinear mapping to constrain deep features f D The feature distribution of is close to the query feature f Q , and undergoes nonlinear mapping through convolution to improve the deep features f D The significance of geographic key points in the output key feature f K . Keyed Convolution It is a 1×1 convolution structure, and the key feature f K The generating formula is:

[0112] f K =F K (f D ) (5)

[0113] The attention weight calculation module calculates the query feature f through dot product calculation Q and key feature f K The similarity is then normalized by the SoftMax activation function to obtain the attention weight matrix W of N geographical boundary key points, where the attention weight matrix W of the nth key point is n The calculation formula is:

[0114]

[0115] Among them, d k is the key feature f K The dimension used to scale the dot product result.

[0116] Reference Figure 6-7 , the attention weight matrix W output by the multi-keypoint prototype attention mechanism module is combined with the deep feature f D The weighted feature f W =Wf D Input classifier F C In (·), the classifier outputs a geographic raster image The prediction result O of all geographical boundary key points in . The generation process of the prediction result O is the same as the pseudo label above The generation process is the same, and the input features are f D Replace with f W The process is as shown in formula (5).

[0117]

[0118] like Figure 7 As shown, the predicted probability map p n Displays geographic boundary key points on the input geographic raster image The recognition probability of the nth geographic boundary key point at different positions. The 18 prediction probability maps respectively represent the recognition probability heat maps of 18 geographic boundary key points. The size of the prediction result O of the geographic boundary key point is consistent with the input geographic raster image. Preferably, the classifier F C (·) The structure is a 1×1 convolution module and a SoftMax activation function.

[0119] In this embodiment:

[0120] Reference Figure 6 , M=4, S=3.

[0121] All the first feature extraction modules and the second feature extraction modules use the residual hole convolution module to expand the receptive field of the convolution, facilitate the global scanning of the geographic raster image, identify the key points of the geographic boundary, and improve the convergence ability. The structure of the residual hole convolution module is as follows: Figure 4 As shown, it includes dilated convolutions with expansion coefficients r of 1 and 2, a convolution with a stride of 1, and a convolution with a stride of 2. In the residual dilated convolution module, for a deeper layer L, its relationship with the l′ layer is expressed as:

[0122]

[0123] Where: x L and x l are the inputs of the Lth layer and the l′th layer respectively; W i is the network weight of the i-th layer; F(·) is the mapping relationship; the L layer can be expressed as the sum of any l′ layer shallower than it and the residual part between them.

[0124] All downsampling modules use convolution modules with a stride of 2 and a convolution kernel of 1 × 1. While implementing downsampling, the convolution module with a stride of 2 can make the features extracted by the model in each layer more and more abstract, which helps the model better capture the global features of the image.

[0125] All upsampling modules use transposed convolution with a convolution kernel of 1 × 1. Compared with simple interpolation methods, transposed convolution can more effectively reconstruct image details such as edges and textures.

[0126] Step 3: Based on the local Gaussian key point loss function, the geographic boundary key point recognition model constructed in step 2 is trained and tested using the training set and the test set;

[0127] Step 3.1 enhances the geographic raster images in the training set. The enhancement method includes two steps: grayscale channel extraction and texture extraction. Different from the traditional preprocessing method based on color transformation, this method significantly extracts the boundary texture in the raster image, thereby increasing the probability weight of the model searching for key points on the boundary. The specific enhancement method is:

[0128] First, the original geographic raster image is converted from RGB to the Lab color space based on human vision. lab .

[0129] Then, based on the Sobel texture extraction method, directional convolution is used to extract T lab The texture gradient map of the L channel of . Among them, the convolution kernel of the directional convolution is G in the horizontal direction. x and vertical G y After directional convolution, the horizontal and vertical gradients are obtained, and then added to obtain the texture gradient map G. The formula is shown in formula (6).

[0130]

[0131] Finally, the texture gradient map G in the L channel is spliced ​​with the original geographic raster image to obtain an enhanced geographic raster image.

[0132] Step 3.2: Transform the enhanced georaster image Input the geographic boundary key point recognition model built in step 2 to obtain the geographic raster image The prediction results O of all geographical key points above;

[0133] Step 3.3: Calculate the nth labeled sample l in the sequence of labeled samples l of geographic boundary key points obtained in step 1.4 above n and the input geographic raster image corresponding to the labeled sample l The prediction result of the nth geographic key point in O n The square error L2 between them is shown in formula (7):

[0134]

[0135] Step 3.4: Calculate the nth labeled sample l in the sequence of labeled samples l of geographic boundary key points obtained in step 1.4 above n and the input geographic raster image corresponding to the labeled sample l The prediction result of the nth geographic key point in O n The key point distance matrix D N×N , the formula is shown in formula (8):

[0136]

[0137] In the formula, let the key point be p i =(x i ,y i ),i=1,...,N; different key points p i and p j The distance between them is d ij , j = 1, ..., N; D N×N The diagonal elements are 0;

[0138] Step 3.5: The key point distance matrix D obtained in step 3.4 N×N It is added to the loss function as a regular term and added to the square error L2 obtained in step 3.3 to obtain the local Gaussian key point loss function L. The formula of the local Gaussian key point loss function L is:

[0139] L=L2+λ|D N×N | (10)

[0140] In the formula, |D N×N | is the key point distance matrix D N×N The modulus of , λ is the regularization term sparseness used to control the regularization term weight, λ∈(0,1], preferably, λ=0.1.;

[0141] Step 3.6: Calculate the loss value based on the local Gaussian key point loss function L obtained in step 3.5, use the loss value to calculate the gradient value required for backpropagation of the geographic boundary key point recognition model, and train the geographic boundary key point recognition model based on the Adam optimizer and test it using the test data set until the model converges.

[0142] Step 4: Extraction of boundary points of geographic raster image;

[0143] Input any geographic raster image (belonging to the same geographic / administrative region as the geographic raster image in the training set used to train the model) into the geographic boundary key point recognition model trained in step 3, and the geographic boundary key point recognition model outputs N (N=18 in this embodiment) recognition prediction results O of geographic boundary key points, as exemplified by Figure 5 shown.

[0144] Based on the method for extracting key points from geographic raster images provided by the present invention, the present invention further provides a method for spatial correction of geographic raster images, comprising the following steps:

[0145] Step 1: Automatically extract N boundary key points O = {O1, ..., O2, ..., O3, ..., O4, ..., O5, ..., O6, ..., O7, ..., O8, ..., O9, ..., O1, ..., O1, ..., O2 ...3, ..., O4, ..., O5, ..., O6, ..., O7, ..., O8, ..., O9, ..., O1, ..., O1, N}.

[0146] Step 2: Filter and calculate the pixel coordinates of the boundary key point O extracted in step 1 and the reference geographic boundary key point l ref The perspective transformation matrix between the real geographic coordinates is used to realize the spatial correction of the geographic raster image based on the perspective transformation matrix. The specific method is as follows:

[0147] Step 2.1) Set N reference geographic boundary key points l ref The geographic coordinates of the boundary key points O = {O1,…,O N}Input into the key point screening algorithm, retain 4 pairs of high reliability boundary key points. Among them, the key point screening algorithm can adopt methods such as random sampling consistency, least squares method or geometric consistency check. Since the accuracy and efficiency of the random sampling consistency method meet the requirements of the present invention, preferably, random sampling consistency is used as the key point screening algorithm. Finally, a 3×3 perspective transformation matrix H is calculated through 4 pairs of high confidence geographic boundary key points.

[0148] Step 2.2) Multiply the geographic raster image I(x, y) to be corrected by the perspective transformation matrix H obtained in step 2.1) to complete the spatial correction of the geographic raster image I(x, y) and obtain the corrected image I'(x', y'). The formula for spatial correction is shown in equation (10).

[0149]

[0150] Where (x, y) is the coordinate of each pixel in the geographic raster image I(x, y), and (x', y') is the new position after spatial correction.

[0151] The above are only preferred embodiments of the present invention, but are not limited to the present invention. Any replacement and change in the design scheme and concept of the present invention should be included in the present invention.

Claims

1. Method for extracting key points from geographic raster images. It is characterized in that The following steps are involved: Step 1: Build a dataset and divide it into training and test sets; Step 1.1 Collect geographic raster images with the same geographic or administrative boundaries. If there are paper images, scan them into digital images. Step 1.2 Select N reference geographic boundary key points l on the real geographic boundary of the geographic or administrative area corresponding to the geographic raster image in step 1.1 ref ; Step 1.3: According to the N reference geographic boundary key points l in step 1.2 ref Annotate the geographic raster image collected in step 1.1 according to the relative position and annotation order of the image to obtain the point labels of the geographic raster image; Step 1.4 performs Gaussian distribution processing on the point labels obtained in step 1.3, and obtains N geographic boundary key point sequence labeling samples l with Gaussian distribution for each geographic raster image; Step 1.5 constructs a data set using the geographic boundary key point sequence annotation sample l obtained in step 1.4 and its corresponding geographic raster image, and divides it into a training set and a test set; Step 2: Construct a geographic boundary key point recognition model; The geographic boundary key point recognition model includes a multi-scale geographic feature encoder, a global geographic feature decoder, a multi-key point prototype attention mechanism module and a classifier; The multi-scale geographic feature encoder includes M first feature extraction modules and S downsampling modules with a step size of 2, S = M-1, M>3; the M first feature extraction modules are used to extract features of M different scales from the input image The S downsampling modules are used to downsample the features output by the first M-1 first feature extraction modules. 1 / 2 downsampling is performed; M first feature extraction modules and S downsampling modules are connected alternately in sequence; at the same time, the M first feature extraction modules are also connected through a cascade operation, so that the output features of each adjacent two first feature extraction modules are spliced ​​according to the channel to output multi-scale features Finally, the multi-scale geographic feature encoder outputs multi-scale features The global geographic feature decoder includes M second feature extraction modules and S upsampling modules with a step size of 2; the M second feature extraction modules are used to identify key point information in the features input therein; the S upsampling modules are used to upsample the features output by the first M-1 second feature extraction modules by 2 times, and output S features of different scales. The deep feature f output by the Mth second feature extraction module D is the output of the global geographic feature decoder; Multi-scale geographic feature encoder and global geographic feature decoder skip connection: Multi-scale features output by the multi-scale geographic feature encoder The features output by each upsampling module in the global geographic feature decoder are Perform channel splicing to obtain the spliced ​​features Among them, cat(·,·) is a concatenation operation; the concatenated features As the input of the second, third, ..., Mth second feature extraction module in the global geographic feature decoder respectively; the features output by the multi-scale geographic feature encoder As the input of the first second feature extraction module in the global geographic feature decoder; The multi-keypoint prototype attention mechanism module is used to analyze the prototype features of N keypoints. and the deep features f output by the multi-scale geographic feature encoder D Processing is performed to generate an attention weight matrix W of N geographical boundary key points; the prototype features of the N key points By the deep feature f D The classifier is based on the deep feature f D Generated pseudo labels Multiply them together to get; The classifier is used to transform the deep features f D and the weighted features f of the attention weight matrix W W Converting into prediction results of all geographic boundary key points in the geographic raster image, the prediction results showing the probability of the geographic boundary key points at different positions of the geographic raster image; Step 3: Train and test the geographic boundary key point recognition model built in step 2; Based on the local Gaussian key point loss function, the geographic boundary key point recognition model constructed in step 2 is trained and tested using the training set and the test set; Step 4: Extract geographic raster image boundary points; Input the geographic raster image of the boundary points to be extracted into the geographic boundary key point recognition model trained in step 3, and the geographic boundary key point recognition model outputs the recognition prediction results of N geographic boundary key points; the geographic raster image of the boundary points to be extracted and the geographic raster image in the data set in step 1 belong to the same geographic or administrative area.

2. The method for extracting key points from geographic raster images according to claim 1, It is characterized in that In step 2: the first feature extraction module and the second feature extraction module adopt a convolution module, a residual convolution module or a hole convolution module; the downsampling module adopts a pooling module, a difference module or a convolution module with a step size of 2; the upsampling module adopts an interpolation module or a transposed convolution module.

3. The method for extracting key points from geographic raster images according to claim 1 or 2, It is characterized in that In step 2: the multi-keypoint prototype attention mechanism module includes N query convolutions and one key convolution; N query convolutions are used to analyze the prototype features of N keypoints. Perform nonlinear change processing to obtain N query features Key convolution is used to transform the deep features f D Perform nonlinear mapping to constrain deep features f D The feature distribution of Q , get the key feature f K ; The attention weight calculation module calculates the query feature f through the dot product Q and key feature f K The similarity is then normalized through the SoftMax activation function to obtain the attention weight matrix W of N geographical boundary key points.

4. The method for extracting key points from geographic raster images according to claim 3, Features: In the attention weight matrix of the N geographical boundary key points, the attention weight matrix W of the nth key point n The calculation formula is: Among them, d k is the dimension of the key vector used to scale the dot product result.

5. The method for extracting key points from geographic raster images according to claim 4, It is characterized in that Step 3 is as follows: Step 3.1 enhances the geographic raster images in the training set; Step 3.2: The enhanced geo-raster images in the training set Input the geographic boundary key point recognition model built in step 2 to obtain the geographic raster image The prediction results O of all geographical key points above; Step 3.3 Calculate the nth labeled sample l in the sequence of labeled samples l of geographic boundary key points obtained in step 1.4 above n and the input geographic raster image corresponding to the labeled sample l The prediction result of the nth geographic key point in O n The square error between 2 ; Step 3.4 calculates the nth labeled sample l in the sequence of labeled samples l of geographic boundary key points obtained in step 1.4 above n and the input geographic raster image corresponding to the labeled sample l The prediction result of the nth geographic key point in O n The key point distance matrix D N×N ; Step 3.5 calculates the local Gaussian key point loss function L using the following formula: L=L 2 +λ|D N×N | In the formula, |D N×N | is the key point distance matrix D N×N The modulus of , λ is the regularization term sparseness used to control the regularization term weight, λ∈(0,1]; Step 3.6: Calculate the loss value based on the local Gaussian key point loss function L obtained in step 3.5, use the loss value to calculate the gradient value required for backpropagation of the geographic boundary key point recognition model, and train the geographic boundary key point recognition model based on the Adam optimizer and test it using the test data set until the model converges.

6. The method for extracting key points from geographic raster images according to claim 5, It is characterized in that Step 3.1 is as follows: First, the original geographic raster image is converted from RGB to the Lab color space based on human vision. lab ; Then, based on the Sobel texture extraction method, directional convolution is used to extract T lab Texture gradient map G of the L channel: G=|G x |+|G y | Finally, the texture gradient map G in the L channel is spliced ​​with the original geographic raster image to obtain an enhanced geographic raster image.

7. Spatial correction method of geographic raster images, It is characterized in that The following steps are involved: Step 1: Extract the boundary key points O of the geographic raster image I (x, y) to be corrected by using the geographic raster image boundary key point extraction method described in any one of claims 1 to 6. 1 ,...,O N }; Step 2: Filter and calculate the pixel coordinates of the boundary key point O extracted in step 1 in the geographic raster image to be corrected I (x, y) and the reference geographic boundary key point l ref A perspective transformation matrix between real geographic coordinates is used, and spatial correction of geographic raster images is achieved based on the perspective transformation matrix.

8. The method for spatial correction of geographic raster images according to claim 7, Features: Step 2 is as follows: Step 2.1) Set N reference geographic boundary key points l ref The geographic coordinates of the boundary key points O extracted in step 1 = {O 1 ,...,O N } Input into the key point screening algorithm, retain 4 pairs of boundary key points with high reliability, and calculate the 3×3 perspective transformation matrix H through these 4 pairs of boundary key points; Step 2.2) Multiply the geographic raster image I(x, y) to be corrected by the perspective transformation matrix H obtained in step 2.1) to complete the spatial correction of the geographic raster image I(x, y) and obtain the corrected image I'(x', y').

9. The method for spatial correction of geographic raster images according to claim 8, Features: The key point screening algorithm described in step 2.1) is a random sampling consensus algorithm.