Method and system for embedding confidential mechanism in Winograd algorithm
By introducing a confidentiality mechanism into the Winograd algorithm and combining plaintext and ciphertext multiplication, the data confidentiality of the input image and convolution kernel holder is ensured, and the calculation efficiency is improved, solving the problem of data confidentiality in the Winograd algorithm. challenges.
Patent Information
- Application Number
- CN202411034804.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-07-31
AI Technical Summary
In the Winograd algorithm, the input image and the convolution kernel belong to different holders, making it a challenge to ensure the confidentiality of the data of both parties during the calculation process, especially when multiplication operations are required.
By introducing a confidentiality mechanism into the Winograd algorithm, the input image holder and the convolution kernel holder perform plaintext multiplication calculations respectively, and use ciphertext multiplication calculations in specific steps, combined with the random numbers generated by the shared random number generator, to perform Element-wise product operations to ensure data confidentiality and computational efficiency.
While speeding up calculations, the confidentiality of the respective data of the input image and the convolution kernel holder is improved, the number of ciphertext multiplication requirements is reduced, the overall computing efficiency is improved, and the security of the data is ensured through multiple encryption processes.
Smart Images

Figure QLYQS_68 
Figure QLYQS_66 
Figure QLYQS_67
Abstract
Description
Technical Field
[0001] The present invention relates to multi-party multiplication operation, and belongs to the technical field of digital information transmission in intelligent manufacturing, and in particular to an embedding method and system of a confidentiality mechanism in a Winograd algorithm. Background Art
[0002] The Winograd algorithm is an algorithm used to accelerate the calculation of convolutional neural networks (CNNs). It improves computational efficiency by reducing the number of multiplication operations. The algorithm was proposed by Terry Winograd in 1980 and was originally applied to the minimum filtering algorithm of finite impulse response (FIR) filters. The core idea of the Winograd algorithm is to replace time-consuming operations (such as multiplication) with non-time-consuming operations (such as addition) to reduce the time complexity of the algorithm.
[0003] The application of Winograd algorithm in convolutional neural network is mainly reflected in two aspects: one-dimensional and two-dimensional Winograd minimum filtering algorithms. These algorithms convert input data and convolution kernels into new representations through specific transformation matrices, then perform calculations on these new representations, and finally obtain the final output through inverse transformation. This conversion process involves far fewer multiplications than the original convolution operation, which significantly improves computational efficiency.
[0004] Specifically, Winograd convolution can be divided into four stages: input transformation, convolution kernel transformation, corresponding bit multiplication, and output transformation. These stages work together to accelerate the convolution operation. For example, for the two-dimensional Winograd minimum filtering algorithm, by nesting the one-dimensional minimum filtering algorithm, a two-dimensional minimum filtering algorithm can be obtained, in which the number of multiplications required is much less than the original convolution algorithm.
[0005] However, in some specific application scenarios, the input image and the convolution kernel belong to different holders, and the input image holder and the convolution kernel holder will regard their own data as confidential data; thus, how to ensure the confidentiality of the data held by both parties in the Winograd-based convolution algorithm becomes a thorny challenge. Summary of the invention
[0006] The purpose of the present invention is to disclose a method and system for embedding a confidentiality mechanism in a Winograd algorithm, so as to improve the confidentiality of the data of the input image holder and the convolution kernel holder respectively while speeding up the calculation.
[0007] To achieve the above object, the present invention discloses a method for embedding a confidentiality mechanism in a Winograd algorithm, comprising: Step S1, determine the transformation matrices G, B and A required by the Winograd algorithm according to the input image size and the convolution kernel size, where G is the convolution kernel transformation matrix, B is the input image transformation matrix, and A is the result transformation matrix.
[0008] Step S2: The input image holder inputs the image data Convert it into your own and the convolution kernel holder ,and ; The convolution kernel holder will convolution kernel data Convert it into your own and the input image holder ,and .
[0009] Step S3: The image holder , Do plaintext multiplication and get: , ; The convolution kernel holders respectively , Do plaintext multiplication and get: , .
[0010] Step S4: The image holder and the convolution kernel holder calculate the input image holder’s and the convolution kernel holder , so that: ;in," " is the element-wise product operator; where , .
[0011] Step S5: The image holder calculates , the convolution kernel holder calculates .
[0012] Step S6: Fuse the calculation results of the image holder and the convolution kernel holder to obtain: ;in," ” is the convolution operator.
[0013] Preferably, in step S4, when calculating In the process of element-wise multiplication, any position Z corresponds to: Step S41: The image holder calculates , ,in, Owned by the image owner The element of the matrix at the Z position, Owned by the image owner The element of the matrix at the Z position, and They are the first and second random numbers generated by the ciphertext multiplication calculation respectively; the image holder sends the calculated t and e to the convolution kernel holder.
[0014] Step S42: Convolution kernel holder calculates ,and ,in, Owned by the convolution kernel holder The element of the matrix at the Z position, Owned by the convolution kernel holder The element of the matrix at the Z position, and Represents an intermediate variable in a calculation.
[0015] Step S43: Convolution kernel holder calculates ;available ,in, for The resulting elements at the corresponding positions of the matrix, Represents the third random number generated by the ciphertext multiplication calculation.
[0016] Step S44: The image holder calculates ,in, for The resulting elements at the corresponding positions of the matrix, and ;because equal The Zth element of the matrix, equal The Zth element of the matrix, so The result is equal to Matrix and The product of the Zth elements of the matrices.
[0017] Follow the above steps S41 to S44 to and Traverse all positions of the matrix to get the final Elements of a matrix.
[0018] Preferably, in calculating In the process of element product, the first, second and third random numbers corresponding to different element positions are randomly generated by the random number generator shared by the image holder and the convolution kernel holder.
[0019] Optionally, before step S1, the method further includes: dividing the large-size original image into input image sizes corresponding to the conversion matrices G, B and A in step S1.
[0020] Preferably, the input image size is , the convolution kernel size is ; and the values of each conversion matrix are: ; ; .
[0021] To achieve the above-mentioned purpose, the present invention also discloses an embedded system of the confidentiality mechanism in the Winograd algorithm, including an image holder node and a convolution kernel holder node that share the random number generated by the same random number generator, each node including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor corresponding to each node executes the corresponding computer program to collaboratively implement the above-mentioned method.
[0022] The present invention has the following beneficial effects: 1. In the series of steps, except for step S4 which requires ciphertext multiplication, the other steps are all based on plaintext operations; and the ciphertext multiplication involved in step S4 of the present invention is an element-wise product, which greatly reduces the number of ciphertext multiplications required compared to directly performing a convolution operation on the input image and the convolution kernel using ciphertext multiplication, thereby improving the overall computing efficiency.
[0023] 2. Under the action of step S2 and step S4, it is equivalent to performing multiple encryption processing on the data of the image holder and the convolution kernel holder, thereby ensuring the confidentiality of the data.
[0024] The present invention is further described in detail below. DETAILED DESCRIPTION
[0025] The following is a detailed description of embodiments of the present invention, but the present invention can be implemented in many different ways as defined and covered by the claims.
[0026] Example 1 This embodiment discloses a method for embedding a confidentiality mechanism in a Winograd algorithm, including: Step S1, determine the transformation matrices G, B and A required by the Winograd algorithm according to the input image size and the convolution kernel size, where G is the convolution kernel transformation matrix, B is the input image transformation matrix, and A is the result transformation matrix.
[0027] In this step, optionally, the input image size is , the convolution kernel size is There are many existing methods for determining G, B and A, which will not be described in detail. However, there are multiple combinations of G, B and A determined by some methods, and some combinations have problems such as numerical overflow in engineering applications. Preferably, this embodiment is for an input image size of , the convolution kernel size is , a set of value combinations of each conversion matrix verified by engineering practice can be respectively: ; ; .
[0028] The use of the above conversion matrix combination can effectively avoid the phenomenon that a single value of the matrix in the subsequent steps exceeds the threshold (that is, exceeds the maximum range that can be represented by a specific data type in the computer), thereby ensuring the correctness of the result.
[0029] Step S2: The input image holder inputs the image data Convert it into your own and the convolution kernel holder ,and ; The convolution kernel holder will convolution kernel data Convert it into your own and the input image holder ,and .
[0030] In this step and the subsequent steps of this embodiment, the input image holder and the convolution kernel holder share a series of random numbers (or "random number sequence") randomly generated by the same random number generator; and each random number is directly discarded after being used. Thus, in the entire calculation process of this embodiment, the number of random numbers consumed by the image holder and the convolution kernel holder is the same, and the random numbers of the same order used by the two parties at each same stage of the calculation process are also the same; no further description will be given later.
[0031] Thus, in this step, for the convolution kernel holder, a matrix of the same size is generated using its own pseudo-random number generator, and the matrix is subtracted from the held convolution kernel to obtain the convolution kernel holder's Correspondingly, the input image holder holds .in, and It can be regarded as two pieces of secret sharing related to the convolution kernel; the transformation of the input image data is similar and will not be elaborated.
[0032] Step S3: The image holder , Do plaintext multiplication and get: , ; The convolution kernel holders respectively , Do plaintext multiplication and get: , .
[0033] Step S4: The image holder and the convolution kernel holder calculate the input image holder’s and the convolution kernel holder , so that: ;in," " is the element-wise product operator; where , .
[0034] Step S5: The image holder calculates , the convolution kernel holder calculates .
[0035] Step S6: Fuse the calculation results of the image holder and the convolution kernel holder to obtain: ;in," ” is the convolution operator.
[0036] Preferably, in step S4, when calculating In the process of element-wise multiplication, any position Z corresponds to: Step S41: The image holder calculates , ,in, Owned by the image owner The element of the matrix at the Z position, Owned by the image owner The element of the matrix at the Z position, and They are the first and second random numbers generated by the ciphertext multiplication calculation respectively; the image holder sends the calculated t and e to the convolution kernel holder.
[0037] Step S42: Convolution kernel holder calculates ,and ,in, Owned by the convolution kernel holder The element of the matrix at the Z position, Owned by the convolution kernel holder The element of the matrix at the Z position, and Represents an intermediate variable in a calculation.
[0038] Step S43: Convolution kernel holder calculates ;available ,in, for The resulting elements at the corresponding positions of the matrix, Represents the third random number generated by the ciphertext multiplication calculation.
[0039] Step S44: The image holder calculates ,in, for The resulting elements at the corresponding positions of the matrix, and ;because equal The Zth element of the matrix, equal The Zth element of the matrix, so The result is equal to Matrix and The product of the Zth elements of the matrices.
[0040] It is worth noting that: in the above-described parameters, the uppercase characters without [] are and It represents the entire matrix, and the lowercase with [] symbol and It represents a single element, and the 0 and 1 in the [] symbol subscript respectively represent the object to which the corresponding element or matrix belongs, where 0 represents the image holder and 1 represents the convolution holder. This will not be described in detail later.
[0041] In the above steps, each ciphertext multiplication consumes three random numbers. The first, second and third random numbers corresponding to different element positions are randomly generated by the random number generator shared by the image holder and the convolution kernel holder, and usually the combination of three random numbers required for each position is different from the random number combinations of most other positions.
[0042] Follow the above steps S41 to S44 to and Traverse all positions of the matrix to obtain the final It is worth noting that in the above calculation process, multiple intermediate variables are used, including but not limited to and Etc.; these variables have no actual physical meaning and are only used for the convenience of description to clearly and briefly explain the specific data processing process.
[0043] Optionally, before step S1, the method further includes: dividing the large-size original image into input image sizes corresponding to the conversion matrices G, B and A in step S1. The original image can be calculated by image segmentation, that is, the large original image is divided into several The remaining part of the input image that cannot be divided by 8 is calculated using the conventional convolution operator. The specific steps are as follows: K1, divide the number of columns of the original input image by 6 and round down to get the number of small images in the column direction If the result of dividing by 6 is 6.3, then round down to 6.
[0044] K2, divide the number of rows of the input image by 6 and round down to get the number of small images in the row direction .
[0045] K3, respectively from List to List, Go to Line interception The above winograd convolution calculation is performed on a small image, where the value of i starts from 0 and goes up to Position, the value of j starts from 0 and goes up to , the pseudo code of the relevant operations is as follows: Split the large image into small images and calculate the convolution:
[0046] K4. Arrange and combine all Y matrices calculated in the above steps in row and column order to get the final result.
[0047] K5. For the rightmost and bottommost parts of the image, if there are extra rows or columns, the conventional convolution algorithm is used for calculation and the final values are filled into specific positions.
[0048] In addition, due to the characteristics of the winograd algorithm, if the input image size is too large or the convolution kernel is too large, the single or matrix single value in the above calculation process will exceed the threshold (that is, exceed the maximum range that can be represented by a specific data type in the computer), which will cause the final result to be incorrect. Therefore, the algorithm of this embodiment is only applicable to small-sized matrix calculations. Thereby, the overall combination of the input image size, convolution kernel size and the preferred transformation matrix value listed in the above embodiment of this embodiment has an unexpected technical effect. However, at the same time, the above examples should not be regarded as limiting the scope of protection of the present invention. It is obvious to those skilled in the art that there are other combinations of sizes and transformation matrices to which the above method can be applied in theory.
[0049] Example 2 Corresponding to the above-mentioned embodiments, the present embodiment discloses an embedded system of a confidentiality mechanism in a Winograd algorithm, including an image holder node and a convolution kernel holder node that share random numbers generated by the same random number generator, each node including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor corresponding to each node executes a corresponding computer program to collaboratively implement the corresponding method of the above-mentioned embodiments.
[0050] In summary, the methods and systems disclosed in the embodiments of the present invention respectively have at least the following beneficial effects: 1. In the series of steps, except for step S4 which requires ciphertext multiplication, the other steps are all based on plaintext operations; and the ciphertext multiplication involved in step S4 of the present invention is an element-wise product, which greatly reduces the number of ciphertext multiplications required compared to directly performing a convolution operation on the input image and the convolution kernel using ciphertext multiplication, thereby improving the overall computing efficiency.
[0051] 2. Under the action of step S2 and step S4, it is equivalent to performing multiple encryption processing on the data of the image holder and the convolution kernel holder, thereby ensuring the confidentiality of the data.
[0052] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for embedding confidentiality mechanism in Winograd algorithm, It is characterized in that include: Step S1, determining the conversion matrices G, B and A required by the Winograd algorithm according to the input image size and the convolution kernel size, where G is the convolution kernel conversion matrix, B is the input image conversion matrix, and A is the result conversion matrix; Step S2: The input image holder inputs the image data Convert to your own and the convolution kernel holder ,and ; The convolution kernel holder will convolution kernel data Convert it into your own and the input image holder ,and ; Step S3: The image holder , Do plaintext multiplication and get: , ; The convolution kernel holders respectively , Do plaintext multiplication and get: , ; Step S4: The image holder and the convolution kernel holder calculate the input image holder’s and the convolution kernel holder , so that: ;in," " is the element-wise product operator; where , ; Step S5: The image holder calculates , the convolution kernel holder calculates ; Step S6: Fuse the calculation results of the image holder and the convolution kernel holder to obtain: ;in," ” is the convolution operator.
2. The method according to claim 1, It is characterized in that In step S4, when calculating In the process of element-wise multiplication, any position Z corresponds to: Step S41: The image holder calculates , ,in, Owned by the image owner The element of the matrix at the Z position, Owned by the image owner The element of the matrix at the Z position, and They are the first and second random numbers generated by the ciphertext multiplication calculation respectively; the image holder sends the calculated t and e to the convolution kernel holder; Step S42: Convolution kernel holder calculates ,and ,in, Owned by the convolution kernel holder The element of the matrix at the Z position, Owned by the convolution kernel holder The element of the matrix at the Z position, and Represents the intermediate variables of the calculation; Step S43: Convolution kernel holder calculates ;available ,in, for The resulting elements at the corresponding positions of the matrix, Represents the third random number generated by the ciphertext multiplication calculation; Step S44: The image holder calculates ,in, for The resulting elements at the corresponding positions of the matrix, and ;because equal The Zth element of the matrix, equal The Zth element of the matrix, so The result is equal to Matrix and The product of the Zth element of the matrix; Follow the above steps S41 to S44 to and Traverse all positions of the matrix to get the final Elements of a matrix.
3. The method according to claim 2, It is characterized in that In calculation In the process of element product, the first, second and third random numbers corresponding to different element positions are randomly generated by the random number generator shared by the image holder and the convolution kernel holder.
4. The method according to any one of claims 1 to 3, It is characterized in that Before step S1, the method further includes: The large-size original image is divided into the input image sizes corresponding to the conversion matrices G, B and A in step S1.
5. The method according to claim 4, It is characterized in that The input image size is , the convolution kernel size is ; and the values of each conversion matrix are: ; ; 。 6. An embedded system of confidentiality mechanism in Winograd algorithm, comprising an image holder node and a convolution kernel holder node sharing a random number generated by the same random number generator, each node comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that The processor corresponding to each node executes the corresponding computer program to collaboratively implement any of the methods described in claims 1 to 5 above.
Citation Information
Patent Citations
Winograd algorithm-based rapid image processing method
CN110222760A
Winograd convolution operation acceleration method and acceleration module
CN113283587A
Privacy protection voice classification method and system based on fully homomorphic encryption
CN117456989A
Convolutional neural network reasoning method with privacy protection based on edge intelligence and homomorphic encryption
CN118364873A
Winograd algorithm on a matrix processing architecture
US20180189237A1
