Quantum image feature extraction method oriented to image similarity task, computer program product and terminal
Through the quantum image feature extraction method, amplitude coding and dual-parameterized quantum circuit are used to solve the bottlenecks and negative sample management problems of traditional methods in high-dimensional data processing in image feature extraction, and the accuracy and robustness of image feature extraction are improved. Achieve more efficient comparative learning.
Patent Information
- Application Number
- CN202411191185.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-08-28
AI Technical Summary
Traditional image feature extraction methods are difficult to efficiently and accurately capture the complex relationships between image features when processing high-dimensional data, and the unsupervised contrast learning method is limited by negative sample management challenges, so the accuracy of image feature extraction needs to be improved.
Using the quantum image feature extraction method, the positive and negative sample pairs are mapped to the quantum state space through amplitude encoding technology, and the feature representation of the quantum state is converted into the quantum state using a dual-parameterized quantum circuit, and trained through the momentum encoder and the comparative learning loss function, combined with Data augmentation technology generates high-quality similar image pairs, optimizing parameter settings to improve extraction accuracy and robustness.
Significantly improve the accuracy and robustness of image feature extraction, improve data processing efficiency, effectively prevent overfitting, ensure the use of the latest negative samples in each training cycle, enhance the efficiency and accuracy of contrast learning, and realize multi-dimensional and multi-dimensional Hierarchical image feature extraction.
Smart Images

