Image encryption method based on classification task

By building an encryption network model in the field of image recognition and training the encryption module to remove the shallow features of the image and reduce the similarity between the encrypted image and the original image, the problem of privacy protection in image recognition in the existing technology is solved, and rapid encryption processing and high recognition are achieved. A combination of accuracy.

CN118797685APending Publication Date: 2024-10-18SHAANXI NORMAL UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410786756.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing technologies are difficult to effectively protect user privacy in the field of image recognition, especially due to the high computational cost of deep learning models and the overhead introduced by homomorphic encryption methods and the impact of encryption results, which limits their use in practical applications.

Method used

An image encryption method based on classification tasks is designed. By constructing an encryption network model and using a loss function to train the encryption module to remove the shallow features of the image, and reduce the similarity between the encrypted image and the original image while maintaining consistent classification results, it is achieved Image encryption processing.

Benefits of technology

While maintaining high recognition accuracy, it achieves fast image encryption processing, effectively protects data privacy, and is suitable for image recognition and classification fields that require privacy protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118797685A_ABST
    Figure CN118797685A_ABST
Patent Text Reader

Abstract

An image encryption method based on a classification task comprises the steps of preprocessing a data set, loading a classification module D, constructing an encryption module G in front of the classification module D to form an encryption network model, training and storing the encryption network model, and testing the encryption network model. And the encryption module G encrypts the graph, and the classifier D identifies and classifies the encrypted image by using effective information in the encrypted image. The method has the advantages of high encryption speed, high recognition accuracy, good concealment and the like, and can be applied to the fields of privacy protection and encrypted image recognition and classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image encryption, and in particular relates to an image encryption method based on classification tasks. Background Art

[0002] In recent years, the development of deep neural networks (DNNs) has promoted the great success of deep learning in academic research and real-world applications. However, deep neural networks usually consist of millions of parameters, which is too computationally expensive, especially for some resource-constrained edge devices. To address this challenge, large models are usually deployed on cloud platforms, allowing users to access them as services, named Deep Learning as a Service (DLaaS). Under the traditional DLaaS framework, although DNNs have a high image recognition accuracy, the data source fed into DNNs for recognition faces the risk of leakage at any time, especially in specific scenarios. Our original data contains a large amount of sensitive personal privacy, and we hope to process the original data to achieve the purpose of privacy protection. Therefore, third-party service providers are in urgent need of a method and means to protect user privacy. We describe the problem as follows: Since the number of parameters of the classification model of the third-party service provider is too large, millions or even tens of millions, the retraining computational cost is too high, so we hope to train an image-to-image, plug-and-play image conversion module.

[0003] Currently, existing encryption technologies applied in the field of images include homomorphic encryption technology, which allows calculations to be performed on encrypted data without the need for decryption. The encrypted results also need to be decrypted to obtain the output generated by the model. This method ensures a high level of privacy protection because the data remains encrypted throughout the reasoning process. However, these encryption methods have certain limitations: 1) They cannot be directly applied to existing deep learning models, because deep learning models involve a large amount of complex calculations in their calculations, and homomorphic encryption technology for network architectures used in computer vision tasks usually introduces significant overhead and increases reasoning time. This additional computational cost can be a limiting factor in practical applications. 2) The results obtained through homomorphic encryption are always encrypted, which may have an impact on some practical applications. Summary of the invention

[0004] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide an image encryption method based on classification tasks to prevent leakage of sensitive information.

[0005] The technical solution adopted to solve the above technical problems is: an image encryption method based on classification tasks, comprising the following steps:

[0006] Step 1. Obtain the image dataset and preprocess it, then divide it into a training set and a test set;

[0007] Step 2. Load the weight file of the classification module D in the classification network, and build an encryption module G before the classification module D to form an encrypted network model. The output end of the encryption module G is connected to the input end of the classification module D. The encryption module G is used to remove the shallow features of the image and encrypt the image to generate an encrypted image;

