Cross-modal semantic retrieval method for privacy protection based on tree structure
By using tree-structured encrypted indexes and CLIP deep neural network models in high-dimensional vector spaces, the problem of low cross-modal semantic retrieval efficiency is solved, cross-modal retrieval with high accuracy and privacy protection is achieved, and multi-modality is supported. Relevant search of data.
Patent Information
- Application Number
- CN202410532286.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-04-29
AI Technical Summary
It is difficult to achieve efficient cross-modal semantic retrieval in high-dimensional vector spaces with existing technologies, especially in privacy-preserving searchable encryption systems. Traditional methods are computationally intensive and have low search efficiency, and cannot effectively support the retrieval of cross-modal features. .
A privacy-preserving cross-modal semantic retrieval method based on a tree structure is adopted to retrieve encrypted images in the cloud server by generating an encrypted index of a tree structure. The CLIP deep neural network model is used to map different modal data to a unified vector space to achieve encryption. Calculation of Euclidean distance and cosine similarity in states.
It achieves high-accuracy cross-modal semantic retrieval, protects data privacy, supports image and text retrieval and content-based image search, has good acceleration effects, and is suitable for associated search of multi-modal data.
Smart Images

Figure CN118535759A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data query and privacy protection, and in particular to a cross-modal semantic retrieval method based on privacy protection of a tree structure. Background Art
[0002] In the contemporary digital age, data sharing has become a dominant trend. Cloud servers have massive storage space and super computing speed. In order to save storage space and facilitate data sharing with other users, more and more data owners choose to upload their data to cloud servers. However, the complexity of privacy protection continues to escalate in cloud computing and data outsourcing. Traditional encryption technology makes data search difficult, and how to achieve search under ciphertext has become a major challenge. In order to achieve search under ciphertext, searchable encryption has been proposed to balance the contradiction between search function and protection of user privacy. Current searchable encryption methods mainly focus on precise keyword search, fuzzy keyword search and content-based image retrieval. However, new challenges have emerged.
[0003] With the advancement of artificial intelligence, data types have significantly diversified. This trend has pushed the integration of image and text systems to the forefront of technological innovation, especially in the field of visual and textual information retrieval. For example, on platforms such as Unsplash, open source images can be semantically searched using natural language descriptions. Social media platforms utilize text-based search to associate related images, while e-commerce platforms utilize text-based search to locate relevant product images. However, searchable encryption systems that support cross-modal semantic retrieval have not yet been developed.
[0004] The development of image-text retrieval faces three major challenges. First, there is heterogeneity between different modalities in data representation, data distribution, and cross-modal feature extraction. Second, cross-modal features are high-dimensional vectors. Traditional vector encryption methods, such as homomorphic encryption and secure multi-party computation, are computationally intensive for high-dimensional vectors. Finally, linear search is inefficient in high-dimensional vector space. In addition, traditional tree index structures such as KD-Tree and ball-tree perform operations close to linear search in high-dimensional vector space (a manifestation of the "curse of dimensionality"). Therefore, it is still challenging to select appropriate feature extraction methods for different modalities and to design effective retrieval methods in encrypted high-dimensional vector space. Summary of the invention
[0005] In order to solve the privacy protection problem of cross-modal retrieval, the present invention provides a cross-modal semantic retrieval method with privacy protection based on a tree structure, which realizes the retrieval of encrypted images according to the encrypted index of the tree structure, and realizes cross-modal semantic retrieval while protecting privacy, with high accuracy and fast search speed.
[0006] A privacy-preserving cross-modal semantic retrieval method based on a tree structure includes the following steps:
[0007] S1: The data owner generates a key and sends it to the data user through a secure channel;
[0008] S2: The data owner encrypts all image data using a key, and sends the encrypted image data and the encrypted index of the tree structure generated based on the image data to the cloud server for storage;
[0009] S3: The data user generates a corresponding search token based on the content of interest and sends the encrypted search token to the cloud server, which queries the encrypted index based on the search token.
[0010] S4: The cloud server returns the encrypted image data obtained by the query to the data user for decryption, and the data user obtains the image data corresponding to the content of interest.
[0011] Furthermore, the key is:
[0012] sk=(ks,M1,M2)
[0013] Among them, sk is the key, ks is the symmetric encryption key, M1 and M2 are two different reversible matrices with dimensions of (m+4)×(m+4), and m is the dimension of the image data to be encrypted.
[0014] Furthermore, the method for the data owner to generate an encrypted index of a tree structure according to the image data is:
[0015] S21: define the structure vector node of each tree node of the tree structure = (ln, rn, lt, rt, data), wherein the variable ln is used to store the pointer pointing to the left node, the variable rn is used to store the pointer pointing to the right node, the variable lt is used to store the judgment data related to the left node, the variable rt is used to store the judgment data related to the right node, the variable data in the leaf node is used to store the encrypted image vector, and the variable data of the non-leaf node is empty; the root node is the first layer of the tree structure, and the leaf node is the last layer of the tree structure;
[0016] S22: Determine whether the number of elements of the current image vector set S that needs to be processed by the current node is less than the set threshold value N0. If yes, execute step S23; if no, execute step S24; wherein the initial value of the current node is the root node;
[0017] S23: Encrypt each element p in the current image vector set S i , the encrypted image vector P iStore it in the variable data of the leaf node of the current node, and complete the index construction from the root node to the current leaf node;
[0018] S24: Obtain the child node to which each element in the current image vector set S belongs relative to the current node, and complete the assignment of the structure vector node of the current node, specifically:
[0019] S241: Determine whether the number of layers of the current node in the tree structure is less than 3. If so, use the 2-Means algorithm to perform a 2-means operation on the element p in the current image vector set S. i After clustering, we get two category vectors p a and p b If not, directly randomly select two category vectors p a and p b ;
[0020] S242: Get two category vectors p a and p b The center vector p c =(p a +p b ) / 2, and then get the element p in the current image vector set S i The corresponding category distance dis i =(p i -p c )·(p a -p c ), dis i >0 element p i Belongs to the left child node of the current node, and dis i >0 element p i Divide into the left subtree set S1, and dis i Elements p ≤ 0 i Belongs to the right child node of the current node, and dis i Elements p ≤ 0 i Divide into right subtree set S2;
[0021] S243: Encrypt two class vectors p a and p b , corresponding to the encrypted category vector P a and the encrypted category vector P b ;
[0022] S244: The variable ln of the current node points to its own left child node, the variable rn of the current node points to its own right child node, and the variable lt of the current node stores the encrypted category vector P a , the variable rt of the current node stores the encrypted category vector P b ;
[0023] S25: Increase the current node layer number by 1, and use the left subtree set S1 and the right subtree set S2 as the new current image vector set S to re-execute steps S22 to S27, until the encrypted image vectors corresponding to all elements in the original image vector set are stored in the variable data of the corresponding leaf node, and the encrypted index construction of the tree structure is completed; wherein, when the left subtree set S1 is used as the new current image vector set S, the new current node is the left child node of the original current node, and when the right subtree set S2 is used as the new current image vector set S, the new current node is the right child node of the original current node.
[0024] Furthermore, in step S23, each element p in the current image vector set S is encrypted. i The method is:
[0025] For each element p in the current image vector set S i Perform the first encryption operation to obtain the encrypted image vector P corresponding to each element i , the first encryption operation is:
[0026] The element p i Expanded to (m+4)-dimensional vector Among them, r1 is a random number, m is the dimension of the image data to be encrypted; the data owner randomly generates a vector p′ with the main diagonal element i The lower triangular random matrix U with dimensions (m+4)×(m+4) i , a main diagonal element is a vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) x ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to transform U i Encrypted to the encrypted image vector P i =M1×I x ×U i ×I x ×M2.
[0027] Furthermore, the category vector p in step S243 a and p b The encryption method is as follows:
[0028] The p a and p b Expanded to (m+4)-dimensional vectors and Where r1 is a random number; the data owner randomly generates a vector p′ with the main diagonal element a The lower triangular random matrix U with dimensions (m+4)×(m+4) a, a lower triangular matrix \(I\) with the main diagonal element being the vector \((1, 1, \cdots, 1)\) 1×(m+4) and the dimension being \((m + 4)\times(m + 4)\) a , a lower triangular random matrix \(U\) with the main diagonal element being the vector \(p'\) b and the dimension being \((m + 4)\times(m + 4)\) b , a lower triangular matrix \(I\) with the main diagonal element being the vector \((1, 1, \cdots, 1)\) 1×(m+4) and the dimension being \((m + 4)\times(m + 4)\) b ; Using random matrices \(M_1\), \(M_2\) both with the dimension of \((m + 4)\times(m + 4)\) to encrypt \(U\) a and \(U\) b into encrypted category vectors \(P\) a = \(M_1\times I\) a \(\times U\) a \(\times I\) a \(\times M_2\) and \(P\) b = \(M_1\times I\) b \(\times U\) b \(\times I\) b \(\times M_2\).
[0029] Furthermore, the method for the cloud server to query the encrypted index based on the search token in step S3 is as follows:
[0030] S31: Judge whether the first node in the current priority queue is a leaf node. If it is, add the encrypted image vector \(P\) i stored in the variable data of the current leaf node to the result set \(R\); if not, execute step S32; where the initial value of the first node is the root node;
[0031] S32: Take out the encrypted category vector \(P\) a stored in the variable \(lt\) of the current first node and the encrypted category vector \(P\) b stored in the variable \(rt\), and calculate the left trace \(dL = tr(p\) a \(\times Q)\) and the right trace \(dR = tr(P\) b \(\times Q)\), where the \(tr(*)\) function represents calculating the trace of the matrix \(*\), and \(Q\) is the encrypted search token;
[0032] S33: Update the priority queue according to the magnitudes of \(dL\) and \(dR\), specifically:
[0033] Judge whether the absolute value of the difference between \(dL\) and \(dR\) is less than the set threshold \(w\). If it is, add the left child node and the right child node of the current first node to the priority queue. If not, judge the magnitudes of \(dL\) and \(dR\). If \(dL > dR\), add the left child node of the current first node to the priority queue. If \(dL < dR\), add the right child node of the current first node to the priority queue;
[0034] S34: Use the updated priority queue as the new current priority queue and re-execute steps S31 to S33 until the priority queue is empty, and then proceed to step S35;
[0035] S35: Calculate the encrypted image vectors P in the result set R respectively i The trace of the product of the search token Q, the encrypted image vector P corresponding to the largest first k traces i As the final query result.
[0036] Further, the encrypted image vector P is obtained in the encrypted state i The Euclidean distance from the search token Q is:
[0037] The CLIP deep neural network model is used to transform each image data I i Encoded as an m-dimensional vector p i , where i∈[1,n], n is the number of image data; the CLIP deep neural network model is used to generate the corresponding search token from the content of interest, where the search token is an m-dimensional vector q;
[0038] The m-dimensional vector p i and q directly execute steps S2 to S4, then the encrypted image vector P in step S45 i The trace of the product of the search token Q is the encrypted image vector P i The Euclidean distance from the search token Q.
[0039] Further, the encrypted image vector P is obtained in the encrypted state i The method for cosine similarity with the search token Q is:
[0040] The CLIP deep neural network model is used to transform each image data I i Encoded as an m-dimensional vector p i , where i∈[1,n], n is the number of image data; the CLIP deep neural network model is used to generate the corresponding search token from the content of interest, where the search token is an m-dimensional vector q;
[0041] The m-dimensional vector p i Perform normalization operation Vector q is normalized Then, steps S2 to S4 are executed, and the encrypted image vector P in step S45 is i The trace of the product of the search token Q is the encrypted image vector P i The cosine similarity between and the search token Q.
[0042] Furthermore, the search token is generated by:
[0043] Data users generate corresponding search tokens from the content of interest using the CLIP deep neural network model, where the search token is an m-dimensional vector q;
[0044] The encryption method for the search token is:
[0045] Expand the search token q into a (m+4)-dimensional vector Where r2 is a random number, m is the dimension of the image data to be encrypted; the data user randomly generates a lower triangular random matrix Y with a main diagonal element as the vector q′ and a dimension of (m+4)×(m+4), and a main diagonal element as the vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) y ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to encrypt the search token q as
[0046] Beneficial effects:
[0047] 1. The present invention provides a privacy-preserving cross-modal semantic retrieval method based on a tree structure, which generates an encrypted index of a tree structure according to image data, wherein the encrypted index of the tree structure can classify image data with a close distance in a high-dimensional space into the same child node with a very high probability, has high accuracy, and has a good acceleration effect; at the same time, since the index and search token of the present invention are encrypted, the cross-modal retrieval of the present invention can allow data retrieval in an encrypted state, thereby protecting the privacy of the data. Even if the data is stored across multiple modalities, it can ensure that the data is protected during transmission and storage, and at the same time, association search can be performed between data of different modalities.
[0048] 2. The present invention provides a privacy-preserving cross-modal semantic retrieval method based on a tree structure, which supports two retrieval tasks: graphic and text retrieval and content-based image search, and can provide richer and more accurate retrieval results.
[0049] 3. The present invention provides a privacy-preserving cross-modal semantic retrieval method based on a tree structure, which can obtain similarity metrics of both Euclidean distance and cosine similarity in an encrypted state, and has very strong practicality in real scenarios.
[0050] 4. The present invention provides a privacy-preserving cross-modal semantic retrieval method based on a tree structure. By using the CLIP deep neural network model, image data of different modalities are mapped into a unified vector space, so that image data of different modalities can be compared and searched in the same space. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1A privacy-preserving cross-modal semantic retrieval model diagram based on a tree structure provided by the present invention;
[0052] Figure 2 A schematic diagram of a cross-modal semantic retrieval method for privacy protection based on a tree structure provided by the present invention;
[0053] Figure 3 A schematic diagram of binary tree generation of a privacy-preserving cross-modal semantic retrieval method based on a tree structure provided by the present invention;
[0054] Figure 4 A privacy-preserving cross-modal semantic retrieval method based on a tree structure provided by the present invention is simulated with four datasets: Imagenet, MNIST, MSCOCO and fkr30k. DETAILED DESCRIPTION
[0055] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0056] Most existing searchable encryption technologies only support keywords and do not support query services with more functions. However, with the development of data diversity, more and more scenarios require cross-modal semantic retrieval, such as image and text retrieval. Due to the heterogeneity of different modalities, cross-modal retrieval is very challenging. At the same time, it is also very difficult to protect data privacy during the query process.
[0057] Therefore, in order to solve the privacy protection challenges of existing cross-modal semantic retrieval, the present invention proposes a cross-modal semantic retrieval method with privacy protection based on a tree structure, which includes data owners, cloud servers and data users; the data owner has a large amount of image data, and the local storage space limits the use and storage of image data, so the data owner will choose to upload the image data to the cloud server for storage, and usually choose to encrypt the image before uploading; the data user can apply to the data owner for permission to access the data; the data user can generate a search token based on text or image, and search for image data by sending a search request to the cloud server.
[0058] like Figure 1 As shown, a privacy-preserving cross-modal semantic retrieval method based on a tree structure mainly includes initialization, index building, and data query, which specifically includes the following steps:
[0059] S1: The data owner generates a key and sends it to the data user through a secure channel;
[0060] The key is:
[0061] sk=(ks,M1,M2)
[0062] Among them, sk is the key, ks is the symmetric encryption key, M1 and M2 are two different reversible matrices with dimensions of (m+4)×(m+4), and m is the dimension of the image data to be encrypted.
[0063] S2: The data owner encrypts all image data using a key, and sends the encrypted image data and the encrypted index of the tree structure generated based on the image data to the cloud server for storage;
[0064] Given an image set I = {I i ,i∈[1,n]}, encrypt all image data C using a symmetric encryption algorithm i =Sym.Enc(ks,I i ),i∈[1,n]; where n is the number of images; image {C i}, i∈[1,n] is sent to the cloud server for storage.
[0065] The method for the data owner to generate a tree-structured encrypted index based on the image data specifically includes the following steps:
[0066] S21: define the structure vector node of each tree node of the tree structure = (ln, rn, lt, rt, data), wherein the variable ln is used to store the pointer pointing to the left node, the variable rn is used to store the pointer pointing to the right node, the variable lt is used to store the judgment data related to the left node, the variable rt is used to store the judgment data related to the right node, the variable data in the leaf node is used to store the encrypted image vector, and the variable data of the non-leaf node is empty; the root node is the first layer of the tree structure, and the leaf node is the last layer of the tree structure;
[0067] S22: Determine whether the number of elements of the current image vector set S that needs to be processed by the current node is less than the set threshold value N0. If yes, execute step S23; if no, execute step S24; wherein the initial value of the current node is the root node;
[0068] S23: Encrypt each element p in the current image vector set S i , the encrypted image vector P i Store it in the variable data of the leaf node of the current node, and complete the index construction from the root node to the current leaf node;
[0069] Among them, each element p in the current image vector set S is encrypted i The method is:
[0070] For each element p in the current image vector set S iPerform the first encryption operation to obtain the encrypted image vector P corresponding to each element i , the first encryption operation is:
[0071] The element p i Expanded to (m+4)-dimensional vector Among them, r1 is a random number, m is the dimension of the image data to be encrypted; the data owner randomly generates a vector p′ with the main diagonal element i The lower triangular random matrix U with dimensions (m+4)×(m+4) i , a main diagonal element is a vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) x ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to transform U i Encrypted to the encrypted image vector P i =M1×I x ×U i ×I x ×M2.
[0072] S24: Obtain the child node to which each element in the current image vector set S belongs relative to the current node, and complete the assignment of the structure vector node of the current node, specifically:
[0073] S241: Determine whether the number of layers of the current node in the tree structure is less than 3. If so, use the 2-Means algorithm (the 2-Means algorithm is a simplification of the k-Means algorithm and can divide the data into two categories) to calculate the element p in the current image vector set S. i After clustering, we get two category vectors p a and p b If not, directly randomly select two category vectors p a and p b ;
[0074] S242: Get two category vectors p a and p b The center vector p c =(p a +p b ) / 2, and then get the element p in the current image vector set S i The corresponding category distance dis i =(p i -p c )·(p a -p c ), dis i >0 element p i Belongs to the left child node of the current node, and disi >0 element p i Divide into the left subtree set S1, and dis i Elements p ≤ 0 i Belongs to the right child node of the current node, and dis i Elements p ≤ 0 i Divide into right subtree set S2;
[0075] S243: Encrypt two class vectors p a and p b , corresponding to the encrypted category vector P a and the encrypted category vector P b , as follows:
[0076] The p b and p b Expanded to (m+4)-dimensional vectors and Where r1 is a random number; the data owner randomly generates a vector p′ with the main diagonal element a The lower triangular random matrix U with dimensions (m+4)×(m+4) a , a main diagonal element is a vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) a , a main diagonal element is the vector p′ b The lower triangular random matrix U with dimensions (m+4)×(m+4) b , a main diagonal element is a vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) b ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to transform U a and U b Encrypted into encrypted category vector P a =M1×I a ×U a ×I a ×M2 and I b =M1×I b ×U b ×I b ×M2.
[0077] S244: The variable ln of the current node points to its own left child node, the variable rn of the current node points to its own right child node, and the variable lt of the current node stores the encrypted category vector P a , the variable rt of the current node stores the encrypted category vector P b ;
[0078] S25: Increase the current node layer number by 1, and use the left subtree set S1 and the right subtree set S2 as the new current image vector set S to re-execute steps S22 to S27, until the encrypted image vectors corresponding to all elements in the original image vector set are stored in the variable data of the corresponding leaf node, and the encrypted index construction of the tree structure is completed; wherein, when the left subtree set S1 is used as the new current image vector set S, the new current node is the left child node of the original current node, and when the right subtree set S2 is used as the new current image vector set S, the new current node is the right child node of the original current node.
[0079] S3: The data user generates a corresponding search token based on the content of interest and sends the encrypted search token to the cloud server, which queries the encrypted index based on the search token.
[0080] It should be noted that data users can choose content-based image retrieval or image-text retrieval; generate a search token based on the content to be queried and send it to the cloud server, which queries the encrypted forest and returns the result to the data user; based on this, the method for generating a search token is as follows:
[0081] Data users generate corresponding search tokens from the content of interest using the CLIP deep neural network model, where the search token is an m-dimensional vector q;
[0082] The encryption method for the search token is:
[0083] Expand the search token q into a (m+4)-dimensional vector Where r2 is a random number, m is the dimension of the image data to be encrypted; the data user randomly generates a lower triangular random matrix Y with a main diagonal element as the vector q′ and a dimension of (m+4)×(m+4), and a main diagonal element as the vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) y ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to encrypt the search token q as
[0084] The method for the cloud server to query the encrypted index based on the search token specifically includes the following steps:
[0085] S31: Determine whether the first node in the current priority queue is a leaf node. If yes, store the encrypted image vector P in the variable data of the current leaf node. i Add to result set R; if not, execute step S32; wherein the initial value of the first node is the root node;
[0086] S32: Retrieve the encrypted category vector P stored in the variable lt of the current first node a and the encrypted category vector P stored in the variable rt b , and calculate the left trace dL = tr(P a ×Q) and the right trace dR = tr(P b ×Q), where the tr(*) function represents calculating the trace of matrix *, that is, the sum of the matrix diagonal elements, and Q is the encrypted search token;
[0087] S33: Update the priority queue according to the magnitudes of dL and dR, specifically:
[0088] Determine whether the absolute value of the difference between dL and dR is less than the set threshold w, that is, |dL - dR| < w. If so, the current first node is close to both the left and right center points, and add the left and right child nodes of the current first node to the priority queue. If not, determine the magnitudes of dL and dR. If dL > dR, add the left child node of the current first node to the priority queue. If dL < dR, add the right child node of the current first node to the priority queue;
[0089] S34: Use the updated priority queue as the new current priority queue and re - execute steps S31 - S33 until the priority queue is empty, then enter step S35;
[0090] S35: Calculate the traces of the products of the encrypted image vectors P i in the result set R and the search token Q respectively, and use the top k traces - corresponding encrypted image vectors P i as the final query results.
[0091] S4: The cloud server returns the queried encrypted image data to the data user for decryption, and the data user obtains the image data corresponding to the content of interest.
[0092] It should be noted that the present invention can also directly calculate the Euclidean distance and cosine similarity between the image vector and the search token when they are in the ciphertext state.
[0093] Specifically, the method for obtaining the Euclidean distance between the encrypted image vector P i and the search token Q in the encrypted state is as follows:
[0094] Use the CLIP deep neural network model to encode each image data I i into an m - dimensional vector p i , where i ∈ [1, n], and n is the number of image data; use the CLIP deep neural network model to generate the corresponding search token for the content of interest, where the search token is an m - dimensional vector q;
[0095] The m-dimensional vector p i and q directly execute steps S2 to S4, then the encrypted image vector P in step S45 i The trace of the product of the search token Q is the encrypted image vector P i The Euclidean distance between the search token Q is:
[0096]
[0097] -0.5(pq) 2 That is, the Euclidean distance between the image vector and the search token is calculated when they are plain text.
[0098] Get the encrypted image vector P in the encrypted state i The method for cosine similarity with the search token Q is:
[0099] The CLIP deep neural network model is used to transform each image data I i Encoded as an m-dimensional vector p i , where i∈[1,n], n is the number of image data; the CLIP deep neural network model is used to generate the corresponding search token from the content of interest, where the search token is an m-dimensional vector q;
[0100] The m-dimensional vector p i Perform normalization operation Vector q is normalized Then, steps S2 to S4 are executed, and the encrypted image vector P in step S45 is i The trace of the product of the search token Q is the encrypted image vector P i The cosine similarity between the search token Q is:
[0101] tr(P×Q)=[p / ||p||2,-0.5,1]·[q / ||q||2,1,-0.5]
[0102] =(p·q) / (||p||2||q||2)-1
[0103] =cos(p,q)-1
[0104] cos(p,q)-1 is the calculation method of the cosine similarity between the image vector and the search token when they are plain text.
[0105] It can be seen that if the trace is larger, the Euclidean distance is smaller or the cosine similarity is larger.
[0106] That is to say, if the m-dimensional vector p i Directly execute steps S2 to S4, then the encrypted image vector P in step S45 iThe trace of the product of the search token Q is the encrypted image vector P i The Euclidean distance between the search token Q; if the m-dimensional vector p i Perform normalization operation Then, steps S2 to S4 are executed, and the encrypted image vector P in step S45 is i The trace of the product of the search token Q is the encrypted image vector P i The cosine similarity between and the search token Q.
[0107] At this point, a privacy-preserving cross-modal semantic retrieval based on a tree structure has been completed.
[0108] The following is a further explanation of a cross-modal semantic retrieval method with privacy protection based on a tree structure provided by the present invention in conjunction with specific application scenarios.
[0109] The system model is shown in the figure Figure 1 ; The data owner has a large amount of image data. The local storage space limits the use and storage of image data. Therefore, the data owner will choose to upload the image data to the cloud server for storage, and usually choose to encrypt the image before uploading; Data users can apply to the data owner for permission to access the data; Data users can generate search tokens based on text or images, and search for image data by sending search requests to the cloud server.
[0110] Assume that the user wants to perform image-text retrieval and use cosine similarity as the similarity measurement function.
[0111] Assume that the data owner has 8 images (in actual scenarios, there may be tens of thousands or hundreds of millions of images); Assume that the vector dimension is 2;
[0112] Assume that the data user wants the most similar ones, that is, top-k = 1;
[0113] Step 1. Initialize the system and generate keys. The data owner generates keys based on system security parameters and sends the keys to the data owner through a secure channel, including the following sub-steps:
[0114] Step 1.1: Initialize the system and define the structure of the tree node as node = (ln, rn, lt, rt, data);
[0115] Among them, ln is a pointer pointing to the left node, rn is a pointer pointing to the right node, lt is the judgment data related to the left node, rt is the judgment data related to the right node, data is the storage information of the leaf node, and the non-leaf node is empty;
[0116] Step 1.2: Define system parameters N0 = 1, threshold w = 0.2, and similarity measurement function df = cosine similarity;
[0117] Step 1.2: The data owner randomly generates a key sk;
[0118] Among them, sk=(ks,M1,M2), ks is the symmetric encryption key used to encrypt image data, and M1 and M2 are two 6×6 reversible matrices used for encryption.
[0119] Step 1.3: Send the key sk to the data user through a secure channel;
[0120] Step 2. Build a security index; specifically: the data owner encrypts all image data and generates an encrypted index based on the image data, which includes the following sub-steps:
[0121] Step 2.1: Given an image set I = {I1,i∈[1,8]}, such as Figure 2 As shown, there are 8 pictures; all image data C is encrypted using a symmetric encryption algorithm i =Sym.Enc(ks,I i ),i∈[1,8];
[0122] Step 2.2: For each image data I i , using the CLIP deep neural network model to transform I i Encoded as an m-dimensional vector p i ; Normalize the vector All vectors p i The set is S =
[0123] [0.63826994,0.76981263],[0.98202917,0.18872918],
[0124] [0.93591069 0.3522374], [0.46777777, 0.88695246]
[0125] [0.34609858,0.93819815], [0.99127382,0.13181886]
[0126] [0.99976908,0.02148911], [0.55742012,0.83023057]
[0127] like Figure 3 There are 8 data points shown;
[0128] Step 2.3: Instantiate a new node as root; recursively build an encrypted tree according to the following steps, passing in the node root, the image vector set S, and the number of levels = 1:
[0129] Step 2.3.1: Determine whether the number of elements in the current image vector set S is less than parameter N0=1. If the number of elements in the image vector set S is greater than parameter N0, execute step 2.3.2; if it is less than N0, execute the following operation: for each element p in the image vector set S i Expanded to (m+4)-dimensional vector Where r1 is a random number; the data owner generates a random 6×6 main diagonal element as vector p′ i The lower triangular random matrix U i , a random 6×6 lower triangular matrix I with the main diagonal elements being the vector (1,1,…,1) x Finally, random matrices M1 and M2 are used to encrypt U i P i =M1×I x ×U i ×I x ×M2; store all encrypted vectors into the data variable of the leaf node; the construction of this path is completed;
[0130] Step 2.3.2: If the number of layers is less than 3, use the 2-Means algorithm to cluster the image vector dataset S and generate two center points p a =[0.51392955,0.84608045] and p b =[0.95535211,0.2382454]; Figure 3 The marked p a and p b ;
[0131] Step 2.3.3: Generate a hyperplane based on the two selected data points, divide the data into two parts, and calculate the center point of the two data points like Figure 3 As shown; all data points p in the image vector dataset S i Calculate dis i =(p i -p c )·(p a -p c ); if dis i >0,p i is divided into S1, if dis i <0, p i Divided into S2; S1 has {p1,p4,p5,p8}, S2 has {p2,p3,p6,p7};
[0132] Step 2.3.4: Encrypt two central nodes. a Expanded to a 6-dimensional vector p′ a =[pa ,-0.5,1,0.2,-0.2]; the data owner generates a random 6×6 main diagonal element as vector p′ a The lower triangular random matrix U a , a random 6×6 lower triangular matrix I with the main diagonal elements being the vector (1,1,…,1) a Finally, random matrices M1 and M2 are used to encrypt U a P a =M1×I a ×U a ×I a ×M2;p b Perform the same operation and encrypt it to P b ;
[0133] Step 2.3.5: Instantiate two nodes: left node leftnode and right node rightnode; point root pointer ln to leftnode, point root pointer rn to rightnode, and root variable lt stores matrix P a , the variable rt of root stores the matrix P b ;
[0134] Step 2.3.6: Generate the left subtree, repeat steps 2.3.1-2.3.5, input vector, node leftnode, image vector set S1, level level+1;
[0135] Step 2.3.7: Generate the right subtree, repeat steps 2.3.1-2.3.5, input vector, node rightnode, image vector set S2, level+1;
[0136] Step 2.4: Repeat step 2.3 to generate a subtree, such as Figure 3 The three layers of encrypted trees shown in the figure constitute an encrypted forest; the encrypted forest and the encrypted image {C i},i∈[1,6], sent to the cloud server for storage;
[0137] Step 3: Query data; the data user selects image and text retrieval; generates a search token based on the content to be queried and sends it to the cloud server. The cloud server queries the encrypted forest and returns the results to the data user.
[0138] Step 3.1: If Figure 2As shown in the figure, the data user encodes the desired query text text = 'Aman on a skateboard with a dog outside' into an m-dimensional vector q = [0.3, 0.4] by using the CLIP model; if the similarity measurement function is the Euclidean distance, the vector remains unchanged; if the similarity measurement function is the cosine similarity, the vector is normalized.
[0139] Step 3.2: Encrypt the query vector, generate a search token and send it to the cloud server for search; the encryption steps are as follows: q is expanded to a 6-dimensional vector q′=[0.6, 0.8, 1, -0.5, 0.3, 0.3], the data user generates a random 6×6 lower triangular random matrix Y with the main diagonal element as the vector q′, and a random 6×6 lower triangular matrix I with the main diagonal element as the vector (1, 1, ..., 1) y Finally, random matrices M1 and M2 are used to encrypt Q: The encrypted matrix Q is sent to the cloud server for query;
[0140] Step 3.3: The cloud server uses the search token to query, adds the root node of the tree to the priority queue, and repeats the following steps until the priority queue is empty;
[0141] Step 3.3.1: Take out the first node node in the queue; if node is a leaf node, add the data of node to the result set R;
[0142] Step 3.3.2: Take out the lt storage content M of node node l and node's rt storage content M r ; Calculate dL = tr (M l ×Q) = -0.01477791 and dR = tr(M r ×Q) = -0.236192414;
[0143] Step 3.3.3: |dL-dR|>w, determine the size of dL and dR, dL>dR, add the left node to the priority queue queue;
[0144] Step 3.3.4: Repeat steps 3.3.1-3.3.3 until the priority queue is empty;
[0145] Step 3.4: Calculate the matrix P1 and P8 in R, calculate the trace of the product with the search token Q respectively, and get -0.00118 and -0.00136. After sorting, get the maximum result, and send the corresponding encrypted image 1 to the data user;
[0146] Step 3.5: The data user decrypts the received image and obtains the final result;
[0147] So far, the present invention has realized privacy-preserving cross-modal semantic retrieval, and can find corresponding pictures through text; at the same time, the present invention also supports two retrieval tasks: picture-text retrieval and content-based image search. The present invention also supports two similarity metrics, which are very practical in real scenarios; Figure 3 This is a comparison between the present invention and the Ball tree on four different data sets. It can be seen from the figure that the Ball tree does not support high acceleration ratios, and the accuracy is poor when the acceleration ratio is the same. In other words, traditional tree structure indexes, such as KD trees and Ball trees, will suffer from dimensionality disasters in high-dimensional vector spaces, that is, the search performance is the same as linear search, and cannot achieve a good acceleration effect; the tree structure of the present invention can divide image data that are close in high-dimensional space into the same child node with a very high probability, with high accuracy and a good acceleration effect.
[0148] Of course, the present invention may have many other embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art may certainly make various corresponding changes and modifications based on the present invention, but these corresponding changes and modifications should all fall within the scope of protection of the claims attached to the present invention.
Claims
1. A privacy-preserving cross-modal semantic retrieval method based on a tree structure, characterized in that: The following steps are involved: S1: The data owner generates a key and sends it to the data user through a secure channel; S2: The data owner encrypts all image data using a key, and sends the encrypted image data and the encrypted index of the tree structure generated based on the image data to the cloud server for storage; S3: The data user generates a corresponding search token based on the content of interest and sends the encrypted search token to the cloud server, which queries the encrypted index based on the search token. S4: The cloud server returns the encrypted image data obtained by the query to the data user for decryption, and the data user obtains the image data corresponding to the content of interest.
2. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 1, characterized in that: The key is: sk=(ks,M1,M2) Among them, sk is the key, ks is the symmetric encryption key, M1 and M2 are two different reversible matrices with dimensions of (m+4)×(m+4), and m is the dimension of the image data to be encrypted.
3. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 1, characterized in that: The method by which the data owner generates a tree-structured encrypted index based on the image data is: S21: define the structure vector node of each tree node of the tree structure = (ln, rn, lt, rt, data), wherein the variable ln is used to store the pointer pointing to the left node, the variable rn is used to store the pointer pointing to the right node, the variable lt is used to store the judgment data related to the left node, the variable rt is used to store the judgment data related to the right node, the variable data in the leaf node is used to store the encrypted image vector, and the variable data of the non-leaf node is empty; the root node is the first layer of the tree structure, and the leaf node is the last layer of the tree structure; S22: Determine whether the number of elements of the current image vector set S that needs to be processed by the current node is less than the set threshold value N0. If yes, execute step S23; if no, execute step S24; wherein the initial value of the current node is the root node; S23: Encrypt each element p in the current image vector set S i , the encrypted image vector P i Store it in the variable data of the leaf node of the current node, and complete the index construction from the root node to the current leaf node; S24: Obtain the child node to which each element in the current image vector set S belongs relative to the current node, and complete the assignment of the structure vector node of the current node, specifically: S241: Determine whether the number of layers of the current node in the tree structure is less than 3. If so, use the 2-Means algorithm to perform a 2-means operation on the element p in the current image vector set S. i After clustering, we get two category vectors p a and p b If not, directly randomly select two category vectors p a and p b ; S242: Get two category vectors p a and p b The center vector p c =(p a +p b ) / 2, and then get the element p in the current image vector set S i The corresponding category distance dis i =(p i -p c )·(p a -p c ), dis i >0 element p i Belongs to the left child node of the current node, and dis i >0 element p i Divide into the left subtree set S1, and dis i Elements p ≤ 0 i Belongs to the right child node of the current node, and dis i Elements p ≤ 0 i Divide into right subtree set S2; S243: Encrypt two class vectors p a and p b , corresponding to the encrypted category vector P a and the encrypted category vector P b ; S244: The variable ln of the current node points to its own left child node, the variable rn of the current node points to its own right child node, and the variable lt of the current node stores the encrypted category vector P a , the variable rt of the current node stores the encrypted category vector P b ; S25: Increase the current node layer number by 1, and use the left subtree set S1 and the right subtree set S2 as the new current image vector set S to re-execute steps S22 to S27, until the encrypted image vectors corresponding to all elements in the original image vector set are stored in the variable data of the corresponding leaf node, and the encrypted index construction of the tree structure is completed; wherein, when the left subtree set S1 is used as the new current image vector set S, the new current node is the left child node of the original current node, and when the right subtree set S2 is used as the new current image vector set S, the new current node is the right child node of the original current node.
4. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 3, characterized in that: In step S23, each element p in the current image vector set S is encrypted i The method is: For each element p in the current image vector set S i Perform the first encryption operation to obtain the encrypted image vector P corresponding to each element i , the first encryption operation is: The element p i Expanded to (m+4)-dimensional vector Among them, r1 is a random number, m is the dimension of the image data to be encrypted; the data owner randomly generates a vector p′ with the main diagonal element i The lower triangular random matrix U with dimensions (m+4)×(m+4) i , a main diagonal element is a vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) x ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to transform U i Encrypted to the encrypted image vector P i =M1×I x ×U i ×I x ×M2.
5. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 3, characterized in that: The category vector p in step S243 a and p b The encryption method is as follows: The p a and p b Expanded to (m+4)-dimensional vectors and Where r1 is a random number; the data owner randomly generates a vector p′ with the main diagonal element a The lower triangular random matrix U with dimensions (m+4)×(m+4) a , a main diagonal element is a vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) a , a main diagonal element is the vector p′ b The lower triangular random matrix U with dimensions (m+4)×(m+4) b , a main diagonal element is a vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) b ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to transform U a and U b Encrypted into encrypted category vector P a =M1×I a ×U a ×I a ×M2 and P b =M1×I b ×U b ×I b ×M2.
6. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 3, characterized in that: In step S3, the cloud server queries the encrypted index based on the search token as follows: S31: Determine whether the first node in the current priority queue is a leaf node. If yes, store the encrypted image vector P in the variable data of the current leaf node. i Add to result set R; if not, execute step S32; wherein the initial value of the first node is the root node; S32: Take out the encrypted category vector P stored in the variable lt of the current first node a And the variable rt stores the encrypted category vector P b , and calculate the left trace dL = tr(P a ×Q) and the right trace dR=tr(P b ×Q), where tr(*) function represents the calculation of the trace of the matrix *, and Q is the encrypted search token; S33: Update the priority queue according to the size of dL and dR, specifically: Judge whether the absolute value of the difference between dL and dR is less than the set threshold w. If so, add the left and right child nodes of the current first node to the priority queue. If not, judge the magnitudes of dL and dR. If dL > dR, add the left child node of the current first node to the priority queue. If dL < dR, add the right child node of the current first node to the priority queue; S34: Use the updated priority queue as the new current priority queue and re - execute steps S31 - S33 until the priority queue is empty, then enter step S35; S35: Calculate the encrypted image vectors P in the result set R respectively i The trace of the product of the search token Q, the encrypted image vector P corresponding to the largest first k traces i As the final query result.
7. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 6, characterized in that: Get the encrypted image vector P in the encrypted state i The Euclidean distance from the search token Q is: The CLIP deep neural network model is used to transform each image data I i Encoded as an m-dimensional vector p i , where i∈[1,n], n is the number of image data; the CLIP deep neural network model is used to generate the corresponding search token from the content of interest, where the search token is an m-dimensional vector q; The m-dimensional vector p i and q directly execute steps S2 to S4, then the encrypted image vector P in step S45 i The trace of the product of the search token Q is the encrypted image vector P i The Euclidean distance from the search token Q.
8. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 6, characterized in that: Get the encrypted image vector P in the encrypted state i The method for cosine similarity with the search token Q is: The CLIP deep neural network model is used to transform each image data I i Encoded as an m-dimensional vector p i , where i∈[1,n], n is the number of image data; the CLIP deep neural network model is used to generate the corresponding search token from the content of interest, where the search token is an m-dimensional vector q; The m-dimensional vector p i Perform normalization operation Vector q is normalized Then, steps S2 to S4 are executed, and the encrypted image vector P in step S45 is i The trace of the product of the search token Q is the encrypted image vector P i The cosine similarity between and the search token Q.
9. The privacy-preserving cross-modal semantic retrieval method based on a tree structure as claimed in claim 1, characterized in that: The method for generating a search token is as follows: The data user uses the CLIP deep neural network model to generate a corresponding search token for the content of interest, where the search token is an m - dimensional vector q; The method for encrypting the search token is as follows: Expand the search token q into a (m+4)-dimensional vector Where r2 is a random number, m is the dimension of the image data to be encrypted; the data user randomly generates a lower triangular random matrix Y with a main diagonal element as the vector q′ and a dimension of (m+4)×(m+4), and a main diagonal element as the vector (1,1,…,1) 1×(m+4) The lower triangular matrix I is of dimension (m+4)×(m+4) y ; Use random matrices M1 and M2 of dimensions (m+4)×(m+4) to encrypt the search token q as
Citation Information
Patent Citations
Cross-modal privacy semantic retrieval method and system and storage medium
CN114519202A
Self-adaptive enhanced adversarial hash unsupervised cross-modal retrieval method
CN117851659A
Cited By
Semantic perception cross-modal encryption retrieval method
CN119760188A
Image retrieval method and system supporting sharing of multiple data sources
CN119788424A
Data processing method and device, equipment and storage medium
CN119807196A
Secure verifiable cross-modal retrieval method
CN120296191A
