Abstract
Quantum machine learning is emerging as a strategy to solve real-world problems. As a quantum computing model, parameterized quantum circuits provide an approach for constructing quantum machine learning algorithms, which may either realize computational acceleration or achieve better algorithm performance than classical algorithms. Based on the parameterized quantum circuit, we propose a hybrid quantum-classical convolutional neural network (HQCCNN) model for image classification that comprises both quantum and classical components. The quantum convolutional layer is designed using a parameterized quantum circuit. It is used to perform linear unitary transformation on the quantum state to extract hidden information. In addition, the quantum pooling unit is used to perform pooling operations. After the evolution of the quantum system, we measure the quantum state and input the measurement results into a classical fully connected layer for further processing. We demonstrate its potential by applying HQCCNN to the MNIST dataset. Compared to a convolutional neural network in a similar architecture, the results reveal that HQCCNN has a faster training speed and higher testing set accuracy than a convolutional neural network.
1. Introduction
Quantum mechanics is a set of rules constructed by mathematical framework or physical theory. As a new computational framework for integrating the concepts of quantum mechanics, quantum computing [1,2] utilizes the properties of quantum mechanics to process both quantum and classical information [3,4], which may cause an insurmountable gap between quantum and classical computers. As quantum technology is developing, noisy intermediate-scale quantum computers (NISQ) have begun to deal with some relatively complex computing tasks, and their computing power has surpassed classical computers in some tasks [5]. At this stage, quantum algorithms are dedicated to implementation on NISQ devices, which gives a new direction to some real classical computational problems.
In parallel to the recent advances in classical machine learning, interest in quantum machine learning has grown significantly in academia [6–9]. As a quantum computing model, parameterized quantum circuits (PQCs) have powerful parallel computing and expressive capabilities. Many researchers have constructed quantum machine learning algorithms using PQC. In 2014, Peruzzo et al. [10] proposed a variational quantum eigensolver (VQE) and realized it with a photon quantum processor and a classical computer. In 2016, McClean et al. [11] improved the variational quantum algorithm’s optimization scheme. In 2020, Schuld et al. [12] used PQC to construct a circuit-centric quantum classifier. The simulation on the dataset showed that the quantum classifier had high performance. In 2022, Zeng et al. [13] proposed a hybrid quantum neural network model based on a ladder circuit structure and introduced a full measurement strategy. The model achieved stable and high accuracy in both binary and multiclassification tasks. Since PQC was first proposed, many quantum machine learning algorithms based on PQC have been proposed [14–20], and it has been proved that the quantum machine learning algorithm based on PQC has better expressive performance and computing ability than the classical algorithm [21,22].
Convolutional neural networks (CNNs) have demonstrated their strong performance in deep learning tasks. Weight sharing and local receptive fields enable CNN to perform most tasks nowadays [23–28]. Furthermore, with the development of quantum information, quantum convolutional neural networks (QCNNs) have begun to interest researchers [29,30]. In 2019, inspired by classical CNN, Cong et al. [31] proposed a QCNN for phase classification and optimization of quantum error correction codes. The QCNN had a similar network architecture to CNN. In 2020, Li et al. [32] proposed a quantum deep convolutional neural network (QDCNN), which was a quantum version of classical convolution and achieved exponential computational acceleration. The model demonstrated the advantages of a quantum system over a classical system. In 2021, Parthasarathy et al. [33] proposed a quantum optical convolutional neural network that integrated quantum convolution and quantum optics. First, salient information was extracted using the linear unitary transformation of the quantum convolution part; subsequently, the quantum convolution results were input into the quantum optical neural network for further processing. The network exhibited good stability in terms of image recognition.
Combining PQC with the classical neural network, we propose a hybrid quantum-classical model for image classification. The hybrid model not only utilizes the powerful performance of PQC but also inherits the characteristics of the classical neural network. The quantum convolutional layer is composed of quantum convolution kernels constructed by PQC. We transform the classic image into a quantum state and input it into the quantum convolutional layer. The quantum convolutional layer performs the unitary transformation on the qubits corresponding to the convolution window. Then, the quantum pooling layer composed of quantum pooling units performs pooling operations. The qubits are measured at specific locations to obtain the results of the evolution of the quantum system, and the results are input to a fully connected layer for further processing. In this study, we refer to this model as a hybrid quantum-classical convolutional neural network (HQCCNN); the simulation experiments show that HQCCNN exhibits strong learning ability and high image classification accuracy.
The organization of the paper is as follows: CNN and PQC models are introduced in Section 2 briefly. The HQCCNN architectures and the algorithm execution process are described in Section 3. Section 4 describes simulation and analysis. Finally, the conclusion is drawn in Section 5.
2. Background
2.1. Convolutional Neural Network
A CNN consists of convolutional layers, pooling layers, and a fully connected layer that outputs the image’s class. The convolution process is to convolve the convolution kernel with the image and then move the convolution kernel according to the step size (usually set to 1); the convolution kernel does the same operation.
The convolution operation can be defined as follows: suppose the input image is the size of , the convolution kernel is the size of , and the convolution operation can be completed through the equationHere, is the nonlinear function. In order to set the feature map’s size to be the same as the input image, padding is usually used in the convolutional layer.
After convolution, the feature map is input into the next convolutional layer or pooling layer for high-dimensional feature extraction or feature dimensionality reduction. The dimensionality reduction methods of the pooling layer include max pooling and average pooling. Finally, the image’s class is obtained at the fully connected layer. The architecture of CNN is illustrated in Figure 1.

