2020 2nd International Conference on Information Technology and Computer Application (ITCA)

Application of Quantum Generative Adversarial Learning in Quantum Image Processing

Wanghao Ren1, Zhiming Li1*, Hailing Li2, Yang Li1, Chunwei Zhang1, Xiaoqian Fu1 1School of Information Science and Engineering, University of Jinan, Jinan 250022,China 2Shandong College of Electronic Technology, 250022 Jinan, China *Corresponding Author (Email:[email protected])

Abstract—Quantum machine learning is a hot topic in the fixed controlled NOT gates and adjustable rotations gates. quantum community recently. The combination of quantum The PQCs composed of these gates provide a concrete way that machine learning and image processing is also one of the can be realized by adjusting the unitary operator U. PQCs are researchers' concerns. With the promotion of deep learning to composed of three parts, including encoder circuit, variational process images, the field of image processing has also shown circuit, and measurement. Variational circuits can be thought of amazing potential. The combination of and as layers of connected computational units controlled by artificial intelligence can not only exert the computing power of adjustable parameters. The output is obtained by quantum computing but also find more applications in the field parameterized unitary operation acting on the input state. At the of image processing. This article combines quantum generative end of PQCs, the quantum state is measured, and a set of adversarial learning with the field of image processing. A estimates of the expected value are obtained from the quantum generative adversarial network is designed to load and learn classical image data. Numerical simulations intuitively show measurement. By calculating the estimator, the parameter that quantum can also effectively process images. In values could be adjusted in the variational circuit. So that the our scheme, using N can load 2N classical bits of image result is more in line with our expectations. data. In classical machine learning, Generative adversarial network (GAN) is one of the most powerful generative models: Keywords- learning; Quantum generative a generator tries to create new sample data that mimic those of adversarial network; Image processing; Deep learning; a true data set, while a discriminator tries to distinguish I. INTRODUCTION between the true and fake data[4]. Recently, the quantum system replaces the generator, discriminator by PQCs to With the rapid development of quantum computation and translate the framework into a quantum computing context. quantum devices, quantum computing, a technology that relies Many quantum adaptations of the classical GAN scheme have on the properties of quantum systems to process information, is been proposed. Seth Lloyd first proposed three theoretical rapidly reaching maturity. As the size of the image becomes models of Quantum Generative Adversarial larger and the calculation becomes more complicated, more Learning(QGAL)[1]. resources and computing power are required. The speed of machine learning training is also affected by the size of the This work discusses the training of an image data loading image. The field of classical machine learning increases the channel with (QML) using QPIE speed of training and prediction by increasing computational [11]. More specifically, we present a feasible loading scheme resources. Due to the increasing demand for computing for the quantum image. The scheme utilizes a quantum- resources, it has become a hot topic to replace some classical classical implementation of a quantum generative adversarial computing with quantum computing. network to train a . The quantum generator after training could be a sub-circuit of other quantum circuits. The model is the most common and easier The generated quantum state in the quantum register could be to understand in the actual quantum research [12]. used by other quantum circuits for quantum image processing. Classical calculations can be described by Boolean circuits. Similar to classical circuits, quantum circuit models are also The remainder of the paper is organized as follows. In Sec.2, composed of circuits and gates. The line We introduced related work on quantum generative adversarial represents the transmission of information in qubits, while the learning. Then, in Sec.3 the QGAL-based learning and loading completes the computation of quantum scheme is introduced. Furthermore, the numerical simulation of information. The unitary transformation in the quantum circuit our scheme is introduced in Sec.4. Finally, A brief conclusion maps the initial state of the qubit to a certain terminal state. follows in Sec.5. Each unitary transformation is regarded as a unitary gate, which is composed of several quantum logic gates. II. RELATED WORK Quantum computing is a new type of computing model To utilize existing quantum computers to their fullest extent, based on the principles of , which has parameterized quantum circuits(PQCs)[5] provide a concrete shown great potential in the field of quantum machine learning. method to implement algorithms in the Noisy Intermediate Scale Quantum (NISQ) era[2]. PQCs are typically composed of

