IoT Privacy Leakage Detection Method and Device Based on Few-Shot Pre-Learning

By converting IoT privacy detection data into three-dimensional images and building internal and external models, the risk of privacy data leakage in IoT devices is solved, and high accuracy detection is achieved in the case of few samples.

CN119357850BActive Publication Date: 2025-05-30HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411930899.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-05-30
Estimated Expiration
2044-12-25

AI Technical Summary

Technical Problem

Due to the lack of effective security protection measures, IoT devices are easily targeted by hackers, resulting in huge risk of leakage of private data.

Method used

Using the IoT privacy leakage detection method based on few-sample pre-learning, by converting privacy detection data into a two-dimensional matrix and a three-dimensional image, a detection model combining an inner layer model and an outer layer pre-learner is constructed, and the learning rate is dynamically adjusted to adapt to the similarity of different tasks.

Benefits of technology

Quickly train a high-accurate IoT privacy leak detection model in a small number of samples to improve the accuracy and adaptability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357850B_ABST
    Figure CN119357850B_ABST
Patent Text Reader

Abstract

The present application provides an Internet of Things privacy leakage detection method and device based on few-shot pre-training. In this embodiment, an Internet of Things privacy leakage detection model composed of an inner layer model + an outer layer pre-learner is constructed, so that an Internet of Things privacy leakage detection model that meets the requirements is trained in a manner that combines the inner loop (training the inner layer model based on a single training task) and the outer loop (optimizing the outer layer pre-learner based on the loss situation of the inner layer models trained based on each training task, and optimizing the inner layer model based on the optimized outer layer pre-learner). Compared with the conventional single training mode, it can quickly train the model with a small number of samples, and this way where the training of the inner layer model determines the optimization of the outer layer pre-learner and the outer layer pre-learner determines the optimization of the inner layer model, making mutual decisions, can ensure that the finally trained target Internet of Things privacy leakage detection model has a high detection accuracy and improve the accuracy of Internet of Things privacy leakage detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the Internet of Things (IoT), and particularly to an IoT privacy leakage detection method and device based on few-shot pre-training. Background Art

[0002] The rapid development of the Internet of Things (IoT) technology has brought convenience to our lives, but also brought new security challenges. In the IoT, the number of IoT devices is huge and often lacks effective security protection measures, which makes the IoT vulnerable to hacker attacks, and a large amount of privacy data in IoT devices faces a potentially huge risk of leakage. Summary of the Invention

[0003] This application provides an IoT privacy leakage detection method and device based on few-shot pre-training to achieve IoT privacy leakage detection.

[0004] The technical solutions provided by this application include:

[0005] An IoT privacy leakage detection method based on few-shot pre-training, which is applied to an electronic device and includes:

[0006] Converting each row of data in the privacy detection dataset into a two-dimensional (2D) matrix of a specified size, and then converting each 2D matrix into a three-dimensional image to obtain a privacy data training sample set; each row of data in the privacy detection dataset is obtained by fusing the service data of each IoT device in the IoT collected within a set time period and a publicly available public dataset for privacy detection;

[0007] Based on the privacy data training sample set, obtaining a training task set; the training task set includes multiple training tasks; any training task includes: an inner model training set and an inner model test set determined based on selecting a corresponding set of privacy data training samples from a first dataset; the set of privacy data training samples includes privacy data training samples under K privacy data categories, the inner model training set is composed of partial privacy data training samples under K privacy data categories, and the inner model test set is composed of the remaining privacy data training samples under K privacy data categories; the privacy data training sample set is divided into a first dataset and a second dataset;

[0008] Sampling a batch of training tasks required for the current training batch from the training task set; obtaining a task similarity evaluation matrix S for describing the similarity relationship between this batch of training tasks;

[0009] For each training task in this batch of training tasks, determine the adaptive learning rate of the training task based on the similarity between the training task and other training tasks, sample training samples from the training task to train the inner model in the current Internet of Things privacy leakage detection model, and adjust the current parameters of the inner model based on the adaptive learning rate at the end of the training to obtain the reference parameters corresponding to the training task;

[0010] Sample test samples from each training task to test the reference parameters corresponding to the training task to obtain loss values, and based on the loss values and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model, adjust the parameters of the inner model in the current Internet of Things privacy leakage detection model to target parameters to obtain the Internet of Things privacy leakage detection model under the current training batch;

[0011] Use the second dataset to test and verify whether the Internet of Things privacy leakage detection model under the current training batch is the target Internet of Things privacy leakage detection model that meets the set requirements. If not, return to the step of sampling a batch of training samples from the training task set. If so, end the current process; the target Internet of Things privacy leakage detection model is used for Internet of Things privacy leakage detection.

[0012] An Internet of Things privacy leakage detection device based on few-shot pre-learning, which is applied to an electronic device and includes:

[0013] A data processing unit, configured to convert each row of data in the privacy detection dataset into a two-dimensional 2D matrix of a specified size, and then convert each 2D matrix into a three-dimensional image to obtain a privacy data training sample set; each row of data in the privacy detection dataset is obtained by fusing the service data of each Internet of Things device in the Internet of Things collected within a set time period and a publicly available public dataset for privacy detection;

[0014] A training unit, configured to obtain a training task set based on the privacy data training sample set; the training task set includes multiple training tasks; any training task includes: an inner model training set and an inner model test set determined based on a corresponding set of privacy data training samples selected from the first dataset; the set of privacy data training samples includes privacy data training samples under K privacy data categories, the inner model training set is composed of partial privacy data training samples under K privacy data categories, and the inner model test set is composed of the remaining privacy data training samples under K privacy data categories; the privacy data training sample set is divided into a first dataset and a second dataset; and,