[0008] Step 3. Train the encrypted network model

[0009] Input the training set into the encrypted network model, use the loss function J(θ) to train the encrypted network model and save it;

[0010] The loss function J(θ) is composed of the similarity loss function L sim (θ) and the prediction loss function L pred (θ) is composed of the similarity loss function L sim (θ) is used to reduce the similarity between the encrypted image and the corresponding original image. The prediction loss function L pred (θ) is used to ensure that the classification results of the encrypted image are consistent with the classification results of the corresponding original image;

[0011] J(θ)=L pred (θ)+λL sim (θ)

[0012] Where λ is the balance weight between the similarity loss function and the prediction loss function.

[0013] Step 4. Test the encrypted network model

[0014] The test set is input into the encryption network model, the encryption module G encrypts the image to generate an encrypted image, and the encrypted image is input into the classification module D for recognition and classification to obtain the classification result.

[0015] As a preferred technical solution, the encryption module G is composed of an encoder and a decoder structure, wherein the encoder is composed of a first sub-encoder layer, a second sub-encoder layer, a third sub-encoder layer, and a fourth sub-encoder layer with the same structure connected in series in sequence, and is used to find features with both classification semantics and encryption semantics from an image; the decoder is used to restore the features found by the encoder to a picture of the same size as the original image for classification, and the decoder is composed of a first sub-decoder layer, a second sub-decoder layer, a third sub-decoder layer, and a fourth sub-decoder layer with the same structure connected in series in sequence, the third sub-decoder layer is connected to the third sub-encoder layer, and the fourth sub-decoder layer is connected to the fourth sub-encoder layer.

[0016] As a preferred technical solution, the first sub-encoder layer is composed of a first 3×3 convolution block, a second 3×3 convolution block, and a downsampling module connected in sequence. The convolution kernel step size of the first convolution block and the second 3×3 convolution block is 1 and the padding is 1, and the convolution kernel step size of the downsampling module is 2 and the padding is 1.

[0017] As a preferred technical solution, the first sub-decoder layer is composed of a first 3×3 deconvolution block, a second 3×3 deconvolution block, and an upsampling module connected in sequence. The transposed convolution kernel step size of the first 3×3 deconvolution block and the second 3×3 deconvolution block is 1 and the padding is 1, and the convolution kernel step size of the upsampling module is 2 and the padding is 1.

[0018] As a preferred technical solution, the similarity loss function L sim (θ) is:

[0019] L sim (θ)=σ 2 R (θ)+σ 2 G (θ)+σ 2 B (θ)

[0020]

[0021] Where N is the total number of image blocks obtained after each channel image of the image input channel (R, G, B) is divided into d*d unit blocks, and b i (θ) is the i-th image patch in each channel image.

[0022] As a preferred technical solution, the prediction loss function L pred (θ) is:

[0023]

[0024] In the formula, C is the number of categories, y c is the true value of the encrypted image after the classification module D, is the predicted value of the encrypted image after passing the classification module D.

[0025] As a preferred technical solution, the classification module D is one of a LeNet classification model, an AlexNet classification model, a VGG16 classification model, and a ResNet20 classification model.

[0026] The beneficial effects of the present invention are as follows:

[0027] The present invention helps the model remove shallow features and reasonably designs optimization functions by reasonably designing the encryption module structure, which can achieve fast image encryption processing while maintaining high recognition accuracy. The present invention effectively protects data privacy and prevents sensitive information leakage by encrypting image data during data transmission and processing. It is suitable for image recognition and classification fields that require privacy protection and data encryption, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a schematic diagram of the process of the present invention.

[0029] Figure 2 It is a schematic diagram of the structure of the encryption module G.

[0030] Figure 3 This is the comparison effect of the original image (left side) and the encrypted image (right side) in Example 1.

[0031] Figure 4 This is the comparison effect of the original image (left side) and the encrypted image (right side) in Example 2.

