Image Compression and Classification Using Qubits and Quantum Deep Learning

1 INTRODUCTION . In the past decade , deep learning has been remarkably successful on a wide variety of classical learning tasks ( Gi ( 2016 ) ; LeCun et al . ( 2015 ) ) . In parallel , quantum computing ( QC ) has long promised dramatic increases in computational power over classical computers , culminating in a recent demonstration of quantum supremacy in a machine with 53 programmable qubits in Arute et al . ( 2019 ) . However , even these quantum systems are already approaching the limits of classical simulability by the world ’ s largest traditional supercomputers ( Boixo et al . ( 2018 ) ; Preskill ( 2012 ) ) . The power of quantum computation suggests that quantum analogues of deep learning models like feedforward neural network may outperform their classical counterparts , especially when the data is inherently quantum ( Wan et al . ( 2017 ) ; Beer et al . ( 2020 ) ; E. Farhi ( 2018 ) ) . In this paper , we use a quantum neural network ( QNN ) to classify the MNIST dataset of handwritten digits ( LeCun & Cortes ( 2010 ) ) . Prior work has been restricted to only highly-compressed , rather unrealistic input images due to their inefficient encoding schemes that are injective maps from classical images to their corresponding pure quantum states . These frameworks have used input images of a maximum resolution of 4× 4 , which is too coarse even for humans to provide accurate labels ( see Figure 1 ) . For larger images , injectivity would necessitate the same number of qubits as bits that are present in the original image . However , recent advances in quantum machine learning ( QML ) on classical data , such as the Flexible Representation of Quantum Images ( FRQI ) in P.Q . Le & Hirota ( 2011 ) , have demonstrated that quantum wavefunctions can utilize quantum entanglement to encode classical data using exponentially less qubits than their corresponding classical representation in bits . In this paper , we use the FRQI method to embed the input images in fewer-qubit systems . This approach necessitates a novel QNN architecture for classification , which we describe in Section 5 . The input to our model are images of resolution up to 16 × 16 whose quantum encoding only requires 8 qubits ( 6 for pixel locations , 1 for color , and 1 for readout ) . To the best of our knowledge , our work is the first to propose a data encoding scheme and QNN that can be used to classify realistic images . Our main contributions are as follows : 1 . We provide a novel construction to compress images and encode them in their FRQI states . Our construction uses only 2-qubit gates , which permits its use in common quantum machine learning packages such as Cirq and Tensorflow Quantum ( TFQ ) and may be of independent interest ( Cirq ( 2021 ) ; GoogleAI ( 2020 ) ) . 2 . We propose a new QNN layers , CRADL and CRAML , which we use in a model trained with the images ’ FRQI states as input . 3 . We show that our trained QNN achieves accuracy comparable to classical models with the same number of parameters . 4 . We propose a novel technique to further compress black and white images , and study the scaling behavior of our model with the extent of image compression . Organization : In Section 2 , we provide a brief review of the formalism of quantum computation . In Section 3 , we provide an overview of related work and motivate our study . In Section 4 , we describe our dataset and how each image is encoded in a quantum state . In Section 5 , we describe the prescription for using a quantum neural network to obtain a classification prediction for a given image and describe the model we use for classification . In Section 6 , we present our results . We conclude with Section 7 and a description of future work in Appendix 8 . 2 PRELIMINARIES . 2.1 QUANTUM COMPUTING . Here we provide a brief review of quantum computation . For a more detailed reference and an interactive coding tutorial , we refer the reader to Nielsen & Chuang ( 2011 ) and Qiskit ( 2017 ) respectively . In quantum computation , the basic unit of information is a two-state quantum mechanical ( QM ) system called a qubit ; the two states are traditionally written |0〉 and |1〉 . A qubit can be in either of these two states , as well as a quantum superposition of these states , formally written as a wavefunction |ψ〉 = a0 |0〉 + a1 |1〉 = ∑ i∈ { 0,1 } ai |i〉 , where each ai ∈ C. When a qubit is measured , the wavefunction collapses and the result of the measurement is state |0〉 with probability |a0|2 and state |1〉 with probability |a1|2 1 . The space of all possible states of the qubit is called the Hilbert space H1 ; the states |0〉 and |1〉 provide a basis for this Hilbert space . 2 Multi-qubit systems are represented mathematically by the tensor product of multiple single-qubit systems . Notationally , we write |ψN 〉 = ∑ { i1 , i2 , ... iN } ∈ { 0,1 } N ai1 , i2 , ... iN |i1 , i2 , . . . iN 〉 where the states |i1 , i2 , . . . iN 〉 provide a basis for the multi-qubit Hilbert space HN and |ψN 〉 is generally a superposition of these basis states . A two-qubit state |ψ〉 ∈ H2 , can not necessarily be factorized into two single-qubit states |ψ1〉 , |ψ2〉 ∈ H1 : |ψ〉 = ∑ { i1 , i2 } ∈ { 0,1 } 2 ai1 , i2 |i1 , i2〉 6= |ψ1〉 ⊗ |ψ2〉 = ( a0 |0〉+ a1 |1〉 ) ⊗ ( a′0 |0〉+ a′1 |1〉 ) we call a state which can not be so factored a mixed state . In particular , we notice thatH2 > H1⊗H1 , and a similar result holds for multi-qubit systems with N > 2 . Under the laws of quantum mechanics , these wavefunctions – or states – evolve in time as determined by linear unitary transformations . Furthermore , any operation that is physically possible to perform 1We require |a0|2 + |a1|2 = 1 2Formally , a Hilbert space is an inner product vector space that is also a complete metric space with respect to the distance function induced by that inner product . on a set of qubits can be represented as a unitary operator . We refer to such unitary operators as quantum gates and note that unitary operators can be viewed as rotations in Hilbert space . A remarkable property of quantum states is their ability to be entangled . Informally , entanglement refers to the property of quantum mechanical systems whereby the state of one qubit can not be described independently of the other qubits ’ states . For example , the state |00〉 is maximally entangled as knowledge of one qubit ’ s state complete specifies the other ’ s . In general , quantum algorithms are procedures whereby an initial wavefunction is transformed under a sequence of unitary operations , or quantum gates , and a measurement is made of the transformed state ; this measurement is often performed on a readout qubit and is the output of the algorithm . Many quantum computation algorithms are designed to exploit properties of entangled systems ( Bernstein & Vazirani ( 1997 ) ; David & Richard ( 1992 ) ; Simon ( 1997 ) ; Shor ( 1997 ) ; Grover ( 1996 ) ) . 2.2 COMMON QUANTUM GATES . Several common quantum gates are defined below . These gates are defined by their action on the basis states of the Hilbert space , since they extend linearly to superpositions of the basis states . The definitions for the single-qubit Hadamard gate H and the Pauli-X gate X are : H |0〉 = |+〉 : = 1√ 2 ( |0〉+ |1〉 ) H |1〉 = |−〉 : = 1√ 2 ( |0〉 − |1〉 ) ( 1 ) X |0〉 = |1〉 X |1〉 = |0〉 ( 2 ) A common 2-qubit gate is CNOT , which flips the second qubit if the first qubit is in state |1〉 : CNOT |00〉 = |00〉 CNOT |01〉 = |01〉 ( 3 ) CNOT |10〉 = |11〉 CNOT |11〉 = |10〉 3 RELATED WORK . Many studies use QNNs to model either inherently quantum or quantum-encoded classical data but are generally restricted to very small images ( Li et al . ( 2020 ) ; Henderson et al . ( 2020 ) ; Oh et al . ( 2021 ) ) . One line of work encodes classical data in quantum systems and focuses on learning the classifier ’ s circuit architecture . These approaches require an injective map from the input image to a corresponding pure quantum state , which forgoes the exponential compression advantages afforded by methods such as FRQI3 ( E. Farhi ( 2018 ) ; Aïmeur et al . ( 2013 ) ; Paparo et al . ( 2014 ) ; Schuld et al . ( 2014 ) ; Kapoor et al . ( 2016 ) ) . Amongst this line of work , E. Farhi ( 2018 ) propose the general setup that we follow in this paper . In contrast with their work , however , we use the FRQI technique to exploit the dimensionality of the multi-qubit Hilbert space and need much fewer qubits . Other studies take the quantum wavefunction as given , either by assuming the classical data is already provided in its quantum-encoded form Schuld et al . ( 2020 ) or because they use inherently quantum data ( Sasaki & Carlini ( 2002 ) ; Gambs ( 2008 ) ; Sentís et al . ( 2012 ) ; Dunjko et al . ( 2016 ) ; Monràs et al . ( 2017 ) ; Alvarez-Rodriguez et al . ( 2017 ) ; Du et al . ( 2020 ) ; Sentís et al . ( 2019 ) ; Beer et al . ( 2020 ) ; Caro & Datta ( 2020 ) ) . Amongst these papers , Schuld et al . ( 2020 ) is perhaps closest to this work . The authors , however , take the mixed-state encodings of images as given for input to a QNN and do not describe how to construct the quantum states . Other work , such as Beer et al . ( 2020 ) , assumes the wavefunctions as given proposes a generalization of the perceptron to the quantum setting , which provides a more generalized framework than in E. Farhi ( 2018 ) These authors use inherently quantum data , in contrast with our work . We use classical data and explicitly construct quantum circuits to encode classical images into their wavefunctions . Our approach lends itself to direct experimentation and is usable with modern quantum machine learning packages . Finally , a third line of work uses quantum convolutional neural networks via semi-classical simulations meant to model the noise introduced by quantum effects , as in Kerenidis et al . ( 2019 ) . These approaches do not provide a fully quantum simulation to evolve the quantum states , which would require construction of the actual data ’ s wavefunctions as in our work . 3For a demo of a standard approach following E. Farhi ( 2018 ) using TFQ , which could also serve as a preliminary for this work , see https : //www.tensorflow.org/quantum/tutorials/mnist Throughout prior work , encoding classical data in quantum states efficiently appears to be a common open problem .

Summary: In this paper, the authors propose a certain type of trainable quantum procedures used as machine learning models for the classification of images. They explicitly show how to implement the circuits for loading compressed images into quantum states that are fed to a trainable unitary that writes the predicted label into a readout register. They conclude on numerical simulation performed on the MNIST dataset.