Siamese network-based spatial data retrieval method, device and equipment and storage medium
By combining the Siamese network framework and graph convolutional neural networks, the shortcomings of similarity evaluation in spatial data retrieval are addressed, enabling accurate querying and retrieval in complex scenarios and improving spatial data management capabilities.
Patent Information
- Application Number
- CN202310666215.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2043-06-06
AI Technical Summary
Existing spatial data retrieval methods cannot effectively assess the similarity of spatial scenes, resulting in insufficient query accuracy and difficulty in meeting the description and query needs of complex spatial relationship features.
A spatial scene overall similarity measurement model is built using the Siamese network framework. The attribute and relationship information of spatial data are stored through a graph data structure, and a similarity measurement prediction model is established by training a graph convolutional neural network. The similarity distance is output to query the most similar spatial scene data.
It improves the accuracy and efficiency of spatial data query and retrieval, supports precise query and retrieval in complex scenarios, and promotes the digital management of spatial data.
Smart Images

Figure CN116775784B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of spatial data retrieval technology in the field of geographic information, and particularly relates to a spatial data retrieval method, device and equipment based on Siamese network and a storage medium. BACKGROUND
[0002] With the rapid development of geographic information technology, in the face of the exponential growth of the acquisition rate of spatial data, it is particularly important to study how to effectively utilize spatial data. Among them, since the spatial scene can comprehensively express the characteristics of spatial data, the research on the similarity of spatial scenes not only has the actual application demand of sketch matching in spatial data retrieval, but also has great application value for mining the potential information of massive data.
[0003] Based on the research on the similarity of entities in the spatial scene, it is shown that in addition to specific concept information, the objects in the spatial scene and the corresponding spatial relationship have an important influence on the query accuracy of the spatial scene. For example, using more specific and more intuitive ways such as sketch drawing and sample matching for query may be more consistent with our way of recognizing things, and thus it is more conducive to accurate retrieval of corresponding spatial data and spatial scenes. Therefore, the research on the similarity calculation method of spatial scenes not only has a more intuitive, more accurate and more visual description of the complex spatial relationship characteristics such as shape, size, orientation and topology in the scene, but also can increase the query accuracy of similar spatial scenes, thereby better serving the spatial data query and retrieval, and finally realizing the transition of the similarity query of spatial scenes from professionals to ordinary users.
[0004] However, the existing solutions are not sufficient to support the evaluation of the similarity of spatial scenes, and there are great limitations in use. How to reasonably evaluate the similarity of spatial scenes with different information has become a problem to be solved at present. SUMMARY
[0005] The purpose of the present application is to solve the problems in the background art. The technical scheme adopted by the present application is to provide a spatial data retrieval method, device and equipment based on Siamese network and a storage medium.
[0006] According to a first aspect of the present application, a spatial data retrieval method based on Siamese network comprises the following steps:
[0007] S1: obtaining sample data or database sample data of spatial data to be queried, and pre-processing the data;
[0008] S2: Construct a spatial scene graph for the preprocessed data, store the spatial information contained in the corresponding spatial data through the graph data structure feature, store the attribute information of the spatial data in the node feature in the graph data, and store the spatial relationship information between the spatial data in the edge feature in the graph data;
[0009] S3: Use a Siamese network framework to build a spatial scene overall similarity measurement training model, use the spatial scene graph as the input data sample of the training model, use two sub-networks with shared weights as the training model, and thus obtain whether the input data sample is similar or has the same classification score according to the training of the sub-networks;
[0010] S4: Establish a corresponding loss function according to the paired similar sample features in the training model, constrain and optimize the training model through the loss function, and obtain the trained model;
[0011] S5: Construct a spatial scene overall similarity measurement prediction model according to the trained model, input the spatial scene data to be queried and the database spatial scene data into the prediction model, output the similarity distance between the spatial scenes through the trained prediction model, and then query the most similar spatial scene data.
[0012] Further, the above step S1 specifically includes the following steps:
[0013] S1.1: Obtain sample data of spatial data to be queried or database sample data, and preprocess the data, including: unifying the spatial coordinate system so that the spatial data is in the same reference system, unifying the data format, processing the redundant data in the data, and checking the topological relationship;
[0014] S1.2: Perform enhancement processing on the line entities of the query related area, delete redundant lines, extract the center line of the related line entities and perform data enhancement, and divide the spatial scene according to the processed line data to obtain spatial scene data convenient for operation;
[0015] S1.3: Perform topological checking operation on the above spatial scene data to obtain preprocessed data.
[0016] Further, in the above step S2, the process of constructing a spatial scene graph includes:
[0017] S2.1: According to the model function in the ArcGIS software, batch cut the spatial scene area divided according to the line entity, and respectively name and save the spatial scene of the data to be queried and the area of the database spatial scene;
[0018] S2.2: Using the Python automatic compiler mentioned above, each scene area is processed separately to extract the specific attribute information of the spatial entities in each scene area, including size information, shape information, direction information, and density information of the spatial entities, and these information is stored in the form of vectors as node feature information in the graph data structure;
[0019] S2.3: The Delanuay triangular mesh method is used to draw the graph structure of the above-mentioned space scene area to represent the spatial relationship distribution information between the spatial entities, and the information representing the position relationship between the entities is stored as edge features in the edge features of the graph data structure to enhance the information representation of the graph structure;
[0020] S2.4: The graphing operation using the Delanuay triangular mesh method is integrated to obtain the spatial scene graph data structure of each space scene area, which is used as input data for the training model and unifies the data format of the input data.
[0021] Further, in the above step S3, a Siamese network framework is used to build a spatial scene overall similarity measurement training model, including the following steps:
[0022] S3.1: According to the characteristics of Siamese network, select the twin network G W (X1) and G W (X2) as the training model of the network framework, which shares the same training weight W;
[0023] S3.2: According to the characteristics of the spatial scene graph data structure, select the graph convolutional neural network as the corresponding twin network to realize the transmission of the related information possessed by the spatial scene graph structure nodes and spatial relationships;
[0024] S3.3: The spatial scene data processed in S2 is used as the input sample of the Siamese network framework and is sent to the constructed training model for training, wherein the training layer is composed of two weight-shared graph convolutional neural networks, and the initial scene graph information is transmitted and aggregated between the node features through the training of the graph convolutional network, to update the corresponding scene graph node information and generate the related vector representation representing the corresponding scene graph;
[0025] S3.4: According to the related vector representation, the similarity distance between the query spatial scene data and the target spatial scene data is obtained through the continuous training of the Siamese network framework, and the final result is output.
[0026] Further, S3.3 specifically includes:
[0027] Let the node feature where v ∈ V denotes the set of nodes; the hidden feature of node v learned by the model at the l-th layer is denoted as d i where d represents the dimension of input features, h where d represents the dimension of hidden features, denotes the node feature; in the graph convolutional neural network, the GNN updates the feature of each node v ∈ V simultaneously at the l-th layer (l = 1...k) which can be formally expressed as
[0028]
[0029]
[0030] where is the feature vector of node v at the l-th iteration / layer; AGGREGATE and COMBINE represent the aggregation operation of the graph convolutional neural network, and the neighborhood N(v) = {u ∈ V | (v, u ∈ E)} of the node v is the neighborhood set of the node v;
[0031] In the graph convolutional network GCN, the pooling layer adopts an element-based mean pooling step, and the AGGREGATE and COMBINE steps are integrated as follows:
[0032]
[0033] where W denotes a learnable matrix, and the COMBINE step can be a concatenation followed by a linear mapping In the pooling variant of GraphSAGE, AGGREGATE is expressed as:
[0034]
[0035] where MAX represents the maximum value, ReLU represents the activation function, and W represents the weight; in the GNN, the last iteration of the node feature is aggregated by the READOUT function, thereby obtaining the relevant vector representation h of the entire graph G .
[0036] Further, in the step S4, the formula of the loss function established is as follows:
[0037]
[0038]
[0039] where D W(X1, X2) represents the Euclidean distance of two sample features X1 and X2, that is, the similarity distance, P represents the feature dimension of the sample, Y represents the label of whether two samples are similar, Y = 1 represents that two samples are similar, Y = 0 represents that two samples are not similar, m is a set threshold, and N is the number of samples;
[0040] When the samples are similar, the loss function is only That is, the originally similar samples; and when the samples are not similar, the loss function is
[0041] Further, in the step S5, the trained model is used to construct a spatial scene overall similarity measurement prediction model to reflect the training effect of the model, and the same framework design as the training model is adopted, wherein part of the selected model adopts the trained model as a training layer, and the similarity results of the to-be-queried spatial data and the target data are output in real time to obtain the trained prediction model.
[0042] According to a second aspect of the present application, an apparatus for the Siamese network-based spatial data retrieval method comprises the following units:
[0043] An acquisition and preprocessing unit is configured to acquire sample data or database sample data of to-be-queried spatial data, and to preprocess the data;
[0044] A scene graph construction unit is configured to construct a spatial scene graph for the preprocessed data, to store spatial information contained in the corresponding spatial data through a graph data structure feature, to store attribute information of the spatial data in node features in the graph data, and to store spatial relationship information between the spatial data in edge features in the graph data;
[0045] A similarity measurement training unit is configured to use a Siamese network framework to build a spatial scene overall similarity measurement training model, to use the spatial scene graph as input data samples of the training model, and to use two sub-networks with shared weights as the training model, so as to obtain whether the input data samples are similar or have the same classification score according to the training of the sub-networks;
[0046] A loss function construction unit is configured to establish a corresponding loss function according to sample feature pairs of the training model, to constrain and optimize the training model through the loss function, and to obtain a trained model;
[0047] A spatial data query prediction unit is configured to use the trained model to construct a spatial scene overall similarity measurement prediction model, to input to-be-queried spatial scene data and database spatial scene data into the prediction model, to output a similarity distance between the spatial scenes through the trained prediction model, and to query the most similar spatial scene data.
[0048] According to a third aspect of the present application, an electronic device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the Siamese network-based spatial data retrieval method when executing the program.
[0049] According to a fourth aspect of the present application, a storage medium has a computer program stored thereon, the computer program implementing the steps of the Siamese network-based spatial data retrieval method when executed by a processor.
[0050] The technical solution provided by the present application has the following beneficial effects:
[0051] 1. The present application applies deep learning technology to spatial data retrieval, which can effectively improve the efficiency of spatial data query and retrieval, further improve the precise management ability of the main transformer vector space data, and promote the digital management and storage of spatial data.
[0052] 2. The present application can realize accurate query and retrieval of spatial scene data in complex scenes, and has certain reference value for realizing effective management of database, accurate retrieval of spatial data, sketch data matching and query, etc. BRIEF DESCRIPTION OF DRAWINGS
[0053] The present application will be further described below in conjunction with the drawings and embodiments, wherein:
[0054] Figure 1 is a flowchart of the Siamese network-based spatial data retrieval method of the present application;
[0055] Figure 2 is a network framework structure proposed by the Siamese network-based spatial data retrieval method of the present application;
[0056] Figure 3 is a training process diagram of the graph convolutional neural network in the Siamese network-based spatial data retrieval method of the present application;
[0057] Figure 4 is a parameter result diagram of the Siamese network framework after training in the Siamese network-based spatial data retrieval method of the present application;
[0058] Figure 5 is a spatial scene sample data diagram in the Siamese network-based spatial data retrieval method of the present application;
[0059] Figure 6 is an implementation example result diagram in the Siamese network-based spatial data retrieval method of the present application;
[0060] Figure 7 This is a schematic diagram of the structure of a spatial data retrieval device based on a Siamese network according to the present invention;
[0061] Figure 8 This is a schematic diagram of the structure of an electronic device according to the present invention. Detailed Implementation
[0062] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0063] like Figure 1 , Figure 2 As shown, the spatial data retrieval method based on Siamese networks of the present invention includes the following steps:
[0064] Step S1: Obtain sample data or database sample data of the spatial data to be queried, and perform relevant preprocessing operations on the data, including operations such as unifying the spatial data coordinate system, unifying the spatial data format, processing redundant spatial data, and checking the spatial data topology to ensure the accuracy of the spatial data used. In the implementation case of this invention, multiple building spatial entity vector surface data and related urban road network vector line data are collected. Relevant preprocessing operations are performed on these vector data to ensure the accuracy of the data. At the same time, the data format is unified for subsequent operations. Finally, all data are processed and cleaned for redundant data to ensure the integrity and accuracy of the data input to the model.
[0065] Step S1: Specifically includes the following sub-steps:
[0066] S1.1: Obtain sample data or database sample data of the spatial data to be queried, and preprocess the data. The main steps include unifying the spatial coordinate system so that the spatial data are in the same reference system, then unifying the data format to facilitate subsequent operations, and processing redundant data in the data, such as deleting small patches generated by latitude and longitude line division, merging related data belonging to the same spatial entity, etc., and finally performing topological relationship checks to identify spatial entities that may have intersections, etc.
[0067] S1.2: Enhance the data of line entities such as road lines and water systems in the relevant query area, delete redundant road and water body lines, and use ArcGIS software to enhance the road line data. This mainly involves extracting the center lines of relevant line entities through buffer operations and center line extraction operations and enhancing the data. Then, based on the spatial areas divided by the road network, the vector spatial area data is clipped to obtain separate spatial scene data that is easy to operate. The relevant input data is saved with the shp suffix.
[0068] S1.3: Topology checking operation is performed on the above-mentioned spatial scene data, mainly including intersection, tangency and the like with line entities, and relevant data is translated, rotated or deleted and the like as appropriate to ensure the integrity of the spatial data in the scene, thereby providing accurate original input data for subsequent input model data.
[0069] Step S2: The pre-processed data is subjected to spatial scene graph construction, the spatial information contained in the corresponding spatial data is stored through the graph data structure features, the attribute information of the spatial data is stored in the node features in the graph data to enhance the semantic feature representation of the nodes, and the spatial relationship information between the spatial data is stored in the edge features in the graph data to enhance the spatial relationship features of the graph data.
[0070] The specific steps of constructing the spatial scene graph in step S2 include the following sub-steps:
[0071] S2.1: The spatial scene region divided according to the line entities such as road network and water system is batched and cut according to the model function in the ArcGIS software, and the spatial scene of the data to be queried and the region of the database spatial scene are respectively named and saved;
[0072] S2.2: The above-mentioned spatial scene region is processed by using a Python automatic compiler, mainly extracting the specific attribute information of the spatial entities in each scene region, including size information, shape information, direction information, density information and the like of the spatial entities, and storing these information in the form of vectors as the node feature information in the graph data structure, wherein the relevant attribute information parameters are as follows:
[0073] (1) Area: When calculating the area, the area of a triangle or the area of a trapezoid can be calculated, as shown below.
[0074]
[0075]
[0076] Wherein, S(A) refers to the area, x and y refer to the coordinate information of the contour points, and n refers to the number of extracted contour points.
[0077] (2) Perimeter:
[0078]
[0079] Wherein, C(A) refers to the perimeter, x and y refer to the coordinate information of the contour points, and n refers to the number of extracted contour points.
[0080] (3) Center point coordinates:
[0081]
[0082] wherein (c x , c y ) denotes the coordinates of the center point, x and y denote the coordinate information of the contour points, and n denotes the number of extracted contour points.
[0083] (4) Average value of internal angle:
[0084]
[0085] wherein θ denotes the internal angle value in the surface entity polygon, and N denotes the number of internal angles.
[0086] (5) Average radius:
[0087]
[0088] wherein (c x , c y ) denotes the coordinates of the center point, x and y denote the coordinate information of the contour points, and n denotes the number of extracted contour points.
[0089] (6) Compactness / arc degree: mainly refers to the quadratic relationship between area and perimeter.
[0090]
[0091] wherein S(A) denotes the area, and C(A) denotes the perimeter.
[0092] (7) Fractal: mainly refers to the logarithmic relationship between area and perimeter.
[0093]
[0094] wherein S(A) denotes the area, C(A) denotes the perimeter, and log represents logarithmic operation.
[0095] (8) Extension rate of surface element: mainly refers to the aspect ratio of the minimum circumscribed rectangle, which constrains the surface entity by the circumscribed rectangle.
[0096]
[0097] wherein L SBR represents the length of the circumscribed rectangle of the related entity, and W SBR represents the width of the circumscribed rectangle of the related entity.
[0098] (9) Concave-convex degree of surface element: mainly refers to the area ratio of the surface entity and the convex hull.
[0099]
[0100] wherein S(A) denotes the area, and S(CH) denotes the area of the convex hull.
[0101] S2.3: Use Delanuay triangulation method to draw the graph structure of the above space scene area to represent the spatial relationship distribution information between spatial entities, such as their distance, orientation, etc. The information representing the position between entities is stored in the edge feature of the graph data structure to enhance the information representation of the graph structure;
[0102] S2.4: Integrate the above graphing operation using Delanuay triangulation method to obtain the spatial scene graph data structure of each spatial scene area, which is used as input data for the training model and unifies the data format of the input data.
[0103] Step S3: Use Siamese network framework to build spatial scene overall similarity measurement training model, use spatial scene graph as input data sample of training model, use two sub-networks with shared weights as training model, and then determine whether the input data sample is similar or has the same classification score according to the training of sub-network. Specifically, the following sub-steps are included:
[0104] S3.1: First, according to the characteristics of Siamese network, select twin network G W (X1) and G W (X2) as the main training model of the network framework, which mainly includes sharing the same training weight W to ensure the stability of the model training process;
[0105] S3.2: According to the characteristics of the spatial scene graph data structure, considering the information transmission advantage of graph convolutional neural network in processing graph data structure, select graph convolutional neural network as the corresponding twin network, so that the related information possessed by the spatial scene graph structure nodes and spatial relationships can be transmitted, such as Figure 3 as shown;
[0106] S3.3: The spatial scene data processed in S2 is used as the input sample of the Siamese network framework and is sent to the constructed model for training, as shown in Figure 4 , which is the stability result of the trained model. Three kinds of graph convolutional networks can all converge. The training layer is composed of two weight-shared graph convolutional neural networks. Through the training of the graph convolutional network, the initial scene graph information is transmitted and aggregated between the node features to update the corresponding scene graph node information and generate the related vector representation of the corresponding scene graph. The detailed steps are as follows:
[0107] Assume that the node features where v∈V represents the node set; the hidden features of node v learned by the training model at the l-th layer are represented by d idimensionality of input features, d h dimensionality of hidden features, denotes the node features. In a graph convolutional neural network, the GNN l-th layer (l = 1...k) updates the feature vector of each node v e V simultaneously which can be formally expressed as
[0108]
[0109]
[0110] where is the feature vector of node v at the l-th iteration / layer, AGGREGATE and COMBINE denote the aggregation operation of the graph convolutional neural network, and the neighborhood N(v) = {u e V | (v, u e E)} of a node v is the set of neighbors of node v. In GNN, AGGREGATE l (·) and COMBINE (l) (·) are crucial. As in the graph convolutional network GCN, the pooling layer adopts an element-based mean pooling step, and integrates the AGGREGATE and COMBINE steps as follows:
[0111]
[0112] where W denotes a learnable matrix, and the COMBINE step can be a concatenation followed by a linear mapping In the pooling variant of GraphSAGE, AGGREGATE is expressed as:
[0113]
[0114] where MAX denotes the maximum value, ReLU represents the activation function, and W represents the weight; in the GNN, the last iteration of the node features is aggregated by the READOUT function to obtain the relevant vector representation h G of the entire graph.
[0115] S3.4: According to the h G representing the graph feature vector, the similarity distance between the to-be-queried space scene data and the target space scene data is obtained through continuous training of the Siamese network framework, and a final result is output.
[0116] Step 4: According to the characteristics of the training model, a corresponding loss function is established, and the training model is optimized by the loss function, so as to obtain a trained model, and the trained model is used to predict the test set, and then the similarity of the to-be-queried data is analyzed. Including the following steps: a corresponding model loss function is established to help improve the training effect of the model, and the formula of the loss function is as follows:
[0117]
[0118]
[0119] Wherein, D W (X1, X2) represents the Euclidean distance (similarity distance) of two sample features X1 and X2, P represents the feature dimension of the sample, Y represents the label of whether the two samples are similar, Y=1 represents that the two samples are similar, Y=0 represents that they are not similar, m is a set threshold, and N is the number of samples;
[0120] When the samples are similar, the loss function is only That is, if the Euclidean distance in the feature space of the originally similar sample is large, it means that the current model is not good, so the loss is increased; and when the samples are not similar, the loss function is The smaller the Euclidean distance in the feature space is.
[0121] Step 5: According to the trained model, a spatial scene overall similarity measurement prediction model is constructed, the to-be-queried spatial scene data and the database spatial scene data are input into the prediction model, and the similarity distance between the spatial scenes is output through the trained prediction model, and then the most similar spatial scene data is queried.
[0122] The implementation effect of the present application is as shown in Figure 5 、 Figure 6 , Figure 5 is to-be-queried sample scene data, Figure 6 is the query and sorting result of the sample scene data, and it is verified that the method of the present application can realize accurate query and retrieval of spatial scene data in a complex scene.
[0123] Next, a spatial data retrieval device based on the Siamese network provided by the present application will be described, and the spatial data retrieval device based on the Siamese network described below can be correspondingly referred to the spatial data retrieval method based on the Siamese network described above.
[0124] As shown in Figure 7 , a spatial data retrieval device based on the Siamese network comprises the following units:
[0125] An acquisition and preprocessing unit 001 is configured to acquire sample data or database sample data to be queried and to preprocess the data;
[0126] A scene graph construction unit 002 is configured to construct a spatial scene graph from the preprocessed data, store spatial information contained in corresponding spatial data in a graph data structure feature, store attribute information of the spatial data in a node feature in the graph data, and store spatial relationship information between the spatial data in an edge feature in the graph data;
[0127] A similarity measurement training unit 003 is configured to use a Siamese network framework to build a spatial scene overall similarity measurement training model, use the spatial scene graph as input data samples of the training model, use two sub-networks with shared weights as the training model, and determine whether the input data samples are similar or have the same classification score according to the training of the sub-networks.
[0128] A loss function construction unit 004 is configured to establish a corresponding loss function according to sample features of pairs of similar samples in the training model, constrain and optimize the training model through the loss function, and obtain a trained model.
[0129] A spatial data query prediction unit 005 is configured to construct a spatial scene overall similarity measurement prediction model according to the trained model, input spatial scene data to be queried and database spatial scene data into the prediction model, output a similarity distance between the spatial scenes through the trained prediction model, and query the most similar spatial scene data.
[0130] As Figure 8As shown, an entity structure diagram of an electronic device is exemplified, which can include: a processor 610, a communications interface 620, a memory 630 and a communications bus 640, wherein the processor 610, the communications interface 620 and the memory 630 complete mutual communication through the communications bus 640. The processor 610 can call the logical instructions in the memory 630 to execute the steps of the above-mentioned spatial data retrieval method based on the Siamese network, specifically including: obtaining sample data or database sample data of spatial data to be queried, and preprocessing the data; constructing a spatial scene graph for the preprocessed data, storing the spatial information contained in the corresponding spatial data through the graph data structure feature, storing the attribute information of the spatial data in the node feature in the graph data, and storing the spatial relationship information between the spatial data in the edge feature in the graph data; using a Siamese network framework to build a spatial scene overall similarity measurement training model, taking the spatial scene graph as the input data sample of the training model, using two sub-networks with shared weights as the training model, so as to obtain whether the input data sample is similar or has the same classification score according to the training of the sub-network; establishing a corresponding loss function according to the paired similar sample features in the training model, constraining and optimizing the training model through the loss function, and obtaining the trained model; constructing a spatial scene overall similarity measurement prediction model according to the trained model, inputting the spatial scene data to be queried and the database spatial scene data into the prediction model, outputting the similarity distance between the spatial scenes through the trained prediction model, and then querying the most similar spatial scene data.
[0131] In addition, the logical instructions in the memory 630 described above can be implemented in the form of a software function unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0132] In yet another aspect, the embodiments of the present application also provide a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-mentioned Siamese network-based spatial data retrieval method, and specifically includes: obtaining sample data or database sample data of spatial data to be queried, and pre-processing the data; constructing a spatial scene graph for the pre-processed data, storing spatial information contained in the corresponding spatial data through a graph data structure feature, storing attribute information of the spatial data in node features in the graph data, and storing spatial relationship information between the spatial data in edge features in the graph data; using a Siamese network framework to build a spatial scene overall similarity measurement training model, taking the spatial scene graph as input data samples of the training model, using two sub-networks with shared weights as the training model, so as to obtain whether the input data samples are similar or have the same classification score according to the training of the sub-networks; establishing a corresponding loss function according to the pair of similar sample features in the training model, and performing constraint optimization on the training model through the loss function to obtain a trained model; constructing a spatial scene overall similarity measurement prediction model according to the trained model, inputting spatial scene data to be queried and database spatial scene data into the prediction model, outputting a similarity distance between the spatial scenes through the trained prediction model, and then querying the most similar spatial scene data.
[0133] It should be noted that, in this document, the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or apparatus that comprises a list of elements not only includes those elements, but also includes other elements not explicitly listed, or inherent to such a process, method, article, or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0134] The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments. In the unit claims in which several devices are listed, several of these devices can be embodied by the same hardware item. The use of the words first, second, and third does not represent any order, and these words can be interpreted as identifiers.
[0135] The above is only the preferred embodiments of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation using the contents of the specification and drawings of the present application, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for spatial data retrieval based on Siamese network, characterized in that, The method comprises the following steps: S1: obtaining sample data or database sample data of spatial data to be queried, and preprocessing the data; the sample data is a plurality of building spatial entity vector surface data and related urban road network vector line data; The step S1 comprises the following steps: S1.1: unify the spatial coordinate system so that the spatial data is in the same reference system, unify the data format, process the redundant data in the data, and check the topological relationship; S1.2: enhancing the road line, deleting the redundant line, extracting the center line of the road line and enhancing the data, and dividing the space scene according to the processed line data to obtain the space scene data convenient for operation; S1.3: topological checking operation is performed on the above-mentioned space scene data to obtain the preprocessed data; S2: constructing a space scene graph for the preprocessed data, storing the spatial information contained in the corresponding spatial data through the graph data structure characteristics, storing the attribute information of the spatial data in the node characteristics in the graph data, and storing the spatial relationship information between the spatial data in the edge characteristics in the graph data; S3: using a Siamese network framework to build a spatial scene overall similarity measurement training model, taking the spatial scene graph as the input data sample of the training model, using two sub-networks with shared weights as the training model, so as to obtain whether the input data sample is similar or has the same classification score according to the training of the sub-network; the training model selects a graph convolutional neural network; S4: establishing a corresponding loss function according to the sample feature of the training model, constraining and optimizing the training model through the loss function, and obtaining the trained model; S5: constructing a spatial scene overall similarity measurement prediction model according to the trained model, inputting the spatial scene data to be queried and the database spatial scene data into the prediction model, outputting the similarity distance between the spatial scenes through the trained prediction model, and then querying the most similar spatial scene data. 2.The spatial data retrieval method based on Siamese network according to claim 1, wherein: In the step S2, the process of constructing the space scene graph comprises: S2.1: cutting the space scene region divided according to the line entity according to the model function in the ArcGIS software, and respectively naming and saving the space scene of the data to be queried and the region of the database space scene; S2.2: using a Python automatic compiler to process each scene region respectively, extracting the specific attribute information of the spatial entity in each scene region, including the size information, shape information, direction information and density information of the spatial entity, and storing these information in the form of vectors as the node feature information in the graph data structure; S2.3: using the Delanuay triangulation method to draw the graph structure of the above-mentioned space scene region to represent the spatial relationship distribution information between the spatial entities, storing the information representing the position relationship between the entities as the edge feature in the edge feature of the graph data structure to enhance the information representation of the graph structure; S2.4: The operation of using the Delanuay triangle network method for mapping is integrated to obtain the spatial scene graph data structure of each spatial scene region, which is used as input data of the training model and unifies the data format of the input data. 3.The spatial data retrieval method based on Siamese network according to claim 1, wherein: In the above step S3, a Siamese network framework is used to build a spatial scene overall similarity measurement training model, including the following steps: S3.1: Selecting Siamese network according to Siamese network characteristics G W ( X 1) With G W (X 2) As a training model of network framework, the training model shares the same training weight W ; S3.2: According to the characteristics of the spatial scene graph data structure, a graph convolutional neural network is selected as the corresponding twin network to realize the transmission of the related information possessed by the spatial scene graph structure nodes and spatial relationships; S3.3: The spatial scene data processed in S2 is used as the input sample of the Siamese network framework and is sent to the built training model for training, wherein the training layer is composed of two weight-shared graph convolutional neural networks, and the initial scene graph information is transmitted and aggregated between node features through the training of the graph convolutional network to update the corresponding scene graph node information and generate a related vector representation representing the corresponding scene graph; S3.4: According to the related vector representation, the similarity distance between the query spatial scene data and the target spatial scene data is obtained through continuous training of the Siamese network framework, and the final result is output. 4.The Siamese network-based spatial data retrieval method of claim 3, wherein: S3.3 specifically includes: node features wherein denotes a set of nodes; the trained model learns node hidden features of nodes at the , represents the dimension of input features, denotes node features; in a graph convolutional neural network, GNN learns node features at the , for each node updates formally as : wherein is a node At the first iteration, the eigenvector is initialized to a vector of ones. and denotes an aggregation operation of the graph convolutional neural network, the neighborhood of a node is a set of neighbors of the node . 5.The spatial data retrieval method based on Siamese network according to claim 1, wherein: In the above step S4, the formula of the loss function is represented as follows: wherein, W denotes the training weight; denotes the Euclidean distance between two sample features and , i.e. the similarity distance, denotes the feature dimension of a sample, denotes the label indicating whether two samples are similar, denotes that two samples are similar, denotes that two samples are not similar, m is a set threshold, is the number of samples; When the samples are similar, the loss function is left with i.e. the originally similar samples; And the sample is not similar, the loss function is . 6.The Siamese network-based spatial data retrieval method of claim 1, wherein: In the above step S5, a spatial scene overall similarity measurement prediction model is built using the trained model to reflect the training effect of the model, which uses the same framework design as the training model, wherein the selected model part uses the trained model as the training layer, and outputs the similarity result of the query spatial data and the target data in real time to obtain the trained prediction model.
7. An apparatus for implementing the Siamese network-based spatial data retrieval method according to any one of claims 1-6, characterized in that: It includes the following units: An acquisition and preprocessing unit is configured to acquire sample data or database sample data of the query spatial data and pre-process the data; A scene graph construction unit is configured to construct a spatial scene graph based on the pre-processed data, store the spatial information contained in the corresponding spatial data in the node features in the graph data structure, and store the spatial relationship information between the spatial data in the edge features in the graph data; A similarity measurement training unit is configured to use a Siamese network framework to build a spatial scene overall similarity measurement training model, use the spatial scene graph as the input data sample of the training model, and use two sub-networks sharing the same weight as the training model, so as to determine whether the input data sample is similar or has the same classification score according to the training of the sub-networks; A loss function construction unit is configured to establish a corresponding loss function based on the sample features of the training model, constrain and optimize the training model through the loss function, and obtain a trained model; A spatial data query prediction unit is configured to build a spatial scene overall similarity measurement prediction model based on the trained model, input the query spatial scene data and the database spatial scene data into the prediction model, output the similarity distance between the spatial scenes through the trained prediction model, and then query the most similar spatial scene data.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that: The processor implements the steps of the Siamese network-based spatial data retrieval method according to any one of claims 1-6 when executing the program.
9. A storage medium having stored thereon a computer program, characterized in that: The computer program implements the steps of the Siamese network-based spatial data retrieval method according to any one of claims 1-6 when executed by the processor.
Citation Information
Patent Citations
Point cloud registration model and method combining attention mechanism and three-dimensional graph convolutional network
CN111882593A
Learning system and image retrieval system
JP2019101927A