[0032] Figure 5 This is the comparison effect of the original image (left side) and the encrypted image (right side) in Example 3.

[0033] Figure 6 This is the comparison effect of the original image (left side) and the encrypted image (right side) in Example 4. DETAILED DESCRIPTION

[0034] The present invention will be further described in detail below in conjunction with the accompanying drawings and examples, but the present invention is not limited to the following embodiments.

[0035] Example 1

[0036] exist Figure 1 In this embodiment, an image encryption method based on a classification task includes the following steps:

[0037] Step 1. Data preprocessing

[0038] Obtain the public dataset MNIST, which includes 70,000 handwritten digit images with a size of 28×28 pixels. Normalize the dataset MNIST to 0.5 and divide it into a training set and a test set in a ratio of 6:1.

[0039] Step 2. Build an encrypted network model

[0040] Load the weight file of the classification module D in the classification network. The classification module D is a LeNet classification model. The encryption module G is constructed before the classification module D to form an encrypted network model GTransform. The output end of the encryption module G is connected to the input end of the classification module D. The encryption module G is used to remove the shallow features of the image and encrypt the image to generate an encrypted image, such as Figure 3 ;

[0041] exist Figure 2 In the embodiment, the encryption module G is composed of an encoder and a decoder structure. The encoder is composed of a first sub-encoder layer, a second sub-encoder layer, a third sub-encoder layer, and a fourth sub-encoder layer having the same structure, which are connected in series in sequence, and is used to find features with both classification semantics and encryption semantics from the image; the decoder is used to restore the features found by the encoder to a picture of the same size as the original image for classification.

[0042] The first sub-encoder layer consists of a first 3×3 convolution block, a second 3×3 convolution block, and a downsampling module connected in sequence. The convolution kernel step size of the first convolution block and the second 3×3 convolution block is 1 and the padding is 1, and the convolution kernel step size of the downsampling module is 2 and the padding is 1.

[0043] The decoder is composed of a first sub-decoder layer, a second sub-decoder layer, a third sub-decoder layer, and a fourth sub-decoder layer having the same structure, which are connected in series in sequence. The third sub-decoder layer is connected to the third sub-encoder layer, and the fourth sub-decoder layer is connected to the fourth sub-encoder layer.

[0044] The first sub-decoder layer consists of a first 3×3 deconvolution block, a second 3×3 deconvolution block, and an upsampling module connected in sequence. The transposed convolution kernel step size of the first 3×3 deconvolution block and the second 3×3 deconvolution block is 1 and padded with 1, and the convolution kernel step size of the upsampling module is 2 and padded with 1.

[0045] Step 3. Train the encrypted network model GTransform

[0046] Input the training set into the encrypted network model, use the loss function J(θ) to train the encrypted network model GTransform, and save the weight file of the encrypted network model GTransform after training.

[0047] The loss function J(θ) is composed of the similarity loss function L sim (θ) and the prediction loss function L pred (θ) is composed of the similarity loss function L sim (θ) is used to reduce the similarity between the encrypted image and the corresponding original image. The prediction loss function L pred (θ) is used to ensure that the classification results of the encrypted image are consistent with the classification results of the corresponding original image;

[0048] J(θ)=L pred (θ)+λL sim (θ)

[0049] In the formula, λ is the balance weight between the similarity loss function and the prediction loss function, λ = 1;

[0050] Among them, the similarity loss function L sim (θ) is:

[0051] L sim (θ)=σ 2 R (θ)+σ 2 G (θ)+σ 2 B (θ)

[0052]

[0053] Where N is the total number of image blocks obtained after each channel image of the image input channel (R, G, B) is divided into d*d unit blocks, d=16, N=169, b i (θ) is the i-th image block in each channel image;

[0054] Prediction loss function L pred (θ) is:

[0055]

[0056] In the formula, C is the number of categories, y c is the true value of the encrypted image after the classification module D, is the predicted value of the encrypted image through the classification module D;