[0015] Sample a batch of training tasks required for the current training batch from the training task set; obtain a task similarity evaluation matrix S for describing the similarity relationship between this batch of training tasks;

[0016] For each training task in the batch of training tasks, determine the adaptive learning rate of the training task based on the similarity between the training task and other training tasks, sample training samples from the training task to train the inner model in the current Internet of Things privacy leakage detection model, and adjust the current parameters of the inner model based on the adaptive learning rate at the end of the training to obtain the reference parameters corresponding to the training task;

[0017] Sample test samples from each training task to test the reference parameters corresponding to the training task to obtain loss values, and based on the loss values and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model, adjust the parameters of the inner model in the current Internet of Things privacy leakage detection model to target parameters to obtain the Internet of Things privacy leakage detection model under the current training batch;

[0018] A test and verification unit is used to test and verify whether the Internet of Things privacy leakage detection model under the current training batch is a target Internet of Things privacy leakage detection model that meets the set requirements. If not, return to the step of sampling a training batch of samples from the training task set. If so, end the current process; the target Internet of Things privacy leakage detection model is used for Internet of Things privacy leakage detection.

[0019] An electronic device, the electronic device includes: a processor and a machine-readable storage medium;

[0020] The machine-readable storage medium stores machine-executable instructions that can be executed by the processor;

[0021] The processor is used to execute the machine-executable instructions to implement the steps in the above method.

[0022] It can be seen from the above technical solutions that in this embodiment, an Internet of Things privacy leakage detection model composed of an inner model + an outer pre-learner is constructed, so that a qualified Internet of Things privacy leakage detection model is trained in a manner that combines the inner loop (training the inner model based on a single training task) and the outer loop (optimizing the outer pre-learner based on the loss situation of the inner models trained based on each training task, and optimizing the inner model based on the optimized outer pre-learner). This way of combining the inner loop and the outer loop can, compared with the conventional single training mode, quickly train the model with a small number of samples. Moreover, this way that the training of the inner model determines the optimization of the outer pre-learner and the outer pre-learner determines the optimization of the inner model makes mutual decisions, which can ensure that the finally trained target Internet of Things privacy leakage detection model has a high detection accuracy and greatly improves the accuracy of Internet of Things privacy leakage detection.

[0023] Further, in this embodiment, in the current training batch, a batch of training tasks required for the current training batch are sampled from the training task set, and the following steps are performed on this batch of training tasks: for the inner model (denoted as the initial inner model) in the current Internet of Things privacy leakage detection model, training samples are sampled from the inner model training set of each training task in this batch of training tasks to train the initial inner model, obtaining the reference inner model corresponding to this training task. Finally, the latest Internet of Things privacy leakage detection model is trained in the current training batch. This method can ensure the diversity of training samples, enable the model to learn more types of privacy features, and improve the generalization ability of the model, so that the trained model can adapt to the leakage detection of more types of privacy data;

[0024] Further, in this embodiment, the adaptive learning rate of each training task is dynamically adjusted according to the similarity between training tasks to implement the learning strategy of each training task, thereby improving the adaptability and learning efficiency of the model to new tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The accompanying drawings herein are incorporated into and constitute a part of this specification, showing embodiments consistent with the present disclosure and, together with the specification, are used to explain the principles of the present disclosure.

[0026] Figure 1 is a flowchart of the method provided by the embodiment of the present application;

[0027] Figure 2 is a flowchart of the implementation of step 101 provided by the embodiment of the present application;

[0028] Figure 3 is a structural diagram of the inner model provided by the embodiment of the present application;

[0029] Figure 4 is a structural diagram of the device provided by the embodiment of the present application;

[0030] Figure 5 provided by the embodiment of the present application Figure 4 is a hardware structural diagram of the device shown. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0031] To make the method provided by the present application easier to understand, the method provided by the present application will be described in detail below with reference to the accompanying drawings and embodiments:

[0032] See Figure 1 , Figure 1 which is a flowchart of the method provided by the embodiment of the present application. This process can be applied to Internet of Things devices or other electronic devices, and this embodiment does not specifically limit.

[0033] As Figure 1 shown, this process may include the following steps:

[0034] Step 101: Convert each row of data in the privacy detection dataset into a two-dimensional (2D) matrix of a specified size, and then convert each 2D matrix into a three-dimensional image to obtain a privacy data training sample set.

[0035] In this embodiment, each row of data in the privacy detection dataset is obtained by fusing the service data of each Internet of Things device in the Internet of Things collected within a set time period with a publicly available public dataset for privacy detection.

[0036] Optionally, the above service data may include normal data (excluding the privacy data of the Internet of Things terminal), and / or abnormal data such as privacy data (such as user login information when the Internet of Things terminal logs in, location sharing information initiated by the Internet of Things terminal, payment transactions occurring on the Internet of Things terminal, etc.).

[0037] The following gives an example of how to obtain the privacy data training sample set, which will not be elaborated here for the time being.

[0038] Step 102: Obtain a training task set based on the privacy data training sample set; the training task set includes multiple training tasks; any one training task includes: an inner model training set and an inner model test set determined based on selecting a corresponding set of privacy data training samples from the first dataset; a set of privacy data training samples includes privacy data training samples under K privacy data categories, the inner model training set is composed of partial privacy data training samples under K privacy data categories, and the inner model test set is composed of the remaining privacy data training samples under K privacy data categories; the first dataset is a dataset divided from the privacy data training sample set, and the privacy data training sample set is also divided into a second dataset.