Figure CN119169306A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of quantum image feature extraction, and in particular to a quantum image feature extraction method, a computer program product and a terminal for image similarity tasks. Background Art
[0002] With the rapid development of computer vision technology, image similarity detection plays an increasingly important role in many fields such as image classification, object detection and image segmentation. Traditional image feature extraction methods, mainly based on classic machine learning and deep learning technologies such as Convolutional Neural Networks (CNN), have made significant progress in image feature representation. However, faced with the rapid expansion of data scale and the increasing dimension of image data, these classic methods have encountered bottlenecks in processing high-dimensional data, making it difficult to efficiently and accurately capture the complex relationship between image features.
[0003] Unsupervised learning learns effective feature representations by maximizing the similarity between positive sample pairs and minimizing the similarity between negative sample pairs, where positive sample pairs are similar or related sample pairs in the feature space, and negative sample pairs are dissimilar or unrelated sample pairs in the feature space. This method does not rely on pre-defined category labels, but learns through the relative similarity between samples. In this way, the model is able to learn features that distinguish different instances, which can then be used for various downstream tasks. Unsupervised contrastive learning methods rely on a large number of positive and negative sample pairs. Learning with the latest negative samples can ensure the contrastive learning effect. The current challenges of negative sample management limit the widespread application of unsupervised contrastive learning methods, and the accuracy of image feature extraction needs to be further improved. Summary of the invention
[0004] The purpose of the present invention is to overcome the problems of the prior art and to provide a quantum image feature extraction method, a computer program product and a terminal for image similarity tasks.
[0005] The object of the present invention is to achieve the following technical solution: a quantum image feature extraction method for image similarity tasks, the method comprising the following steps:
[0006] Construct positive and negative sample pairs;
[0007] The positive and negative sample pairs are mapped to the quantum state space through amplitude coding technology to obtain the quantum state representation of the positive and negative sample pairs;
[0008] The quantum state representation of the positive and negative sample pairs is converted into the feature representation of the quantum state through a dual-parameterized quantum circuit; the dual-parameterized quantum circuit includes a main encoder and a momentum encoder, the main encoder is used to extract the features of the positive samples, the momentum encoder is used to extract the features of the negative samples, and the parameters of the momentum encoder are the exponential moving average of the parameters of the main encoder;
[0009] Different measurement basis vectors are selected to measure the characteristic representation of the quantum state to obtain image features.
[0010] In one example, constructing positive and negative sample pairs includes:
[0011] Generate positive sample pairs of input images through data augmentation operations, where the data augmentation operations include one or more of flipping, rotating, color distortion, adding noise, scaling, translating, shearing transformation, perspective transformation, brightness and contrast adjustment, saturation and hue adjustment, gamma correction, random erasing, affine transformation, filtering, random color space transformation, occlusion and masking;
[0012] Any image in the dataset that is different from the input image is considered a negative sample of the input image.
[0013] In one example, the structure of the dual-parameterized quantum circuit is expressed as:
[0014]
[0015] Where U(θ) represents the unit operator of the dual-parameterized quantum circuit; θ represents the adjustable parameter of the dual-parameterized quantum circuit; L represents the number of layers; Q represents the number of quantum bits; and They represent the rotation gates RZ and RY acting on the qth quantum bit in the lth layer respectively; CNOT(p,q) represents the CNOT gate acting on the pth and qth quantum bits.
[0016] In one example, the update expression of the parameters of the momentum encoder is:
[0017] θ momentum =α·θ momentum +(1-α)·θ;
[0018] Where, θ represents the parameters of the main encoder; θ momentum represents the parameters of the momentum encoder; α is the momentum factor, which is used to control the update speed of the parameters of the momentum encoder.
[0019] In one example, a dual-parameterized quantum circuit is trained using a contrastive learning loss function. The expression is:
[0020]
[0021] Where f(|x>) represents the characteristic representation of the input quantum state |x>; Represents the data in the negative sample pair The quantum state representation of The characteristic representation of y i,k is a label, indicating that the sample pair Is it a positive sample pair? If |x> and Similar, then y i,k =1; otherwise y i,k = 0; m represents the margin, which is used to ensure that the distance between the target sample and the negative sample is at least m larger than the distance between the anchor point and the positive sample; represents the distance metric between feature representations.
[0022] In one example, a differential gradient descent method is used to adjust parameters of a dual-parameterized quantum circuit, including:
[0023] (1) Initializing the parameters of the dual-parameterized quantum circuit;
[0024] (2) executing a dual-parameterized quantum circuit, measuring the quantum state to obtain a measurement result, and calculating the loss function value under the current parameters;
[0025] (3) Calculate the positive perturbation loss function and negative perturbation loss function of each parameter, and use the numerical approximation formula to calculate the gradient;
[0026] (4) Update parameters using gradient descent;
[0027] (5) Repeat steps (2)-(4) until the loss function converges or reaches a predetermined number of iterations.
[0028] It should be further explained that the technical features corresponding to the various examples of the above method can be combined or replaced with each other to form a new technical solution.
[0029] The present invention also includes a computer program product, including a computer program, which, when executed by a processor, implements the steps of the quantum image feature extraction method for image similarity tasks formed by any one of the above examples or a combination of multiple examples.
[0030] The present invention also includes a terminal, including a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, and when the processor executes the computer instructions, the steps of the quantum image feature extraction method for image similarity tasks formed by any one or more of the above examples are executed.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] 1. In one example, a dual parameterized quantum circuit (PQC) can effectively utilize the characteristics of quantum superposition and quantum entanglement to efficiently capture the complex relationship between image features at a deeper level, significantly improving the accuracy and robustness of feature extraction, as well as data processing efficiency; the momentum encoder maintains similar but slightly different parameter settings as the main encoder through a momentum update mechanism to achieve more efficient contrastive learning; at the same time, different types of observation information of the original data are obtained through different types of observations, and the original data is further enhanced to obtain more negative samples. By gradually updating the samples in the negative sample set, it can ensure that the latest negative samples can be used in each training cycle, thereby improving the efficiency and accuracy of contrastive learning.
[0033] 2. In one example, the input image is processed by data augmentation technology to generate high-quality similar image pairs (positive samples) and different image pairs (negative samples), providing a basis for contrastive learning.
[0034] 3. In one example, the design of the dual-parameterized quantum circuit allows flexible adjustment of parameters in the image feature extraction process. By optimizing these parameters, the accuracy and robustness of image similarity detection can be further improved. At the same time, by introducing the parameters of the momentum encoder, it is equivalent to regularizing the dual-parameterized quantum circuit, which can effectively prevent overfitting problems and optimize the processing of high-dimensional data. Furthermore, based on the dual-parameterized quantum circuit, a dynamic dictionary with momentum update is introduced to store and manage a large number of negative samples. By gradually updating the samples in the negative sample set, a stable and rich negative sample set is maintained, thereby improving the effect of contrastive learning.
[0035] 4. In one example, different basis vector combinations of quantum measurement are used to perform measurements to achieve multi-dimensional and multi-level image feature extraction, and to construct diversified feature representations, thereby obtaining more negative samples. During the training process, a large number of positive and negative sample pairs are constructed, and a contrastive learning strategy is used for training to optimize the parameter settings of PQC, so that the feature representations of similar images are closer and the feature representations of different images are more separated. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The specific implementation methods of the present invention are further described in detail below in conjunction with the accompanying drawings. The accompanying drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The same reference numerals are used in these drawings to represent the same or similar parts. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application.
[0037] Figure 1 A method flow chart provided for an example of the present invention;
[0038] Figure 2 A schematic diagram of a dual-parameterized quantum circuit provided for an example of the present invention;
[0039] Figure 3 A schematic diagram of a feature extractor provided for an example of the present invention. DETAILED DESCRIPTION
[0040] The technical solution of the present invention is described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] In the description of the present invention, it should be noted that the directions or positional relationships indicated by "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc. are directions or positional relationships based on the drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the use of ordinal numbers (e.g., "first and second", "first to fourth", etc.) is to distinguish objects, and is not limited to this order, and cannot be understood as indicating or implying relative importance.
[0042] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, "installation", "connection" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0043] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0044] In one example, if Figure 1 As shown, a quantum image feature extraction method for image similarity tasks includes the following steps:
[0045] S1: Construct positive and negative sample pairs.
[0046] Specifically, contrastive learning aims to learn data representation so that similar data points are closer in the feature space, while different data points are farther away. The model is trained by constructing positive and negative sample pairs, with the goal of enabling the model to distinguish subtle differences between the data and thus obtain better feature representation. Among them, the positive sample pair consists of two similar data points, such as different enhanced versions of the same image, or different views of the same object. The negative sample pair consists of two dissimilar data points, such as enhanced versions of different images, or different views of different objects.
[0047] S2: Map the positive and negative sample pairs to the quantum state space through amplitude coding technology to obtain the quantum state representation of the positive and negative sample pairs.
[0048] Specifically, amplitude coding technology is used to map the image pixel matrix to the Hilbert space to achieve quantum state embedding of image data. By utilizing the characteristics of quantum superposition and quantum entanglement, the relationship between image features can be captured at a deeper level, overcoming the bottleneck of classical methods in processing high-dimensional data.
[0049] S3: The quantum state representation of the positive and negative sample pairs is converted into the feature representation of the quantum state through a dual-parameterized quantum circuit; the dual-parameterized quantum circuit includes a main encoder and a momentum encoder, the main encoder is used to extract the features of the positive samples, the momentum encoder is used to extract the features of the negative samples, and the parameters of the momentum encoder are the exponential moving average of the parameters of the main encoder.
[0050] In this example, a trained dual PQC encoder structure is used to convert the quantum state representation into a feature representation. The dual PQC encoder structure includes a main encoder and a momentum encoder, which respectively process the image data of the current batch and maintain the similarity of parameter settings through a momentum update mechanism, and evolve the encoded quantum state representation to achieve further feature extraction.
[0051] S4: Select different combinations of measurement basis vectors to measure the characteristic representation of the quantum state and obtain quantum image characteristics.
[0052] Among them, the measurement basis vectors are standard basis (quantum state |0> and quantum state |1>), X basis, Y basis, Z basis, and Hadamard basis, etc. Different types of observation information of the original data are obtained through different types of observations, and the original data is further enhanced to obtain more negative samples.
[0053] In one example, constructing positive and negative sample pairs includes:
[0054] S11: generating a positive sample pair of the input image through a data augmentation operation, wherein the data augmentation operation includes one or more of flipping, rotating, color distortion, adding noise, scaling, translating, shearing transformation, perspective transformation, brightness and contrast adjustment, saturation and hue adjustment, gamma correction, random erasing, affine transformation, filtering, random color space transformation, occlusion and masking;
[0055] S12: Take any image in the dataset that is different from the input image as a negative sample of the input image.
[0056] Among them, steps S11 and S12 can be executed simultaneously or in a reversed order.
[0057] Specifically, let x i Represents the u-th input image, and generates its positive sample pair x' through data enhancement operation i :
[0058] x′ i =Augment(x i );
[0059] Augment refers to data augmentation operations, including flipping, rotation, color distortion, adding noise, scaling, translation, shearing, perspective transformation, brightness and contrast adjustment, saturation and hue adjustment, gamma correction, random erasing, affine transformation, filtering, random color space transformation, occlusion and masking, etc. For example, by adding noise and scaling the image, the following augmented samples can be generated:
[0060] x′ i =Scale(AddNoise(x i ));
[0061] Among them, Scale represents the image scaling operation; AddNoise represents the noise adding operation.
[0062] Let x i There are K negative samples These negative samples can be those in the dataset that are different from x i Different arbitrary images, then each image x i Have a positive sample pair (x i ,x' i ) and a large number of negative samples These sample pairs will serve as basic data for contrastive learning and be used to train and optimize dual-parameterized quantum circuits.
[0063] By combining classical data enhancement technology and quantum circuit processing, the present invention can efficiently construct positive and negative sample pairs that meet the requirements of quantum computing and effectively solve the challenges of high-dimensional data processing.
[0064] Optionally, depending on the width of the quantum circuit, the positive and negative sample pairs can also be subjected to dimensionality reduction or cropping to ensure that the sample pairs are adapted to the computing power of the quantum circuit while retaining key features of the image.
[0065] In one example, mapping the positive and negative sample pairs to the quantum state space includes:
[0066] Represent each sample x as an n-dimensional vector (x1, x2, ..., xn). The amplitude encoding process creates a quantum state |x>, which is expressed as:
[0067]
[0068] Among them, x i is the i-th component of the data x, and |i> is the standard calculation basis vector. For the data x' in the enhanced positive sample, its quantum state is expressed as:
[0069]
[0070] For a large number of negative sample pairs Their quantum states are represented as follows:
[0071]
[0072] By using amplitude coding technology, after mapping the positive and negative sample pairs to the quantum state space, the following quantum state representation can be obtained:
[0073]
[0074] in, Represents the set of quantum states of positive and negative samples.
[0075] In one example, the structure of a dual-parameterized quantum circuit is as follows Figure 2 As shown in Figure 1, it consists of several single-qubit rotation gates and several multi-qubit entanglement gates. The single-qubit rotation gates include RZ gates and RY gates, which can accurately manipulate quantum states and realize pure state vector manipulation at any angle. The multi-qubit entanglement gate is a CNOT gate, which is used to build a strong entanglement layer and enhance the correlation between qubits. The main encoder has the same structure as the momentum encoder, as shown in Figure 1. Figure 2 As shown, each includes several sub-layers, the first sub-layer includes RZ gates, RY gates, and RZ gates connected in sequence, and other sub-layers include RZ gates, RY gates, RZ gates, and CNOT gates connected in sequence. The second RZ gate of the first sub-layer is connected to the CNOT gate of the next sub-layer, and in other adjacent sub-layers, the CNOT gate of the previous sub-layer is connected to the CNOT gate of the next sub-layer, and the main encoder and the momentum encoder are connected to each sub-layer accordingly. Specifically, the structure of the dual-parameterized quantum circuit in this example is expressed as:
[0076]
[0077] Where U(θ) represents the unit operator of the dual-parameterized quantum circuit; θ represents the adjustable parameter of the dual-parameterized quantum circuit; L represents the number of layers; Q represents the number of quantum bits; and They represent the rotation gates RZ and RY acting on the qth quantum bit in the lth layer respectively; CNOT(p,q) represents the CNOT gate acting on the pth and qth quantum bits.
[0078] Through the above PQC encoder structure, the input quantum state |x> is converted into the feature representation f, which is expressed as follows:
[0079] f(|x>)=U(θ)|x>;
[0080] For positive sample pairs (|x>,|x'>) and negative sample pairs The characteristic representation calculation expression is:
[0081] f(|x>)=U(θ)|x>;
[0082] f(|x'>)=U(θ)|x'>;
[0083]
[0084] In one example, the update expression of the parameters of the momentum encoder is:
[0085] θ momentum =α·θ momentum +(1-α)·θ;
[0086] Where, θ represents the parameters of the main encoder; θ momentum represents the parameters of the momentum encoder; α is the momentum factor, which is used to control the update speed of the parameters of the momentum encoder. During the training process, only the main encoder is trained, and the parameters of the momentum encoder are the exponential moving average (EMA) of the main encoder parameters, which helps to smooth the learning process and improve the consistency of features.
[0087] In one example, the encoding circuit (encoding), the dual parameterized quantum circuit (ansatz), and the measurement circuit (measure) corresponding to the amplitude coding are sequentially connected to form a feature extractor, which is trained using a contrastive learning loss function to maximize the similarity of positive sample pairs and minimize the similarity of negative sample pairs. The expression is:
[0088]
[0089] Where f(|x>) represents the characteristic representation of the input quantum state |x>; Represents the data in the negative sample pair The quantum state representation of The characteristic representation of y i,k is a label, indicating the sample pair Is it a positive sample pair? If |x> and Similar, then y i,k =1; otherwise y i,k = 0; m represents the margin, which is used to ensure that the distance between the target sample and the negative sample is at least m larger than the distance between the anchor point and the positive sample; Represents a distance metric between feature representations, such as Euclidean distance:
[0090]
[0091] By maximizing the similarity of positive sample pairs and minimize the similarity of negative sample pairs The contrastive learning loss function guides the model to learn effective feature representations.
[0092] In one example, in quantum circuit optimization, the differential gradient descent method is used to adjust the parameters of the dual-parameterized quantum circuit. The differential gradient descent method is based on the differentiability of the quantum circuit and updates the parameters by calculating the gradient of the parameters, so that the loss function gradually decreases. The gradient calculation formula is as follows:
[0093]
[0094] Among them, ∈ is a small perturbation, and the gradient is approximated by calculating the loss function value before and after the perturbation. Then, the parameters are updated by the gradient descent method:
[0095]
[0096] Here, η represents the learning rate.
[0097] More specifically, the specific steps of the differential gradient descent method include:
[0098] (1) Initialization parameters: Randomly initialize the parameters θ of the quantum circuit;
[0099] (2) Calculate the loss function: Execute the dual-parameterized quantum circuit, measure the quantum state to obtain the measurement result, and calculate the loss function value under the current parameters;
[0100] (3) Calculate the numerical gradient: For each parameter θ i ,calculate and Then use the numerical approximation formula to calculate the gradient
[0101] (4) Update parameters: Use the gradient descent formula to update the parameter θ;
[0102] (5) Repeat steps (2)-(4) until the loss function converges or reaches a predetermined number of iterations. Through repeated iterations, the differential gradient descent method gradually optimizes the parameters of the dual-parameterized quantum circuit, so that the model performance is continuously improved.
[0103] Combining the above examples, we get a preferred example of the present invention. In this case, the feature extractor structure corresponding to the method is as follows: Figure 3 As shown, the method now includes the following steps:
[0104] S10: construct positive and negative sample pairs;
[0105] S20: Map the positive and negative sample pairs to the quantum state space through amplitude coding technology to obtain the quantum state representation of the positive and negative sample pairs;
[0106] S30: Convert the quantum state representation of the positive and negative sample pairs into the characteristic representation of the quantum state through a dual-parameterized quantum circuit;
[0107] S40: Select different measurement basis vectors to measure the characteristic representation of the quantum state to obtain image features;
[0108] S50: According to the measurement results, the contrastive learning loss function is used to train and optimize the dual-parameterized quantum circuit to maximize the similarity of positive samples and minimize the similarity of negative samples;
[0109] S60: The parameters of the dual-parameterized quantum circuit are adjusted by using the differential gradient descent method to complete the training of the dual-parameterized quantum circuit, and efficient and accurate image feature extraction is achieved based on the optimized dual-parameterized quantum circuit.
[0110] By introducing quantum contrast learning and dual-parameterized quantum circuits, the present invention can use unlabeled image data to learn useful feature representations without the need for a large amount of labeled data, reducing the dependence on labeled data and providing high-quality features for downstream computer vision tasks. This new method is expected to overcome the shortcomings of existing technologies, improve the efficiency and accuracy of image similarity detection, enable quantum computing technology to be more widely used in the field of image processing, and provide new perspectives and possibilities for the application of quantum computing in the field of image processing.
[0111] At the same time, the present invention realizes deep-level feature extraction of image data through quantum contrast learning and dual-parameterized quantum circuits, providing high-quality feature representation for image similarity detection. This method not only overcomes the bottleneck of traditional methods in processing high-dimensional data, but also effectively improves the accuracy and robustness of detection. By introducing a dynamic dictionary with momentum updates and an efficient contrast learning mechanism, the present invention not only solves the challenges of negative sample management, but also reduces the dependence on labeled data, providing new ideas and technical means for the application of quantum computing in the field of image similarity detection.
[0112] An example of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the quantum image feature extraction method for image similarity tasks formed by any one of the above examples or a combination of multiple examples. The processor may be a single-core or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
[0113] An example of the present invention also provides a storage medium, which has the same inventive concept as a quantum image feature extraction method for image similarity tasks formed by any one of the above examples or a combination of multiple examples, and stores computer instructions thereon, which, when executed, execute the steps of the quantum image feature extraction method for image similarity tasks formed by any one of the above examples or a combination of multiple examples.
[0114] Based on this understanding, the technical solution of this embodiment, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0115] An example of the present invention further provides a terminal, which has the same inventive concept as any example or a combination of multiple examples corresponding to the above-mentioned quantum image feature extraction method for image similarity tasks, including a memory and a processor, the memory stores computer instructions that can be run on the processor, and the processor executes the steps of the above-mentioned quantum image feature extraction method for image similarity tasks when running the computer instructions. The processor can be a single-core or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
[0116] In one example, the terminal, i.e., the electronic device, is presented in the form of a general-purpose computing device, and the components of the electronic device may include but are not limited to: at least one processing unit (processor) mentioned above, at least one storage unit mentioned above, and a bus connecting different system components (including storage units and processing units).
[0117] The storage unit stores a program code, and the program code can be executed by the processing unit, so that the processing unit performs the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification. For example, the processing unit can perform the above-mentioned quantum image feature extraction method for image similarity tasks.
[0118] The storage unit may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 3201 and / or a cache memory unit, and may further include a read-only memory unit (ROM).
[0119] The storage unit may also include a program / utility having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0120] The bus may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0121] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0122] Through the above description, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to this exemplary embodiment can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method of the exemplary embodiment of the present application.
[0123] The above specific implementation methods are detailed descriptions of the present invention. It cannot be determined that the specific implementation methods of the present invention are limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions and substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A quantum image feature extraction method for image similarity tasks, It is characterized in that The following steps are involved: Construct positive and negative sample pairs; The positive and negative sample pairs are mapped to the quantum state space through amplitude coding technology to obtain the quantum state representation of the positive and negative sample pairs; The quantum state representation of the positive and negative sample pairs is converted into the feature representation of the quantum state through a dual-parameterized quantum circuit; the dual-parameterized quantum circuit includes a main encoder and a momentum encoder, the main encoder is used to extract the features of the positive samples, the momentum encoder is used to extract the features of the negative samples, and the parameters of the momentum encoder are the exponential moving average of the parameters of the main encoder; Different measurement basis vectors are selected to measure the characteristic representation of the quantum state to obtain image features.
2. The quantum image feature extraction method for image similarity tasks according to claim 1, It is characterized in that Constructing positive and negative sample pairs includes: Generate positive sample pairs of input images through data augmentation operations, where the data augmentation operations include one or more of flipping, rotating, color distortion, adding noise, scaling, translating, shearing transformation, perspective transformation, brightness and contrast adjustment, saturation and hue adjustment, gamma correction, random erasing, affine transformation, filtering, random color space transformation, occlusion and masking; Any image in the dataset that is different from the input image is considered a negative sample of the input image.
3. The quantum image feature extraction method for image similarity tasks according to claim 1, It is characterized in that The structure of the dual-parameterized quantum circuit is expressed as: Where U(θ) represents the unit operator of the dual-parameterized quantum circuit; θ represents the adjustable parameter of the dual-parameterized quantum circuit; L represents the number of layers; Q represents the number of quantum bits; and They represent the rotation gates RZ and RY acting on the qth quantum bit in the lth layer respectively; CNOT(p,q) represents the CNOT gate acting on the pth and qth quantum bits.
4. The quantum image feature extraction method for image similarity tasks according to claim 1, It is characterized in that The update expression of the parameters of the momentum encoder is: i momentum =a·θ momentum +(1-a)·θ; Where, θ represents the parameters of the main encoder; θ momentum represents the parameters of the momentum encoder; α is the momentum factor, which is used to control the update speed of the parameters of the momentum encoder.
5. The quantum image feature extraction method for image similarity tasks according to claim 1, It is characterized in that The dual-parameterized quantum circuit is trained using a contrastive learning loss function. The expression is: Where f(|x>) represents the characteristic representation of the input quantum state |x>; Represents the data in the negative sample pair The quantum state representation of The characteristic representation of y i,k is a label, indicating the sample pair Is it a positive sample pair? If |x> and Similar, then y i,k =1; otherwise y i,k = 0; m represents the margin, which is used to ensure that the distance between the target sample and the negative sample is at least m larger than the distance between the anchor point and the positive sample; represents the distance metric between feature representations.
6. The quantum image feature extraction method for image similarity tasks according to claim 1, It is characterized in that The differential gradient descent method is used to adjust the parameters of the dual-parameterized quantum circuit, including: (1) Initializing the parameters of the dual-parameterized quantum circuit; (2) executing a dual-parameterized quantum circuit, measuring the quantum state to obtain a measurement result, and calculating the loss function value under the current parameters; (3) Calculate the positive perturbation loss function and negative perturbation loss function of each parameter, and use the numerical approximation formula to calculate the gradient; (4) Update parameters using gradient descent; (5) Repeat steps (2)-(4) until the loss function converges or reaches a predetermined number of iterations.
7. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the quantum image feature extraction method for image similarity tasks described in any one of claims 1 to 6 are implemented.
8. A terminal comprising a memory and a processor, wherein the memory stores computer instructions executable on the processor, It is characterized in that When the processor runs the computer instructions, the processor performs the steps of the quantum image feature extraction method for image similarity tasks described in any one of claims 1 to 6.
Citation Information
Patent Citations
Model training method and device, image processing method and device, medium and electronic equipment
CN116258657A
Content resource detection model training method, content resource detection method and device
CN116933069A
Composition for preventing or treating arthritis comprising altiratinib
KR1020250173033A
Estimation of classical capacity of quantum channel
US20230153674A1
Dual Attention Network Using Transformers for Cross-Modal Retrieval
US20240194328A1
Cited By
Filling station control method and system based on video monitoring
CN120810904A
