Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a neural network construction method under homomorphic encryption, which comprises the following steps: acquiring a pre-trained convolutional neural network model and outputting network parameters of the convolutional neural network model;
converting the convolutional neural network model under homomorphic encryption according to the network parameters to obtain a convolutional neural network capable of identifying various types of data;
the convolutional neural network model is obtained by training a plurality of image data of a user layer and corresponding classification results.
Preferably, the converting the convolutional neural network model under homomorphic encryption according to the network parameters to obtain a convolutional neural network capable of identifying multiple types of data includes:
converting an input layer of the convolutional neural network model according to the image data in the convolutional neural network model;
converting the convolution layer of the convolutional neural network model according to the network parameters in the convolutional neural network model;
converting an activation function of a pooling connection output layer of the convolutional neural network model according to network parameters in the convolutional neural network model;
and under homomorphic encryption, obtaining the convolutional neural network capable of identifying various types of data according to the conversion result of the activation functions of the input layer, the convolutional layer and the pooling connection output layer.
Preferably, the input layer conversion calculation formula is as follows:
wherein x is the input of image data information, and sign (x) is the image data information after the input layer conversion.
Preferably, the convolutional layer conversion calculation formula is as follows:
wherein tau is a precision parameter, omega is a network parameter in the convolutional neural network model, processWeight (omega, tau) is a network parameter and a precision parameter after convolutional layer conversion,
is a pair of
And rounding up.
Preferably, the converting the activation function of the pooled connection output layer of the convolutional neural network model according to the network parameters in the convolutional neural network model includes:
and according to the network parameters in the convolutional neural network model, expanding the activation function of the pooled connection output layer of the convolutional neural network model by adopting a Taylor series to obtain the converted activation function of the pooled connection output layer.
Preferably, the training of the convolutional neural network model includes:
taking a plurality of image data of a user layer as an input function, and taking a classification result corresponding to the image data as an output function;
training the input function and the output function to obtain the convolutional neural network model;
the convolutional neural network model comprises an input layer, a convolutional layer and a pooling connection output layer.
Based on the same inventive concept, the invention also provides an image data processing method, which is characterized by comprising the following steps:
acquiring image data to be processed;
processing the image data to be processed by utilizing a convolution neural network capable of identifying various types of data to obtain a classification result of the image data to be processed;
the convolutional neural network capable of identifying the multiple types of data is constructed in advance by adopting a neural network construction method under homomorphic encryption.
Preferably, the processing the image data to be processed by using a convolutional neural network capable of identifying multiple types of data to obtain a classification result of the image data to be processed includes:
inputting image data to be processed into a convolutional neural network through an input layer in the convolutional neural network capable of identifying various types of data, carrying out convolutional processing on the image data to be processed through a convolutional layer in the convolutional neural network capable of identifying various types of data, and outputting a classification result of the image data to be processed through a pooling connection output layer in the convolutional neural network capable of identifying various types of data.
Preferably, after the processing the image data to be processed by using the convolutional neural network capable of identifying multiple types of data, the method further includes:
and verifying the convolutional neural network capable of identifying the multiple types of data to obtain the accuracy of the data based on the original data and homomorphic encryption.
Based on the same inventive concept, the present invention also provides an image data processing system, comprising: the device comprises an acquisition module and a processing module;
the acquisition module is used for acquiring image data to be processed;
the processing module is used for processing the image data to be processed by utilizing a convolution neural network capable of identifying various types of data to obtain a classification result of the image data to be processed;
the convolutional neural network capable of identifying the multiple types of data is constructed in advance by adopting a neural network construction method under homomorphic encryption.
Compared with the closest prior art, the invention has the following beneficial effects:
1. the invention discloses a neural network construction method under homomorphic encryption, which comprises the following steps: acquiring a pre-trained convolutional neural network model and outputting network parameters of the convolutional neural network model; converting the convolutional neural network model under homomorphic encryption according to the network parameters to obtain a convolutional neural network capable of identifying various types of data; the convolutional neural network model is obtained by training a plurality of image data of a user layer and corresponding classification results. The method constructs a convolution neural network which can process original data and homomorphic encrypted data and can identify various types of data, overcomes the defects of the existing machine learning, and improves the prediction accuracy.
2. The invention solves the defect of complex operation of homomorphic encrypted data and simultaneously improves the data security of the convolutional neural network.
3. The invention provides an image processing method and system, comprising the following steps: acquiring image data to be processed; processing the image data to be processed by utilizing a convolution neural network capable of identifying various types of data to obtain a classification result of the image data to be processed; the convolutional neural network capable of identifying the multiple types of data is constructed in advance by adopting a neural network construction method under homomorphic encryption. The invention provides a method for processing data by using a newly constructed convolutional neural network capable of identifying various types of data, and the efficiency and the accuracy of data processing are improved.
Detailed Description
The following describes embodiments of the present invention in further detail with reference to the accompanying drawings.
Example 1:
the schematic flow chart of the construction method of the convolutional neural network under homomorphic encryption provided by the invention is shown in fig. 1, and comprises the following steps:
step 1: acquiring a pre-trained convolutional neural network model and outputting network parameters of the convolutional neural network model;
step 2: converting the convolutional neural network model under homomorphic encryption according to the network parameters to obtain a convolutional neural network capable of identifying various types of data;
the convolutional neural network model is obtained by training a plurality of image data of a user layer and corresponding classification results.
Specifically, the method comprises the following steps:
step 1: acquiring a pre-trained convolutional neural network model and outputting network parameters of the convolutional neural network model;
and training a plurality of image data of the user layer and corresponding classification results thereof to obtain a trained convolutional neural network model, and obtaining network parameters in the trained convolutional neural network model.
Step 2: converting the convolutional neural network model under homomorphic encryption according to the network parameters to obtain a convolutional neural network capable of identifying various types of data;
the conversion of input layers, the conversion of convolution parameters and the conversion of other layer activation functions in the convolutional neural network.
The conversion of the input layer is to limit the message space of the input layer of the homomorphic LeNet-5 model in [ -1,1], and to convert the input data by a sign (x) function, wherein the specific conversion mode is as follows:
the input data is image information of a user layer, sign (x) is a sign function of the image data, the efficiency of overall evaluation can be improved only when the message space is as small as possible, and meanwhile, as the output value of the activation function used in the neural network is in [ -1,1], in order to enable the input and the network input to be in the same range, semantic information in the image input is reserved, and the input is converted.
The convolution parameter conversion, the parameter in the convolution layer should also be correspondingly converted, so that the convolution layer can process the cryptograph after homomorphic encryption. The following transformation is proposed as formula (2):
wherein, tau is a precision parameter, and omega is an original network parameter.
Is a pair of
And rounding up. Process weight (ω, τ) is a step weight function of network parameters and precision parameters, which are adjusted according to different models. After the above processing is carried out according to the function, the network parameter boundary can be reduced, and the ciphertext data can not be excessively dispersed after calculation, so that the problem that the network is difficult to fit is caused.
After the input layer and the convolutional layer are converted, the neurons in the convolutional neural network can be represented as shown in fig. 2:
y=sign(<ω,x>) (3)
wherein, x is the input of image data information as formula (3), and ω is the original network parameter.
The conversion of the activation function, the pooling connection output layer (a series of layers in the convolutional neural network, such as a pooling layer, a connection layer and an output layer) in the neural network, all the activation functions can effectively introduce nonlinear characteristics, so that the network avoids the problem of gradient disappearance. In LeNet-5 neural networks, the activation function used is a sigmoid function, as in equation (4):
the current homomorphic encryption scheme does not support exponential operation, so Taylor series expansion is used for approximately solving the exponential part, and then calculation is carried out by an equation (4), wherein the expansion mode is as follows:
wherein l is the input of the upper network in the pooling connection output layer.
Example 2:
the invention takes LeNet-5 convolution neural network as an example, and uses the method of the invention to carry out conversion:
1. firstly, converting input, and for each pixel value a in an input image, the following steps are provided:
2. the convolution layer is as follows:
D2=N
wherein, W1 × H1 is the feature size of the input image, N is the number of convolution kernels, F is the size of the convolution kernels, S is the step size, and P is the number of zero padding.
For the weight W in the convolutional layer, the following conversion is performed:
wherein, tau is a precision parameter, and omega is an original network parameter.
3. The classification function softmax in the convolutional network is as follows:
softmax(b)=normalize(exp(b))
it is converted using a taylor series as follows:
wherein b is the input of the upper layer network.
The LeNet-5 model was trained using raw data and validated using raw data to record baseline accuracy, with the results shown in Table 1:
TABLE 1 reference results
Table 1 Benchmark result
The LeNet-5 model is trained by using original data, the LeNet-5 model and the homomorphic-transformed LeNet-5 model are verified by using data which is approximately homomorphic encrypted, whether the transformation is effective is proved by the step, and the result is shown in Table 2:
TABLE 2 LeNet-5 conversion comparison
Table 2 LeNet-5 conversion comparison
As can be seen from the above table, after the model is converted, the accuracy of processing the data after the approximate homomorphic encryption is greatly improved.
Training a LeNet-5 model by using the approximately homomorphic encrypted data, and verifying the homomorphic transformed LeNet-5 by using the original data and the approximately homomorphic encrypted data respectively, which proves that homomorphic transformation of the model is necessary for the approximately homomorphic encrypted data, and the result is shown in Table 3.
Table 3 encrypted data comparison
Table 3 Data conversion comparison
From the analysis of the above table, aiming at the prediction of the encrypted data, the LeNet-5 model after conversion is improved by 23 percentage points compared with the model without conversion, and the effectiveness and the practicability of the model conversion thought provided by the scheme are verified through the step of experiment.
Example 3:
based on the same invention concept, the invention also provides an image data processing method, and repeated parts are not repeated as the processing method is based on a neural network construction method under homomorphic encryption.
The method, as shown in fig. 3, includes:
acquiring image data to be processed;
processing the image data to be processed by utilizing a convolution neural network capable of identifying various types of data to obtain a classification result of the image data to be processed;
the convolutional neural network capable of identifying the multiple types of data is constructed in advance by adopting a neural network construction method under homomorphic encryption.
The method specifically comprises the following steps:
preferably, the processing the image data to be processed by using a convolutional neural network capable of identifying multiple types of data to obtain a classification result of the image data to be processed includes:
inputting image data to be processed into a convolutional neural network through an input layer in the convolutional neural network capable of identifying various types of data, carrying out convolutional processing on the image data to be processed through a convolutional layer in the convolutional neural network capable of identifying various types of data, and outputting a classification result of the image data to be processed through a pooling connection output layer in the convolutional neural network capable of identifying various types of data.
Preferably, after the processing the image data to be processed by using the convolutional neural network capable of identifying multiple types of data, the method further includes:
and verifying the convolutional neural network capable of identifying the multiple types of data to obtain the accuracy of the data based on the original data and homomorphic encryption.
Example 4:
based on the same inventive concept, the invention also provides an image data processing system, and the principles of solving the technical problems of the devices are similar to those of an image data processing method, so repeated parts are not repeated.
The system, as shown in fig. 4, includes:
the device comprises an acquisition module and a processing module;
the acquisition module is used for acquiring image data to be processed;
the processing module is used for processing the image data to be processed by utilizing a convolution neural network capable of identifying various types of data to obtain a classification result of the image data to be processed;
the convolutional neural network capable of identifying the multiple types of data is constructed in advance by adopting a neural network construction method under homomorphic encryption.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that the above-mentioned embodiments are only for illustrating the technical solutions of the present invention and not for limiting the protection scope thereof, and although the present invention has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that after reading the present invention, they can make various changes, modifications or equivalents to the specific embodiments of the present invention, but these changes, modifications or equivalents are within the protection scope of the appended claims.