[0039] In this embodiment, the privacy data training sample set will be first divided, for example, into a first dataset and a second dataset. Optionally, K privacy data categories will be randomly or according to set requirements first selected from the first dataset, and each category contains L privacy data training samples. Then, the privacy data training samples under each privacy data category are divided into inner model training samples and inner model test samples. Optionally, if L is greater than K, then the K privacy data training samples under each privacy data category can be used as the inner model training samples, and the remaining privacy data training samples are used as the inner model test samples. Of course, if L is less than or equal to K, then V privacy data training samples under each privacy data category can be used as the inner model training samples, and the remaining privacy data training samples are used as the inner model test samples, where V is less than K.

[0040] According to the above description, the inner model training samples under each privacy data category are organized into an inner model training set, and the inner model test samples under each privacy data category are organized into an inner model test set. The number of training samples in the inner model training set is K1. The inner model training set, the inner model test set, and the above K privacy data categories are used as a training task.

[0041] In the above manner, multiple training tasks will be obtained, and finally a training task set will be formed. Any two training tasks in the training task set are different. The number of tasks in the training task set determines the number of model training samples. The more the number of tasks, the more the number of model training samples, but the longer the training time. Therefore, the number of training tasks will be limited according to the actual situation here.

[0042] It should be noted that the above K determines the classification ability of the subsequent trained target Internet of Things privacy leakage detection model. The larger the K, the stronger the classification ability of the model, but the longer the training time. Similarly, the above K1 also determines the model training difficulty. The smaller the K1, the greater the model training difficulty, but the stronger the model generalization ability. Based on this, the above K and K1 can be set according to the actual situation, and are not specifically limited here in this embodiment.

[0043] Step 103: Sample a batch of training tasks required for the current training batch from the training task set, obtain a task similarity evaluation matrix S for describing the similarity relationship between this batch of training tasks. For each training task in this batch of training tasks, determine the adaptive learning rate of this training task based on the similarity between this training task and other training tasks, sample training samples from this training task to train the inner model in the current Internet of Things privacy leakage detection model, and at the end of the training, adjust the current parameters of the inner model based on this adaptive learning rate to obtain the reference parameters corresponding to this training task; and, sample test samples from each training task to test the reference parameters corresponding to this training task to obtain loss values, and based on each loss value and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model, adjust the parameters of the inner model in the current Internet of Things privacy leakage detection model to target parameters, so as to obtain the Internet of Things privacy leakage detection model under the current training batch.

[0044] It can be seen that in this embodiment, in the current training batch, a batch of training tasks required for the current training batch will be sampled from the training task set.

[0045] As for obtaining the task similarity evaluation matrix S for describing the similarity relationship between the batch of training tasks, initially, the task similarity evaluation matrix S can be an initial matrix. When it is not the initial state, the task similarity evaluation matrix S can be determined based on the parameters of the inner model in the Internet of Things privacy leakage detection model under the previous training batch. The specific determination method can draw on clustering algorithms (such as clustering the output results obtained by inputting a batch of training tasks required for the current training batch into the Internet of Things privacy leakage detection model under the previous training batch), similarity measurement methods (such as measuring the similarity of the output results obtained by inputting a batch of training tasks required for the current training batch into the Internet of Things privacy leakage detection model under the previous training batch), or other methods such as neural networks to dynamically adjust the above S.

[0046] In addition, for each training task in this batch of training tasks, there are many ways to determine the adaptive learning rate of this training task based on the similarity between this training task and other training tasks. For example, based on the similarity between this training task and other training tasks, the current adaptive learning rates of other training tasks, and the maximum value among the similarities between this training task and other training tasks, determine the adaptive learning rate of this training task; initially, the current adaptive learning rate of any training task is the base learning rate α. Specifically, the following method can be used to determine the adaptive learning rate of the i-th training task : ; where represents the adaptive learning rate of the j-th training task: represents the similarity between the i-th training task and the j-th training task; represents the said maximum value, determined based on the total number of this batch of training tasks. For example, N is the total number of this batch of training tasks. In this case, if j = i, then the can be a default value such as 0.

[0047] In addition, in step 103, training samples are sampled from this training task to train the inner model in the current Internet of Things privacy leakage detection model, and combined with the above sampling of a batch of training tasks required for the current training batch from the training task set. This sampling method can ensure the diversity of training samples, enable the model to learn more types of privacy features, and improve the generalization ability of the model, so that the trained model can adapt to the leakage detection of more types of privacy data.

[0048] As for how to adjust the current parameters of the inner layer model based on the adaptive learning rate in step 103 to obtain the reference parameters corresponding to the training task, and how to sample test samples from each training task to test the reference parameters corresponding to the training task to obtain loss values, and then adjust the parameters of the inner layer model in the current Internet of Things privacy leakage detection model to target parameters based on the loss values and the outer learning rate of the outer layer pre-learner in the current Internet of Things privacy leakage detection model, examples will be described below and will not be elaborated here for the time being.

[0049] It can be seen from step 103 that in this embodiment, an Internet of Things privacy leakage detection model composed of an inner layer model + an outer layer pre-learner is constructed, so that the Internet of Things privacy leakage detection model that meets the requirements is trained in a manner that combines the inner loop (training the inner layer model based on a single training task) and the outer loop (optimizing the outer layer pre-learner based on the loss situation of the inner layer models trained based on each training task, and optimizing the inner layer model based on the optimized outer layer pre-learner). This way of combining the inner loop and the outer loop can, compared with the conventional single training mode, achieve fast training of the model with a small number of samples. Moreover, this way that the training of the inner layer model determines the optimization of the outer layer pre-learner and the outer layer pre-learner determines the optimization of the inner layer model, with mutual decision-making, can ensure that the finally trained target Internet of Things privacy leakage detection model has a high detection accuracy, greatly improving the accuracy of Internet of Things privacy leakage detection.