978-0-7381-1141-4/20/$31.00 ©2020 IEEE 467 DOI 10.1109/ITCA52113.2020.00104 Finding suitable applications for these algorithms is a hot topic The information of a pixel position is encoded in a right now. computational basis state, while the pixel information for each pixel is represented by . After defining Jinfeng Zeng et al. use quantum generative adversarial the image encoding method, the corresponding relationship circuits to infer missing data in Bars-and-Stripes dataset[6]. An between the quantum state and the image is corresponding. The adversarial training scheme was proposed to train quantum encoder circuit in PQCs can effectively encode classical circuits. The training approach involves a game between a information into the quantum state. quantum circuit generator and a classical neural network discriminator. The quantum generator generates a probability We propose a quantum generative adversarial learning distribution close to the classical data, and at the same time, the algorithm to learning the encoded quantum image, which classical discriminator determines whether the distribution rapidly converges to Nash equilibrium. We formally define the comes from real data or generated data. The trained quantum quantum generative adversarial learning problem and devise a circuit can be used to infer the missing data. Jonathan Romero general framework for using quantum generative adversarial et al. used a quantum generator and a classical neural network learning to accomplish quantum image processing tasks. as the discriminator and used automatic differentiation tools to perform the optimization of PQCs[7]. The trained quantum Quantum generative adversarial learning consists of a circuit can produce a continuous distribution similar to the data quantum generator G and a quantum discriminator D in Fig1. set. Similarly, Christa Zoufal et al. applied the designed Both the quantum generator and the discriminator are quantum generative adversarial network to the field of quantum composed of universal quantum circuits[13]. Assuming that a finance[8]. quantum state is represented by N quanta, our goal is to generate similar quantum states. Both the generator and the However, for the first time, we use quantum generative discriminator are composed of quantum circuits. Both the adversarial networks learning and load images into quantum quantum generator and the discriminator are composed of devices. Our framework can also learn quantum images quantum circuits. Each quantum circuit is composed of generated by other circuits. The application of learning pictures universal quantum gates. The basic unit of quantum circuits is a is the basis of quantum image processing. By learning the universal quantum gate. Each universal quantum gate can pictures produced by other quantum programs, the circuit can represent the quantum state of any two qubits. learn the quantum state without measuring the entire qubit. The generator attempts to generate data similar to real data III. QUANTUM GENERATIVE ADVERSARIAL LEARNING BY R. Instead, the discriminator tries to distinguish real data from QUANTUM CIRCUITS generated data. The generator G and discriminator D together form a zero-sum game. This zero-sum game can be described Many quantum image processing algorithms need to encode by a loss function: classic images into quantum states. There are three main ways to express encoded information in a quantum state in the field L(G,D) = P(T|fake)P(G) + P(F|real)P(R),    of quantum image processing. A flexible representation of quantum images(FRQI)[9] and a novel enhanced quantum representation(NEQR)[10] encode pixel information into an where P(T|fake),P(F|real) donate the probability of angle and basis of qubits respectively. Quantum probability misjudgment. The training goal of the generator is to maximize image encoding(QPIE) directly encodes pixel information into the probability of error making the generated data approximate the probability amplitude. Different image representation to the real data. On the contrary, the discriminator should methods have different emphasis. QPIE can use the least minimize the probability of making a mistake. After multiple number of qubits to realize the representation of classic images. iterations, Nash equilibrium is reached when the generated data This way of representation does not require auxiliary bits, and is similar to the real data. When the program converges, the the measurement form is simple. real data and the generated data are almost indistinguishable. There is only a slight difference in value. The way of quantum probability image encoding allows the classical image pixel information to be encoded into a quantum According to the properties of quantum mechanics, pure state using the Quantum image Representation(QimR) conditional probability can be represented by the trace of two method. QPIE utilizes the probability amplitude to represent states. The loss function can be described by a quantum the color information of an image, and the computational basis information language and executed in a quantum circuit as: to encode the two-dimensional position information. In a classical image, the pixel information of each pixel is L(G,D) = Tr(TG)P(G) + Tr(FD)P(R),    represented by a pixel value. QPIE is similar to the pixel representation for classical images on traditional computers. It where Tr() donate the trace. captures basic information about color and the corresponding The generator and the discriminator are optimized position of each point in the image and expresses it in the form alternately[3]. The generator makes the distance between the of a vector. target state and the generated state get closer and closer. The coefficient encodes the pixel value and satisfies the normalization condition:

2 1/2 Ck = Pi,j / (ᱧPi,j ) .   

468 will also increase. Different qubit numbers have different representation capabilities. The more qubits, the stronger the capability. But the training time will also increase as the number of qubits increases.

Figure 1. The structure of quantum generative adversarial learning Figure 3. Experimental comparison of three qubits. The process of randomly learning different pictures is different, but it will eventually converge. IV. NUMERICAL EXPERIMENTS Numerical experiments used the classic MNIST data set to Finally, we use real pictures as learning goals. To show the test the stability of different qubits. The MNIST dataset is one program's presentation capabilities. It is also the first time to of the most commonly used digital handwriting datasets in the use quantum generative adversarial learning combined with field of artificial intelligence. We use the quantum adversarial classical image processing. This method will learn different generative learning introduced in the previous section to learn grayscale images. We chose different grayscale images for real image data. We assume that every image can be obtained learning and showed the effect of one of the digital pictures. by image encoding or from unknown quantum circuits. Select The effects of other pictures are similar to this picture, you can some pictures from the data set for learning, and display the learn classic pictures and save them in the quantum circuit. learning results. After learning, the gap between the final gray image and the generated image is very small. If you don't look at the data and The criterion for quantum state similarity is fidelity. When only look at the image, it is difficult to distinguish. This also the two quantum states are completely orthogonal, the fidelity shows the learning ability and convergence ability of quantum is 0. When the two quantum states are exactly the same, the generation against learning. fidelity is 1 [14]. The goal of quantum generative adversarial learning is to increase the fidelity by reducing the loss function. The generator and the discriminator are trained alternately. The loss function keeps decreasing in the alternate training, while the fidelity keeps increasing. The fidelity of the target state and the generated state will get closer and closer to 1. The test in the case of two qubits shows the correctness of the experiment as shown in the figure below.