[0057] Step 4. Test the encrypted network model GTransform

[0058] The test set is input into the encryption network model, the encryption module G encrypts the image to generate an encrypted image, and the encrypted image is input into the classification module D for recognition and classification to obtain the classification result.

[0059] Example 2

[0060] In the image encryption method based on classification task in this embodiment, step 2. load the weight file of the classification module D in the classification network, the classification module D is the AlexNet classification model, and construct the encryption module G before the classification module D to form an encryption network model. The structure of the encryption module G is the same as that in embodiment 1. The encryption module G is used to remove the shallow features of the image and encrypt the image to generate an encrypted image, such as Figure 4 ;

[0061] Step 3. Input the training set into the encrypted network model and use the loss function J(θ) to train the encrypted network model;

[0062] J(θ)=L pred (θ)+λL sim (θ)

[0063] Where λ is the balance weight between the similarity loss function and the prediction loss function, λ = 0.01;

[0064] Among them, the similarity loss function L sim (θ) and the prediction loss function L pred (θ) is the same as in Example 1.

[0065] The other operation steps are the same as those in Example 1.

[0066] Example 3

[0067] In the image encryption method based on classification task in this embodiment, step 1. obtain the public data set CIFAR10, including 60,000 handwritten digital images, the image size is 32×32 pixels, the pixel values ​​of the data set CIFAR10 are normalized to [0.485, 0.456, 0.406], and divided into a training set and a test set at a ratio of 5:1;

[0068] Step 2. Load the weight file of the classification module D in the classification network. The classification module D is a VGG16 classification model, and an encryption module G is constructed before the classification module D to form an encrypted network model GTransform. The structure of the encryption module G is the same as that in Example 1. The encryption module G is used to remove the shallow features of the image and encrypt the image to generate an encrypted image. Figure 5 ;

[0069] Step 3. Input the training set into the encrypted network model and use the loss function J(θ) to train the encrypted network model;

[0070] J(θ)=L pred (θ)+λL sim (θ)

[0071] Where λ is the balance weight between the similarity loss function and the prediction loss function, λ = 0.01;

[0072] Among them, the similarity loss function L sim (θ) is:

[0073] L sim (θ)=σ 2 R (θ)+σ 2 G (θ)+σ2 B (θ)

[0074]

[0075] Where N is the total number of image blocks obtained after each channel image of the image input channel (R, G, B) is divided into d*d unit blocks, d=16, N=289, b i (θ) is the i-th image block in each channel image;

[0076] Prediction loss function L pred (θ) is the same as in Example 1.

[0077] Step 4. Test the encrypted network model GTransform

[0078] The test set is input into the encryption network model GTransform. The encryption module G encrypts the image to generate an encrypted image, and the encrypted image is input into the classification module D for recognition and classification to obtain the classification result.

[0079] Example 4

[0080] In the image encryption method based on classification task in this embodiment, step 2. load the weight file of the classification module D in the classification network, the classification module D is a ResNet20 classification model, and construct an encryption module G before the classification module D to form an encryption network model. The structure of the encryption module G is the same as that in embodiment 1. The encryption module G is used to remove the shallow features of the image and encrypt the image to generate an encrypted image, such as Figure 6 ;

[0081] The other operation steps are the same as those in Example 3.

[0082] experiment

[0083] In order to verify the beneficial effects of the present invention, the inventors conducted a comparative simulation experiment on the encrypted network model of the present invention and the HRG module based on the homomorphic encryption method and the latest encryption method. The various experimental results are as follows:

[0084] Table 1. Comparison results between the present invention and homomorphic encryption method

[0085]

[0086] Table 2. Comparison results between the present invention and computer vision methods

[0087]

