Image generation method based on mixed quantum classical condition generative adversarial network
By introducing a hybrid quantum classical conditional generation adversarial network into the quantum generative adversarial network, the combination of quantum states and classical neural networks is used to solve the problem of poor computing efficiency and generation quality of traditional networks in complex data processing, and achieve high efficiency, Diversified and controllable image generation.
Patent Information
- Application Number
- CN202411479429.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-17
AI Technical Summary
Traditional quantum generation adversarial networks are difficult to achieve precise control of specific conditions or labels when processing complex data, and in the NISQ era, conditional characterization and noise image generation are difficult to work properly when there are fewer quantum bits, resulting in the lack of customization and variety of generated images. sex.
Using the hybrid quantum classical condition generation adversarial network (QC-CGAN) method, by loading classic random noise and conditional labels into quantum states, the sub-image feature data is generated using the quantum condition generator, and the complete image is output through the classic single-layer neural network. Data, combined with PennyLane and PyTorch for seamless interaction, uses one-hot encoding and quantum gate operation to implement conditional control and entanglement layer processing, and optimizes the parameters of the generator and discriminator.
It significantly improves the efficiency and quality of image generation, increases the diversity and controllability of generation, and can generate images that meet the requirements under clear conditions, solving the poor computing efficiency and generation quality of traditional GANs in complex data processing. question.
Smart Images