Figure 4. Pictures taken from the MNIST dataset

Figure 5. Images generated using quantum generative adversarial learning Figure 2. Experimental results of two qubits. methods

After verifying the correctness of the algorithm, we use Through experimental verification, we can learn classical multiple qubits to detect the expansion capability of the image information using quantum generative adversarial algorithm. When the number of qubits is increased, the depth of learning. After storing the circuit parameters, quantum images the quantum circuit will increase like a classical neural network. can be generated multiple times. These quantum images can be The way to increase the depth of the quantum circuit is to used in other quantum image processing algorithms. repeat the circuit many times. This way of increasing the line Researchers can create quantum states multiple times by representation ability is inspired by the deepening of the recording the parameters of the quantum circuit gate. And network in deep learning. The number of iterations after when you use this part of the quantum circuit next time, you increasing the qubit will increase, and the difficulty of training

469 can get the required quantum state by setting the parameters of Perdomo, C Monroe. “Training of quantum circuits on a hybrid quantum the quantum circuit gate. computer;” Science advances, 2019, pp:5(10). [4] I Goodfellow, J Pouget-Abadie, M Mirza, et al. “Generative adversarial V. CONCLUSION nets,” Advances in neural information processing systems. 2014, pp:2672-2680. Quantum generative adversarial learning is a new direction [5] M Benedetti, E Lloyd, S Sack, et al. “Parameterized quantum circuits as in the field of quantum computing and machine learning. This machine learning models,” Quantum Science and Technology, 2019, paper combines quantum generative adversarial learning theory pp:4(4): 043001. and quantum image processing to construct a set of quantum [6] J Zeng, Y Wu, J G Liu, et al. “Learning and inference on generative circuit generative models. This model can learn the image adversarial quantum circuits,” Physical Review A, 2019, pp:99(5): representation in image processing and reconstruct the quantum 052306. image by adjusting the parameters in the variational circuit. We [7] J Romero, A Aspuru-Guzik. “Variational quantum generators: Generative adversarial quantum machine learning for continuous distributions,” arXiv simulated the calculation of quantum generative adversarial preprint arXiv:1901.00848, 2019. learning on a classical computer. By learning the handwritten [8] C Zoufal, A Lucchi, S Woerner. “Quantum generative adversarial networks picture data set, the quantum circuit can learn the approximate for learning and loading random distributions,” npj , state of any quantum process. By comparing the original data 2019, pp:5(1): 1-9. and the learned data, the state fidelity accuracy rate can reach [9] P Q Le, F Dong, K Hirota. “A flexible representation of quantum images for more than 99%. polynomial preparation, image compression, and processing operations,” Quantum Information Processing, 2011, pp:10(1): 63-84. ACKNOWLEDGMENT [10] Y Zhang, K Lu, Y Gao, et al. “NEQR: a novel enhanced quantum representation of digital images,” Quantum Information Processing, 2013, This work supported by the National Key R&D Program of vol:12(8), pp: 2833-2860. China (Grant No. 2018YFA0306703) and the National Key [11] J Biamonte, P Wittek, N Pancotti, et al. “Quantum machine learning,” Nature, R&D Program of China fund (No.2017YFB0404202). 2017, vol:549(7671), pp: 195-202. [12] A C C Yao. “Quantum circuit complexity,” Proceedings of 1993 IEEE 34th REFERENCES Annual Foundations of . IEEE, 1993: pp:352-361. [1] L Seth,W Christian. “Quantum Generative Adversarial Learning,” [13] G Vidal, C M Dawson. “Universal quantum circuit for two-qubit Physical review letters, 2018, pp.121(4). transformations with three controlled-NOT gates,” Physical Review A, 2004, [2] J Preskill. “Quantum Computing in the NISQ era and beyond,” pp:69(1): 010301. Quantum,2018,pp:2. [14] R Jozsa. “Fidelity for mixed quantum states,” Journal of modern optics, 1994, [3] D Zhu, N M Linke , M Benedetti, K A Landsman, N H Nguyen, C H vol:41(12), pp: 2315-2323. Alderete, A PerdomoOrtiz, N Korda, A Garfoot, C Brecque, L Egan, O

470