Abstract
With the rapid advance of quantum machine learning, several proposals for the quantum-analogue of convolutional neural network (CNN) have emerged. In this work, we benchmark fully parameterized quantum convolutional neural networks (QCNNs) for classical data classification. In particular, we propose a quantum neural network model inspired by CNN that only uses two-qubit interactions throughout the entire algorithm. We investigate the performance of various QCNN models differentiated by structures of parameterized quantum circuits, quantum data encoding methods, classical data pre-processing methods, cost functions and optimizers on MNIST and Fashion MNIST datasets. In most instances, QCNN achieved excellent classification accuracy despite having a small number of free parameters. The QCNN models performed noticeably better than CNN models under the similar training conditions. Since the QCNN algorithm presented in this work utilizes fully parameterized and shallow-depth quantum circuits, it is suitable for Noisy Intermediate-Scale Quantum (NISQ) devices.
Similar content being viewed by others
References
Acciarri R et al (2017) . J Instrum 12(03):P03011
Araujo IF, Park DK, Petruccione F, da Silva AJ (2021) . Scientif Rep 11(1):6329
Aurisano A, Radovic A, Rocco D, Himmel A, Messier M, Niner E, Pawloski G, Psihas F, Sousa A, Vahle P (2016) . J Instrum 11(09):P09001
Bergholm V, Izaac J, Schuld M, Gogolin C, Alam MS, Ahmed S, Arrazola JM, Blank C, Delgado A, Jahangiri S, McKiernan K, Meyer JJ, Niu Z, Száva A, Killoran N (2020) Pennylane: Automatic differentiation of hybrid quantum-classical computations. arXiv:1811.04968
Bharti K, Cervera-Lierta A, Kyaw TH, Haug T, Alperin-Lea S, Anand A, Degroote M, Heimonen H, Kottmann JS, Menke T, Mok WK, Sim S, Kwek LC, Aspuru-Guzik A (2021) Noisy intermediate-scale quantum (NISQ) algorithms. arXiv:2101.08448
Blank C, Park DK, Rhee JKK, Petruccione F (2020) . npj Quantum Information 6(1):1
Cerezo M, Arrasmith A, Babbush R, Benjamin SC, Endo S, Fujii K, McClean JR, Mitarai K, Yuan X, Cincio L, Coles PJ (2021) Variational quantum algorithms. Nature Reviews Physics 3(9):625–644. https://doi.org/10.1038/s42254-021-00348-9
Chen SYC, Wei TC, Zhang C, Yu H, Yoo S (2020) Quantum convolutional neural networks for high energy physics data analysis. arXiv:2012.12177
Cong I, Choi S, Lukin MD (2019) . Nat Phys 15(12):1273. http://www.nature.com/articles/s41567-019-0648-8
George D, Huerta E (2018) . Phys Lett B 778:64. https://www.sciencedirect.com/science/article/pii/S0370269317310390
Giovannetti V, Lloyd S, Maccone L (2008) . Phys Rev Lett 100:160501
Goodfellow I, Bengio Y, Courville A (2016) Deep Learning. MIT Press, Cambridge. http://www.deeplearningbook.org
Goodfellow I, Pouget-Abadie J, Mirza M, Xu B, Warde-Farley D, Ozair S, Courville A, Bengio Y (2014) .. In: Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 2 (MIT Press, Cambridge, MA, USA), NIPS’14, p 2672–2680
Grant E, Benedetti M, Cao S, Hallam A, Lockhart J, Stojevic V, Green AG, Severini S (2018) . npj Quantum Information 4(1):65. http://www.nature.com/articles/s41534-018-0116-9
Henderson M, Shakya S, Pradhan S, Cook T (2020) . Quantum Mach Intell 2(1):2
Huang R, Tan X, Xu Q (2021) . Neurocomputing 452:89. https://www.sciencedirect.com/science/article/pii/S092523122100624X
Jolliffe IT (2002) Principal Component Analysis, 2nd edn Springer Series in Statistics. Springer, New York
Kerenidis I, Landman J, Luongo A, Prakash A (2019) . In: Wallach H, Larochelle H, Beygelzimer A, D‘Alché-Buc F, Fox E, Garnett R (eds) Advances in Neural Information Processing Systems. vol. 32. https://proceedings.neurips.cc/paper/2019/file/16026d60ff9b54410b3435b403afd226-Paper.pdf, vol 32. Curran Associates Inc
Kerenidis I, Landman J, Prakash A (2019) Quantum algorithms for deep convolutional neural networks. arXiv:1911.01117
Kingma DP, Ba J (2017) Adam: A method for stochastic optimization. arXiv:1412.6980
LaRose R, Coyle B (2020) . Phys Rev A 102:032420
LeCun Y, Bengio Y, Hinton G (2015) . Nature 521(7553):436
Lecun Y, Bottou L, Bengio Y, Haffner P (1998) . Proc IEEE 86(11):2278
Li J, Yang X, Peng X, Sun CP (2017) . Phys Rev Lett 118:150503
Li Y, Zhou RG, Xu R, Luo J, Hu W (2020) . Quantum Sci Technol 5(4):044003
Liu J, Lim KH, Wood KL, Huang W, Guo C, Huang HL (2021) Hybrid quantum-classical convolutional neural networks. Science China Physics, Mechanics & Astronomy 64(9):290311
Lloyd S, Mohseni M, Rebentrost P (2013) arXiv:1307.0411
Lloyd S, Mohseni M, Rebentrost P (2014) . Nat Phys 10(9):631
Lloyd S, Schuld M, Ijaz A, Izaac J, Killoran N (2020) Quantum embeddings for machine learning. arXiv:2001.03622
MacCormack I, Delaney C, Galda A, Aggarwal N, Narang P (2020) [physics, physics:quant-ph]. arXiv:2012.14439
Mangini S, Tacchino F, Gerace D, Bajoni D, Macchiavello C (2021) . EPL (Europhysics Letters) 134(1):10002
Mangini S, Tacchino F, Gerace D, Macchiavello C, Bajoni D (2020) Quantum computing model of an artificial neuron with continuously valued input data. Machine Learning: Science and Technology 1 (4):045008
Mitarai K, Negoro M, Kitagawa M, Fujii K (2018) . Phys Rev A 98:032309
Monteiro CA, Filho GI, Costa MHJ, de Paula Neto FM, de Oliveira WR (2021) . Neural Netw 143:698. https://www.sciencedirect.com/science/article/pii/S0893608021003051
Nesterov Y (1983) . Proceedings of the USSR Academy of Sciences 269:543
Park DK, Blank C, Petruccione F (2021) .. In: 2021 International Joint Conference on Neural Networks (IJCNN), pp 1–7
Park DK, Petruccione F, Rhee JKK (2019) . Scientif Rep 9(1):3949
Parrish RM, Hohenstein EG, McMahon PL, Martínez TJ (2019) . Phys Rev Lett 122:230401
Pesah A, Cerezo M, Wang S, Volkoff T, Sornborger AT, Coles PJ (2021) . Phys Rev X 11:041011
Preskill J (2018) . Quantum 2:79
Rebentrost P, Mohseni M, Lloyd S (2014) . Phys Rev Lett 113:130503
Schuld M, Bergholm V, Gogolin C, Izaac J, Killoran N (2019) . Phys Rev A 99:032331
Schuld M, Killoran N (2019) . Phys Rev Lett 122:040504
Sim S, Johnson PD, Aspuru-Guzik A (2019) . Adv Quantum Technol 2(12):1900070
Tacchino F, Macchiavello C, Gerace D, Bajoni D (2020) An artificial neuron implemented on an actual quantum processor. npj Quantum Information 5(1):26
Tanaka A, Tomiya A (2017) . J Phys Soc Japan 86(6):063001
Vatan F, Williams C (2004) . Phys Rev A 69:032315
Veras TML, De Araujo ICS, Park KD, Da Silva AJ (2020) IEEE Trans Comput 1–1
Wei S, Chen Y, Zhou Z, Long G (2021) [quant-ph]. arXiv:2104.06918
Wei H, Di Y (2012) . Quantum Inf Comput 12(3-4):262
Wiebe N, Kapoor A, Svore KM (2015) . Quantum Info Comput 15(3–4):316–356
Acknowledgements
We thank Quantum Open Source Foundation as this work was initiated under the Quantum Computing Mentorship program.
Funding
This research is supported by the National Research Foundation of Korea (Grant No. 2019R1I1A1A01050161 and 2021M3H3A1038085) and Quantum Computing Development Program (Grant No. 2019M3E4A1080227).
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The authors declare no competing interests.
Additional information
Data availability
The source code used in this study is available at https://github.com/takh04/QCNN.
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Tak Hur and Leeseok Kim contributed equally to this work and are listed in alphabetical order.
Appendices
Appendix: A. Related works
The term quantum convolutional neural network (QCNN) appears in several places, but it refers to a number of different frameworks. Several proposals have been made in the past to reproduce classical CNN on a quantum circuit by imitating the basic arithmetic of the convolutional layer for a given filter (Kerenidis et al. 2019; Li et al. 2020; Wei et al. 2021). Although these algorithms have the potential to achieve exponential speedups against the classical counterpart in the asymptotic limit, they require an efficient means to implement quantum random access memory (QRAM), expensive subroutines such as the linear combination of unitaries or quantum phase estimation with extra qubits, and they work only for specific types of quantum data embedding. Another branch of CNN-inspired QML algorithms focuses on implementing the convolutional filter as a parameterized quantum circuit, which can be stacked by inserting a classical pooling layer in between (Liu et al. 2021; Henderson et al. 2020; Chen et al. 2020). Following the nomenclature provided in Henderson et al. (2020), we refer to this approach as quanvolutioanl neural network to distinguish it from QCNN. The potential quantum advantage of using quanvolutional layers lies in the fact that quantum computers can access kernel functions in high-dimensional Hilbert spaces much more efficiently than classical computers. In quanvolutional NN, a challenge is to find a good structure for the parametric quantum circuit in which the number of qubits equals the size of the filter. This approach is also limited to qubit encoding since each layer requires a quantum embedding which has a non-negligible cost. Furthermore, stacking quanvolutional layers via pooling requires each parameterized quantum circuit to be measured multiple times for the measurement statistics.
Variational quantum circuits with the hierarchical structure consisting of \(O(\log (n))\) layers do not exhibit the problem of “barren plateau” (Pesah et al. 2021). In other words, the precision required in the measurement grows at most polynomially with the system size. This result guarantees the trainability of the fully parameterized QCNN models studied in this work when randomly initializing their parameters. Furthermore, numerical calculations in Ref. Pesah et al. (2021) show that the cost function gradient vanishes at a slower rate (with n, the number of initial qubits) when all unitary operators in the same layer are identical as in QCNN (Cong et al. 2019). The hierarchical structure inspired by tensor network, without translational invariance, was first introduced in Ref. Grant et al. (2018). The hierarchical quantum circuit can be combined with a classical neural network as demonstrated in Ref. Huang et al. (2021).
We note in passing that there exist several works proposing the quantum version of perceptron for binary classification (Tacchino et al. 2020; Mangini et al. 2020; Monteiro et al. 2021). While our QCNN model defers from them as it implements the entire network as a parameterized quantum circuit, interesting future work is to investigate the alternative approach to construct a complex network of quantum artificial neurons developed in the previous works.
Appendix: B. Classical CNN
In order to compare the classification accuracy of CNN and QCNN in fair conditions, we fixed hyperparameters used in the optimization step to be the same, which include iteration numbers, batch size, optimizer type, and its learning rates. In addition, we modified the structure of CNN in ways that its number of parameters subject to optimization is as close to that used in QCNN as possible. For example, since QCNN attains the best results with about 40 to 50 free parameters, we adjust the CNN structure accordingly. This led us to come up with two CNN, one with the input shape of (8, 1, 1) and another with the input shape of (16, 1, 1). In order to occupy the small number of input nodes for MNIST and Fashion MNIST classification, PCA and autoencoding are used for data pre-processing as done in QCNN. The CNNs go through convolutional and pooling stages twice, followed by a fully connected layer. The number of free parameters used in the CNN models is 26 or 44 for the case of 8 input nodes and 34 or 56 for the case of 16 input nodes.
The training also mimics that of QCNN. For every iteration step, 25 data are randomly selected from the training dataset, and trained via Adam optimizer with the learning rate of 0.01. We also fixed the number of iterations to be 200 as done in QCNN. The number of training (test) data are 12665 (2115) and 12000 (2000) for MNIST and fashion MNIST datasets, respectively.
Appendix: C. QCNN simulation results for MSE loss
In Section 4 of the main text, we presented the Pennylane simulation results of QCNN trained with the cross-entropy loss. When MSE is used as the cost function, similar results are obtained. We report classification results for MNIST and Fashion MNIST data attained from QCNN models that are trained with MSE in Tables 6 and 7.
Appendix: D. Classification with hierarchical quantum classifier
The hierarchical structure inspired by tensor network named as hierarchical quantum classifier (HQC) was first introduced in Ref. Grant et al. (2018). The HQC therein does not enforce translational invariance, and hence, the number of free parameters subject to optimization grows as O(n) for a quantum circuit with n input qubits. Although the simulation presented in the main manuscript aims to benchmark the classification performance of the QML model in which the number of parameters grows as \(O(\log (n))\), we also report the simulation results of HQC with the tensor tree network (TTN) structure (Grant et al. 2018) in this supplementary section for interested readers. The TTN classifier does not employ parameterized quantum gates for pooling. Thus, for certain ansatz, the number of parameters differs from that of QCNN models. For example, although the convolutional circuit 2 in Fig. 2 has two free parameters, only one of them is effective since one of the qubits is traced out as soon as the parameterized gate is applied. For brevity, here we only report the results obtained with the cross-entropy loss but similar results can be obtained with MSE. As can be seen from Table 8 and Table 9, the number of effective parameters (i.e., the second column) grows faster than that of QCNN models. An interesting observation is that there is no clear trend as the number of parameters is increased beyond 42, which is close to the maximum number of parameters used in QCNN. In other words, there is no clear motivation to increase the number of free parameters beyond 42 or so when seeking to improve the classification performance. Studying overfitting under the growth of the number of parameters remains an interesting open problem.
Rights and permissions
About this article
Cite this article
Hur, T., Kim, L. & Park, D.K. Quantum convolutional neural network for classical data classification. Quantum Mach. Intell. 4, 3 (2022). https://doi.org/10.1007/s42484-021-00061-x
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s42484-021-00061-x