[0050] Step 104: Use the second data set to test and verify whether the Internet of Things privacy leakage detection model in the current training batch is the target Internet of Things privacy leakage detection model that meets the set requirements. If not, return to the step of sampling a training batch of samples from the training task set. If so, end the current process; the target Internet of Things privacy leakage detection model is used for Internet of Things privacy leakage detection.

[0051] Examples will be described below on how to test and verify the Internet of Things privacy leakage detection model and will not be elaborated here for the time being.

[0052] So far, the Figure 1 shown process is completed.

[0053] Next, a description will be given on how to obtain the above-mentioned privacy data training sample set:

[0054] The service data of each IoT device collected above, as well as the public data in the above public dataset, are often single-line data such as one-dimensional data in specific applications, which are not suitable for model training. To solve this problem, in this embodiment, each single-line data in the privacy detection dataset will be first converted into a two-dimensional (2D) matrix of a specified size (such as P*P or X*P), and then each 2D matrix will be further converted into a three-dimensional image, and the three-dimensional images form a privacy data training sample set. Any three-dimensional image in the privacy data training sample set is a privacy data training sample. Here, P and X are not equal. Figure 2 An example shows how to obtain a privacy data training sample set.

[0055] See Figure 2 , Figure 2 which is the flowchart of step 101 provided by the embodiment of the present application. As Figure 2 shown, the process may include the following steps:

[0056] Step 201, select multiple pieces of privacy data from the privacy detection dataset.

[0057] That is, through this step 201, some data that have little impact on subsequent model training, such as source IP, destination IP, timestamp, etc., can be discarded, and only the privacy data with high reference value is retained.

[0058] Step 202, filter the multiple pieces of privacy data selected to obtain an initial privacy data sample set; the privacy data in the initial privacy data sample set is called an initial privacy data sample, and the initial privacy data samples satisfy a set difference condition.

[0059] Through this step 202, prior knowledge of privacy data leakage detection under various privacy categories can be obtained as much as possible.

[0060] Step 203, convert each initial privacy data sample into a 2D matrix of a specified scale to obtain a 2D matrix corresponding to each initial privacy data sample.

[0061] In this embodiment, when converting each initial privacy data sample into a 2D matrix of a specified scale, the unit can be ignored, and only the formal transformation of specific numerical values (also called eigenvalue) is considered. Since the number of eigenvalues in different initial privacy data samples is different, in this embodiment, the average distribution method is used to evenly distribute each initial privacy data sample throughout the 2D matrix and keep the interval consistent.

[0062] Step 204, map the 2D matrix corresponding to each initial privacy data sample to a 3D image (that is, a three-dimensional image) to obtain a privacy data training sample set.

[0063] In this embodiment, any 3D image in the privacy data training sample set is a privacy data training sample. Optionally, the number of image pixels in the 3D image here is 84 x 84 and includes three RGB channels. That is, the size of each 3D image is 84x84x3. Compared with the 2D matrix, the 3D image can better simulate the real scene. For example, the three RGB channels can respectively represent three different dimensions of network traffic data, such as traffic volume, protocol type, service scenario, etc. Furthermore, the 3D image is more suitable for model training and further improves the recognition ability and generalization ability of the model.

[0064] Optionally, assuming that the 2D matrix corresponding to each initial privacy data sample is a vector of N x 1, then any element in the vector (denoted as data[n]) can be mapped to a pixel point in the 3D image (denoted as image[i][j][k], representing the k-th channel in the i-th row and j-th column of the 3D image) according to the set mapping relationship, and the pixel value of this pixel point can be expressed by the following formula: data[n] / max_value; where max_value represents the maximum value of all elements in the vector.

[0065] By dividing any element in the vector (denoted as data[n]) by the maximum value of all elements in the vector, the pixel value of the pixel point in the 3D image that has a mapping relationship with this element can be scaled to the range of [0, 1], avoiding the influence of too large numerical values on the image processing effect.

[0066] So far, the Figure 2 shown process is completed.

[0067] Through Figure 2 the shown process, how to obtain the privacy data training sample set in step 101 is realized.

[0068] The following describes the above step 103:

[0069] First, construct an initial Internet of Things privacy leakage detection model. The initial Internet of Things privacy leakage detection model here consists of an outer pre-learner and an inner model.

[0070] Optionally, the inner model here can be constructed based on a convolutional neural network. The inner model is as Figure 3As shown, it may include: an input layer, at least one convolutional layer, an activation layer, a pooling layer, one or more fully connected layers, and a Softmax output layer. Optionally, each convolutional layer uses a set of convolutional kernels for extracting image features. Each convolutional kernel is responsible for extracting local features in the image. The activation layer is used to introduce non-linear features and enhance the expressive power of the model. The pooling layer is used to reduce the spatial dimension of the features, reduce the computational amount, and increase the invariance to image displacement. The fully connected layer is used to map the extracted features to the final classification result. The fully connected layer uses the Softmax activation function for multi-class classification. The Softmax output layer is used to output the probability of each category.

[0071] In the model training stage, the output of the outer pre-learner is the input of the inner model. Initially, the outer pre-learner determines the initial parameters of the inner model, such as θ.

[0072] The following is an expanded description of model training:

[0073] 1), Task sampling:

[0074] Sample (such as random sampling) a batch of training tasks required for the current training batch from the training task set (also known as the training task distribution p train(T)). Each training task includes the inner model training set and the inner model test set described above. And, obtain the task similarity evaluation matrix S corresponding to the current training batch. The task similarity evaluation matrix S is as described above and will not be elaborated here.

[0075] 2), Inner model training (Inner Training):

[0076] First, obtain the current Internet of Things privacy leakage detection model. Initially, the current Internet of Things privacy leakage detection model is the above-mentioned initial Internet of Things privacy leakage detection model.

[0077] For the inner model (denoted as the initial inner model) in the current Internet of Things privacy leakage detection model, perform the following steps: For each training task in the currently sampled training batch, based on the task similarity evaluation matrix S corresponding to the current training batch, determine the adaptive learning rate of this training task. The method for determining the adaptive learning rate is as described above. By determining the adaptive learning rate of this training task in this way, it can be achieved that if the number of other training tasks whose similarity to this training task meets the set requirements is large, the adaptive learning rate of this training task will be relatively high, and vice versa, it will be relatively low. This can ensure that the finally trained model will learn more from each training task whose similarity meets the set requirements.

[0078] Sample S1 training samples from the inner model training set in this training task. S1 can be set according to actual needs. Train the initial inner model based on these S1 training samples, and when the training iteration end condition is met, such as the number of iterations meets the requirement or the loss value meets the requirement, etc., update the current parameters θ of the inner model using the above adaptive learning rate to obtain the reference parameter θi′ corresponding to this training task. For example, obtain the reference parameter according to the following formula : , where is the loss gradient determined by the loss function of the i-th training task.

[0079] Finally, in the above manner, the reference parameters corresponding to each training task in the current training batch will be obtained.

[0080] 3), Outer pre-learner update:

[0081] First, for each training task in the current training batch, use the inner model test set in this training task to test the reference parameter corresponding to this training task to obtain the loss value of this reference parameter on the inner model test set (denoted as the loss value corresponding to this training task). This loss value reflects the adaptability of the model to this training task.

[0082] After that, aggregate the loss values corresponding to each training task to form an aggregated loss. For example, perform a specified aggregation operation on the loss values corresponding to each training task, such as taking the average or other statistical quantity operations, to obtain the aggregated loss. The aggregated loss is used to evaluate the generalization ability of the model on different training tasks.

[0083] Calculate the gradient of the aggregated loss with respect to the current parameters of the above inner model, such as θ (denoted as the relative gradient). This relative gradient indicates how to adjust the current parameters of the above inner model, such as θ, to reduce the loss on new tasks. For example, use the following formula to calculate the above relative gradient (denoted as ): ; where Lmeta represents the above aggregated loss, LTi is the loss value corresponding to the i-th training task, and fθ is the prediction function when the model parameters are θ.

[0084] Use the above relative gradient and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model to determine the target parameters, and adjust the current parameters of the inner model in the current Internet of Things privacy leakage detection model, such as θ, to the above target parameters. For example, determine the target parameters according to the following formula: ; where, represents the current parameters of the above inner model, is the outer learning rate of the outer pre-learner, represents the above relative gradient, Represents the above aggregation loss.

[0085] The adjusted initial inner model and the outer pre - learner together constitute the Internet of Things privacy leakage detection model for the current training batch (which is also the latest Internet of Things privacy leakage detection model).

[0086] 4), Test and verification:

[0087] Use the above - mentioned second dataset to test and verify whether the current latest Internet of Things privacy leakage detection model is the target Internet of Things privacy leakage detection model that meets the set requirements. If not, return to the step of task sampling above. If so, end the current process; the target Internet of Things privacy leakage detection model is used for Internet of Things privacy leakage detection.

[0088] Optionally, in this embodiment, the above - mentioned second dataset is also divided into a test set and a validation set. The test set and the validation set are different.

[0089] Based on this, use the test set to test whether the current latest Internet of Things privacy leakage detection model meets the test requirements, and use the validation set to verify whether the current latest Internet of Things privacy leakage detection model meets the validation requirements. If it is found that the test requirements or the validation requirements are not met, the learning rate, model structure, or other hyperparameters can be adjusted according to the test or verification results, and then return to the step of task sampling above. Continue to iterate until convergence (for example, the model performance no longer improves or reaches a predetermined number of iterations). It should be noted that in the iteration, the above steps are repeated, and each iteration uses a new batch of training tasks. If it is found that the test requirements and the validation requirements are met, the current process can be ended; the Internet of Things privacy leakage detection model at this time is the target Internet of Things privacy leakage detection model.

[0090] Through the above steps, the finally trained target Internet of Things privacy leakage detection model can learn how to quickly adjust its own parameters when facing new tasks, so as to achieve rapid adaptation.

[0091] The following describes the model testing:

[0092] Sample (such as randomly sample) a batch of test tasks from the test set. Each test task in this batch has a small number of privacy data training samples (referred to as test samples) under multiple different privacy data categories. In this embodiment, the test set can be divided into multiple test tasks.

[0093] For each test task, use part of the test samples in the test task to fine - tune the inner model in the current Internet of Things privacy leakage detection model. For example, update the parameters of the inner model by performing several gradient descent steps to make it adapt to the current task: , where θ is the model parameter before update, θ′ is the parameter after fine-tuning, α is the fine-tuning learning rate, and LT is the loss measured by the test task. The remaining test samples in this test task are used to evaluate the fine-tuned inner model, so as to evaluate the model performance metrics such as accuracy, precision, recall, and F1-score under this test task. These metrics reflect the adaptability and detection ability of the model to new tasks.

