Unmanned aerial vehicle GPS spoofing attack detection method and device based on comparative learning and Mama
By comparing the learning and Mamba's dual-branch model, combining time-domain and frequency-domain feature extraction, the problem of strong dependence on labeled samples and low efficiency in long-sequence modeling in UAV GPS spoofing attack detection is solved, and efficient and robust spoofing attack detection is achieved.
Patent Information
- Application Number
- CN202511062065.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-07-31
AI Technical Summary
The existing UAV GPS spoofing attack detection methods have strong dependence on labeled samples, low efficiency in long sequence modeling, and insufficient detection robustness in complex scenarios.
A two-branch model based on comparison learning and Mamba is used to obtain drone GPS navigation data for preprocessing to generate a trajectory subsequence of fixed window length, and convert the data to the time domain and frequency domain. The two-branch Mamba model with shared weights is used for feature extraction, and the spoof scores are calculated in combination with time domain and frequency domain features for attack detection.
Without the need to label large numbers of samples, the accuracy and robustness of detection are improved, the computational complexity is reduced, and it is suitable for real-time detection in complex scenarios.
Smart Images

Figure CN120559680A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of unmanned aerial vehicle (UAV) navigation security monitoring technology, and in particular to a UAV GPS spoofing attack detection method and device based on contrastive learning and Mamba. Background Art
[0002] In recent years, drones have been widely used in fields such as environmental monitoring, logistics distribution, and emergency rescue, and the security of their navigation systems has attracted increasing attention. While the Global Positioning System (GPS), which drones rely on for flight, offers advantages such as global coverage, low power consumption, and strong real-time performance, its weak signal strength and high openness make it highly susceptible to interference, particularly the threat of GPS spoofing attacks. These attacks, by transmitting forged GPS signals, can trick drones into misjudging their current location and flight direction, or even completely control their flight path. This can lead to mission failures, crashes, and even safety hazards, and is highly concealed and dangerous.
[0003] While some current detection methods have achieved promising results, they still face significant limitations when faced with complex terrain environments and emerging attack methods. For one thing, many methods rely on hand-crafted rules or statistical features, lacking adaptability to attack patterns and prone to failure in unstructured or dynamically changing scenarios. Furthermore, detection models based on traditional supervised learning typically require a large number of labeled deception samples for training. However, such samples are difficult to obtain in practice, and attack methods are highly uncertain, limiting the model's generalization ability. Furthermore, GPS navigation data is inherently high-dimensional, multivariate, and long-term dependent time series data. Conventional time series modeling methods, such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), and convolutional neural networks (CNNs), struggle to balance modeling capabilities and computational efficiency, especially under high-frequency sampling conditions, which places significant pressure on real-time processing.
[0004] Therefore, existing technologies have not yet effectively solved the problems of strong dependence on labeled samples, low efficiency in long sequence modeling, and insufficient detection robustness in complex scenarios. Summary of the Invention
[0005] The embodiments of the present invention provide a method and device for detecting GPS spoofing attacks on drones based on contrastive learning and Mamba, so as to solve the problems of existing drone GPS spoofing attack detection solutions, such as strong dependence on labeled samples, low efficiency in long sequence modeling, and insufficient detection robustness in complex scenarios.
[0006] In a first aspect, an embodiment of the present invention provides a method for detecting drone GPS spoofing attacks based on contrastive learning and Mamba, comprising: Obtaining navigation data from the GPS of the UAV, preprocessing the navigation data to generate multiple trajectory subsequences with a fixed window length to obtain initial time domain data, and performing frequency domain conversion processing on the navigation data to obtain initial frequency domain data; Inputting the initial time domain data and the initial frequency domain data into the trained dual-branch Mamba model for feature extraction, and outputting time domain features and frequency domain features; Calculating a deception score based on the time domain features and the frequency domain features, and determining a deception attack behavior detection result based on the deception score; In the dual-branch Mamba model, two branches share weights; the dual-branch Mamba model is trained based on a contrastive learning strategy.
[0007] In a possible implementation, the dual-branch Mamba model includes an instance normalization module, a one-dimensional convolution module, and a Mamba module connected sequentially; The input of the instance normalization module is the initial time domain data and the initial frequency domain data, and the output is the normalized time domain data and frequency domain data; The input of the one-dimensional convolution is the normalized time domain data and frequency domain data, and the output is the intermediate time domain data and intermediate frequency domain data mapped to the required feature dimensions inside the Mamba module; The Mamba module includes a first branch and a second branch with shared weights; wherein the input of the first branch is the intermediate time domain data, and the output is a time domain feature with the same feature dimension as the initial time domain data; the input of the second branch is the intermediate frequency domain data, and the output is a frequency domain feature with the same feature dimension as the initial frequency domain data.
[0008] In one possible implementation, the first branch and the second branch each include: a first RMS normalization module, a linear layer, a SiLU activation, a one-dimensional convolutional layer, a selective state space model, a linear mapping layer, and a second RMS normalization module; The output of the first RMS normalization module is a normalized feature vector; wherein the feature vector is divided into a first part and a second part according to the channel dimension: The first part generates a gating signal through the linear layer and the SiLU activation function; the second part is processed by the linear layer, the one-dimensional convolution layer and the SiLU activation function, and then input into the selective state space model; The output of the selective state space model is multiplied element-by-element by the gate signal to obtain a fusion feature and input it into the linear mapping layer; The output of the linear mapping layer is the target feature after mapping; wherein the target feature has the same feature dimension as the input feature of the first RMS normalization module; The input of the second RMS normalization module is the sum of the target feature and the input feature of the first RMS normalization module.
[0009] In a possible implementation, preprocessing the navigation data to generate a plurality of trajectory subsequences with a fixed window length includes: Normalizing the navigation data to convert the navigation data into a standard normal distribution with a mean of 0 and a variance of 1; A sliding window strategy is used to extract fixed-length trajectory subsequences from the normalized navigation data according to the set length.
[0010] In a possible implementation, performing frequency domain conversion on the navigation data to obtain initial frequency domain data includes: Converting the navigation data from the time domain to the frequency domain using a fast Fourier transform, and extracting amplitude information and phase information; The amplitude information and the phase information are spliced along the channel dimension, and the splicing result is mapped and converted into the same dimension as the navigation data to obtain initial frequency domain data.
[0011] In a possible implementation, the frequency domain conversion processing formula for the navigation data is as follows:
[0012] in, and Represent the amplitude characteristics and phase characteristics respectively, represents the feature representation after amplitude and phase mapping, represents the splicing operation along the channel dimension, and are the weight matrix and bias vector of the linear layer.
[0013] In one possible implementation, the training process of the deception attack detection model includes: Obtain historical navigation data from the UAV GPS, and obtain initial time domain data and initial frequency domain data to construct training samples; Input the initial time domain data and the initial frequency domain data into the initial two-branch Mamba model for feature extraction, and output two branch features: time domain features and frequency domain features; The two branch features are respectively normalized by Softmax and converted into probability distributions. The KL divergence loss function is used to calculate the difference between the probability distributions of the normal navigation trajectory and the spoofing signal in the time domain and frequency domain branches. When the KL divergence loss function is used to calculate the loss of the frequency domain branch, the stopped gradient back propagation operation is used for the time domain features; when the KL divergence loss function is used to calculate the loss of the time domain branch, the stopped gradient back propagation operation is used for the frequency domain features. According to the loss of the frequency domain branch and the loss of the time domain branch, the gradient of the total loss function with respect to each model parameter is transferred to the initial two-branch Mamba model through the back propagation algorithm, and the model parameters are updated using the Adam optimizer until the preset convergence criterion is reached, thereby obtaining a trained two-branch Mamba model.
[0014] In one possible implementation, the KL divergence loss function is as follows:
[0015]
[0016]
[0017] in, and Respectively represent the probability distribution of time domain features and frequency domain features after Softmax normalization, The operation is used to stop the gradient back propagation, ensuring that the two branches learn independently during training. is the KL divergence metric, and are the loss functions of the time domain branch and the frequency domain branch respectively, is the total loss function.
[0018] In a possible implementation, the step of reaching a preset convergence standard includes: Record the network loss value calculated by the total loss function corresponding to each training cycle; When the network loss value corresponding to the consecutive training cycles is less than the minimum historical network loss value, the convergence condition is met.
[0019] In a possible implementation, determining the deception attack behavior detection result according to the deception score includes: If the spoofing score is greater than the set threshold, it is determined that the location corresponding to the spoofing score has a GPS spoofing attack risk.
[0020] In one possible implementation, the cheating score calculation formula is as follows:
[0021] in, and denote the output representations of the time domain and frequency domain branches respectively, The operation is used to stop the gradient back propagation, is the KL divergence metric, is the deception score of the current sample point.
[0022] In a second aspect, an embodiment of the present invention provides a drone GPS spoofing attack detection device based on contrastive learning and Mamba, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the method in the first aspect or any possible implementation of the first aspect.
[0023] In an embodiment of the present invention, the GPS navigation data of the drone is obtained and preprocessed to generate a fixed window trajectory subsequence to obtain initial time domain data, and the frequency domain conversion is performed to obtain initial frequency domain data, which can simultaneously retain the time domain continuity and frequency domain feature information of the navigation data. The shared weight design of the dual-branch Mamba model can ensure that the features learned from the time domain and frequency domain perspectives are consistent, reducing the redundancy of model parameters while improving the stability of feature learning. The dual-branch Mamba model trained based on the contrastive learning strategy can learn the discriminative features of normal and deceptive signals by mining the differences in time domain and frequency domain features without the need for a large number of labeled deceptive samples, and ultimately detect attack behaviors through deception scores, thereby reducing the reliance on manual labels while taking into account the modeling efficiency and detection accuracy of long-sequence navigation data. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a diagram of an application scenario of a drone GPS spoofing attack detection method based on contrastive learning and Mamba provided by an embodiment of the present invention; Figure 2 This is a flowchart of an implementation method for detecting drone GPS spoofing attacks based on contrastive learning and Mamba, provided in an embodiment of the present invention; Figure 3 Schematic diagram of the structure of the dual-branch Mamba model provided by an embodiment of the present invention; Figure 4 Schematic diagram of the structure of the Mamba branch in the dual-branch Mamba model provided by an embodiment of the present invention; Figure 5 1 is a flow chart of frequency domain conversion processing of navigation data provided by an embodiment of the present invention; Figure 6 Schematic diagram of the training process of the deception attack detection model provided by an embodiment of the present invention; Figure 73 is a structural diagram of a UAV GPS spoofing attack detection device based on contrastive learning and Mamba provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] Recently, self-supervised learning methods represented by contrastive learning have shown good performance advantages in the field of anomaly detection. They guide the model to learn discriminative potential features by constructing positive and negative sample pairs, without relying on a large number of labels, and are suitable for scenarios where data samples are scarce. At the same time, the Mamba model, as a new type of state space model (SSM), dynamically adjusts parameters through a selective state space mechanism (Selective SSM), and can efficiently model long sequence data with linear time complexity. It is suitable for application in time series data such as navigation trajectories that have long-distance dependencies and dynamic evolution characteristics. The solution provided in the embodiment of the present application aims to provide a new method that combines a self-supervised contrastive learning strategy with an efficient sequence modeling structure based on contrastive learning and the Mamba structure, so as to improve the accuracy, robustness and real-time performance of GPS spoofing attack detection while reducing label requirements.
[0026] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0027] Figure 1 This is an application scenario diagram of the drone GPS spoofing attack detection method based on contrastive learning and Mamba provided in an embodiment of the present invention. Figure 1 As shown, the drone interacts with the server via a wireless network to exchange GPS navigation data. During this interaction, the signal strength is weak and the openness is high, making it extremely susceptible to human interference, especially the threat of "GPS spoofing attacks." This type of attack induces the drone to misjudge its current position and flight direction by transmitting forged GPS signals, and even achieves complete control over its flight path, which may cause mission failure, crash accidents, and even safety hazards. This application aims to provide a drone GPS spoofing attack detection method based on contrastive learning and Mamba, which performs drone GPS spoofing attack detection on the drone and / or server side to improve drone safety.
[0028] In practice, drone GPS spoofing attack detection increases computational pressure and energy consumption. Therefore, when a drone has limited range or a large workload with limited computing power, detection is primarily performed by the server. In other possible implementations, when the drone is not in a range-sensitive situation and computing power allows, detection can be performed on the drone itself, allowing the drone to make timely flight corrections.
[0029] See also Figure 2, which shows a flowchart of an implementation method for detecting drone GPS spoofing attacks based on contrastive learning and Mamba provided by an embodiment of the present invention, including the following steps: S201, obtain the navigation data of the GPS of the UAV, pre-process the navigation data to generate multiple trajectory subsequences with fixed window lengths to obtain initial time domain data, and perform frequency domain conversion processing on the navigation data to obtain initial frequency domain data.
[0030] The execution entities of each embodiment of the present application can be servers, processors, microprocessors and other devices with data processing functions. In the actual implementation process, the specific implementation method of the execution entity can be selected according to actual needs. This embodiment does not impose any special restrictions on this, as long as it is a device with data processing functions.
[0031] The navigation data from the drone's GPS includes characteristic dimensions such as position, velocity, and heading. When preprocessing the navigation data to generate multiple trajectory subsequences with a fixed window length, these characteristic dimensions are normalized to eliminate the effects of varying data scales.
[0032] The navigation data is converted into frequency domain to obtain initial frequency domain data, which enhances the distinguishability between normal navigation trajectory and deceptive trajectory in feature space.
[0033] S202: Input the initial time domain data and the initial frequency domain data into a trained dual-branch Mamba model for feature extraction, and output time domain features and frequency domain features. The dual-branch Mamba model has two branches that share weights and is trained based on a contrastive learning strategy.
[0034] The dual-branch Mamba architecture combines the differences in time and frequency domain representation to further enhance GPS spoofing attack detection. Through its efficient state-space modeling mechanism and compact feature representation capabilities, it significantly reduces computational complexity while maintaining model expressiveness, making it suitable for real-time modeling of long time series in drone navigation data.
[0035] The two branches of the dual-branch Mamba model share weights. The dual-branch Mamba model aims to perform deep feature extraction on the input GPS navigation subsequence from both the time and frequency domains. The shared weight design ensures consistency in feature representation between the two branches. This model simultaneously captures characteristic patterns of trajectory signals from different perspectives, enabling the model to more comprehensively understand both normal patterns and potential anomalies in navigation data, thereby improving the accuracy and robustness of identifying GPS spoofing attacks.
[0036] Contrastive learning, used to train the two-branch Mamba model for GPS spoofing attack detection, is a self-supervised learning strategy that can mine deep feature representations in data without relying on a large number of labels. Its core idea is to construct pairs of positive and negative examples from different perspectives, enabling the model to learn to identify potential anomalies in navigation trajectories.
[0037] Specifically, for normal drone navigation trajectories, the features extracted from the time and frequency domains are similar due to the consistency of their physical motion. However, for trajectory data subjected to GPS spoofing attacks, the time and frequency domain features often exhibit structural inconsistencies and significant differences. By employing a contrastive learning strategy for training, the model can effectively amplify these feature deviations, making it more sensitive to identifying abnormal trajectory changes.
[0038] S203: Calculate a deception score based on the time domain features and the frequency domain features, and determine a deception attack behavior detection result based on the deception score.
[0039] In this embodiment, the GPS navigation data of the drone is obtained and preprocessed to generate a fixed window trajectory subsequence to obtain the initial time domain data, and the frequency domain conversion is performed to obtain the initial frequency domain data, which can simultaneously retain the time domain continuity and frequency domain feature information of the navigation data. The shared weight design of the dual-branch Mamba model can ensure that the features learned from the time domain and frequency domain perspectives are consistent, reducing the redundancy of model parameters while improving the stability of feature learning. The dual-branch Mamba model trained based on the contrastive learning strategy can learn the discriminative features of normal and deceptive signals by mining the differences in time domain and frequency domain features without the need for a large number of labeled deceptive samples, and finally detect the attack behavior through the deception score, thereby reducing the dependence on manual labels while taking into account the modeling efficiency and detection accuracy of long sequence navigation data.
[0040] In one possible implementation, the dual-branch Mamba model includes a sequentially connected instance normalization module, a one-dimensional convolution module, and a Mamba module, corresponding to Figure 3 Instance Normalization, Convert1D, and MambaBlock are shown in .
[0041] The input of the instance normalization module is the initial time domain data and the initial frequency domain data, and the output is the normalized time domain data and frequency domain data; The input of the one-dimensional convolution module is the normalized time domain data and frequency domain data, and the output is the intermediate time domain data and intermediate frequency domain data mapped to the required feature dimensions inside the Mamba module; The Mamba module includes a first branch and a second branch with shared weights; the first branch inputs intermediate time domain data and outputs time domain features with the same feature dimension as the initial time domain data; the second branch inputs intermediate frequency domain data and outputs frequency domain features with the same feature dimension as the initial frequency domain data.
[0042] In its implementation, the instance normalization module first normalizes the input time and frequency domain data separately. The normalized data is then processed using a one-dimensional convolution module, mapping it to the required feature dimensions within the Mamba module. Finally, the convolutional features are fed into two parallel Mamba branches. These branches utilize a shared weight design to learn representations of the input data from both the time and frequency domain perspectives, ensuring consistent feature representations using the same structure and parameters.
[0043] The input time domain data and frequency domain data are normalized separately by instance normalization, which is defined as follows: Assume that the input data ,in, is the batch size, is the length of the sequence, is the feature number, and its instantiation normalization formula is as follows:
[0044]
[0045]
[0046] in, Representation sample At time step and features The value on Representation sample In Features The mean on Representation sample In Features The standard deviation on Represents the normalized value; Optionally, a one-dimensional convolution module uses a kernel size of 3, a stride of 1, an output dimension of 256, a padding size of 1, and a circular padding method to process edge data. After convolving the input time and frequency domain data, the one-dimensional convolution module outputs intermediate time and frequency domain data mapped to the required feature dimensions within the Mamba module, adapting the data to the Mamba model structure.
[0047] The first and second branches of the Mamba module, which share weights, process the intermediate time domain data and the intermediate frequency domain data, respectively, capturing the deep features of the navigation data from different dimensions and outputting frequency domain features with the same feature dimensions as the initial frequency domain data.
[0048] In this embodiment, the instance normalization module in the dual-branch Mamba model normalizes the initial time-domain and frequency-domain data, eliminating interference from differences in data distribution on feature extraction. The one-dimensional convolution module maps the normalized data to the feature dimensions required by the Mamba module, achieving adaptation of the data to the model structure. The weighted first and second branches, which respectively process the intermediate time-domain and frequency-domain data, ensure that the two branches generate consistent feature representations under the same parameters while capturing deep features of the navigation data from different dimensions. This reduces the number of model parameters while improving the robustness of feature extraction and providing a more reliable feature foundation for subsequent deception attack detection.
[0049] In one possible implementation, the first branch and the second branch each include: a first RMS normalization module, a linear layer, a SiLU activation, a one-dimensional convolutional layer, a selective state space model, a linear mapping layer, and a second RMS normalization module, corresponding to Figure 4 RMSNorm, Linear, SiLU, Conv1D, SSSM (Selective StateSpace Model), Linear Projection Layer and RMSNorm are distributed from left to right.
[0050] The output of the first RMS normalization module is a normalized feature vector; the feature vector is divided into a first part and a second part according to the channel dimension: The first part generates a gating signal through a linear layer and a SiLU activation function; the second part is processed by a linear layer, a one-dimensional convolutional layer, and a SiLU activation function, and then inputs the selective state space model; The output of the selective state space model is element-wise multiplied with the gate signal to obtain the fused feature and input it into the linear mapping layer; The output of the linear mapping layer is the target feature after mapping, wherein the target feature has the same feature dimension as the input feature of the first RMS normalization module; The input of the second RMS normalization module is the sum of the target feature and the input feature of the first RMS normalization module.
[0051] In the specific implementation process, the operation steps of each branch of the Mamba module are as follows: For input features Perform root mean square (RMS) normalization:
[0052] in, is the number of channels of the input feature; To prevent the constant introduced by the division by zero operation, the value is generally set to 1e-5; For the Input features of channels; The normalized eigenvector Divided into two parts along the channel dimension:
[0053] in, Used to generate gating signals, as input to subsequent selective state-space models; Generate a gating signal for the first part of the features through a linear layer and SiLU activation function:
[0054] in, and are the weight matrix and bias of the linear layer respectively; The second part of the features is processed by a linear layer, a one-dimensional convolution layer, and a SiLU activation function, and then passed to the selective state space model as input:
[0055]
[0056]
[0057] in, and is the linear layer parameter; is the convolution kernel size; is the output of the linear layer; for and One-dimensional convolution; Output the selective state space model With the generated gating signal Perform element-by-element multiplication to achieve selective fusion of information:
[0058] The obtained fusion features are processed through a linear mapping layer to map them to the same feature dimension as the input features:
[0059] in, and is the linear mapping layer parameter; The processed features are added to the input features, and the added results are then RMS normalized again to obtain the final output:
[0060] in, is the fusion feature after mapping; is the input feature; is the number of channels of the input feature; To prevent the constant introduced by the division by zero operation, the value is generally set to 1e-5; For the Input features of channels; For the The fused features after mapping; Both the time domain branch and the frequency domain branch adopt the operation steps of the above-mentioned Mamba module and ensure the consistency of feature expression by sharing weights; The selective state space model is defined as follows:
[0061]
[0062]
[0063]
[0064]
[0065] in, is the time step, is the state transition matrix, is the input matrix, is the output matrix, It is a linear transformation layer, which is used to transform the input Dynamically adjust parameters, and is the discretized state transfer matrix and input matrix, is the identity matrix; is hidden state, is the output of the selective state-space model, is the hidden state of the current time step, is the hidden state of the previous time step.
[0066] In practice, the first and second branches of the Mamba module perform the aforementioned data processing on time-domain data and frequency-domain data, respectively. The two branches can process time-domain and frequency-domain data in parallel, improving data processing efficiency and accuracy.
[0067] In this embodiment, the first RMS normalization module within the first branch and the second branch can normalize the input features and stabilize the training process. The feature vector is divided into two parts and processed separately, where the gating signal generated by the first part is multiplied element-by-element with the output of the selective state space model, which can achieve selective fusion of information and highlight key features. The second part is processed by the linear layer, the one-dimensional convolution layer and the SiLU activation function and then input into the selective state space model, which can efficiently model the time dependency of long sequence data. The linear mapping layer ensures that the output features are consistent with the input feature dimensions, which facilitates subsequent comparative learning. The second RMS normalization module further optimizes the feature distribution, ultimately enabling the two branches to accurately capture subtle feature differences in time domain and frequency domain data, and improve the ability to identify complex deception attacks.
[0068] The previous section focused on the specific process of inputting initial time-domain and frequency-domain data into the dual-branch Mamba model for feature extraction, and then outputting time-domain and frequency-domain features. The following section describes the preprocessing of drone GPS navigation data to obtain initial time-domain and frequency-domain data.
[0069] In one possible implementation, the navigation data is preprocessed to generate multiple trajectory subsequences with fixed window lengths, including: Normalize the navigation data and convert it into a standard normal distribution with a mean of 0 and a variance of 1; A sliding window strategy is used to extract fixed-length trajectory subsequences from the normalized navigation data according to the set length.
[0070] The navigation data is standardized and converted into a standard normal distribution with a mean of 0 and a variance of 1 to eliminate the influence of different data scales.
[0071] Optionally, the fixed set length corresponding to the sliding window strategy is 100, and the window sliding step is 1. The sliding window strategy is used to extract fixed-length trajectory subsequences from the normalized navigation data according to the set length to ensure the continuity of subsequent subsequence data and cover the entire sequence.
[0072] The process of extracting fixed-length subsequences using the sliding window strategy is as follows: Assume that the navigation sequence corresponding to the original navigation data is , the window length is L, the sliding step is s, then the sub-trajectory sequence data is obtained at time t after segmentation Expressed as: .
[0073] In this embodiment, the navigation data is normalized to a standard normal distribution with a mean of 0 and a variance of 1. This eliminates scale differences across feature dimensions and prevents a single feature from dominating model learning due to its excessively large numerical range. A sliding window strategy is employed to extract fixed-length trajectory subsequences, ensuring their continuity and complete coverage of the original navigation sequence. This allows the model to learn the temporal correlations of the navigation data, providing consistent and continuous input data for subsequent time-frequency domain feature extraction and attack detection, improving the model's ability to model dynamic navigation processes.
[0074] Figure 5 FIG. 1 is a flow chart of frequency domain conversion processing of navigation data provided by an embodiment of the present invention. Figure 5 As shown, in a possible implementation, performing frequency domain conversion processing on the navigation data to obtain initial frequency domain data includes: The navigation data is converted from the time domain to the frequency domain using fast Fourier transform, and the amplitude and phase information are extracted; The amplitude information and phase information are spliced along the channel dimension, and the spliced result is mapped and converted to the same dimension as the navigation data to obtain the initial frequency domain data.
[0075] The formula for fast Fourier transform is as follows:
[0076] in, Represents the nth sampling value of the time domain signal, represents the corresponding frequency domain coefficient, is the total number of signal sampling points, Is an imaginary unit.
[0077] Since the frequency domain data is represented in complex form, it cannot be directly used for neural network training. It is necessary to extract the amplitude and phase information of the frequency domain data. The calculation formulas for amplitude and phase are as follows:
[0078]
[0079] in, is the amplitude characteristic, Phase characteristics.
[0080] Using a linear layer (such as Figure 5The linear matrix (Linear) concatenates the amplitude and phase information along the channel dimension, maps the concatenated result into the same dimension as the navigation data, and converts it into real number form to adapt to the neural network input.
[0081] In one possible implementation, the frequency domain conversion formula for the navigation data is as follows:
[0082] in, and Represent the amplitude characteristics and phase characteristics respectively, represents the feature representation after amplitude and phase mapping, represents the splicing operation along the channel dimension, and are the weight matrix and bias vector of the linear layer.
[0083] This formula achieves the fusion of two key types of information in the frequency domain by concatenating amplitude and phase features along the channel dimension. The concatenated result is then mapped into a target feature representation using the weight matrix and bias vector of the linear layer, ensuring that the mapped frequency domain features align with the dimensions of the original navigation data and directly adapt to the input requirements of the subsequent two-branch Mamba architecture. This operation also effectively preserves the inherent correlation between amplitude and phase features, allowing frequency domain features to more accurately reflect the characteristics of navigation data. This provides a reliable foundation for comparative learning with time domain features, further enhancing the model's sensitivity to spoofing signals.
[0084] In this embodiment, the navigation data is converted from the time domain to the frequency domain using a fast Fourier transform (FFT). This exploits frequency features that are difficult to visualize in the time domain, supplementing the characteristic dimensions of the navigation data. Amplitude and phase information is extracted and concatenated along the channel dimension, preserving the key information of the frequency domain features. The concatenated results are mapped to the same dimension as the navigation data. This ensures that the frequency domain features can be directly input into the dual-branch Mamba model and enables collaborative modeling of time and frequency domain features. Multi-perspective feature fusion enhances the distinction between legitimate navigation trajectories and spoofing trajectories, thereby improving detection accuracy.
[0085] The above embodiments introduce the acquisition of initial time domain data and initial frequency domain data, and the extraction of time domain features and frequency domain features from the initial time domain data and initial frequency domain data. The following describes the training process of the dual-branch Mamba model.
[0086] In one possible implementation, the training process of the two-branch Mamba model includes: Obtain historical navigation data from the UAV GPS, and obtain initial time domain data and initial frequency domain data to construct training samples; Input the initial time domain data and the initial frequency domain data into the initial two-branch Mamba model for feature extraction, and output two branch features: time domain features and frequency domain features; The two branch features are respectively normalized by Softmax and converted into probability distributions. The KL divergence loss function is used to calculate the difference between the probability distributions of the normal navigation trajectory and the spoofing signal in the time domain and frequency domain branches. When the KL divergence loss function is used to calculate the loss of the frequency domain branch, the stopped gradient back propagation operation is used for the time domain features; when the KL divergence loss function is used to calculate the loss of the time domain branch, the stopped gradient back propagation operation is used for the frequency domain features. According to the loss of the frequency domain branch and the loss of the time domain branch, the gradient of the total loss function with respect to each model parameter is transferred to the initial two-branch Mamba model through the back propagation algorithm, and the model parameters are updated using the Adam optimizer until the preset convergence standard is reached, thus obtaining a trained two-branch Mamba model.
[0087] Combine Figure 6 The flowchart shown is as follows: historical UAV GPS navigation data is obtained, and data preprocessing is performed to obtain training samples to avoid excessive noise data in the samples and improve the accuracy of model training. For each training sample, time domain data and frequency domain data are first obtained through the frequency domain feature extraction module, and input into the dual-branch Mamba model to generate corresponding feature representations through the time domain branch and the frequency domain branch respectively; then, the features of the two branches are normalized by Softmax and converted into probability distributions, and the KL divergence loss function is used to calculate the difference between the normal navigation trajectory and the deception signal in the time domain and frequency domain branch output probability distributions. Among them, when calculating the contrast loss, the gradient of one of the branches is subjected to the stop backpropagation operation (i.e. Figure 6 ) to ensure that the two branches can learn independently during training, thereby avoiding gradient interference; finally, the gradient of the total loss function with respect to each model parameter is transferred to the two-branch Mamba model through the backpropagation algorithm, and the model parameters are updated using the Adam optimizer until the preset convergence criteria are reached.
[0088] In this embodiment, historical navigation data is used to construct training samples, fully exploring the characteristic patterns of normal and deceptive navigation patterns. The time and frequency domain features extracted by the dual-branch Mamba structure are converted into probability distributions after Softmax normalization, and the difference between the two feature distributions can be accurately measured using the KL divergence loss function. When calculating the loss, stopping the gradient backpropagation operation on one of the branches can avoid gradient interference between the two branches, ensuring that each branch independently learns the unique characteristics of the time and frequency domains. In combination with the total loss function, the Adam optimizer is used to update the parameters, effectively adjusting the model parameters until convergence. This allows the model to fully learn the distinguishing characteristics of normal and deceptive signals without the need for a large number of labeled samples, thereby improving the generalization ability and convergence efficiency of the detection model.
[0089] In one possible implementation, the KL divergence loss function is as follows:
[0090]
[0091]
[0092] in, and Respectively represent the probability distribution of time domain features and frequency domain features after Softmax normalization, The operation is used to stop the gradient back propagation, ensuring that the two branches learn independently during training. is the KL divergence metric, and are the loss functions of the time domain branch and the frequency domain branch respectively, is the total loss function.
[0093] In one possible implementation, until a preset convergence criterion is reached, the steps include: Record the network loss value calculated by the total loss function corresponding to each training cycle; When the network loss value corresponding to the consecutive training cycles is less than the minimum historical network loss value, the convergence condition is met.
[0094] Optionally, the number of training cycles is set to 3 to 8. Optionally, when the network loss value corresponding to 5 consecutive training cycles is less than the minimum historical network loss value, it is determined that the convergence condition is met and training is stopped to avoid overfitting of the model and determine the convergence state.
[0095] In this embodiment, the preset convergence criteria clarify the termination conditions for model training, preventing undertraining from leading to poor model performance or overtraining from causing overfitting. By setting criteria such as the loss function remaining stable within a preset range and reaching a maximum number of iterations, the model can maintain good generalization capabilities while learning sufficiently. This allows the trained model to be stably and reliably applied in actual drone GPS spoofing attack detection scenarios, ensuring consistent detection performance.
[0096] In one possible implementation, determining a deception attack behavior detection result based on a deception score includes: If the spoofing score is greater than the set threshold, it is determined that the location corresponding to the spoofing score has the risk of GPS spoofing attack.
[0097] In this embodiment, the attack detection result is determined by comparing the spoofing score with a set threshold, making the spoofing attack determination process quantitative and clear. When the spoofing score exceeds the set threshold, the risk of a GPS spoofing attack is determined. This mechanism can intuitively reflect the degree of abnormality in the current navigation data based on the degree of difference in the time-frequency branch characteristics, avoiding ambiguous judgments, improving the reliability and interpretability of detection results, and facilitating the drone navigation system to quickly respond to potential attacks.
[0098] In one possible implementation, the cheating score calculation formula is as follows:
[0099] in, and denote the output representations of the time domain and frequency domain branches respectively, The operation is used to stop the gradient back propagation, is the KL divergence metric, is the deception score of the current sample point.
[0100] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0101] The following are device embodiments of the present invention. For details not fully described therein, reference may be made to the corresponding method embodiments described above.
[0102] Figure 7 The following is a schematic diagram of the structure of a UAV GPS spoofing attack detection device based on contrastive learning and Mamba according to an embodiment of the present invention. For ease of explanation, only the parts related to the embodiment of the present invention are shown, which are detailed as follows: like Figure 7As shown, the drone GPS spoofing attack detection device 7 based on contrastive learning and Mamba includes: The data preprocessing module 701 is used to obtain the navigation data of the UAV GPS, preprocess the navigation data to generate multiple trajectory subsequences with a fixed window length to obtain initial time domain data, and perform frequency domain conversion on the navigation data to obtain initial frequency domain data; The feature extraction module 702 is used to input the initial time domain data and the initial frequency domain data into the trained two-branch Mamba model for feature extraction, and output the time domain features and the frequency domain features; Detection module 703, configured to calculate a deception score based on the time domain features and the frequency domain features, and determine a deception attack behavior detection result based on the deception score; Among them, the two branches in the two-branch Mamba model share weights; the two-branch Mamba model is trained based on the contrastive learning strategy.
[0103] In a possible implementation, the data preprocessing module 701 is specifically configured to: Normalize the navigation data and convert it into a standard normal distribution with a mean of 0 and a variance of 1; A sliding window strategy is used to extract fixed-length trajectory subsequences from the normalized navigation data according to the set length.
[0104] In a possible implementation, the data preprocessing module 701 is specifically configured to: The navigation data is converted from the time domain to the frequency domain using fast Fourier transform, and the amplitude and phase information are extracted; The amplitude information and phase information are spliced along the channel dimension, and the spliced result is mapped and converted to the same dimension as the navigation data to obtain the initial frequency domain data.
[0105] In a possible implementation, a training module is further included, configured to: Obtain historical navigation data from the UAV GPS, and obtain initial time domain data and initial frequency domain data to construct training samples; Input the initial time domain data and the initial frequency domain data into the initial two-branch Mamba model for feature extraction, and output two branch features: time domain features and frequency domain features; The two branch features are respectively normalized by Softmax and converted into probability distributions. The KL divergence loss function is used to calculate the difference between the probability distributions of the normal navigation trajectory and the spoofing signal in the time domain and frequency domain branches. When the KL divergence loss function is used to calculate the loss of the frequency domain branch, the stopped gradient back propagation operation is used for the time domain features; when the KL divergence loss function is used to calculate the loss of the time domain branch, the stopped gradient back propagation operation is used for the frequency domain features. According to the loss of the frequency domain branch and the loss of the time domain branch, the gradient of the total loss function with respect to each model parameter is transferred to the initial two-branch Mamba model through the back propagation algorithm, and the model parameters are updated using the Adam optimizer until the preset convergence standard is reached, thus obtaining a trained two-branch Mamba model.
[0106] Embodiments of the present invention also provide a drone GPS spoofing attack detection device based on contrastive learning and Mamba, comprising a memory and a processor. The memory stores a computer program, and the processor, when executing the computer program, implements the method described in the above method embodiment. For example, the drone GPS spoofing attack detection device based on contrastive learning and Mamba can be a server, a laptop computer, or the like, without limitation herein.
[0107] In the above embodiments, the descriptions of each embodiment have their own focus. For parts not described or recorded in detail in one embodiment, please refer to the relevant descriptions of other embodiments. Unless otherwise specified or there is a logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other. The technical features of different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0108] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A drone GPS spoofing attack detection method based on contrastive learning and Mamba, characterized by: include: Obtaining navigation data from the GPS of the UAV, preprocessing the navigation data to generate multiple trajectory subsequences with a fixed window length to obtain initial time domain data, and performing frequency domain conversion processing on the navigation data to obtain initial frequency domain data; Inputting the initial time domain data and the initial frequency domain data into the trained dual-branch Mamba model for feature extraction, and outputting time domain features and frequency domain features; Calculating a deception score based on the time domain features and the frequency domain features, and determining a deception attack behavior detection result based on the deception score; In the dual-branch Mamba model, two branches share weights; the dual-branch Mamba model is trained based on a contrastive learning strategy.
2. The UAV GPS spoofing attack detection method based on contrastive learning and Mamba according to claim 1 is characterized in that: The dual-branch Mamba model includes a sequentially connected instance normalization module, a one-dimensional convolution module and a Mamba module; The input of the instance normalization module is the initial time domain data and the initial frequency domain data, and the output is the normalized time domain data and frequency domain data; The input of the one-dimensional convolution is the normalized time domain data and frequency domain data, and the output is the intermediate time domain data and intermediate frequency domain data mapped to the required feature dimensions inside the Mamba module; The Mamba module includes a first branch and a second branch with shared weights; wherein the input of the first branch is the intermediate time domain data, and the output is a time domain feature with the same feature dimension as the initial time domain data; the input of the second branch is the intermediate frequency domain data, and the output is a frequency domain feature with the same feature dimension as the initial frequency domain data.
3. The method for detecting UAV GPS spoofing attacks based on contrastive learning and Mamba according to claim 2 is characterized in that: The first branch and the second branch each include: a first RMS normalization module, a linear layer, a SiLU activation, a one-dimensional convolutional layer, a selective state space model, a linear mapping layer, and a second RMS normalization module; The output of the first RMS normalization module is a normalized feature vector; wherein the feature vector is divided into a first part and a second part according to the channel dimension: The first part generates a gating signal through the linear layer and the SiLU activation function; the second part is processed by the linear layer, the one-dimensional convolution layer and the SiLU activation function, and then input into the selective state space model; The output of the selective state space model is multiplied element-by-element by the gate signal to obtain a fusion feature and input it into the linear mapping layer; The output of the linear mapping layer is the target feature after mapping; wherein the target feature has the same feature dimension as the input feature of the first RMS normalization module; The input of the second RMS normalization module is the sum of the target feature and the input feature of the first RMS normalization module.
4. The method for detecting UAV GPS spoofing attacks based on contrastive learning and Mamba according to claim 1 is characterized in that: The preprocessing of the navigation data to generate a plurality of trajectory subsequences of fixed window lengths includes: Normalizing the navigation data to convert the navigation data into a standard normal distribution with a mean of 0 and a variance of 1; A sliding window strategy is used to extract fixed-length trajectory subsequences from the normalized navigation data according to the set length.
5. The method for detecting UAV GPS spoofing attacks based on contrastive learning and Mamba according to claim 1 is characterized in that: The performing frequency domain conversion processing on the navigation data to obtain initial frequency domain data includes: Converting the navigation data from the time domain to the frequency domain using a fast Fourier transform, and extracting amplitude information and phase information; The amplitude information and the phase information are spliced along the channel dimension, and the splicing result is mapped and converted into the same dimension as the navigation data to obtain initial frequency domain data.
6. The method for detecting UAV GPS spoofing attacks based on contrastive learning and Mamba according to claim 5 is characterized in that: The frequency domain conversion formula for the navigation data is as follows: in, and Represent the amplitude characteristics and phase characteristics respectively, represents the feature representation after amplitude and phase mapping, represents the splicing operation along the channel dimension, and are the weight matrix and bias vector of the linear layer.
7. The method for detecting UAV GPS spoofing attacks based on contrastive learning and Mamba according to claim 1, characterized in that: Determining the deception attack behavior detection result according to the deception score includes: If the spoofing score is greater than the set threshold, it is determined that the location corresponding to the spoofing score has a GPS spoofing attack risk.
8. The method for detecting UAV GPS spoofing attacks based on contrastive learning and Mamba according to claim 1, characterized in that: The training process of the dual-branch Mamba model includes: Obtain historical navigation data from the UAV GPS, and obtain initial time domain data and initial frequency domain data to construct training samples; Input the initial time domain data and the initial frequency domain data into the initial two-branch Mamba model for feature extraction, and output two branch features: time domain features and frequency domain features; The two branch features are respectively normalized by Softmax and converted into probability distributions. The KL divergence loss function is used to calculate the difference between the probability distributions of the normal navigation trajectory and the spoofing signal in the time domain and frequency domain branches. When the KL divergence loss function is used to calculate the loss of the frequency domain branch, the stopped gradient back propagation operation is used for the time domain features; when the KL divergence loss function is used to calculate the loss of the time domain branch, the stopped gradient back propagation operation is used for the frequency domain features. According to the loss of the frequency domain branch and the loss of the time domain branch, the gradient of the total loss function with respect to each model parameter is transferred to the initial two-branch Mamba model through the back propagation algorithm, and the model parameters are updated using the Adam optimizer until the preset convergence criterion is reached, thereby obtaining a trained two-branch Mamba model.
9. The method for detecting UAV GPS spoofing attacks based on contrastive learning and Mamba according to claim 8, characterized in that: The method of reaching a preset convergence standard includes: Record the network loss value calculated by the total loss function corresponding to each training cycle; When the network loss value corresponding to the consecutive training cycles is less than the minimum historical network loss value, the convergence condition is met.
10. A drone GPS spoofing attack detection device based on contrastive learning and Mamba, characterized by: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Fraud behavior detection method based on multi-model fusion
CN111461784A
Unmanned aerial vehicle positioning deception detection method and system
CN117197692A
Multivariable time sequence classification method and system based on time-frequency mixed contrast learning
CN118097306A
Super-resolution processing method of remote sensing image and related equipment
CN118761907A
Equipment anomaly detection method and system based on time-frequency characteristic interaction
CN119106379A
Cited By
Power battery fault detection method based on frequency domain intensity contrast learning Mama
CN121188504A
Double-branch deep neural network uncertainty evaluation method
CN121388517A