2.2. Parameterized Quantum Circuits
PQC is a quantum computing model, and it can be run on quantum computers. PQC usually consists of parametric unitary gates and nonparametric unitary gates. The parametric gate includes single-qubit rotation gate, and the three single-qubit rotation gates are defined as follows:
According to the quantum circuit , the parameterized circuit performs the unitary transformation of quantum state to produce the output quantum state , that is,where is the parameter in the circuit, such as the angle of the qubit rotation gate. PQC allows great freedom to design quantum algorithms, and it can realize different quantum algorithms by combining different quantum gates. The parameters of PQC are updated using the quantum-classical training method, as illustrated in Figure 2.

The quantum computer performs unitary transformation on the input quantum state according to the quantum circuits and then measures the output quantum state. The measurement results are input into a classical computer to calculate the loss value. The quantum circuit parameters are optimized through multiple iterations of the classical computer until the expectation value is satisfied or the maximum number of iterations is reached.
3. HQCCNN
3.1. Preparing the Quantum State
When the number of qubits in a quantum system is limited and the quantum system is used to tackle classical problems, the dimensionality reduction processing of classical data is usually required first. This paper downsamples the image to size, scales the pixel value to , and then flattens the image.
We get a vector after these operations and convert the vector to angle information , that is,where . The angle information is taken as the rotation angle of the rotation gate, and the rotation gate is applied to the initial quantum state for encoding, for a -input quantum system:Hence, qubits are required to encode a downsampled image of size , and the quantum state is obtained by encoding all pixels of the downsampled image.
3.2. Quantum Convolutional Layer
After obtaining the quantum state , the quantum convolution kernel designed by PQC is used to perform unitary transformation on . The convolution kernel has 5 training parameters , as shown in the circuit structure in the purple window in Figure 3.

The circuit in Figure 3 shows a convolutional layer circuit with an image size of . We use the convolution kernel to perform unitary transformation on the qubits corresponding to the convolution window. It should be noted that the quantum convolution window is consistent with the classical convolution window, but it corresponds to 4 qubits. The purpose of the convolution window repeatedly acting on the 4 qubits is to preserve the characteristics of the convolution as much as possible and extract the hidden information from the quantum state.
3.3. Quantum Pooling Layer
In this study, the quantum pooling unitary gate composed of 3 CNOT gates is used to reduce the dimension of the convolution results, as shown in the brown square in Figure 4. The pooling window acts in the same position as the convolution window, and after pooling, the convolution result of a convolution window is mapped to a qubit. Therefore, we only measure the specific qubit to obtain the expected value.