[0094] Based on the model performance metrics under each test task, identify the task types for which the model performs well (i.e., meets the requirements) and the task types for which it performs poorly (i.e., does not meet the requirements). Statistically calculate the average performance metrics of the model on all test tasks. If the requirements are not met, adjust the inner model, such as adjusting the model structure, hyperparameters, or training strategy. Then, sample (e.g., randomly sample) a batch of test tasks from the test set and continue to iteratively optimize the model to obtain the tested model, i.e., the above-mentioned target IoT privacy leakage detection model.

[0095] In this embodiment, the target IoT privacy leakage detection model can be deployed in an actual IoT environment for real-time privacy leakage detection and its performance can be continuously monitored.

[0096] The method provided by the embodiment of the present application has been described above. Next, the device provided by the embodiment of the present application will be described:

[0097] See Figure 4 , Figure 4 which is the device structure diagram provided by the embodiment of the present application. This device is applied to an electronic device and includes:

[0098] A data processing unit, which is used to convert each row of data in the privacy detection dataset into a two-dimensional 2D matrix of a specified size, and then convert each 2D matrix into a three-dimensional image to obtain a privacy data training sample set; each row of data in the privacy detection dataset is obtained by fusing the service data of each IoT device in the IoT within a set time period and a publicly available public dataset for privacy detection;

[0099] A training unit, which is used to obtain a training task set based on the privacy data training sample set; the training task set includes multiple training tasks; any training task includes: an inner model training set and an inner model test set determined based on selecting a corresponding group of privacy data training samples from the first dataset; the group of privacy data training samples includes privacy data training samples under K privacy data categories, the inner model training set is composed of partial privacy data training samples under K privacy data categories, and the inner model test set is composed of the remaining privacy data training samples under K privacy data categories; the privacy data training sample set is divided into a first dataset and a second dataset; and,

[0100] Sample a batch of training tasks required for the current training batch from the training task set; obtain a task similarity evaluation matrix S for describing the similarity relationship between the batch of training tasks;

[0101] For each training task in the batch of training tasks, determine the adaptive learning rate of the training task based on the similarity between the training task and other training tasks, sample training samples from the training task to train the inner model in the current Internet of Things privacy leakage detection model, and adjust the current parameters of the inner model based on the adaptive learning rate at the end of training to obtain the reference parameters corresponding to the training task;

[0102] Sample test samples from each training task to test the reference parameters corresponding to the training task to obtain loss values, and based on the loss values and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model, adjust the parameters of the inner model in the current Internet of Things privacy leakage detection model to target parameters to obtain the Internet of Things privacy leakage detection model under the current training batch;

[0103] A test and verification unit for using the second data set to test and verify whether the Internet of Things privacy leakage detection model under the current training batch is a target Internet of Things privacy leakage detection model that meets the set requirements. If not, return to the step of sampling a training batch of samples from the training task set. If so, end the current process; the target Internet of Things privacy leakage detection model is used for Internet of Things privacy leakage detection.

[0104] Optionally, the obtaining the privacy data training sample set by converting each 2D matrix into a three-dimensional image includes:

[0105] For each 2D matrix, determine the 3D image pixel points corresponding to each element in the 2D matrix, and based on the element and the element with the largest value in the 2D matrix, determine the pixel value of the 3D image pixel point; based on the 3D image pixel points and pixel values corresponding to the elements in the 2D matrix, determine the 3D image corresponding to the 2D matrix;

[0106] Generate a privacy data training sample set using the 3D images corresponding to each 2D matrix; any 3D image in the privacy data training sample set is a privacy data training sample.

[0107] Optionally,

[0108] The determining the adaptive learning rate of the training task based on the similarity between the training task and other training tasks includes:

[0109] Determine the adaptive learning rate of the training task based on the similarity between this training task and other training tasks, the current adaptive learning rate of other training tasks, and the maximum value among the similarities between this training task and other training tasks; initially, the current adaptive learning rate of any training task is the base learning rate α; and / or,

[0110] The determining the adaptive learning rate of the training task based on the similarity between this training task and other training tasks, the current adaptive learning rate of other training tasks, and the maximum value among the similarities between this training task and other training tasks includes:

[0111] Determine the adaptive learning rate of the i-th training task according to the following formula :

[0112] ;

[0113] where, represents the adaptive learning rate of the j-th training task: represents the similarity between the i-th training task and the j-th training task; represents the maximum value, determined based on the total number of this batch of training tasks; and / or,

[0114] The adjusting the current parameters of the inner layer model based on the adaptive learning rate at the end of training to obtain the reference parameters corresponding to the training task includes:

[0115] Adjust the current parameters of the inner layer model according to the following formula:

[0116] ;

[0117] where, represents the reference parameter corresponding to the i-th training task, θ represents the current parameters of the inner layer model, represents the adaptive learning rate of the i-th training task, is the loss gradient determined by the loss function of the i-th training task; and / or,

[0118] Based on each loss value and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model, adjusting the parameters of the inner layer model in the current Internet of Things privacy leakage detection model to target parameters includes:

[0119] Perform a specified aggregation operation on each loss value to obtain an aggregated loss; calculate the relative gradient of the aggregated loss with respect to the current parameters of the inner model in the current Internet of Things privacy leakage detection model; determine the target parameters based on the relative gradient and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model, and adjust the parameters of the inner model in the current Internet of Things privacy leakage detection model to the target parameters; and / or,

[0120] The determining the target parameters based on the relative gradient and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model includes:

[0121] Determine the target parameters according to the following formula: ;