[0088] The experiment uses each trained model to test the same test set on different data sets, and uses the evaluation code to test the model accuracy. The evaluation function ACC is used to evaluate the quality of the evaluation method. The larger the ACC value of the evaluation function, the better the accuracy. Among them, the NA indicator represents the plaintext accuracy. The experimental results in Table 1 show that the encryption network model of the present invention has the characteristics of fast encryption speed and high accuracy compared with the homomorphic encryption method. The experimental results in Table 2 show that the encryption network model of the present invention has better encryption classification accuracy than the latest image encryption method under the same background.

Claims

1. An image encryption method based on classification task, characterized in that: The following steps are involved: Step 1. Obtain the image dataset and preprocess it, then divide it into a training set and a test set; Step 2. Load the weight file of the classification module D in the classification network, and build an encryption module G before the classification module D to form an encrypted network model. The output end of the encryption module G is connected to the input end of the classification module D. The encryption module G is used to remove the shallow features of the image and encrypt the image to generate an encrypted image; Step 3. Train the encrypted network model Input the training set into the encrypted network model, use the loss function J(θ) to train the encrypted network model and save it; The loss function J(θ) is composed of the similarity loss function L sim (θ) and the prediction loss function L pred (θ) is composed of the similarity loss function L sim (θ) is used to reduce the similarity between the encrypted image and the corresponding original image. The prediction loss function L pred (θ) is used to ensure that the classification result of the encrypted image is consistent with the classification result of the corresponding original image; J(θ)=L pred (θ)+λL sim (i) Where λ is the balance weight between the similarity loss function and the prediction loss function. Step 4. Test the encrypted network model The test set is input into the encryption network model, the encryption module G encrypts the image to generate an encrypted image, and the encrypted image is input into the classification module D for recognition and classification to obtain the classification result.

2. The image encryption method based on classification task according to claim 1, characterized in that: The encryption module G is composed of an encoder and a decoder structure. The encoder is composed of a first sub-encoder layer, a second sub-encoder layer, a third sub-encoder layer, and a fourth sub-encoder layer with the same structure connected in series in sequence, and is used to find features with both classification semantics and encryption semantics from an image; the decoder is used to restore the features found by the encoder to a picture of the same size as the original image for classification, and the decoder is composed of a first sub-decoder layer, a second sub-decoder layer, a third sub-decoder layer, and a fourth sub-decoder layer with the same structure connected in series in sequence, the third sub-decoder layer is connected to the third sub-encoder layer, and the fourth sub-decoder layer is connected to the fourth sub-encoder layer.

3. The image encryption method based on classification task according to claim 1, characterized in that: The first sub-encoder layer consists of a first 3×3 convolution block, a second 3×3 convolution block, and a downsampling module connected in sequence. The convolution kernel step size of the first convolution block and the second 3×3 convolution block is 1 and the padding is 1, and the convolution kernel step size of the downsampling module is 2 and the padding is 1.

4. The image encryption method based on classification task according to claim 1, characterized in that: The first sub-decoder layer is composed of a first 3×3 deconvolution block, a second 3×3 deconvolution block, and an upsampling module connected in sequence. The transposed convolution kernel step size of the first 3×3 deconvolution block and the second 3×3 deconvolution block is 1 and padded with 1, and the convolution kernel step size of the upsampling module is 2 and padded with 1.

5. The image encryption method based on classification task according to claim 1, characterized in that: The similarity loss function L sim (θ) is: Where N is the total number of image blocks obtained after each channel image of the image input channel (R, G, B) is divided into d*d unit blocks, and b i (θ) is the i-th image patch in each channel image.

6. The image encryption method based on classification task according to claim 1, characterized in that: The prediction loss function L pred (θ) is: In the formula, C is the number of categories, y c is the true value of the encrypted image after the classification module D, is the predicted value of the encrypted image after passing the classification module D.

7. The image encryption method based on classification task according to claim 1, characterized in that: The classification module D is one of a LeNet classification model, an AlexNet classification model, a VGG16 classification model, and a ResNet20 classification model.

Citation Information

Cited By

  • Security analysis method and device for image data personality privacy protection

    CN120881213A