Classical CNN introduces nonlinearity through the nonlinear functions. In a quantum system, we introduce nonlinearity through measurement. After the evolution of the quantum system to the quantum state, the final quantum state is obtained. We perform Z-based measurement on the state to obtain the expectation value, that is,where is a vector of operators acting on different qubits, is the parameter-free unitary gate in the pooling layer, , is the number of convolutions in a convolutional layer, where for an image of , , and the pooling unit also performs times in a pooling layer. If we directly measure the output of the quantum convolutional layer, we get a quantum output with dimension ; if we measure the output of the quantum pooling layer, we get a vector with dimension . is a vector composed of expectation values of different qubits, which is not directly related to the image label, so the should be input into the classical fully connected layer for further processing.
3.4. Generating Hybrid Network
HQCCNN consists of a quantum convolutional layer, a quantum pooling layer, and a classical fully connected layer. As shown in Figure 5, the quantum convolutional layer consists of multiple convolution kernels, which complete the quantum convolution to obtain the feature map. The convolution kernel in Figure 5 is the convolution structure introduced in Section 3.2, but the parameters of different convolution kernels are different. The convolution results are reduced by the quantum pooling layer, and the quantum pooling unit is the quantum pooling structure introduced in Section 3.3. Then, measuring the specific qubits, the measurement results are input into the fully connected layer to obtain the image’s class.

3.5. Algorithm Execution Process
One of the reasons for the success of the classical neural network is that it has a developed backpropagation algorithm. We rely on the quantum computing framework TensorFlow Quantum [34] to complete the numerical simulation on a classical computer. TensorFlow Quantum implements a backpropagation algorithm that can be used in hybrid quantum-classical structures. We use the adjoint differentiation method to obtain gradients of the quantum system, which is described in detail in [34,35]. Through the abovementioned definition of the HQCCNN, the image classification algorithm is shown in Algorithm 1.
|
4. Simulation and Analysis
In this section, we use the MNIST dataset for simulation and analysis of HQCCNN. First, for each class in the MNIST dataset, 200 training images and 50 testing images are randomly selected. Therefore, in this paper, a total of 2000 images in the training set and 500 images in the testing set are used. However, the size of each image in the MNIST dataset is , which is not realistic for the current quantum experimental simulation, so we downsample each image to the size of .
The experimental setup in this section is as follows: first, we test all binary classification subsets in the MNIST dataset, then analyze the HQCCNN’s structural changes on classification performance, and finally compare them with CNNs of the same architecture. And, all experiment details are set as follows: we use a classical hidden layer when performing binary classification tasks, and two hidden layers are used when performing multiple classification tasks. The hidden layers use ReLu nonlinear function, and the classic optimizer Adam [36] is used to optimize the parameters, the batch size is set to 32, the learning rate is 0.01, and 100 epochs are set.
4.1. Evaluation Indicators
To more intuitively evaluate the performance of HQCCNN, this study uses training set loss and testing set accuracy as evaluation indicators. Using the cross-entropy function as the loss function, the cross-entropy function is defined as follows:where is the size of the training set, is the one-hot vector of the -th sample in the training set, and is the predicted probability vector by the model. Accuracy is defined aswhere is the size of the testing set, is the true class of the -th sample, and the argmax function outputs the maximum value’s position in a vector.
4.2. Binary Classification
In this section, we classify all binary subsets of MNIST and HQCCNN sets 1 convolutional layer, with 1 convolution kernel, and no pooling layer. The classical output layer uses a sigmoid nonlinear activation function. The binary classification results are shown in Figure 6.

Among all 45 binary classification tasks, HQCCNN shows high classification accuracy. The maximum appears in the classification task of digits 4 and 5, reaching 99.80%. The minimum value of 91.51% appears in the classification task of digits 3 and 8. It shows that HQCCNN is perfectly qualified for the binary classification task. However, it can also be seen in the classification results that when other digits are classified with 5 or 8, the probability of lower accuracy is higher. The reason for this difference may be that after image downsampling, some image features are lost, which increases the similarity between images.
Reference [37] proposes a quantum tensor network model. We compare some binary classification tasks with reference [37]. Reference [37] uses a model with 1008 parameters to test all binary classification tasks, while we use 150 parameters. The result is shown in Figure 7; it can be clearly seen from the figure that in the binary classification subsets \{0, 9\}, \{1, 7\}, \{2, 9\}, \{4, 6\}, \{6, 7\}, and \{8, 9\}, the accuracy of our model is better than in reference [37].

4.3. The Influence of Convolution Kernel on HQCCNN
Next, we discuss the influence of the convolution kernel’s number on HQCCNN. 2 HQCCNNs with 1 quantum convolutional layer are set, and the number of convolution kernels is 2 and 4, respectively. The fully connected layers are the same, and the output layer uses the softmax nonlinear activation function. We set a multiclassification task of digits 0–4. The results are plotted in Figure 8.

(a)