[0122] wherein, represents the current parameters of the inner model, is the outer learning rate of the outer pre-learner, represents the relative gradient, represents the aggregated loss.

[0123] The device provided by the embodiments of the present application has been described above.

[0124] Correspondingly, the present application further provides Figure 4 the hardware structure of the device shown. Refer to Figure 5 . The hardware structure may include: a processor and a machine-readable storage medium, and the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above examples of the present application.

[0125] Based on the same application concept as the above method, an embodiment of the present application further provides a machine-readable storage medium, on which a number of computer instructions are stored, and when the computer instructions are executed by a processor, the method disclosed in the above examples of the present application can be implemented.

[0126] Exemplarily, the above machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device, and can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drive (such as a hard disk drive), solid state drive, any type of storage disk (such as an optical disk, dvd, etc.), or a similar storage medium, or a combination thereof.

[0127] The systems, apparatuses, modules or units illustrated in the above embodiments may be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device, or a combination of any several of these devices.

[0128] For convenience of description, when describing the above apparatuses, they are divided into various units according to functions and described separately. Of course, when implementing the present application, the functions of each unit may be implemented in one or more software and / or hardware.

[0129] Those skilled in the art should understand that the embodiments of the present application may be provided as a method, a system, or a computer program product. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0130] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowcharts and / or block diagrams, and the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0131] Moreover, these computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are executed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions for implementing the steps of the process Figure 1 one process or a plurality of processes and / or blocks Figure 1 steps of the functions specified in one block or a plurality of blocks.

[0133] The above are only embodiments of the present application and are not intended to limit the present application. Various modifications and changes can be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A privacy leakage detection method for the Internet of Things based on few-sample pre-learning, characterized in that: The method is applied to an electronic device, comprising: Convert each row of data in the privacy detection data set into a 2D matrix of a specified size, determine the 3D image pixel point corresponding to each element in the 2D matrix for each 2D matrix, and determine the pixel value of the 3D image pixel point based on the element and the element with the largest value in the 2D matrix; determine the 3D image corresponding to the 2D matrix based on the 3D image pixel points and pixel values ​​corresponding to each element in the 2D matrix; generate a privacy data training sample set using the 3D images corresponding to each 2D matrix; any 3D image in the privacy data training sample set is a privacy data training sample; each row of data in the privacy detection data set is obtained by fusing the business data of each IoT device in the IoT collected within a set time period with the public data set that has been disclosed for privacy detection; the business data includes privacy data; Based on the private data training sample set, a training task set is obtained; the training task set includes multiple training tasks; any training task includes: an inner model training set and an inner model test set determined based on a corresponding set of private data training samples selected from the first data set; the set of private data training samples includes private data training samples under K private data categories, the inner model training set and the inner model test set both include private data training samples under K private data categories, the inner model training set consists of some private data training samples under the K private data categories, and the inner model test set consists of the remaining private data training samples under the K private data categories; the private data training sample set is divided into a first data set and a second data set; A batch of training tasks required for the current training batch is sampled from the training task set; a task similarity evaluation matrix S is obtained for describing the similarity relationship between the batch of training tasks; in a non-initial state, the task similarity evaluation matrix S is determined based on the parameters of the inner model in the IoT privacy leakage detection model obtained under the previous training batch; For each training task in the batch of training tasks, based on the similarity between the training task and other training tasks, the current adaptive learning rates of other training tasks, and the maximum value of the similarity between the training task and other training tasks, the adaptive learning rate of the training task is determined, and training samples are sampled from the training task to train the inner model in the current IoT privacy leakage detection model. At the end of the training, the current parameters of the inner model are adjusted based on the adaptive learning rate to obtain the reference parameters corresponding to the training task; the adaptive learning rate of the i-th training task for: ;in, represents the adaptive learning rate of the jth training task: Represents the similarity between the i-th training task and the j-th training task; represents the maximum value, Determined based on the total number of training tasks in this batch; Sampling test samples from each training task to test the reference parameters corresponding to the training task to obtain a loss value, adjusting the parameters of the inner model in the current IoT privacy leakage detection model to the target parameters based on the loss values ​​and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model, and obtaining the IoT privacy leakage detection model under the current training batch; Use the test task test, which contains privacy data training samples under multiple different privacy data categories in the second data set, to verify whether the IoT privacy leakage detection model under the current training batch is the target IoT privacy leakage detection model that meets the set requirements; if not, return to the step of sampling a training batch sample from the training task set; if yes, end the current process; the target IoT privacy leakage detection model is used for IoT privacy leakage detection.

2. The method according to claim 1, characterized in that The step of adjusting the current parameters of the inner model based on the adaptive learning rate at the end of the training to obtain the reference parameters corresponding to the training task includes: Adjust the current parameters of the inner model as follows: ; in, represents the reference parameter corresponding to the i-th training task, θ represents the current parameter of the inner model, represents the adaptive learning rate of the ith training task, is the loss gradient determined by the loss function of the i-th training task.

3. The method according to claim 1, characterized in that Based on the loss values ​​and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model, the parameters of the inner model in the current IoT privacy leakage detection model are adjusted to the target parameters including: Perform the specified aggregation operation on each loss value to obtain the aggregate loss; Calculate the relative gradient of the aggregate loss with respect to the current parameters of the inner model in the current IoT privacy leakage detection model; Based on the relative gradient and the outer learning rate of the outer pre-learner in the current Internet of Things privacy leakage detection model, the target parameter is determined, and the parameters of the inner model in the current Internet of Things privacy leakage detection model are adjusted to the target parameter.

