A general intrusion detection method for heterogeneous unmanned aerial vehicles
By combining a multi-layer Transformer encoder with time-series feature engineering and feature importance analysis, the problem of insufficient adaptability of traditional intrusion detection systems in heterogeneous UAV environments is solved, and efficient identification and cross-platform detection of heterogeneous UAV network attacks are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG UNIV OF TECH
- Filing Date
- 2025-08-22
- Publication Date
- 2026-05-15
AI Technical Summary
Traditional machine learning-based intrusion detection systems lack adaptability and robustness in heterogeneous drone environments, struggle to operate stably on unseen platforms or with different data distributions, and are unable to effectively identify network attacks.
A multi-layer Transformer encoder combined with time series feature engineering is adopted. By extracting timestamp decomposition features, time-derived features and periodic features from UAV sensor data, a unified feature matrix is constructed. Then, random forest and gradient boosting tree models are used to calculate feature importance and train the multi-layer Transformer encoder for intrusion detection.
It improves the model's ability to perceive the temporal semantics of attack patterns, accurately identifies attack behaviors on unseen drone types, has cross-platform detection capabilities, and enhances detection accuracy and generalization performance.
Smart Images

Figure CN120956499B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of unmanned aerial vehicle (UAV) cybersecurity, and in particular to a general intrusion detection method for heterogeneous UAVs. Background Technology
[0002] With the widespread deployment of drones in agricultural inspection, logistics transportation, disaster response, and urban air traffic, their network communication systems are gradually exhibiting characteristics of heterogeneity, high dynamism, and high dependence. However, this open, wireless communication structure also exposes serious security vulnerabilities, such as GPS spoofing, signal interference, and denial-of-service (DoS) attacks. These attacks can not only lead to mission failures but may even cause drones to go out of control, veer off course, or crash, seriously threatening the safety and stability of urban airspace operations.
[0003] While traditional machine learning-based intrusion detection systems (IDS) demonstrate high recognition performance in experimental environments, their adaptability and robustness in real-world heterogeneous drone environments are severely lacking due to a lack of ability to model statistical differences between different drone platforms. Therefore, improving the "generalization capability" of intrusion detection systems—enabling them to operate stably even on unseen platforms or with different data distributions—has become a core issue that urgently needs to be addressed to ensure the cybersecurity of drone systems. Summary of the Invention
[0004] The purpose of this invention is to solve the diverse network attack problems faced by heterogeneous drones in urban air traffic systems, and to propose a general intrusion detection method for heterogeneous drones.
[0005] To achieve the above objectives, the technical solution provided by this invention is as follows:
[0006] A general intrusion detection method for heterogeneous unmanned aerial vehicles (UAVs) includes:
[0007] Acquire drone sensor data to obtain the raw dataset, and preprocess the raw dataset to obtain the preprocessed dataset;
[0008] Extract timestamp decomposition features, time-derived features, and periodic features from each sample in the preprocessed dataset;
[0009] A unified feature matrix is constructed based on the original dataset, the timestamp decomposition features of each sample, time-derived features, and periodic features;
[0010] Labels are added to the unified feature matrix to obtain the complete feature dataset, and the complete feature dataset is divided to obtain the training set;
[0011] The feature importance is calculated based on the unified feature matrix to obtain the feature sequence;
[0012] A multi-layer Transformer encoder is constructed. The feature sequence is input into the multi-layer Transformer encoder to obtain the temporal context representation sequence. The temporal context representation sequence is aggregated to obtain an aggregate vector. The attack probability is calculated based on the aggregate vector.
[0013] A multi-layer Transformer encoder is trained using the binary cross-entropy loss function to obtain a trained multi-layer Transformer encoder.
[0014] The sample to be detected is input into a trained multi-layer Transformer encoder to obtain the probability of whether it is an attack.
[0015] Furthermore, the preprocessing of the original dataset includes:
[0016] The original dataset includes malicious original datasets and benign original datasets;
[0017] Samples in the malicious original dataset are marked as attacks, and samples in the benign original dataset are marked as benign.
[0018] The malicious and benign original datasets are merged and then sorted according to timestamps.
[0019] Furthermore, the extraction of timestamp decomposition features, time-derived features, and periodic features from samples in the preprocessed dataset includes:
[0020] Decompose timestamp data into timestamp decomposition features;
[0021] Extract time-derived features, including:
[0022] Calculate the relative offset of the current accelerometer sample recording time with respect to the takeoff timestamp;
[0023] Calculate the integral time interval between two consecutive accelerometer readings;
[0024] Calculate the accelerometer limit;
[0025] Calculate the integral time interval between two consecutive frames of gyroscope readings;
[0026] Calculate the time difference between consecutive samples;
[0027] Extracting periodic features, including:
[0028] Calculate the current running time based on the current timestamp and takeoff timestamp;
[0029] Calculate the sine minute and cosine minute based on the current running time in minutes.
[0030] Furthermore, the step of calculating feature importance based on the unified feature matrix to obtain the feature sequence includes:
[0031] The importance of features is calculated based on the unified feature matrix to obtain the set of features with zero importance;
[0032] Remove the set of zero-importance features from the unified feature matrix, and arrange the remaining feature vectors in the unified feature matrix into a sequence according to timestamp order;
[0033] Positional encoding is added to the feature vectors in the sequence to obtain the feature sequence.
[0034] Furthermore, the step of calculating feature importance based on the unified feature matrix to obtain a set of zero-importance features includes:
[0035] A random forest model and a gradient boosting tree model are trained using the current unified feature matrix, and feature importance scores of the training set are calculated based on the random forest model and the gradient boosting tree model, respectively.
[0036] In both the random forest and gradient boosting tree models, features with a feature importance score of zero are considered zero-importance features. The set of zero-importance features is obtained based on the feature importance scores of all features.
[0037] Furthermore, the calculation of feature importance scores for the training set based on the random forest model and the gradient boosting tree model respectively includes:
[0038] The formula for calculating feature importance score is as follows:
[0039]
[0040]
[0041] in, This represents the first value calculated based on a random forest model or a gradient boosting tree model. Features Importance score , This represents the random forest model. This represents a gradient boosting tree model. This represents all trees in a random forest model or gradient boosting tree model that are named after the first tree. Features A set of split nodes;
[0042] For the random forest model:
[0043]
[0044]
[0045] in, Indicates impurity. It is the first The proportion of class samples in the training set. This indicates two categories: benign and malicious. Indicates the first The node uses the first Features The reduction in Gini impurity resulting from the partition, i.e., the amount of Gini impurity of the current feature at the [number]th [node]. Information gain at each node Represents the training set, , This represents the left and right subsets after the training set has been divided. This indicates the number of samples in the left subset. This indicates the number of samples in the right subset. Indicates the number of samples in the training set;
[0046] Will Substitute the values and calculate the feature importance score;
[0047] For gradient boosting tree models:
[0048]
[0049]
[0050] in, Indicates the current node Use the Features The decrease in the loss function after partitioning. This represents the loss function value on the training set. This represents the loss function value on the left subset after the training set has been split. This represents the loss function value on the right subset after the training set has been split. Represents a set The loss function value on, This represents the set of samples corresponding to the current partition node. Represents a set The number of samples in the middle Indicates the first The feature vector of each sample Indicates the first The true labels for each sample are: 1 indicates an attack, and 0 indicates a benign attack. This indicates that the gradient boosting tree model applies to samples. The predicted attack probability;
[0051] Will Substitute the values and calculate the feature importance score.
[0052] Furthermore, the multi-layer Transformer encoder includes multiple Transformer encoder layers, each Transformer encoder layer including a multi-head self-attention layer, a residual connection layer and a feedforward fully connected layer, the feedforward fully connected layer including two linear layers and an activation function.
[0053] Furthermore, the step of inputting the feature sequence into a multi-layer Transformer encoder to obtain a temporal context representation sequence includes:
[0054] The feature sequence is input into a multi-layer Transformer encoder. The operation of each Transformer encoder layer is as follows:
[0055] Each head of the multi-head self-attention layer calculates its attention score and generates an attention-weighted output. The outputs of all heads in the multi-head self-attention layer are concatenated and multiplied with the output transformation matrix to obtain the output of the multi-head self-attention layer.
[0056] The residual connection layer connects the input and output of the multi-head self-attention layer and normalizes the input, as expressed by the formula:
[0057]
[0058] in, This represents the normalized output after the residual connection. Indicates the normalization layer. This represents the output of the multi-head self-attention layer. Represents a characteristic sequence;
[0059] Feature enhancement is performed using two linear layers and an activation function, expressed by the following formula:
[0060]
[0061]
[0062] in, Indicates a feedforward fully connected layer. This represents the weight matrix of the first linear layer in the feedforward fully connected layer. This represents the bias of the first linear layer in the feedforward fully connected layer. This represents the activation function. This represents the weight matrix of the second linear layer in the feedforward fully connected layer. This represents the bias of the second linear layer in the feedforward fully connected layer. This represents the temporal context representation sequence of the output of a multi-layer Transformer encoder.
[0063] Furthermore, the calculation of the attack probability based on the aggregated vector is expressed by the formula:
[0064]
[0065] in, This represents the sigmoid function. Indicates the bias term. This indicates the probability of a predicted attack. This represents the parameter matrix to be learned. This represents an aggregate vector.
[0066] Furthermore, a cross-validation training strategy is adopted:
[0067] The training phase uses a combination of simulated and real-time data for training, and the testing phase uses real-time data for testing.
[0068] Alternatively, data from multiple different drone platforms can be used for training and testing during the training and testing phases.
[0069] Compared with existing technologies, the significant advantages of this invention are as follows: (1) This invention introduces a model-independent time series feature engineering method in its algorithm design. By extracting deep-level time features such as periodic features (minute_sin, minute_cos), time difference (time_diff), and elapsed time from the original sensor timestamps, it effectively enhances the model's ability to perceive the temporal semantics of attack patterns, enabling the model to accurately identify attack behaviors from temporal changes and to detect UAV (Unmanned Aerial Vehicle) types not present in the training set. (2) This invention adopts the Transformer model while considering the temporal semantic features of the data. In terms of training strategy, two multi-stage cross-validation mechanisms are designed to systematically evaluate the model's cross-environment and cross-platform detection capabilities in two scenarios: "combined data training + pure real-time data testing" and "partial UAV platform training + new platform testing". This further improves the detection accuracy and generalization performance. Attached Figure Description
[0070] Figure 1 This is a flowchart of a general intrusion detection method for heterogeneous unmanned aerial vehicles (UAVs) according to the present invention. Detailed Implementation
[0071] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0072] This invention provides a general intrusion detection method for heterogeneous unmanned aerial vehicles (UAVs), such as... Figure 1 As shown, it includes the following steps:
[0073] (1) Data preprocessing: The collected UAV sensor data is initially cleaned and sorted, key features are extracted, and the data is labeled according to whether it is an attack, so as to obtain a preprocessed dataset.
[0074] (1-1) Loading and sorting data:
[0075] First, multiple sensor datasets (raw datasets) related to malicious and benign data from the drone are loaded. These raw datasets include both malicious and benign raw datasets. Samples from both datasets are then sorted by timestamps to ensure temporal consistency. The features of the sensor datasets are shown in Table 1. This step helps provide time-meaningful structured data for subsequent analysis.
[0076] Table 1 Features of the original dataset
[0077] feature describe nature x-axis acceleration Acceleration along the x-axis (m / s²) Sensor characteristics y-axis acceleration Acceleration along the y-axis (m / s²) Sensor characteristics z-axis acceleration Acceleration along the z-axis (m / s²) Sensor characteristics x-axis gyroscope offset Angular velocity about the x-axis (rolling) Sensor characteristics y-axis gyroscope offset Angular velocity about the y-axis (pitch) Sensor characteristics z-axis gyroscope offset Angular velocity about the z-axis (yaw) Sensor characteristics Departure time Start time of flight session Sensor characteristics Timestamp Second-level timestamp Sensor characteristics
[0078] (1-2) Data labeling:
[0079] Each sample in the sorted dataset is labeled: samples from the benign original dataset are labeled as benign (attack = 0), and samples from the malicious original dataset are labeled as attack (attack = 1). In this way, each sample in the dataset is clearly classified, providing a clear label for subsequent analysis and training.
[0080] (1-3) Merging and mixing datasets:
[0081] The labeled datasets are merged and sorted by timestamp to ensure that the dataset contains both attack and benign data during model training and to avoid temporal bias in the data.
[0082] (2) Feature Engineering: Extract timestamp decomposition features, time-derived features, and periodic features (such as sine and cosine transforms of timestamps) from the preprocessed dataset to help the model capture the differences between benign and attack events. The extracted features are shown in Table 2.
[0083] Table 2 Features extracted by feature engineering
[0084] feature describe nature Accelerometer relative timestamp Relative timestamps of accelerometer data Time-derived features Accelerometer integral time difference accelerometer integration time interval Time-derived features Accelerometer limiting Indicate whether the reading is out of range Time-derived features Gyroscope integration time difference gyroscope integration time interval Time-derived features Year Data input year Timestamp Decomposition Features moon Data input month Timestamp Decomposition Features day Data entry date Timestamp Decomposition Features Week What day of the week? Timestamp Decomposition Features hour Data input hours Timestamp Decomposition Features point Data input minutes Timestamp Decomposition Features Second Data input seconds Timestamp Decomposition Features Sine Minutes Sine wave (periodic pattern) every minute Periodicity cosine minutes The cosine of the minute (periodic pattern) Periodicity Time difference Time interval between adjacent samples Time-derived features runtime Total time elapsed since startup Time-derived features
[0085] (2-1) Timestamp Decomposition
[0086] Decompose the timestamp data into timestamp decomposition features.
[0087] (2-2) Extracting time-derived features
[0088] (2-2-1) The accelerometer relative timestamp refers to the relative offset of the current accelerometer sample recording time relative to the start time of the flight session (i.e., the takeoff timestamp). The calculation formula is as follows:
[0089]
[0090] in, Indicates the relative timestamp of the accelerometer. Indicates the timestamp of the current accelerometer sample. This indicates the takeoff timestamp. This feature reflects the relative position of the current sensor reading throughout the flight cycle, helping to capture the phased evolution of attack behavior.
[0091] (2-2-2) The accelerometer integral time difference represents the integral time interval between two consecutive accelerometer readings, reflecting the data update frequency and sensor sampling stability. The calculation formula is:
[0092]
[0093] in, This indicates the time difference of accelerometer integration. and These represent the timestamps of the accelerometer data in the current frame and the previous frame, respectively. This feature can be used to detect attackers exploiting time delays to tamper with or block signals.
[0094] (2-2-3) Accelerometer limiting is used to indicate whether the current acceleration reading exceeds the sensor's measurement range, and is usually represented by a Boolean variable or a binary variable:
[0095]
[0096] in, Indicates accelerometer limiting. This represents the maximum permissible reading for the accelerometer. This feature helps the model identify potential physical attacks or extreme flight maneuvers.
[0097] (2-2-4) The gyroscope integration time difference refers to the integration time interval between two consecutive frames of gyroscope readings, representing the update periodicity of angular velocity data. The calculation method is the same as that of the accelerometer integration time difference:
[0098]
[0099] in, This represents the gyroscope integration time difference. The timestamp indicating the current frame gyroscope reading. This indicates the timestamp of the previous gyroscope reading. This feature is used to monitor abrupt changes or lags in angular velocity data during flight, helping to identify abnormal attitude change patterns caused by attacks.
[0100] (2-2-5) Calculate the time difference between consecutive data instances. Unexpected gaps or spikes in the time interval may indicate an attack, representing an attacker interfering with normal communication or sending bursts of transmissions. The time difference is expressed by the formula:
[0101]
[0102] in, This represents the time difference between the current sample and the previous sample. It is the timestamp of the current sample. It is the timestamp of the previous sample.
[0103] (2-2-6) Extracting runtime
[0104] Runtime helps identify patterns of benign and malicious events throughout the entire drone session. Runtime can be measured using the following formula:
[0105]
[0106] in, This indicates the runtime of the current sample. It is the timestamp of the current sample. It's the takeoff timestamp.
[0107] (2-3) Extracting periodic features
[0108] Periodic features capture the cyclical nature of time, which helps the model learn cyclical patterns associated with benign and malicious instances. The formula for calculating periodic features is as follows:
[0109]
[0110]
[0111] in, Represents cosine minutes. This indicates the current running time in minutes. It represents a sine minute.
[0112] (2-4) Feature Importance Analysis
[0113] Feature importance analysis is performed on the processed dataset to measure the importance of features in the new dataset, which contains both original features and feature-engineered features. To select the most important training features, this embodiment employs a dual-model cross-evaluation strategy, calculating feature importance scores from both a random forest-based classifier and a gradient boosting classifier. The most important features, present in both feature importance lists, are selected, and features with zero importance are removed from the feature-enhanced dataset.
[0114] (2-4-1) Construction of Feature Set
[0115] All features obtained through steps (2-1) to (2-3) are combined to form a unified feature matrix, including:
[0116] Raw sensor characteristics (such as triaxial acceleration, angular velocity, integral time difference, etc.); time-derived characteristics (such as time difference, running time); periodic characteristics (such as sine minute, cosine minute); timestamp decomposition characteristics (year, month, day, hour, etc.).
[0117]
[0118] in, Represents a unified characteristic matrix. For the sample size, For feature dimensions.
[0119] (2-4-2) Feature Importance Assessment Method
[0120] The influence of each feature on attack detection was independently evaluated using random forest and gradient boosting tree models:
[0121] Complete feature dataset (i.e., a unified feature matrix + labels) is divided into training sets. and test set :
[0122]
[0123] For each model ,in, This represents the random forest model. This represents a gradient boosting tree model. Fitting the model onto the training set:
[0124]
[0125] For the model Its feature set is Calculate each feature Importance score.
[0126]
[0127]
[0128] in, This represents the first value calculated based on a random forest model or a gradient boosting tree model. Features Importance score , This represents the random forest model. This represents a gradient boosting tree model. This represents all trees in a random forest model or gradient boosting tree model that are named after the first tree. Features A set of split nodes.
[0129] For the random forest model ( Impurity is usually 100%. :
[0130]
[0131]
[0132] in, Indicates impurity. It is the first The proportion of class samples in the training set. This indicates two categories: benign and malicious. Indicates the first The node uses the first Features The reduction in Gini impurity resulting from the partition, i.e., the amount of Gini impurity of the current feature at the [number]th [node]. Information gain at each node Represents the training set, , This represents the left and right subsets after the training set has been divided. This indicates the number of samples in the left subset. This indicates the number of samples in the right subset. This indicates the number of samples in the training set.
[0133] For gradient boosting tree model ( ), commonly used Indicates impurity:
[0134]
[0135]
[0136] in, Indicates the current node Use the Features The decrease in the loss function after partitioning is used to measure the marginal contribution of this feature to improving model performance. This represents the loss function value on the training set. This represents the loss function value on the left subset after the training set has been split. This represents the loss function value on the right subset after the training set has been split. Represents a set The loss function value on, This represents the set of samples corresponding to the current partition node. Represents a set The number of samples in the middle Indicates the first The feature vector of each sample Indicates the first The true labels for each sample are: 1 indicates an attack, and 0 indicates a benign attack. This indicates that the gradient boosting tree model applies to samples. The predicted attack probability.
[0137] (2-4-3) Screening for features with zero importance
[0138] model and The importance vectors of the output are denoted as follows:
[0139]
[0140]
[0141] in, , These respectively indicate the use of the random forest model ( ) and gradient boosting tree model ( The feature importance vector is calculated.
[0142] Construct a set of features with zero importance:
[0143]
[0144] in, Represents the set of features with zero importance. It represents the union of sets.
[0145] Finally, these features with zero importance are removed from the training set:
[0146]
[0147] in, This represents the feature set after removing features with zero importance from the training set. This represents the set difference operation, i.e., from Remove from The elements in.
[0148] (3) Model Training: To improve the generalization and real-time detection capabilities of the UAV intrusion detection system on heterogeneous platforms, this invention proposes to use a deep learning model based on the Transformer structure for training. Compared with traditional ensemble learning methods, the Transformer model has stronger time series modeling capabilities, the ability to adapt to heterogeneous features, and end-to-end training scalability, making it suitable for multi-source, dynamic, and time-varying UAV sensor data in urban airspace environments.
[0149] (3-1) Data Input and Feature Sequence Construction
[0150] Arrange the time-series sensor data from the drone in flight into a sequence format according to timestamps.
[0151]
[0152] in, The feature vector representing the flight sequence of a drone. This indicates the number of dimensions, i.e., the number of features at each time step (such as velocity, angular velocity, timestamp, etc.).
[0153] (3-2) Location coding
[0154] Positional encoding is added to the feature vectors in the sequence to obtain the feature sequence. For each position pos, the positional encoding vector is... Defined as:
[0155]
[0156]
[0157] in, Indicates the location index of the data. Indicates that position pos is at the 1st position. Dimensional encoding, Indicates that position pos is at the 1st position. Dimensional encoding, =0, 1, …, , Indicates the number of dimensions of the embedding.
[0158] The positional encoding is added to the input features by adding the encoded vector at each position to the original feature vector:
[0159]
[0160]
[0161] in, Represents the characteristic sequence, Indicates that position pos is at the 1st position. Dimensional encoding.
[0162] (3-3) Construct a multi-layer Transformer encoder.
[0163] Construct a multi-layered Transformer Encoder, each layer containing:
[0164] Multi-Head Self-Attention Layer:
[0165]
[0166] in, Represents the query vector. Represents the key vector. Represents a value vector. Represents the dimension of the key vector. These are the weight matrices for the query vector, key vector, and value vector, respectively.
[0167] Concatenate the outputs of all heads in the multi-head self-attention layer and combine them with an output transformation matrix. Multiplying them together yields the output of the multi-head self-attention layer:
[0168]
[0169] in, This represents the output of the multi-head self-attention layer. This represents concatenating the outputs of all heads in a multi-head self-attention layer.
[0170] Residual connection layer:
[0171]
[0172] in, This represents the normalized output after the residual connection. Indicates the normalization layer;
[0173] Feedforward fully connected layer:
[0174] Feature enhancement is performed using two linear layers and activation functions (such as GELU, ReLU):
[0175]
[0176]
[0177] in, Indicates a feedforward fully connected layer. This represents the weight matrix of the first linear layer in the feedforward fully connected layer. This represents the bias of the first linear layer in the feedforward fully connected layer. This represents the activation function. This represents the weight matrix of the second linear layer in the feedforward fully connected layer. This represents the bias of the second linear layer in the feedforward fully connected layer. This represents the temporal context representation sequence of the output of a multi-layer Transformer encoder.
[0178] (3-4) Sequence aggregation and classification
[0179] Aggregate the output of the multi-layer Transformer encoder (e.g., average pooling or max pooling).
[0180]
[0181] in, Represents an aggregate vector. This represents the vector obtained in step 3-3. This indicates the average pooling operation.
[0182] The attack probability is output through the classification head (fully connected layer + activation function):
[0183]
[0184] in, The sigmoid function is used for binary classification. Indicates the bias term. This indicates the probability of a predicted attack. This represents the parameter matrix to be learned.
[0185] (3-5) Training and Reasoning
[0186] Training is performed using the Binary Cross Entropy (BCE) loss function:
[0187]
[0188] in, This represents a true / false label, where 1 indicates an attack and 0 indicates no attack. This represents the attack probability predicted by the multi-layer Transformer encoder.
[0189] During the inference phase, inputting a test set or a new flight sequence allows for prediction of whether it constitutes a malicious attack.
[0190] (4) Cross-data analysis: To ensure that the system can adapt to changes in different datasets, the system adopts two cross-validation methods: 1) Cross-validation using real-time data to test the system's intrusion detection capabilities under various UAV models. 2) Cross-validation using simulated data, combining real-time data and simulated data for training to ensure that the system can cope with attacks under various operating environments.
[0191] (4-1) Training was performed using a combined dataset, and testing was conducted using real-time data. Simulated data and real-time data were mixed for training, and the model's adaptability to real-world tasks was evaluated by testing its performance in a purely real-time scenario. The simulated data was obtained by constructing a UAV flight simulation platform, which replicated various typical flight scenarios and attack behaviors, including GPS spoofing, denial-of-service attacks, and communication interference.
[0192] (4-2) The model was trained using data from three UAV models and tested using data from five different UAV models. By training and testing on data from multiple different UAV platforms, the model's adaptability to attack identification tasks under heterogeneous UAV systems was verified, ensuring its versatility in urban airspace.
[0193] Unlike traditional intrusion detection methods that are only applicable to a single platform, this invention systematically improves the adaptability to heterogeneous platforms at the system level, aiming to build a universal security detection framework that can be migrated and used across multiple UAV types and has cross-platform robustness and practicality.
[0194] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A general intrusion detection method for heterogeneous unmanned aerial vehicles (UAVs), characterized in that, The general intrusion detection method for heterogeneous UAVs includes: Acquire drone sensor data to obtain the raw dataset, and preprocess the raw dataset to obtain the preprocessed dataset; Extract timestamp decomposition features, time-derived features, and periodic features from each sample in the preprocessed dataset; A unified feature matrix is constructed based on the original dataset, the timestamp decomposition features of each sample, time-derived features, and periodic features; Labels are added to the unified feature matrix to obtain the complete feature dataset, and the complete feature dataset is divided to obtain the training set; The feature importance is calculated based on the unified feature matrix to obtain the feature sequence; A multi-layer Transformer encoder is constructed. The feature sequence is input into the multi-layer Transformer encoder to obtain the temporal context representation sequence. The temporal context representation sequence is aggregated to obtain an aggregate vector. The attack probability is calculated based on the aggregate vector. A multi-layer Transformer encoder is trained using the binary cross-entropy loss function to obtain a trained multi-layer Transformer encoder. The sample to be detected is input into a trained multi-layer Transformer encoder to obtain the probability of whether it is an attack. in, The step of calculating feature importance based on a unified feature matrix to obtain a feature sequence includes: The importance of features is calculated based on the unified feature matrix to obtain the set of features with zero importance; Remove the set of zero-importance features from the unified feature matrix, and arrange the remaining feature vectors in the unified feature matrix into a sequence according to timestamp order; Add positional encoding to the feature vectors in the sequence to obtain the feature sequence; The step of calculating feature importance based on the unified feature matrix to obtain a set of zero-importance features includes: A random forest model and a gradient boosting tree model are trained using the current unified feature matrix, and feature importance scores of the training set are calculated based on the random forest model and the gradient boosting tree model, respectively. In both the random forest and gradient boosting tree models, features with a feature importance score of zero are considered zero-importance features. The set of zero-importance features is obtained based on the feature importance scores of all features.
2. The universal intrusion detection method for heterogeneous unmanned aerial vehicles according to claim 1, characterized in that, The preprocessing of the original dataset includes: The original dataset includes malicious original datasets and benign original datasets; Samples in the malicious original dataset are marked as attacks, and samples in the benign original dataset are marked as benign. The malicious and benign original datasets are merged and then sorted according to timestamps.
3. The universal intrusion detection method for heterogeneous unmanned aerial vehicles according to claim 1, characterized in that, The extraction of timestamp decomposition features, time-derived features, and periodic features from samples in the preprocessed dataset includes: Decompose timestamp data into timestamp decomposition features; Extract time-derived features, including: Calculate the relative offset of the current accelerometer sample recording time with respect to the takeoff timestamp; Calculate the integral time interval between two consecutive accelerometer readings; Calculate the accelerometer limit; Calculate the integral time interval between two consecutive frames of gyroscope readings; Calculate the time difference between consecutive samples; Extracting periodic features, including: Calculate the current running time based on the current timestamp and takeoff timestamp; Calculate the sine minute and cosine minute based on the current running time in minutes.
4. The universal intrusion detection method for heterogeneous unmanned aerial vehicles according to claim 1, characterized in that, The calculation of feature importance scores for the training set based on the random forest model and the gradient boosting tree model includes: The formula for calculating feature importance score is as follows: in, This represents the first value calculated based on a random forest model or a gradient boosting tree model. Features Importance score , This represents the random forest model. This represents a gradient boosting tree model. This represents all trees in a random forest model or gradient boosting tree model that are named after the first tree. Features A set of split nodes; For the random forest model: in, Indicates impurity. It is the first The proportion of class samples in the training set. This indicates two categories: benign and malicious. Indicates the first The node uses the first Features The reduction in Gini impurity resulting from the partition, i.e., the amount of Gini impurity of the current feature at the [number]th [node]. Information gain at each node Represents the training set, , This represents the left and right subsets after the training set has been divided. This indicates the number of samples in the left subset. This indicates the number of samples in the right subset. Indicates the number of samples in the training set; Will Substitute the values and calculate the feature importance score; For gradient boosting tree models: in, Indicates the current node Use the Features The decrease in the loss function after partitioning. This represents the loss function value on the training set. This represents the loss function value on the left subset after the training set has been split. This represents the loss function value on the right subset after the training set has been split. Represents a set The loss function value on, This represents the set of samples corresponding to the current partition node. Represents a set The number of samples in the middle Indicates the first The feature vector of each sample Indicates the first The true labels for each sample are: 1 indicates an attack, and 0 indicates a benign attack. This indicates that the gradient boosting tree model applies to samples. The predicted attack probability; Will Substitute the values and calculate the feature importance score.
5. The universal intrusion detection method for heterogeneous unmanned aerial vehicles according to claim 1, characterized in that, The multi-layer Transformer encoder includes multiple Transformer encoder layers. Each Transformer encoder layer includes a multi-head self-attention layer, a residual connection layer, and a feedforward fully connected layer. The feedforward fully connected layer includes two linear layers and an activation function.
6. The universal intrusion detection method for heterogeneous unmanned aerial vehicles according to claim 5, characterized in that, The step of inputting the feature sequence into a multi-layer Transformer encoder to obtain a temporal context representation sequence includes: The feature sequence is input into a multi-layer Transformer encoder. The operation of each Transformer encoder layer is as follows: Each head of the multi-head self-attention layer calculates its attention score and generates an attention-weighted output. The outputs of all heads in the multi-head self-attention layer are concatenated and multiplied with the output transformation matrix to obtain the output of the multi-head self-attention layer. The residual connection layer connects the input and output of the multi-head self-attention layer and normalizes the input, as expressed by the formula: in, This represents the normalized output after the residual connection. Indicates the normalization layer. This represents the output of the multi-head self-attention layer. Represents a characteristic sequence; Feature enhancement is performed using two linear layers and an activation function, expressed by the following formula: in, Indicates a feedforward fully connected layer. This represents the weight matrix of the first linear layer in the feedforward fully connected layer. This represents the bias of the first linear layer in the feedforward fully connected layer. This represents the activation function. This represents the weight matrix of the second linear layer in the feedforward fully connected layer. This represents the bias of the second linear layer in the feedforward fully connected layer. This represents the temporal context representation sequence of the output of a multi-layer Transformer encoder.
7. The universal intrusion detection method for heterogeneous unmanned aerial vehicles according to claim 1, characterized in that, The calculation of the attack probability based on the aggregated vector is expressed by the following formula: in, This represents the sigmoid function. Indicates the bias term. This indicates the probability of a predicted attack. This represents the parameter matrix to be learned. This represents an aggregate vector.
8. The universal intrusion detection method for heterogeneous unmanned aerial vehicles according to claim 1, characterized in that, Employ a cross-validation training strategy: The training phase uses a combination of simulated and real-time data for training, and the testing phase uses real-time data for testing. Alternatively, data from multiple different drone platforms can be used for training and testing during the training and testing phases.