Internet of Things privacy leakage detection method and device based on few-sample pre-learning
By converting the IoT privacy detection data into a three -dimensional image and constructing the inner and outer layer models, the risk of the leakage of the private data leakage of the Internet of Things equipment is solved, and the high accuracy detection in the case of small samples is achieved.
Patent Information
- Application Number
- CN202411930899.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-12-25
AI Technical Summary
Due to the huge number of IoT devices and lack of effective security protection measures, they are easily targeted by hackers, resulting in huge risk of private data leakage.
Using the IoT privacy leak detection method based on a small sample pre -learning, by converting privacy detection data into a two -dimensional matrix and a three -dimensional image, a detection model composed of inner layer models and outer pre -learning device, using internal circulation and external outside The combined training method of cycle, quickly train a high -accuracy IoT privacy leak detection model.
An IoT privacy leak detection model with high detection accuracy is quickly trained with a small number of samples, which improves the accuracy and adaptability of IoT privacy leak detection.
Smart Images

Figure CN119357850A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the Internet of Things, and in particular to a privacy leakage detection method and device for the Internet of Things based on few-sample pre-learning. Background Art
[0002] The rapid development of Internet of Things (IoT) technology has brought convenience to our lives, but it has also brought new security challenges. The number of IoT devices is huge and they often lack effective security protection measures, which makes IoT an easy target for hacker attacks. A large amount of privacy data in IoT devices faces a potential huge risk of leakage. Summary of the invention
[0003] The present application provides an IoT privacy leakage detection method and device based on few-sample pre-learning to achieve IoT privacy leakage detection.
[0004] The technical solutions provided in this application include: A privacy leakage detection method for the Internet of Things based on few-sample pre-learning, which is applied to electronic devices, includes: A privacy data training sample set is obtained by converting each row of data in the privacy detection data set into a two-dimensional 2D matrix of a specified size, and then converting each 2D matrix into a three-dimensional image; each row of data in the privacy detection data set is obtained by integrating 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; 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 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; For each training task in the batch of training tasks, an adaptive learning rate of the training task is determined based on the similarity between the training task and other training tasks, a training sample is sampled from the training task to train an inner model in the current IoT privacy leakage detection model, and at the end of the training, a current parameter of the inner model is adjusted based on the adaptive learning rate to obtain a reference parameter corresponding to the training task; 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 second data set to test and 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.
[0005] An IoT privacy leakage detection device based on few-sample pre-learning, which is applied to electronic devices, includes: A data processing unit, configured to obtain a privacy data training sample set by converting each row of data in the privacy detection data set into a two-dimensional 2D matrix of a specified size, and then converting each 2D matrix into a three-dimensional image; 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; 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 consists of some privacy data training samples under the K privacy data categories, and the inner model test set consists of the remaining privacy data training samples under the 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; For each training task in the batch of training tasks, an adaptive learning rate of the training task is determined based on the similarity between the training task and other training tasks, a training sample is sampled from the training task to train an inner model in the current IoT privacy leakage detection model, and at the end of the training, a current parameter of the inner model is adjusted based on the adaptive learning rate to obtain a reference parameter corresponding to the training task; 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 testing and verification unit is used to test and verify, using the second data set, 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 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.
[0006] An electronic device, comprising: a processor and a machine-readable storage medium; The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; The processor is used to execute machine executable instructions to implement the steps in the above method.
[0007] It can be seen from the above technical scheme that this embodiment constructs an Internet of Things privacy leakage detection model consisting of an inner model + an outer pre-learner, so that an Internet of Things privacy leakage detection model that meets the requirements is trained in a manner that cooperates with an inner loop (training the inner model based on a single training task) and an outer loop (optimizing the outer pre-learner based on the loss of the inner model trained by each training task, and optimizing the inner model based on the optimized outer pre-learner). Compared with the conventional single training mode, this method of coordinating the inner loop and the outer loop can achieve rapid model training with a small number of samples, and 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. The mutual decision-making can ensure that the target Internet of Things privacy leakage detection model finally trained has a high detection accuracy, thereby greatly improving the accuracy of Internet of Things privacy leakage detection.
[0008] Furthermore, 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, and the following steps will be performed on the batch of training tasks: for the inner model in the current IoT privacy leakage detection model (recorded as the initial inner model), training samples are sampled from the inner model training set of each training task in the batch of training tasks to train the initial inner model, and the reference inner model corresponding to the training task is obtained, and finally the latest IoT privacy leakage detection model will be trained under 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; Furthermore, this embodiment dynamically adjusts the adaptive learning rate of each training task according to the similarity between the 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
[0009] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0010] Figure 1 A flow chart of the method provided in the embodiment of the present application; Figure 2 A flowchart for implementing step 101 provided in an embodiment of the present application; Figure 3 The inner layer model structure diagram provided for the embodiment of the present application; Figure 4 A diagram of the device structure provided for the embodiment of the present application; Figure 5 Provided in the embodiments of this application Figure 4 Hardware block diagram of the device shown. DETAILED DESCRIPTION
[0011] In order to make the method provided by the present application easier to understand, the method provided by the present application is described in detail below with reference to the accompanying drawings and embodiments: See also Figure 1 , Figure 1 This is a flow chart of the method provided in the embodiment of the present application. The process can be applied to Internet of Things devices or other electronic devices, and this embodiment is not specifically limited.
[0012] like Figure 1 As shown, the process may include the following steps: Step 101 , converting each row of data in the privacy detection data set 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.
[0013] In this embodiment, each row of data in the privacy detection data set is obtained by integrating the business data of each IoT device in the IoT collected within a set time period and the public data set that has been made public for privacy detection.
[0014] Optionally, the above-mentioned business data may include normal data (excluding privacy data of the IoT terminal) and / or abnormal data such as privacy data (such as user login information when the IoT terminal logs in, location sharing information initiated by the IoT terminal, payment transactions occurring in the IoT terminal, etc.).
[0015] The following example describes how to obtain a private data training sample set, which will not be elaborated here.
[0016] Step 102, based on the privacy data training sample set, obtain 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 the first data set; a set of privacy data training samples includes privacy data training samples under K privacy data categories, the inner model training set consists of some privacy data training samples under the K privacy data categories, and the inner model test set consists of the remaining privacy data training samples under the K privacy data categories; the first data set is a data set divided from the privacy data training sample set, and the privacy data training sample set is further divided into a second data set.
[0017] In this embodiment, the privacy data training sample set will first be divided, for example, into a first data set and a second data set. Optionally, K privacy data categories will be randomly or according to set requirements selected from the first data set, and each category contains L privacy data training samples. Afterwards, 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, the K privacy data training samples under each privacy data category can be used as inner model training samples, and the remaining privacy data training samples can be used as inner model test samples. Of course, if L is less than or equal to K, the V privacy data training samples under each privacy data category can be used as inner model training samples, and the remaining privacy data training samples can be used as inner model test samples, and V is less than K.
[0018] 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 regarded as a training task.
[0019] According to the above method, 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 tasks there are, the more training samples there are for the model, but the training time will also be longer. Therefore, the number of training tasks will be limited according to the actual situation.
[0020] It should be noted that the above K determines the classification ability of the target IoT privacy leakage detection model trained subsequently. The larger the K, the stronger the classification ability of the model, but the longer the training time will be. Similarly, the above K1 also determines the difficulty of model training. The smaller the K1, the greater the difficulty of model training, but the model generalization ability will be stronger. Based on this, the above K and K1 can be set according to actual conditions, and this embodiment is not specifically limited here.
[0021] 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 the batch of training tasks, determine the adaptive learning rate of each training task in the batch of training tasks based on the similarity between the training task and other training tasks, sample training samples from the training tasks 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; and sample test samples from each training task to test the reference parameters corresponding to the training task to obtain a loss value, adjust the parameters of the inner model in the current Internet of Things 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 Internet of Things privacy leakage detection model, and obtain the Internet of Things privacy leakage detection model under the current training batch.
[0022] 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.
[0023] As for obtaining the task similarity evaluation matrix S used to describe the similarity relationship between the batch of training tasks, initially, the task similarity evaluation matrix S can be an initial matrix. In the non-initial state, the task similarity evaluation matrix S can be determined based on the parameters of the inner model in the IoT privacy leakage detection model under the previous training batch. The specific determination method can refer to the clustering algorithm (such as clustering the output results obtained by inputting a batch of training tasks required for the current training batch into the IoT privacy leakage detection model under the previous training batch), similarity measurement method (such as similarity measurement of the output results obtained by inputting a batch of training tasks required for the current training batch into the IoT privacy leakage detection model under the previous training batch), or other methods such as neural networks to dynamically adjust the above S.
[0024] In addition, for each training task in the batch of training tasks, there are many ways to determine the adaptive learning rate of the training task based on the similarity between the training task and other training tasks. For example, the adaptive learning rate of the training task is determined based on the similarity between the training task and other training tasks, the current adaptive learning rate of other training tasks, and the maximum value of the similarity between the training task and other training tasks. Initially, the current adaptive learning rate of any training task is the basic learning rate α. Specifically, the adaptive learning rate of the i-th training task can be determined in the following way: : ;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, for example, N is the total number of training tasks in this batch. In this case, if j=i, then Can be a default value such as 0.
[0025] In addition, in step 103, training samples are sampled from the training task to train the inner model in the current IoT privacy leakage detection model, and then combined with the above-mentioned 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.
[0026] As for how to adjust the current parameters of the inner model based on the adaptive learning rate in step 103 to obtain the reference parameters corresponding to the training task, and sample test samples from each training task to test the reference parameters corresponding to the training task to obtain the loss value, based on each loss value 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. The following will give an example description and will not be repeated here.
[0027] It can be seen from step 103 that this embodiment constructs an Internet of Things privacy leakage detection model consisting of an inner model + an outer pre-learner, so that an Internet of Things privacy leakage detection model that meets the requirements is trained in a manner that cooperates with an inner loop (training the inner model based on a single training task) and an outer loop (optimizing the outer pre-learner based on the loss of the inner model trained by each training task, and optimizing the inner model based on the optimized outer pre-learner). Compared with the conventional single training mode, this manner of coordination between the inner loop and the outer loop can achieve rapid model training with a small number of samples, and 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. The mutual decision-making can ensure that the target Internet of Things privacy leakage detection model finally trained has a high detection accuracy, thereby greatly improving the accuracy of Internet of Things privacy leakage detection.
[0028] Step 104, using the second data set to test and 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.
[0029] The following article will give examples to describe how to test and verify the IoT privacy leakage detection model, which will not be elaborated here.
[0030] So far, completed Figure 1 The process shown.
[0031] The following describes how to obtain the above private data training sample set: The business data of each IoT device collected above and the public data in the public data set are often single-row data, such as one-dimensional data, in specific applications, which are not suitable for model training. To solve this problem, this embodiment will first convert each single-row data in the privacy detection data set into a two-dimensional (2D) matrix of a specified size (such as P*P or X*P), and then further convert each 2D matrix into a three-dimensional image, and each three-dimensional image constitutes 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 This article gives an example of how to obtain a private data training sample set.
[0032] See also Figure 2 , Figure 2 The step 101 provided in the embodiment of the present application is implemented as a flowchart. Figure 2 As shown, the process may include the following steps: Step 201: Select multiple pieces of private data from a privacy detection data set.
[0033] That is, through this step 201, some data that has little impact on subsequent model training, such as source IP, target IP, timestamp, etc., can be discarded, and only privacy data with high reference value is retained.
[0034] Step 202 , filtering the selected multiple pieces of private data to obtain an initial private data sample set; the private data in the initial private data sample set is called an initial private data sample, and each initial private data sample satisfies a set difference condition.
[0035] Through this step 202, as much prior knowledge as possible on privacy data leakage detection under various privacy categories can be obtained.
[0036] Step 203: Convert each initial private data sample into a 2D matrix of a specified scale to obtain a 2D matrix corresponding to each initial private data sample.
[0037] In this embodiment, when converting each initial private data sample into a 2D matrix of a specified scale, the unit can be ignored, and only the form transformation of the specific numerical value (also called eigenvalue) is considered. Since the number of eigenvalues in different initial private data samples is different, this embodiment uses an average distribution method to evenly distribute each initial private data sample to the entire 2D matrix and keep the intervals consistent.
[0038] Step 204 : Map the 2D matrix corresponding to each initial private data sample into a 3D image (ie, a three-dimensional image) to obtain a private data training sample set.
[0039] In this embodiment, any three-dimensional image in the privacy data training sample set is a privacy data training sample. Optionally, the number of image pixels in the three-dimensional image here is 84 x 84, and it contains three RGB channels. That is, the size of each three-dimensional image is 84x84x3. Compared with 2D matrices, 3D images can better simulate real scenes. For example, the three RGB channels can respectively represent three different dimensions of network traffic data, such as traffic size, protocol type, business scenario, etc., and thus, 3D images are more suitable for model training, and further improve the recognition and generalization capabilities of the model.
[0040] Optionally, assuming that the 2D matrix corresponding to each initial private data sample is an N x 1 vector, 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 i-th row, j-th column, and k-th channel in the 3D image) according to the set mapping relationship, and the pixel value of the 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.
[0041] By dividing any element in a 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 the element can be scaled to the range of [0, 1] to avoid the image processing effect being affected by excessively large values.
[0042] So far, completed Figure 2 The process shown.
[0043] pass Figure 2 The process shown implements how to obtain a private data training sample set in step 101 .
[0044] The above step 103 is described below: First, an initial IoT privacy leakage detection model is constructed. The initial IoT privacy leakage detection model here consists of an outer pre-learner and an inner model.
[0045] Optionally, the inner model here can be constructed based on a convolutional neural network. Figure 3 As 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 convolution kernels to extract image features. Each convolution kernel is responsible for extracting local features in the image. The activation layer is used to introduce nonlinear features and enhance the expressive power of the model. The pooling layer is used to reduce the spatial dimension of the features, reduce the amount of calculation, and increase the invariance to image displacement. The fully connected layer is used to map the extracted features to the final classification results. The fully connected layer uses the Softmax activation function for multi-category classification. The Softmax output layer is used to output the probability of each category.
[0046] During the model training phase, 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 θ.
[0047] The following is an expanded description of model training: 1) Task sampling: A batch of training tasks required for the current training batch is sampled (e.g., randomly sampled) from the training task set (also called the training task distribution ptrain(T)). Each training task includes the inner model training set and the inner model test set described above. In addition, the task similarity evaluation matrix S corresponding to the current training batch is obtained. The task similarity evaluation matrix S is described above and will not be repeated here.
[0048] 2) Inner Model Training: First, the current Internet of Things privacy leakage detection model is obtained. Initially, the current Internet of Things privacy leakage detection model is the above-mentioned initial Internet of Things privacy leakage detection model.
[0049] For the inner model (referred to as the initial inner model) in the current IoT privacy leakage detection model, the following steps are performed: for each training task sampled from the current training batch, the adaptive learning rate of the training task is determined based on the task similarity evaluation matrix S corresponding to the current training batch. The adaptive learning rate determination method is described above. By determining the adaptive learning rate of the training task in this way, it can be achieved that if there are many other training tasks whose similarity with the training task meets the set requirements, the adaptive learning rate of the training task will be relatively high, otherwise, it will be relatively low, which can ensure that the model finally trained will learn more from the training tasks whose similarity meets the set requirements.
[0050] S1 training samples are sampled from the inner model training set in the training task. S1 can be set according to actual needs. The initial inner model is trained based on the S1 training samples, and when the training iteration end conditions are met, such as the number of iterations meets the requirements or the loss value meets the requirements, the current parameter θ of the inner model is updated using the above adaptive learning rate to obtain the reference parameter θi′ corresponding to the training task. For example, the reference parameter is obtained according to the following formula : , is the loss gradient determined by the loss function of the i-th training task.
[0051] Finally, according to the above method, the reference parameters corresponding to each training task in the current training batch will be obtained.
[0052] 3) Update of outer layer pre-learner: First, for each training task in the current training batch, the inner model test set in the training task is used to test the reference parameters corresponding to the training task to obtain the loss value of the reference parameter on the inner model test set (recorded as the loss value corresponding to the training task). The loss value reflects the adaptability of the model to the training task.
[0053] After that, the loss values corresponding to each training task are aggregated to form an aggregate loss. For example, the loss values corresponding to each training task are subjected to a specified aggregation operation such as an average or other statistical operation to obtain the aggregate loss. The aggregate loss is used to evaluate the generalization ability of the model on different training tasks.
[0054] Calculate the gradient of the aggregate loss relative to the current parameters of the inner model, such as θ (denoted as relative gradient). This relative gradient indicates how to adjust the current parameters of the inner model, such as θ, to reduce the loss on the new task. For example, the following formula is used to calculate the relative gradient (denoted as ): ; Where Lmeta represents the above-mentioned aggregate loss, LTi is the loss value corresponding to the i-th training task, and fθ is the prediction function when the model parameter is θ.
[0055] The target parameters are determined using the above relative gradient and the outer learning rate of the outer pre-learner in the current IoT privacy leakage detection model, and the above current parameters of the inner model in the current IoT privacy leakage detection model, such as θ, are adjusted to the above target parameters. For example, the target parameters are determined according to the following formula: ;in, represents the current parameters of the above inner model, is the outer learning rate of the outer pre-learner, represents the relative gradient mentioned above, represents the above mentioned aggregation loss.
[0056] The adjusted initial inner model and outer pre-learner constitute the IoT privacy leakage detection model under the current training batch (which is also the latest IoT privacy leakage detection model).
[0057] 4) Test verification: Use the above-mentioned second data set test to verify whether the current latest IoT privacy leakage detection model is the target IoT privacy leakage detection model that meets the set requirements. If not, return to the above-mentioned task sampling step. If yes, end the current process; the target IoT privacy leakage detection model is used for IoT privacy leakage detection.
[0058] Optionally, in this embodiment, the second data set is further divided into a test set and a validation set. The test set and the validation set are different.
[0059] Based on this, the test set is used to test whether the current latest IoT privacy leakage detection model meets the test requirements, and the verification set is used to verify whether the current latest IoT privacy leakage detection model meets the verification requirements. If it is found that the test requirements or the verification requirements are not met, the learning rate, model structure or other hyperparameters can be adjusted according to the test or verification results, and then the above task sampling steps are returned. Continue to iterate until the iteration converges (for example, the model performance no longer improves or reaches the predetermined number of iterations). It should be noted that the above steps are repeated in the iteration, and a new batch of training tasks is used for each iteration. If it is found that the test requirements and verification requirements are met, the current process can be ended; the IoT privacy leakage detection model at this time is the target IoT privacy leakage detection model.
[0060] Through the above steps, the IoT privacy leakage detection model that is finally trained can learn how to quickly adjust its own parameters when facing new tasks, thereby achieving rapid adaptation.
[0061] The following describes the model test: A batch of test tasks is sampled (e.g., randomly sampled) from the test set. Each test task in the batch of test tasks includes a small number of private data training samples (referred to as test samples) under multiple different private data categories. In this embodiment, the test set can be divided into multiple test tasks.
[0062] For each test task, some test samples in the test task are used to fine-tune the inner model in the current IoT privacy leakage detection model. For example, the parameters of the inner model are updated by performing several gradient descent steps to adapt it to the current task: , where θ is the model parameter before update, θ′ is the fine-tuned parameter, α is the fine-tuning learning rate, and LT is the loss tested by the test task. The fine-tuned inner model is evaluated using the remaining test samples in the test task to evaluate the model performance indicators such as accuracy, precision, recall, and F1 score under the test task. These indicators reflect the model's adaptability and detection ability to new tasks.
[0063] Based on the model performance indicators under each test task, the task types where the model performs well (i.e. meets the requirements) and the task types where the model performs poorly (i.e. does not meet the requirements) are identified. The average performance indicators of the model on all test tasks are statistically calculated. If the requirements are not met, the inner model is adjusted, such as adjusting the model structure, hyperparameters or training strategies. Then, a batch of test tasks are sampled (such as random sampling) from the test set to continue iterative optimization of the model to obtain the tested model, which is the target IoT privacy leakage detection model mentioned above.
[0064] In this embodiment, the target IoT privacy leakage detection model can be deployed in an actual IoT environment to perform real-time privacy leakage detection, and its performance can be continuously monitored.
[0065] The method provided by the embodiment of the present application is described above. The device provided by the embodiment of the present application is described below: See also Figure 4 , Figure 4 This is a diagram of the device structure provided in the embodiment of the present application. The device is applied to electronic equipment, including: A data processing unit, configured to obtain a privacy data training sample set by converting each row of data in the privacy detection data set into a two-dimensional 2D matrix of a specified size, and then converting each 2D matrix into a three-dimensional image; 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; 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 consists of some privacy data training samples under the K privacy data categories, and the inner model test set consists of the remaining privacy data training samples under the 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; For each training task in the batch of training tasks, an adaptive learning rate of the training task is determined based on the similarity between the training task and other training tasks, a training sample is sampled from the training task to train an inner model in the current IoT privacy leakage detection model, and at the end of the training, a current parameter of the inner model is adjusted based on the adaptive learning rate to obtain a reference parameter corresponding to the training task; 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 testing and verification unit is used to test and verify, using the second data set, 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 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.
[0066] Optionally, converting each 2D matrix into a three-dimensional image to obtain a privacy data training sample set includes: For each 2D matrix, determine the 3D image pixel corresponding to each element in the 2D matrix, and determine the pixel value of the 3D image pixel 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 and pixel value corresponding to each element in the 2D matrix; A private data training sample set is generated by using the 3D images corresponding to each 2D matrix; any 3D image in the private data training sample set is a private data training sample.
[0067] Optionally, Determining the adaptive learning rate of the training task based on the similarity between the training task and other training tasks includes: Determine the adaptive learning rate of the training task based on the similarity between the training task and other training tasks, the current adaptive learning rate of other training tasks, and the maximum value of the similarity between the training task and other training tasks; initially, the current adaptive learning rate of any training task is the basic learning rate α; and / or, Determining the adaptive learning rate of the training task 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 similarities between the training task and other training tasks comprises: Determine the adaptive learning rate of the i-th training task according to the following formula: : ; 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 the batch; and / or, 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.
[0068] The above describes the device provided in the embodiments of the present application.
[0069] Correspondingly, the present application also provides Figure 4 The hardware structure of the device shown. Figure 5 The hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing 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 example of this application.
[0070] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.
[0071] Exemplarily, the above-mentioned machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device, which can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0072] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of 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, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0073] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0074] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application may adopt 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 codes.
[0075] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0076] Moreover, these computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0077] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0078] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in 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: A privacy data training sample set is obtained by converting each row of data in the privacy detection data set into a two-dimensional 2D matrix of a specified size, and then converting each 2D matrix into a three-dimensional image; each row of data in the privacy detection data set is obtained by integrating 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; 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 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; For each training task in the batch of training tasks, an adaptive learning rate of the training task is determined based on the similarity between the training task and other training tasks, a training sample is sampled from the training task to train an inner model in the current IoT privacy leakage detection model, and at the end of the training, a current parameter of the inner model is adjusted based on the adaptive learning rate to obtain a reference parameter corresponding to the training task; 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 second data set to test and 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 converting each 2D matrix into a three-dimensional image to obtain a private data training sample set includes: For each 2D matrix, determine the 3D image pixel corresponding to each element in the 2D matrix, and determine the pixel value of the 3D image pixel 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 and pixel value corresponding to each element in the 2D matrix; A private data training sample set is generated by using the 3D images corresponding to each 2D matrix; any 3D image in the private data training sample set is a private data training sample.
3. The method according to claim 1, characterized in that Determining the adaptive learning rate of the training task based on the similarity between the training task and other training tasks includes: Determine the adaptive learning rate of the training task 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 similarities between the training task and other training tasks; initially, the current adaptive learning rate of any training task is the basic learning rate α.
4. The method according to claim 3, characterized in that Determining the adaptive learning rate of the training task 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 similarities between the training task and other training tasks comprises: Determine the adaptive learning rate of the i-th training task according to the following formula: : ; 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.
5. 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.
6. 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.
7. The method according to claim 6, 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.
8. The method according to claim 1, characterized in that The method of using the second data set to test and verify whether the current Internet of Things privacy leakage detection model is a target Internet of Things privacy leakage detection model that meets the 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.
9. An IoT privacy leakage detection device based on few-sample pre-learning, characterized in that: The device is used in electronic equipment, including: A data processing unit, configured to obtain a privacy data training sample set by converting each row of data in the privacy detection data set into a two-dimensional 2D matrix of a specified size, and then converting each 2D matrix into a three-dimensional image; 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; 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 consists of some privacy data training samples under the K privacy data categories, and the inner model test set consists of the remaining privacy data training samples under the 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; For each training task in the batch of training tasks, an adaptive learning rate of the training task is determined based on the similarity between the training task and other training tasks, a training sample is sampled from the training task to train an inner model in the current IoT privacy leakage detection model, and at the end of the training, a current parameter of the inner model is adjusted based on the adaptive learning rate to obtain a reference parameter corresponding to the training task; 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 testing and verification unit is used to test and verify, using the second data set, 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 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.
10. The device according to claim 9, characterized in that The step of converting each 2D matrix into a three-dimensional image to obtain a private data training sample set includes: For each 2D matrix, determine the 3D image pixel corresponding to each element in the 2D matrix, and determine the pixel value of the 3D image pixel 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 and pixel value corresponding to each element in the 2D matrix; A private data training sample set is generated by using the 3D images corresponding to each 2D matrix; any 3D image in the private data training sample set is a private data training sample.
11. The device according to claim 9, characterized in that Determining the adaptive learning rate of the training task based on the similarity between the training task and other training tasks includes: Determine the adaptive learning rate of the training task based on the similarity between the training task and other training tasks, the current adaptive learning rate of other training tasks, and the maximum value of the similarity between the training task and other training tasks; initially, the current adaptive learning rate of any training task is the basic learning rate α; and / or, Determining the adaptive learning rate of the training task 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 similarities between the training task and other training tasks comprises: Determine the adaptive learning rate of the i-th training task according to the following formula: : ; 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 the batch; and / or, 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
Image processing method
US20160078670A1
Generating trained neural networks with increased robustness against adversarial attacks
US20200234110A1
Metafaas architecture for training on serverless instances
US20230419180A1