Figure CN119323614A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of quantum computing and generation, and specifically to a method for efficient and conditional image generation by combining quantum computing with classical neural networks and using image generation technology based on a hybrid quantum-classical conditional generative adversarial network (Quantum-Classical Conditional Generative Adversarial Network, QC-CGAN), which is particularly suitable for image generation and optimization tasks under complex conditions. Background Art
[0002] Since its introduction in 2014, Generative Adversarial Networks (GANs) have become the mainstream technology for image generation and generative learning. However, traditional GANs often face problems such as unstable training and poor generation quality when processing complex and high-dimensional data. To this end, Conditional Generative Adversarial Networks (CGANs) have greatly improved the relevance and diversity of generated images by introducing conditional information (such as category labels or specific image features).
[0003] Although CGAN has shown superiority in conditional generation, it still faces challenges in processing complex data. The generator needs to learn complex multidimensional data distribution, while traditional classical neural networks are limited by computing resources when dealing with large-scale data. The introduction of quantum computing provides the possibility to overcome this limitation. Quantum computing can achieve higher computing efficiency than classical computers in some tasks through characteristics such as quantum superposition and entanglement. The concept of quantum generative adversarial networks (QGANs) came into being. It optimizes the generator through quantum computing and shows great potential in generation tasks. However, most research on quantum generation models focuses on unconditional generation tasks. These models can generate different images, but often lack precise control over specific conditions or labels and cannot generate customized content. How to represent external condition information in quantum circuits and guide noise in quantum circuits to successfully generate specific pictures is a challenge. In the NISQ era, there are fewer quantum bits available, and it is difficult to work properly when representing conditions in quantum circuits. Secondly, it is necessary to guide the generation of noise image data, which further complicates the construction of quantum circuits. Summary of the invention
[0004] To address these challenges, this paper proposes a method for image generation based on a hybrid quantum classical conditional generative adversarial network (QC-CGAN), which introduces quantum circuits designed specifically for processing conditional variables, enabling the model to generate images that meet specified requirements under clear conditional guidance (such as specific labels or guidance information). This innovation not only promotes technological progress in the field of quantum machine learning, but also enhances the feasibility and prospects of quantum technology in practical applications.
[0005] The present invention provides an image generation method based on a hybrid quantum classical conditional generative adversarial network, comprising the following steps:
[0006] S1: Load the classical random noise vector and conditional label data into quantum states respectively;
[0007] S2: quantum conditional sub-generator generates sub-image feature data;
[0008] S3: Sub-image feature data is output as complete image data through a classic single-layer neural network;
[0009] S4: Input the real sample image data and the unique hot encoding of the real image conditional label into the conditional discriminant network to obtain the discrimination result of the real image; at the same time, input the generated image data and the unique hot encoding of the random conditional label into the conditional discriminant network to obtain the discrimination result of the generated image;
[0010] S5: by comparing the real image discrimination result and the generated image discrimination result, matching them with the true label and the false label respectively, and calculating the discrimination loss of the discriminator and the generator based on the discrimination result and the loss function;
[0011] S6: Based on the discriminator loss and the generator loss, back propagation is performed respectively to update the gradient information of the generator network and the discriminator network, and the parameters of the generator and the discriminator are updated respectively using the stochastic gradient descent (SGD) optimization algorithm;
[0012] S7: Generate images using a trained hybrid quantum classical conditional generation network;
[0013] Further considering the loading method in S1, the classic random noise vector Z = (z1, z2, ..., z N ), each noise component z i Randomly draw from a standard normal distribution. For each noise component z i , when converted into a quantum state, through the formula θ i =arctan(z i ) Calculate the rotation angle θ i Next, go through the revolving door R x (θ i ) and R y (θ i ), respectively rotating around the X-axis and Y-axis to convert classical noise into quantum state. The formulas of these two rotating gates are: Conditional label vector Y = (y1, y2, ..., y N ) is encoded into a quantum state using One-Hot Encoding and a rotating gate. The final quantum state of noise encoding and label encoding is and
[0014] In step S2, the hybrid quantum conditional generation network is used to generate image feature data. The quantum gate operation in the quantum generation network processes the quantum conditional input to generate image feature data. The quantum generation network operates the quantum state through multiple quantum gates (such as CNOT gates and rotation gates). After the operation is completed, the Pauli-Z measurement is used to convert the quantum state of each sub-generator into classical data and splice it. The formula for the measurement result is: <z>=<0|Z|0> The classical data after measurement is the image feature data;
[0015] The specific process is as follows: the encoded qubits are processed through the designed entanglement layers. These layers consist of CNOT gates and a series of RX and RY rotation gates, which introduce entanglement between qubits to simulate complex relationships and dependencies in the data. The operation of the entanglement layer can be expressed as:
[0016] Here, CNOT is a controlled NOT gate used to create entanglement between quantum bits, and RY(θj) and RX(φj) are parameterized rotation gates. By adjusting the parameters θj and φj, fine control of the quantum state is achieved. Through these composite quantum operations, the sub-generator quantum state is as follows: |G i (z|y)>=U entangle (θ)|ψ label >、|G j (z|y)>=U entangle (α)|ψ noise >, and then the subgenerator |G i (z|y)> are measured and concatenated in sequence to obtain G(z|y)←[G1(z)&…&G p (z)] T ;
[0017] In S3, the classical single-layer neural network receives the image feature data generated by the quantum generation network and further processes it into complete image data. The calculation formula of the classical neural network is: y = W·X+b, where X represents the image feature output by the quantum generation network, W is the weight matrix, b is the bias term, and y is the complete image data output. Through this classical single-layer network, the image size can be expanded to any dimension to achieve the image size scaling function.
[0018] In step S4, the real image data and the generated image data are combined with the conditional labels and uniformly input into the discriminant network for processing. The operation mechanism is as follows:
[0019] First, the real sample image and the generated image are combined with their corresponding conditional labels. In order to make the conditional label effectively recognized by the discriminant network, the label is encoded using One-Hot Encoding. The conditional label is y, then the label after One-Hot Encoding can be represented as vector y one-hot , which is in the form of: one-hot ={0,0,1,0,…,0}, where y one-hot is a binary vector of length class. For a real image x real and generate images G(z|y), which are combined with the corresponding conditional labels to form input pairs (x real ,y one-hot ) and (G(z|y), y random-one-hot ).
[0020] Regardless of the input (x real ,y one-hot ) or (G(z|y), y random-one-hot ), they are all input into the same discriminant network for processing. The discriminant network first extracts features from the input image data and conditional labels. The network structure consists of fully connected layers. The goal of the discriminator D(x,y) is to distinguish whether the input image is from real data or generated data. The output of the discriminator is a probability value indicating the possibility that the image is real.
[0021] The formula is: D(x,y)=σ(W x f(x)+W y ·y+b), f(x) is the feature extraction function of image x, W x and W y are the weight matrices of image features and conditional labels, respectively, b is the bias vector, and σ is the Sigmoid activation function, which is used to normalize the output value to a probability between 0 and 1.
[0022] The loss function L of the discriminator D It is used to maximize the discrimination results of real images and minimize the discrimination results of generated images. Where: p data is the distribution of real data, p z is the noise distribution at the generator input.
[0023] The loss function L of the generator G The generator is optimized by minimizing the probability that the generated image is judged as fake. The loss function is:
[0024] The loss function of the generator and discriminator is the core indicator in the training process. We calculate the loss function of the generator and discriminator respectively based on the discrimination results of the generated image and the real image. PennyLane is mainly responsible for the quantum computing part, while PyTorch is used for the classical computing part, responsible for executing the training and optimization of the neural network. We use PennyLane to handle the backpropagation part of the quantum generator, combined with the operation of the quantum circuit, to calculate the gradient of the generator and discriminator.
[0025] In this process: the generator back-propagates through the quantum nodes in PennyLane, calculates the gradient of the generated image to be discriminated as the real image, and passes it to the quantum generation network. The discriminator uses PyTorch to process the back-propagation of the classical neural network and directly calculates the gradient of the discriminator loss function to its parameters. The key to this step is that the seamless integration of PennyLane and PyTorch ensures that the gradients of the quantum generator and the classical discriminator can be calculated simultaneously.
[0026] After calculating the gradient of the loss function, the Stochastic Gradient Descent (SGD) algorithm is performed using the optimizer in PyTorch to update the parameters of the generator and discriminator.
[0027] The specific steps include: the generator parameter update updates the parameters of the quantum generation network through the gradient information output by the PennyLane quantum network, making the generated images more and more realistic. The discriminator parameter update updates the parameters of the classical neural network discriminator through the PyTorch optimizer to improve the accuracy of distinguishing generated images from real images. The entire training process is a cycle, and each iteration is optimized based on the results of the previous round until the generator produces high-quality images and the discriminator has difficulty distinguishing between generated images and real images. The combination of PennyLane and PyTorch enables quantum generation and classical discrimination to work together effectively, ensuring efficient interaction between quantum computing and classical neural networks.
[0028] Compared with the prior art, the present invention has achieved the following beneficial technical effects:
[0029] 1. More efficient image generation: The combination of quantum computing and classical neural networks has greatly improved the speed and computational efficiency of image generation. Quantum computing can extract features more quickly when processing high-dimensional data, which is more efficient than traditional pure classical networks, especially in large-scale image generation tasks.
[0030] 2. Improved generation quality and diversity: Quantum superposition and quantum entanglement properties make the generated images more diverse and high-quality. Compared with traditional GAN, this invention can generate richer and more diverse images under the same conditions, reducing the problem of pattern collapse in the image generation process.
[0031] 3. Strong scalability: Based on the fusion framework of PennyLane and PyTorch, the present invention realizes seamless collaboration between the quantum part and the classical part. Its architecture can not only be applied to the field of image generation, but also be extended to other generation tasks, such as text generation, video generation, etc., with good scalability and adaptability.
[0032] 4. Innovative conditional control: Most existing quantum generative adversarial networks are unconditional generation, and the generation results cannot be effectively controlled. The present invention introduces conditional generation in a hybrid quantum classical framework. By combining quantum states with classical conditional labels, it is possible to generate images that meet the requirements according to preset conditions. The conditional labels are combined with quantum states through unique hot encoding, which ensures a strong correlation between image generation and specific conditions, greatly improving the controllability and accuracy of conditional generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A flowchart of an image generation method based on a hybrid quantum classical conditional generative adversarial network provided in an embodiment of the present invention;
[0034] Figure 2 An architecture diagram of a hybrid quantum classical conditional generative adversarial network provided in an embodiment of the present invention;
[0035] Figure 3 A quantum circuit diagram based on a hybrid quantum classical conditional generative adversarial network provided in an embodiment of the present invention;
[0036] Figure 4 A diagram of a simulation image result under an image generation method based on a hybrid quantum classical conditional generative adversarial network provided in an embodiment of the present invention;
[0037] Figure 5 A simulation loss value diagram for an image generation method based on a hybrid quantum classical conditional generative adversarial network provided in an embodiment of the present invention; DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described implementation examples 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.
[0039] The core of the present invention is to provide an image generation method based on a hybrid quantum classical conditional generative adversarial network to solve the problems of small scale of images generated by existing quantum generative adversarial networks and collapse of traditional generative adversarial network models.
[0040] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0041] Figure 1 A flowchart of an image generation method based on a hybrid quantum classical conditional generative adversarial network provided by an embodiment of the present invention, such as Figure 1 As shown, the following steps are included:
[0042] S1: Load the classical random noise vector and conditional label data as quantum states respectively.
[0043] Generate a classical random noise vector Z and a random conditional label Y, and load these classical data into quantum states. The generation of quantum states is achieved through quantum gate operations. The key to this step is to quantize the classical data to prepare for the subsequent quantum generation network to process image feature data.
[0044] Specifically, the Optdigits dataset contains 10 types of handwritten digits (from 0 to 9), each of which corresponds to a specific label, and the conditional generation network generates images related to the specified conditions based on these labels. We randomly generate a noise vector of length 4 from a standard normal distribution. Each component of this noise vector is used to encode into a quantum state and affect the details of the generated image through quantum operations, such as Z = [0.2, -0.5, 0.8, -1.2]. Random conditional label Y random It is generated by randomly selecting a label from the 10 categories of the Optdigits dataset and performing a one-hot encoding. For example, if the categories of the Optdigits dataset are 0 to 9, and the randomly generated label is the number "3", then the one-hot encoding is Y random =[0,0,0,1,0,0,0,0,0,0].
[0045] Next, we need to load the classical noise vector and random conditional labels into quantum states. First, we convert the noise vector Z into a quantum state using a quantum rotating gate R x (θ i ) and R y (θ i ) to process each noise component z separately i , where the rotation angle is θ i =arctan(z i ), then, the random conditional label Y random Load it into quantum state, use CNOT gate to entangle the label state with the noise state, ensure that the noise quantum state is combined with the label quantum state, and finally generate a quantum state containing random noise and random label information and
[0046] In S2, the quantum conditional generation network receives the quantum state generated in step S1 and starts to generate sub-image feature data through quantum gate operations. First, these quantum states include the entangled information of random noise and random conditional labels, and generate the image features through a series of quantum gate operations. Specifically, the rotation gate further adjusts the angle of the quantum state, while the CNOT gate ensures that the entangled information of random labels and noise is retained throughout the quantum generation process. The quantum state of the sub-generator passing through the entanglement layer is |G i (z|y)>=U entangle (θ)|ψ label >with|G j (z|y)>=U entangle (α)|ψ noise >.
[0047] Through these operations, the quantum generation network generates the corresponding sub-image features. These quantum feature data represent the basic information of the local image. Then, the quantum state is measured through the Pauli-Z basis. The measurement results convert the quantum state into classical data, which are then spliced into G(z|y)←[G1(z)&…&G P (z)] T , these classic data are the sub-features of the generated image and serve as the input for subsequent classic neural network processing.
[0048] The structure of the classic single-layer neural network in step S3 has only one layer of fully connected network, and the input of the neural network is the sub-image feature data. The network performs weighted summation on the input data and processes it through the activation function to generate the final pixel value of the image. For the handwritten digit generation task in the Optdigits dataset, the output is a pixel matrix of size 8×8, where each element corresponds to a pixel value, indicating the brightness or grayscale at different positions in the image. After the sub-image is input into the single-layer network, the Sigmoid activation function is used for activation to output the complete image data.
[0049] In step S4, we first transform the real sample image data x real The conditional label y with the true image label real Through the one-hot encoding combination, it is input into the conditional discriminant network. When the real image is generated as the number "7", its one-hot encoding label Y real =[0,0,0,0,0,0,0,1,0,0], the combined (x real ,y real ) is input into the discriminant network, and the network calculates the matching degree between the image and the label and outputs the probability D(x) that the image is a real image. real ,y real ).
[0050] At the same time, the generated image data x fake and the corresponding random conditional label y random It is also input into the same discriminative network. Generate image x fake This is also the image data of the number "7". Similarly, (x real ,y random ) Input the conditional discriminant network, and the network outputs the probability D(x) that the generated image is misclassified as a real image. real ,y random ). Through these inputs, the conditional discriminant network judges the real image and the generated image respectively, and outputs the discriminant probability D(x real ,y real ) and the discriminant probability D(x) of the generated image real ,y random ).
[0051] In step S5, firstly, the discrimination result D(x real ,y real ) and the discriminant result D(x real ,y random ), respectively matched with the true label and false label, so as to calculate the loss function of the conditional discriminator. The label of the real image is "true", that is, 1, and the label of the generated image is "false", that is, 0. The loss function of the discriminator The discriminant accuracy of real images and generated images is calculated, with the goal of enabling the discriminator to correctly distinguish between real images and generated images.
[0052] The first term is the loss of real images, ensuring that the discrimination result of real images is as close to 1 as possible (that is, real images are correctly judged as real); the second term is the loss of generated images, ensuring that the discrimination result of generated images is as close to 0 as possible (that is, generated images are correctly judged as false). By minimizing this loss function, the discriminator can learn how to effectively distinguish between real images and generated images during training.
[0053] Next, the loss function of the generator is The difference between the generated image and the real image is calculated with the goal of making the generated image as realistic as possible, thereby fooling the discriminator into misjudging the generated image as a real image. The goal of the generator is to maximize the probability that the generated image is considered a real image by the discriminator, that is, to make the discriminator's output as close to 1 as possible. This process is achieved by minimizing the generator's loss function, thereby gradually improving the quality of the generated image.
[0054] In step S6, based on the previously calculated discriminator loss L D and the generator loss L G , back propagation is performed to update the gradient information of the generating network and the discriminant network, as follows: First, the discriminator loss L is calculated by the back propagation algorithm D Relative to the discriminator parameter θ D This process will pass the gradient information from the output layer to the input layer through the chain rule of the computational graph to ensure the minimization of the loss function, thereby optimizing the performance of the discriminator. The formula is:
[0055] Next, the generator loss L G Back propagation is also required to calculate the loss function L G For the generator parameter θ G The gradient of the generator is used to update the parameters of the generator to make the generated image more realistic. The formula is: After the gradient calculation is completed, the parameters of the generator and discriminator are updated using the stochastic gradient descent (SGD) optimization algorithm. Specifically, the parameters updated using the SGD algorithm are as follows:
[0056] For the discriminator parameters Update the generator parameters Update. Where η is the learning rate, which controls the step size of each parameter update. In this way, the parameters of the generator and the discriminator are optimized, so that the generator can generate higher quality images and the discriminator can distinguish between real and generated images more accurately. After multiple iterations of training, the performance of the generator and the discriminator will continue to improve, thus achieving better image generation results.
[0057] In step S7, a specific image is generated using the trained converged quantum conditional generation network. Any specified conditional label can be input, and the quantum conditional generation network will generate an image that matches the conditional label. Specifically, Figure 4 The following figure shows the generation results of three groups of handwritten digits with conditional labels of all 0s, sequence 0 to 9, and random 0 to 9. Figure 5 Shows the loss curves of the generator and the discriminator when generating images.
[0058] The above is a detailed introduction to an image generation method based on a hybrid quantum classical conditional generative adversarial network provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other.
[0059] The contents not described in detail in the specification of the present invention belong to the prior art known to the professional and technical personnel in this field.< / z>
Claims
1. An image generation method based on a hybrid quantum classical conditional generative adversarial network, characterized in that: The method comprises the following steps: S1: Load the classical random noise vector and conditional label data into quantum states respectively; S2: quantum conditional sub-generator generates sub-image feature data; S3: Sub-image feature data is output as complete image data through a classic single-layer neural network; S4: Input the real sample image data and the unique hot encoding of the real image conditional label into the conditional discriminant network to obtain the discrimination result of the real image; at the same time, input the generated image data and the unique hot encoding of the random conditional label into the conditional discriminant network to obtain the discrimination result of the generated image; S5: by comparing the real image discrimination result and the generated image discrimination result, matching them with the true label and the false label respectively, and calculating the discrimination loss of the discriminator and the generator based on the discrimination result and the loss function; S6: Based on the discriminator loss and the generator loss, back propagation is performed respectively to update the gradient information of the generator network and the discriminator network, and the parameters of the generator and the discriminator are updated respectively using the stochastic gradient descent (SGD) optimization algorithm; S7: Generate images using a trained hybrid quantum classical conditional generation network.
2. The image generation method based on a hybrid quantum classical conditional generative adversarial network according to claim 1 is characterized in that: The quantum state is generated by a rotating gate operation, wherein the rotating gate includes rotations around the X-axis and the Y-axis, and the rotation angle is determined by the value of the classical random noise vector; the specific process is: Generate a classical random noise vector Z = (z1, z2, ..., z N ), each noise component z i Randomly draw from a standard normal distribution; for each noise component z i , when converted into a quantum state, through the formula θ i =arctan(z i ) Calculate the rotation angle θ i ; Then, go through the revolving door R x (θ i ) and R y (θ i ), respectively rotating around the X-axis and Y-axis to convert classical noise into quantum state; the formulas of these two rotating gates are: Conditional label vector Y = (y1, y2, ..., y N ) One-Hot Encoding is used to generate quantum states; the one-hot encoded labels are entangled with the noise quantum states through CNOT gates to generate quantum conditional inputs.
3. The image generation method based on a hybrid quantum classical conditional generative adversarial network according to claim 1 is characterized in that: The sub-generator circuit in the quantum conditional generation network generates multiple sub-image feature data through quantum entanglement operation, and obtains classical data from the sub-image feature data through measurement; the details are as follows: The quantum generation network operates quantum states through multiple entangled layers, which are composed of CNOT gates and rotation gates. After the operation is completed, the Pauli-Z measurement is used to convert the quantum state of each sub-generator into classical data and splice it. The formula for the measurement result is: <z> =<0|Z|0>The classical data after measurement is the image feature data.< / z> 4. The image generation method based on a hybrid quantum classical conditional generative adversarial network according to claim 1, characterized in that: The classical neural network receives the image feature data generated by the quantum generation network and further processes it into complete image data; the calculation formula of the classical neural network is: y=W·X+b, where X represents the image feature output by the quantum generation network, W is the weight matrix, b is the bias term, and y is the output complete image data.
5. The image generation method based on a hybrid quantum classical conditional generative adversarial network according to claim 1, characterized in that: The conditional discriminant network is a classic neural network. Its input is the one-hot encoding form of image feature data and condition labels. The discriminant network makes judgments by comparing the matching degree between the image and the condition, as follows: First, the real sample image and the generated image are combined with their corresponding conditional labels respectively. In order to make the conditional label able to be effectively recognized by the discriminant network, the label is encoded using One-Hot Encoding; the conditional label is y, then the label after One-Hot Encoding can be represented as vector y one-hot , which is in the form of: one-hot ={0,0,1,0,…,0}, where y one-hot is a binary vector of length class; for a real image x real and generate images G(z|y), which are combined with the corresponding conditional labels to form input pairs (x real ,y one-hot ) and (G(z|y), y random-one-hot ); The discriminant network first extracts features from the input image data and conditional labels. The network structure consists of fully connected layers. The goal of the discriminator D(x,y) is to distinguish whether the input image comes from real data or generated data. The output of the discriminator is a probability value; Finally, the real sample image data and the real image conditional label are uniquely encoded and input into the conditional discriminant network to obtain the discrimination result of the real image; At the same time, the generated image data and the unique hot encoding of the random conditional label are input into the conditional discriminant network to obtain the discrimination result of the generated image.
6. The image generation method based on hybrid quantum classical conditional generative adversarial network according to claim 1 is characterized in that: By comparing the real image discrimination result and the generated image discrimination result, matching them with the true label and the false label respectively, the discrimination loss of the discriminator and the generator is calculated based on the discrimination result and the loss function; The loss function L of the discriminator D It is used to maximize the discrimination results of real images and minimize the discrimination results of generated images. Where: p data is the distribution of the real data, p z is the noise distribution of the generator input; the loss function L of the generator G The generator is optimized by minimizing the probability that the generated image is judged as fake. The loss function is:
7. The image generation method based on a hybrid quantum classical conditional generative adversarial network according to claim 1, characterized in that: Based on the discriminator loss and the generator loss, back propagation is performed to update the gradient information of the generator network and the discriminator network, and the parameters of the generator and the discriminator are updated respectively using the stochastic gradient descent (SGD) optimization algorithm; the quantum computing part is performed using the PennyLane framework, and the training of the conditional generative adversarial network is completed in combination with the Pytorch framework. The goal of the training is to make the generated image data unable to be distinguished by the discriminator network as to whether it is a generated image or a real image; the details are as follows: The generator and discriminator are optimized through adversarial training. The discrimination results of generated images and real images are optimized by calculating the loss function to optimize the network weights. The loss function of the discriminator is defined as: Among them, x is the real image, y is the conditional label, G(z|y) is the generated image; the loss function of the generator is defined as The goal of the generator is to minimize the difference with the real image so that the generated image is considered real by the discriminator; the weight update is performed using the stochastic gradient descent (SGD) algorithm, and the update formula is: Among them, θ is the model parameter, η is the learning rate, is the gradient of the loss function with respect to the parameters.
8. The image generation method based on hybrid quantum classical conditional generative adversarial network according to claim 1 is characterized in that: Use the trained hybrid quantum classical conditional generation network to generate images. You can input any specified conditional label, and the hybrid quantum classical conditional generation network will generate images that match the conditional label.
Citation Information
Cited By
Quantum neural network distributed deployment method based on quantum chip noise vector
CN119558421A
Medical image automatic classification method and system based on machine learning
CN119851047A
Power system renewable energy scene generation method based on quantum generative adversarial network
CN120542247A
Power system renewable energy scene generation method based on quantum generative adversarial network
CN120542247B
Image classification method and system based on quantum network
CN121640197A