4. The method according to claim 3, characterized in that The determining of the target parameter based on the relative gradient and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model includes: The target parameters are determined according to the following formula: ; in, represents the current parameters of the inner model, is the outer learning rate of the outer pre-learner, represents the relative gradient, represents the polymerization loss.

5. The method according to claim 1, characterized in that The test task of using the second data set, each of which contains a plurality of privacy data training samples under different privacy data categories, to test and verify whether the IoT privacy leakage detection model under the current training batch is a target IoT privacy leakage detection model that meets the set requirements includes: Sampling a batch of test tasks required for the current test batch from the second data set; any test task includes private data training samples under different private data categories; For each test task, use part of the privacy data training samples in the test task to fine-tune the parameters of the inner model in the current IoT privacy leakage detection model to be tested and verified, and use the remaining privacy data training samples to test and evaluate the fine-tuned parameters to obtain the test evaluation results corresponding to the test task; Based on the test evaluation results corresponding to each test task, determine whether the current IoT privacy leakage detection model is the target IoT privacy leakage detection model that meets the requirements; if not, adjust the current IoT privacy leakage detection model and return to the step of sampling a batch of training tasks required for the current training batch from the training task set, or directly return to the step of sampling a batch of training tasks required for the current training batch from the training task set.

6. An IoT privacy leakage detection device based on few-sample pre-learning, characterized in that: The equipment includes: A data processing unit, configured to convert each row of data in a privacy detection data set into a 2D matrix of a specified size, determine, for each 2D matrix, a 3D image pixel corresponding to each element in the 2D matrix, and determine a pixel value of the 3D image pixel based on the element and the element with the largest value in the 2D matrix; determine a 3D image corresponding to the 2D matrix based on the 3D image pixel and pixel value corresponding to each element in the 2D matrix; generate a privacy data training sample set using the 3D images corresponding to each 2D matrix; any 3D image in the privacy data training sample set is a privacy data training sample; each row of data in the privacy detection data set is obtained by fusing the business data of each IoT device in the IoT collected within a set time period with a public data set that has been disclosed for privacy detection; the business data includes privacy data; A training unit, used to obtain a training task set based on a privacy data training sample set; the training task set includes multiple training tasks; any training task includes: an inner model training set and an inner model test set determined based on a corresponding set of privacy data training samples selected from a first data set; the set of privacy data training samples includes privacy data training samples under K privacy data categories, the inner model training set and the inner model test set both include privacy data training samples under K privacy data categories, the inner model training set consists of some privacy data training samples under K privacy data categories, and the inner model test set consists of the remaining privacy data training samples under K privacy data categories; the privacy data training sample set is divided into a first data set and a second data set; and, A batch of training tasks required for the current training batch is sampled from the training task set; a task similarity evaluation matrix S is obtained for describing the similarity relationship between the batch of training tasks; in a non-initial state, the task similarity evaluation matrix S is determined based on the parameters of the inner model in the IoT privacy leakage detection model obtained under the previous training batch; For each training task in the batch of training tasks, based on the similarity between the training task and other training tasks, the current adaptive learning rates of other training tasks, and the maximum value of the similarity between the training task and other training tasks, the adaptive learning rate of the training task is determined, and training samples are sampled from the training task to train the inner model in the current IoT privacy leakage detection model. At the end of the training, the current parameters of the inner model are adjusted based on the adaptive learning rate to obtain the reference parameters corresponding to the training task; the adaptive learning rate of the i-th training task for: ;in, represents the adaptive learning rate of the jth training task: Represents the similarity between the i-th training task and the j-th training task; represents the maximum value, Determined based on the total number of training tasks in this batch; Sampling test samples from each training task to test the reference parameters corresponding to the training task to obtain a loss value, adjusting the parameters of the inner model in the current IoT privacy leakage detection model to the target parameters based on the loss values ​​and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model, and obtaining the IoT privacy leakage detection model under the current training batch; A test verification unit is used to test and verify whether the Internet of Things privacy leakage detection model under the current training batch is a target Internet of Things privacy leakage detection model that meets the set requirements by using the test tasks in the second data set, each of which contains privacy data training samples under multiple different privacy data categories. If not, return to the step of sampling a training batch sample from the training task set; if yes, end the current process; the target Internet of Things privacy leakage detection model is used for Internet of Things privacy leakage detection.

7. The device according to claim 6, characterized in that The step of adjusting the current parameters of the inner model based on the adaptive learning rate at the end of the training to obtain the reference parameters corresponding to the training task includes: Adjust the current parameters of the inner model as follows: ; in, represents the reference parameter corresponding to the i-th training task, θ represents the current parameter of the inner model, represents the adaptive learning rate of the ith training task, is the loss gradient determined by the loss function for the ith training task; and / or, Based on the loss values ​​and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model, the parameters of the inner model in the current IoT privacy leakage detection model are adjusted to the target parameters including: Performing a specified aggregation operation on each loss value to obtain an aggregated loss; calculating the relative gradient of the aggregated loss relative to the current parameter of the inner model in the current IoT privacy leakage detection model; determining the target parameter based on the relative gradient and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model, and adjusting the parameter of the inner model in the current IoT privacy leakage detection model to the target parameter; and / or, The determining of the target parameter based on the relative gradient and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model includes: The target parameters are determined according to the following formula: ; in, represents the current parameters of the inner model, is the outer learning rate of the outer pre-learner, represents the relative gradient, represents the polymerization loss.

Citation Information

Patent Citations

  • Training method, identification method and device of intrusion detection model

    CN115563610A

  • Malicious traffic detection method and system based on attention mechanism and deep learning

    CN118869238A