(b)
According to Figure 8, the HQCCNN with 4 convolution kernels achieves a smaller training loss value, and at the beginning of the epoch, it achieves a higher classification accuracy than the HQCCNN with 2 convolution kernels. However, with the increase in the epoch, the accuracy of the 2 architectures is almost the same, indicating that the HQCCNN with 2 convolution kernels already has high learning ability and image classification ability for the 5-class classification task.
4.4. The Influence of Pooling Layer on HQCCNN
To explore the influence of adding a pooling layer on the performance of HQCCNN, we construct a HQCCNN with a pooling layer. HQCCNN sets 1 convolutional layer with 2 convolution kernels. After adding a pooling layer, the convolution results are pooled and then input into the same classical fully connected layer. We set a classification task of digits 0–4. The training set loss and testing set accuracy of HQCCNN are plotted in Figure 9.

(a)

(b)
When adding a pooling layer, compared to HQCCNN without adding a pooling layer, the classification performance of HQCCNN is degraded. However, it still maintains high performance, indicating that the pooling unit used in this paper can keep the model with high learning ability and image classification ability.
4.5. Comparative Experiment of HQCCNN and CNN
We explore the difference in classification performance between HQCCNN and CNN. We take the 5-class (0–4) task as an example to illustrate the curve change in the numerical results of HQCCNN and CNN and set up other classification tasks to illustrate the performance differences. We set HQCCNN and CNN with the same network architecture, which means that the number of parameters between HQCCNN and CNN is the same. HQCCNN sets 1 convolutional layer with 2 convolution kernels and sets 2 architectures, one without pooling layer and another with a pooling layer. The corresponding CNN sets 1 convolutional layer with 2 convolution kernels, the convolutional layer with padding 1, the convolution kernel size is , with step size 1, and the activation function is ReLu. In the pooling layer, max pooling is used, and without padding, kernel size is , with step size 1. The classical fully connected layers are the same. The training set loss and testing set accuracy are plotted in Figure 10.

(a)

(b)

(c)

(d)
Next, we set up two complex binary classification tasks. The numerical results of HQCCNN and CNN are shown in Table 1.
As can be seen from Figure 10, without pooling layer, HQCCNN and CNN have almost the same loss value. However, HQCCNN has higher testing set accuracy than CNN. After adding a pooling layer, HQCCNN has a faster convergence speed and higher testing set accuracy than CNN. From Table 1, for complex binary classification tasks, HQCCNN also shows strong competitiveness. Figure 10 and Table 1 also show that the hybrid quantum-classical model has better learning ability and classification performance than CNN.
5. Conclusion
The development of quantum computing mode has made it possible to use quantum computing paradigm to solve classical problems. However, because of the limited number of available qubits in quantum computers at this stage, dealing with high-dimensional data is difficult. Thus, only the dimensionality of the data can be reduced, such as image downsampling. Although image downsampling is a compromise for current quantum devices, it makes it difficult to classify images because several images may become similar. Image downsampling makes the features disappear or become blur, thereby increasing uncertainty in the classification process. Amplitude encoding is a more efficient data-encoding approach, but it will result in intractable complexity. With researchers’ efforts, the advent of large-scale quantum computers will facilitate the handling of high-dimensional data, which will additionally enable them to handle more classical problems.
In conclusion, we propose a hybrid quantum-classical convolutional computing model that includes two parts: a quantum computing part and a classical computing part. The quantum computing part includes quantum convolutional layer and quantum pooling layer. The quantum convolutional layer has a parameterized quantum circuit design to achieve the linear unitary transformation of the quantum state. The potential of quantum computing can be harnessed using parameterized quantum circuits. Classical computing is used to map the expectation value of the quantum system further, making it related to the image label. In the experimental simulation, we classify all the binary subsets of MNIST dataset and achieve better performance. Furthermore, we discuss the impact of model architecture changes on HQCCNN and conduct comparative experiments using CNNs with the same architecture. The results show that compared to CNN, HQCCNN has a faster training speed and higher testing set accuracy.
Data Availability
Data are available on request to the corresponding author.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
Acknowledgments
This work was supported by the National Natural Science Foundation of China (Grant No. 61772295), Natural Science Foundation of Shandong Province, China(Grant Nos. ZR2021MF049 and ZR2019YQ01), and Project of Shandong Provincial Natural Science Foundation Joint Fund Application (ZR202108020011).