Gravitational lensing gravitational wave pairing method and system based on deep learning
By using a deep learning-based twin encoder and a generalized cross-correlation-phase transform algorithm, the problems of high cost and false alarm rate in existing technologies are solved, achieving efficient and accurate gravitational wave pairing, which is suitable for real-time early warning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2026-04-10
- Publication Date
- 2026-06-19
AI Technical Summary
Existing gravitational wave pairing methods are computationally expensive, especially prone to false alarms under high redshift or low signal-to-noise ratio conditions, and machine learning methods based on spectrograms have difficulty accurately estimating millisecond-level time delays.
We employ a deep learning-based twin encoder and a generalized cross-correlation-phase transform algorithm. The twin encoder reduces the dimensionality of gravitational wave data and maps it into low-dimensional feature vectors. Cosine similarity is used to screen candidate pairings. The generalized cross-correlation-phase transform algorithm is combined to calculate refined similarity scores and time delays. Finally, the maximum weight matching algorithm is used to obtain the final pairing results.
It effectively identifies amplitude differences between lens images, improves search speed on large-scale datasets, provides reliable time delay estimation, is suitable for real-time or near-real-time early warning, and reduces computational costs.
Smart Images

Figure CN121997078B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of gravitational wave data processing technology, and more specifically, to a deep learning-based gravitational lensing gravitational wave pairing method and system. Background Technology
[0002] Gravitational lensing can cause signals from the same gravitational wave source to produce multiple images. These images arrive at Earth at different times and have different magnifications and phase shifts (such as Morse phase). In gravitational wave astronomy, identifying multiple lensed images belonging to the same source (i.e., "pairing") is crucial. This not only avoids double counting of the same merger event but also allows for the study of the properties and cosmological parameters of lensed objects by measuring time delays and magnification ratios.
[0003] Existing pairing methods typically rely on Bayesian parameter estimation, which compares the overlap of posterior parameter distributions (such as mass, spin, and sky position) of different events. However, this approach is computationally very expensive, and parameter degeneracy can lead to false alarms under conditions of high redshift or low signal-to-noise ratio. Furthermore, spectrogram-based machine learning methods often lose phase information, making it difficult to accurately estimate millisecond-level time delays.
[0004] Therefore, there is an urgent need for an automated pairing scheme that can directly utilize time-domain waveform information, efficiently process large-scale directories, and is insensitive to amplitude differences. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a gravitational lensing gravitational wave pairing method and system based on deep learning.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] A deep learning-based gravitational lensing method for pairing gravitational waves includes the following steps:
[0008] Step S1: Obtain time-series strain data from the gravitational wave detector, perform frequency domain whitening on the data, convert it back to the time domain, and extract a whitened strain segment of fixed length.
[0009] Step S2: Input the whitened strain fragment into the pre-trained Siamese encoder and map it into a low-dimensional feature vector;
[0010] Step S3: Based on the cosine similarity between feature vectors, select several other events with the highest similarity for each gravitational wave event to form a candidate pairing set;
[0011] Step S4: For each pair of events in the candidate pairing set, the generalized cross-correlation-phase transform algorithm is used to calculate its waveform cross-correlation, so as to obtain a refined similarity score and an estimate of the relative time delay between the event pairs.
[0012] Step S5: Construct a weighted graph with gravitational wave events as nodes and refined similarity scores as edge weights. Obtain the final pairing result by solving the maximum weight matching of the graph.
[0013] Furthermore, in step S2, the twin encoder contains two one-dimensional convolutional neural network branches with identical structures and shared weights. Each branch extracts features from the input temporal data through multiple convolutional blocks and pooling layers, and finally outputs a 128-dimensional unit norm feature vector.
[0014] Furthermore, in step S2, the pre-training process of the twin encoder adopts a contrastive learning approach, using a normalized temperature-scaled cross-entropy loss function. Different images generated by the same gravitational wave source through gravitational lensing are used as positive sample pairs, and signals from different gravitational wave sources are used as negative sample pairs for training.
[0015] Furthermore, the expression for the loss function is:
[0016]
[0017] In the formula, and These are the feature vectors output by the projection head of the twin encoder for samples i and j, respectively. Indicates cosine similarity; For temperature parameters; This represents the number of positive sample pairs. For indicator functions, This is the index for all samples in the batch; The first in the batch The feature vector output by the projection head of each sample after passing through the twin encoder;
[0018] By minimizing the loss function, positive sample pairs are brought closer to each other in the feature space, while negative sample pairs are moved further apart.
[0019] Furthermore, in step S4, the generalized cross-correlation-phase transform algorithm is implemented as follows: in the frequency domain, the cross-power spectrum of the two signals is normalized, the cross-correlation sequence is calculated based on the normalized phase information, the peak value of the sequence is used as the refined similarity score, and the peak position is used as the relative time delay estimate between the two events.
[0020] Furthermore, in step S5, the construction process of the weighted graph is as follows:
[0021] All gravitational wave events are viewed as nodes in a graph, with each event corresponding to a unique node in the graph;
[0022] For any two distinct event nodes i and j, obtain the calculated refined similarity score. If the score exceeds a preset threshold λ, an undirected edge is established between node i and node j, and the weight of the edge is set accordingly. Set as If the score does not exceed the threshold λ, then no edge is established between the nodes.
[0023] All nodes and edges that satisfy the conditions together form a weighted undirected graph. ,in For a set of nodes, Let it be the set of edges.
[0024] Furthermore, in step S5, the maximum weight matching algorithm searches for a set of edges in the weighted graph, in which any two edges in the set do not have a common node, and the sum of the weights of the selected edges is maximized.
[0025] This invention also provides a deep learning-based gravitational lensing gravitational wave pairing system, the system comprising:
[0026] The preprocessing module is used to perform whitening, time-domain transformation, and segmentation on the raw time-domain data of the gravitational wave detector.
[0027] The feature mapping module is equipped with a pre-trained Siamese encoder, which is used to convert preprocessed temporal data into low-dimensional feature vectors.
[0028] The coarse screening module is used to calculate the cosine similarity between feature vectors and generate a candidate pairing list containing several most similar events for each event;
[0029] The fine analysis module is used to perform generalized cross-correlation-phase transform calculations on event pairs in the candidate pairing list, and output fine similarity scores and time delay estimates.
[0030] The global decision module is used to construct a weighted graph based on refined similarity scores and execute the maximum weight matching algorithm to output the final gravitational lensing gravitational wave image pairing results.
[0031] The beneficial effects of this invention are:
[0032] 1. By using the generalized cross-correlation-phase transformation algorithm, this invention is insensitive to the amplitude difference (magnification ratio) between lens images and can effectively identify pairing events with huge signal-to-noise ratio differences.
[0033] 2. In this invention, a twin encoder is used to reduce the dimensionality of high-dimensional time-domain data, and a coarse screening strategy is used to avoid full pairwise comparisons of the catalog, which greatly improves the search speed on large-scale datasets.
[0034] 3. Unlike parameter estimation methods based on overlap, this invention extracts time delay directly from waveform correlation. The accuracy depends on the sampling rate, which can provide reliable prior information for subsequent scientific analysis.
[0035] 4. This invention is purely data-driven and does not require expensive Bayesian parameter inference in advance, making it suitable as a real-time or near-real-time early warning tool. Attached Figure Description
[0036] Figure 1 This is a flowchart of a deep learning-based gravitational lensing gravitational wave pairing method in this embodiment.
[0037] Figure 2 This is an architecture diagram of a twin encoder in this embodiment;
[0038] Figure 3 This is a schematic diagram illustrating the principle of the generalized cross-correlation-phase transform algorithm in this embodiment when processing lens signals with time delay and amplitude differences;
[0039] Figure 4 This is a framework diagram of a deep learning-based gravitational lensing gravitational wave pairing system in this embodiment;
[0040] Figure 5 The figure shows the ROC curve of the pairing performance of the deep learning-based gravitational lensing gravitational wave pairing method in this embodiment on a simulated dataset.
[0041] Figure labels: Preprocessing module 1, Feature mapping module 2, Coarse screening module 3, Fine analysis module 4, Global decision module 5. Detailed Implementation
[0042] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0043] A deep learning-based gravitational lensing method for pairing gravitational waves, such as... Figure 1As shown, the method comprises five main stages: First, the raw gravitational wave detector data is whitened and truncated into fixed-length segments; second, the processed segments are input into a twin encoder to obtain low-dimensional feature vectors; then, based on cosine similarity, several most similar candidate pairs are selected for each event; next, a generalized cross-correlation-phase transform algorithm is used to calculate the refined similarity score and time delay for the candidate pairs; finally, a weighted graph is constructed and the maximum weighted match is solved to output the final pairing result. The stages are executed sequentially, effectively reducing the computational load of subsequent refined processing through coarse screening.
[0044] Specifically, such as Figures 1-3 As shown, the method includes the following steps:
[0045] Step S1, Data Acquisition and Preprocessing: Acquire time-series strain data from the gravitational wave detector, which typically contains noise and gravitational wave signals; perform Fourier transform on the acquired data, divide it by the square root of the noise power spectrum in the frequency domain to achieve whitening, thereby suppressing the influence of frequency-related noise; restore the whitened frequency domain data to the time domain signal through inverse Fourier transform, and extract a fixed-length whitened strain segment according to the preset time window length as the input data to be paired.
[0046] Step S2, Feature Embedding: Construct and train a Siamese Encoder based on contrastive learning, and input the whitened strain fragment into the pre-trained Siamese Encoder.
[0047] like Figure 2 As shown, the twin encoder comprises two structurally identical one-dimensional convolutional neural network branches with shared weights. Each branch contains multiple convolutional blocks and pooling layers, enabling progressive compression of the temporal resolution of the input data while extracting deep waveform features. At the network's end, a projection head is used to compress the extracted features into a 128-dimensional unit-norm feature vector (Embedding).
[0048] Through contrastive learning training, the distance between different images (positive sample pairs) generated by the same gravitational wave source through gravitational lensing is shortened in the feature space, while the signals from different gravitational wave sources (negative sample pairs) are pushed further apart. After pre-training, the whitened strain fragment is input into the encoder to generate a corresponding low-dimensional feature vector for each gravitational wave event.
[0049] Step S3, Coarse Screening of Candidate Pairs: Rapid screening is performed using the feature vectors generated in step S2. Specifically:
[0050] Calculate the cosine similarity between all pairwise feature vectors of all events to construct a complete similarity matrix. Then, for each row of the matrix (representing a specific event), retain only the k column indices with the highest similarity values. That is, for each event, only retain the few other events most similar to it, forming a candidate pairing set. In this way, a fully connected dense graph is transformed into a sparse candidate list, thereby reducing the search space and significantly reducing the computational burden of subsequent fine-tuning.
[0051] Step S4, Refined Scoring and Delay Estimation: For each pair of events in the candidate pairing set, the Generalized Cross-Correlation-Phase Transform (GCC-PHAT) algorithm is used in the time domain for processing.
[0052] like Figure 3 As shown, the algorithm first performs a Fourier transform on the time-domain signals of the two events to calculate their cross-power spectrum. Then, it normalizes the amplitude of the cross-power spectrum, retaining only the phase information. Finally, it uses an inverse Fourier transform to convert the phase information back to the time domain, obtaining a cross-correlation sequence. The peak value of this sequence reflects the degree of morphological consistency between the two waveforms and can be used as a refined similarity score; the position of the peak corresponds to an estimate of the relative time delay between the two events. The amplitude normalization operation makes the algorithm completely insensitive to differences in signal amplification caused by the lensing effect.
[0053] By employing a generalized cross-correlation-phase transformation algorithm, the influence of lens magnification differences on waveform amplitude can be eliminated. Pairing is identified solely based on waveform morphology consistency and time delay characteristics, thereby improving the robustness of identifying event pairs with large magnification differences.
[0054] Step S5, Global Graph Matching: Construct a weighted graph with gravitational wave events as nodes and refined similarity scores as edge weights. The final pairing result is obtained by solving the maximum weight matching problem of the graph.
[0055] Specifically, a weighted undirected graph is constructed using all gravitational wave events as nodes and the refined similarity scores calculated in step S4 as edge weights. Only node pairs with similarity scores exceeding a preset threshold λ are connected by edges. Then, the Maximum-Weight Matching algorithm is applied in graph theory to find a set of edges in the graph where no two edges share the same node, and the sum of the weights of these edges is maximized. This ensures that the final pairing results satisfy the "one-to-one" lens image assumption, meaning each event is assigned to at most one matching partner.
[0056] Corresponding to the above methods, this invention also provides a deep learning-based gravitational lensing gravitational wave pairing system, such as... Figure 4As shown, the system includes a preprocessing module 1, a feature mapping module 2, a coarse screening module 3, a fine analysis module 4, and a global decision module 5.
[0057] Among them, the preprocessing module 1 is responsible for whitening, time-domain transformation and segmentation of the raw time-domain data of the gravitational wave detector.
[0058] Feature mapping module 2 is equipped with a pre-trained twin encoder, which is responsible for converting the preprocessed time-domain data into low-dimensional feature vectors.
[0059] The coarse screening module 3 is responsible for calculating the cosine similarity between feature vectors and generating a candidate pairing list containing several most similar events for each event.
[0060] The fine analysis module 4 is responsible for performing generalized cross-correlation-phase transformation calculations on event pairs in the candidate pairing list, and outputting refined similarity scores and time delay estimates.
[0061] The global decision module 5 is responsible for constructing a weighted graph based on the refined similarity score, executing the maximum weight matching algorithm, and outputting the final gravitational lensing gravitational wave image pairing results.
[0062] Example 1: Construction and Training of a Siamese Encoder
[0063] This embodiment describes in detail the specific construction method and training process of the twin encoder.
[0064] In terms of network architecture, a Siamese network with two shared weight branches is designed. The input to each branch is 8 seconds of whitened gravitational wave time-domain data with a sampling rate of 4096 Hz, resulting in an input tensor size of 1 × 32768. The main body of the network structure consists of four downsampling convolutional blocks, each employing a 5-kernel size and a stride of 2 to progressively reduce the temporal resolution of the data and increase the number of feature channels. Following the convolutional blocks, several feature extraction blocks are connected for deep feature abstraction. The final part of the network includes a global average pooling layer to compress the feature map into a feature vector, which is then passed through a projection head composed of multilayer perceptrons to output a 128-dimensional unit-norm feature vector.
[0065] In terms of the training process, the Normalized Temperature Scaling Cross-Entropy Loss (NT-XentLoss) function in contrastive learning was adopted. The training data was constructed as follows: the simulated binary black hole merger signal was processed by the Singular Isothermal Sphere (SIS) lensing model to generate different lens image pairs generated by the same gravitational wave source, which were used as positive samples; signals or non-lens signals from different gravitational wave sources were randomly combined as negative samples.
[0066] For a training batch containing N positive sample pairs (a total of 2N samples), for any positive sample pair Its loss function is defined as:
[0067]
[0068] In the formula, and These are the 128-dimensional feature vectors output by the twin encoder projection head for samples i and j, respectively. Indicates cosine similarity; This is a temperature parameter used to control the concentration of the similarity distribution; in this embodiment, the value is set to 0.07. For indicator functions, when index If the value is not equal to i, the value is 1; otherwise, the value is 0. The first in the batch The feature vector output by the projection head of each sample after passing through the twin encoder; The function represents the natural logarithm (in terms of...) (Based on the bottom).
[0069] The total loss for the entire batch is the arithmetic mean of the losses of all positive sample pairs. By minimizing this total loss using the gradient descent algorithm, the model is trained to bring positive sample pairs from the same source closer together in the feature space, while pushing negative sample pairs from different sources further apart, thereby learning feature representations that are well invariant to lensing effects (such as phase shifts and amplitude changes).
[0070] Example 2: Pairing Search Process Based on Pre-trained Model
[0071] This embodiment describes how to perform actual pairing search using a trained model in a catalog containing M gravitational wave events.
[0072] Step 1, Feature Vector Generation: Input the whitening strain fragments of all M events in the catalog into the Siamese encoder trained in Example 1. After forward propagation of the network, a corresponding 128-dimensional feature vector is generated for each event.
[0073] Step 2, Coarse Screening: Calculate the cosine similarity between each pair of the M feature vectors, forming an M×M similarity matrix. For each row of the matrix (i.e., each event), retain only the 20 column indices with the highest similarity values (i.e., set k=20), ignoring all other combinations with lower similarity, thus forming a sparse candidate list. This step reduces the number of event pairs to be analyzed from... The magnitude was reduced to approximately 20M.
[0074] Step 3, Refined Scoring: For each pair of events in the candidate list, obtain its preprocessed whitening temporal domain data. and And a refined similarity is calculated using the generalized cross-correlation-phase transform algorithm. and This is the fixed-length whitening strain segment output from step S1. The algorithm first performs a Fourier transform on the two whitening time-domain signals to obtain... and Then, the normalized cross-power spectrum is calculated, and finally, the cross-correlation sequence is obtained through inverse Fourier transform. The calculation formula is as follows:
[0075]
[0076] In the formula, Indicates the inverse Fourier transform; and These are two whitening strain segments. and Fourier transform; Indicates complex conjugation; This indicates the modulo operation.
[0077] The denominator in the formula (i.e. It acts as a whitening filter, normalizing the amplitude of the cross-power spectrum to 1, effectively eliminating the influence of the difference in magnification of the gravitational lens on the cross-correlation amplitude, so that the algorithm only focuses on the phase information determined by the time delay.
[0078] After obtaining the cross-correlation sequence Then, within a preset time window, the maximum value of the sequence is found, and this maximum value is used as the refined similarity score of the event pair. and the delay corresponding to the maximum value As an estimate of the relative time delay between two events.
[0079] Step 4, Global Optimization: Construct a weighted graph using all M gravitational wave events as nodes. For any two nodes i and j, if they were selected as candidates in the coarse screening stage and the calculated refined similarity score is... If the weight is greater than a preset threshold λ, then an undirected edge is established between node i and node j, and the edge weight is set accordingly. Set as If the score does not exceed the threshold λ, no edges are created between nodes, and all nodes and edges that meet the conditions together form a weighted undirected graph. ,in For a set of nodes, Let it be the set of edges.
[0080] The maximum weight matching algorithm is applied to this graph to find an edge set such that no two edges in the set have a common node, and the sum of the weights of all edges is maximized. The edge set output by the algorithm corresponds to the final gravitational lensing gravitational wave event pairing result, ensuring that each event appears at most once in the final result.
[0081] Experiments show that, when applied to a mixed test set containing 5000 lens events and 5000 non-lens events, the method can retrieve all correct lens image pairs with 100% accuracy and exhibits good robustness to varying degrees of noise interference. Figure 5 As shown, our method achieves excellent pairing performance on the simulated dataset, with an area under the curve (AUC) close to 1.0.
[0082] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A deep learning-based gravitational lensing gravitational wave pairing method, characterized in that, Includes the following steps: Step S1: Obtain time-series strain data from the gravitational wave detector, perform frequency domain whitening on the data, convert it back to the time domain, and extract a whitened strain segment of fixed length. Step S2: Input the whitened strain fragment into the pre-trained Siamese encoder and map it into a low-dimensional feature vector; Step S3: Based on the cosine similarity between feature vectors, select several other events with the highest similarity for each gravitational wave event to form a candidate pairing set; Step S4: For each pair of events in the candidate pairing set, the generalized cross-correlation-phase transform algorithm is used to calculate its waveform cross-correlation, so as to obtain a refined similarity score and an estimate of the relative time delay between the event pairs. Step S5: Construct a weighted graph with gravitational wave events as nodes and refined similarity scores as edge weights. Obtain the final pairing result by solving the maximum weight matching of the graph.
2. The deep learning-based gravitational lens-gravitational wave pairing method according to claim 1, wherein, In step S2, the twin encoder contains two one-dimensional convolutional neural network branches with identical structures and shared weights. Each branch extracts features from the input temporal data through multiple convolutional blocks and pooling layers, and finally outputs a 128-dimensional unit norm feature vector.
3. The deep learning based gravitational lensing-gravitational wave pairing method according to claim 1, wherein, In step S2, the pre-training process of the twin encoder adopts a contrastive learning approach, using a normalized temperature-scaled cross-entropy loss function. Different images generated by the same gravitational wave source through gravitational lensing are used as positive sample pairs, and signals from different gravitational wave sources are used as negative sample pairs for training.
4. The deep learning-based gravitational lensing gravitational wave pairing method according to claim 3, characterized in that, The expression for the loss function is: In the formula, and These are the feature vectors output by the projection head of the twin encoder for samples i and j, respectively. Indicates cosine similarity; For temperature parameters; This represents the number of positive sample pairs. For indicator functions, This is the index for all samples in the batch; The first in the batch The feature vector output by the projection head of each sample after passing through the twin encoder; By minimizing the loss function, positive sample pairs are brought closer to each other in the feature space, while negative sample pairs are moved further apart.
5. The deep learning based gravitational lensing-gravitational wave pairing method according to claim 1, wherein, In step S4, the generalized cross-correlation-phase transform algorithm is implemented as follows: in the frequency domain, the cross power spectrum of the two signals is normalized, the cross-correlation sequence is calculated based on the normalized phase information, the peak value of the sequence is used as the refined similarity score, and the peak position is used as the relative time delay estimate between the two events.
6. The deep learning based gravitational lens-gravitational wave pairing method according to claim 1, wherein, In step S5, the construction process of the weighted graph is as follows: All gravitational wave events are viewed as nodes in a graph, with each event corresponding to a unique node in the graph; For any two different event nodes i and j, obtain a computed refined similarity score , and if the score exceeds a pre-set threshold λ, then establish an undirected edge between node i and node j, and set the weight of the edge to . If the score does not exceed the threshold λ, then no edge is created between the nodes; All nodes and edges that meet the condition together form a weighted undirected graph wherein is a set of nodes, is a set of edges.
7. The deep learning based gravitational lens-gravitational wave pairing method according to claim 1, wherein, In step S5, the maximum weight matching algorithm searches for a set of edges in the weighted graph, in which no two edges have a common node and the sum of the weights of the selected edges is maximized.
8. A deep learning based gravitational lensing gravitational wave pairing system for implementing the method of claim 1, characterized by, The system includes: The preprocessing module (1) is used to perform whitening, time-domain transformation and segment extraction on the raw time-domain data of the gravitational wave detector; The feature mapping module (2) is equipped with a pre-trained Siamese encoder, which is used to convert the pre-processed temporal data into low-dimensional feature vectors. The coarse screening module (3) is used to calculate the cosine similarity between feature vectors and generate a candidate pairing list containing several most similar events for each event; The fine analysis module (4) is used to perform generalized cross-correlation-phase transformation calculation on event pairs in the candidate pairing list and output fine similarity scores and time delay estimates. A global decision module (5) is configured to construct a weighted graph based on the refined similarity scores and execute a maximum weight matching algorithm to output a final gravitational lensing gravitational wave image pairing result.