Approximately Equivariant Quantum Neural Network for $p4m$ Group
  Symmetries in Images
Quantum Neural Networks (QNNs) are suggested as one of the quantum algorithms
which can be efficiently simulated with a low depth on near-term quantum
hardware in the presence of noises. However, their performance highly relies on
choosing the most suitable architecture of Variational Quantum Algorithms
(VQAs), and the problem-agnostic models often suffer issues regarding
trainability and generalization power. As a solution, the most recent works
explore Geometric Quantum Machine Learning (GQML) using QNNs equivariant with
respect to the underlying symmetry of the dataset. GQML adds an inductive bias
to the model by incorporating the prior knowledge on the given dataset and
leads to enhancing the optimization performance while constraining the search
space. This work proposes equivariant Quantum Convolutional Neural Networks
(EquivQCNNs) for image classification under planar $p4m$ symmetry, including
reflectional and $90^\circ$ rotational symmetry. We present the results tested
in different use cases, such as phase detection of the 2D Ising model and
classification of the extended MNIST dataset, and compare them with those
obtained with the non-equivariant model, proving that the equivariance fosters
better generalization of the model.
Su Yeon Chang, Michele Grossi, Bertrand Le Saux, Sofia Vallecorsa
# Approximately Equivariant Quantum Neural Network for \(p4m\) Group Symmetries in Images

###### Abstract

Quantum Neural Networks (QNNs) are suggested as one of the quantum algorithms which can be efficiently simulated with a low depth on near-term quantum hardware in the presence of noises. However, their performance highly relies on choosing the most suitable architecture of Variational Quantum Algorithms (VQAs), and the problem-agnostic models often suffer issues regarding trainability and generalization power. As a solution, the most recent works explore Geometric Quantum Machine Learning (GQML) using QNNs equivariant with respect to the underlying symmetry of the dataset. GQML adds an inductive bias to the model by incorporating the prior knowledge on the given dataset and leads to enhancing the optimization performance while constraining the search space. This work proposes equivariant Quantum Convolutional Neural Networks (EquivQCNNs) for image classification under planar \(p4m\) symmetry, including reflectional and \(90^{\circ}\) rotational symmetry. We present the results tested in different use cases, such as phase detection of the 2D Ising model and classification of the extended MNIST dataset, and compare them with those obtained with the non-equivariant model, proving that the equivariance fosters better generalization of the model.

 Quantum Machine Learning, Geometric Quantum Machine Learning, Equivariance, Image classification, Image processing

## I Introduction

During the last few years, Quantum Machine Learning (QML) has witnessed remarkable progress from diverse research perspectives as a promising application for the practical use of quantum computers [1, 2, 3]. In particular, Quantum Neural Networks (QNNs) are suggested as the most general and fundamental formalism to solve a plethora of problems while the architecture is completely agnostic to the given problem. They are often expected to improve existing machine learning (ML) techniques in terms of training performance [2, 4], convergence rate [5, 6], and generalization power [7, 8, 9].

However, they often suffer from issues due to complex loss landscapes, which are often non-convex and lead to many poor local minima [10, 11, 12]. In an effort to solve these issues, the field of Geometric Quantum Machine Learning (GQML) [13, 14, 15, 16, 17, 18, 19] is currently emerging, inspired by the classical Geometric Deep Learning (GDL) [20, 21, 22].

The main idea of GQML is to add sharp inductive bias [23] into the training model by incorporating prior knowledge on the dataset [18, 19]. In practice, GQML aims to construct a parameterized QNN, which is equivariant under the action of the symmetry group associated with the input dataset, so that the same action is applied to the output of the QNN. Previous studies have heavily explored GQML both in terms of theories and applications, showing that GQML helps mitigate the issues often encountered in QML [19]. However, most studies still focus on the permutation symmetric group, \(S_{n}\)[13, 15, 18], \(\mathbb{Z}_{2}\otimes\mathbb{Z}_{2}\) symmetry applied in small toy applications [14], or a single symmetry element in the case of image classification [24].

We extend the study on GQML in the context of image classification by taking into account the _planar wallpaper symmetry_ group, \(p4m\), which includes the reflection and the \(90^{\circ}\) rotation. The \(p4m\) symmetry group is the most common symmetry group observed in image datasets, which are already treated in classical GDL via Group Equivariant Convolutional Networks (GCNN) [25, 21]. Although symmetry in images is considered to hinder neural network training in general, there exist applications where the symmetry has ponderable importance, such as Earth Observation [26, 27, 28, 29], medical images [30], symmetry-related physics datasets [31], etc.

In this work, we introduce the \(p4m\)_-Equivariant Quantum Convolutional Neural Network_ (EquivQCNN) for image classification. The results clearly prove that the equivariant neural network has the advantage in terms of generalization power, in particular, while using only a small number of training samples. Moreover, we show that the presence of small noise in the EquivQCNN training helps to classify the symmetric images better. Our study ultimately paves the way for GQML to tackle realistic image classification tasks, improving training performance.

This paper is structured as follows. First of all, we will briefly summarize in Section II the theoretical backgrounds required to understand GQML. Then, in Section III, we introduce the architecture of _Equivariant Quantum Convolutional Neural Network_ (EquivQCNN) for the _planar wallpaper symmetry_ group \(p4m\) in the context of image classification. Section IV present our first result for EquivQCNN applied on reflectional and rotational symmetric images and prove its generalization power compared to the non-equivariant architecture. We finally conclude in Section V and propose a future
research direction.

## II Preliminaries

This section summarizes the theoretical background on group symmetry and equivariance required to construct a GQML architecture for supervised learning. Consider a classical data space \(\mathcal{X}\) and a label space \(\mathcal{Y}\). Each data sample \(\mathbf{x}\in\mathcal{X}\) is associated with a label \(\ell\in\mathcal{Y}\) with the underlying function \(f:\mathcal{X}\rightarrow\mathcal{Y}\). The supervised learning aims to find \(y_{\boldsymbol{\theta}}\), which is as close as possible to the ground truth \(f\) with the trained parameters \(\boldsymbol{\theta}\).

In the case of QML, we construct a quantum feature map \(\psi:\mathcal{X}\rightarrow\mathcal{H}\), which embeds the classical data into a quantum state in the Hilbert space \(\mathcal{H}\). The input quantum state \(\left|\psi(\mathbf{x})\right\rangle\in\mathcal{H}\) is then transformed via QNN, taking the most general form of a Variational Quantum Circuits (VQCs) \(\mathcal{U}(\boldsymbol{\theta})\) which is parameterized by the rotation angles \(\boldsymbol{\theta}\). The final prediction of the QNN for the input feature \(\mathbf{x}\) is given as an expectation value of the observable \(O\) :

\[y_{\boldsymbol{\theta}}(\mathbf{x})=\left\langle\psi(\mathbf{x})\right| \mathcal{U}^{\dagger}(\boldsymbol{\theta})O\mathcal{U}(\boldsymbol{\theta}) \left|\psi(\mathbf{x})\right\rangle. \tag{1}\]

In general, QNN architecture is completely agnostic to the underlying symmetry of \(\mathcal{X}\). GQML aims to incorporate the symmetry inherent to the dataset with the QNN architecture so that the final prediction is _invariant_ after the action of the symmetry group element on the original input feature.

Let us formalize it in a more concrete way. Consider a symmetry group \(\mathfrak{G}\) that acts on the data space \(\mathcal{X}\). We say the training model is _\(\mathfrak{G}\)-invariant_ if :

\[y_{\boldsymbol{\theta}}(g[\mathbf{x}])=y_{\boldsymbol{\theta}}(\mathbf{x}), \forall\mathbf{x}\in\mathcal{X},\forall g\in\mathfrak{G}. \tag{2}\]

In order to construct _\(\mathfrak{G}\)-invariant_ model, we require three components: equivariant data embedding, equivariant QNN and invariant measurement [14].

First of all, we say that the data embedding is _\(\mathfrak{G}\)-equivariant_ if the symmetry group element \(g\in\mathfrak{G}\) applied on the data \(\mathbf{x}\in\mathcal{R}\) induces a unitary quantum action \(V_{s}[g]\) in the level of quantum states :

\[\left|\psi(g[\mathbf{x}])\right\rangle=V_{s}[g]\left|\psi(\mathbf{x})\right\rangle. \tag{3}\]

We call \(V_{s}\) the _induced representation_ of the embedding \(\psi(\mathbf{x})\)[14].

We also need to construct a trainable quantum circuit ansatz, parameterized by angles \(\boldsymbol{\theta}\), which is equivariant with respect to the symmetry group \(\mathfrak{G}\). For simplicity, we consider only the gates generated by a fixed generator \(G\in\mathcal{G}\) :

\[R_{G}(\theta)=\exp(-i\theta G),\ \theta\in\mathbb{R}. \tag{4}\]

where \(\mathcal{G}\) is a fixed gateset. For a symmetry group \(\mathfrak{G}\) and its representation \(V_{s}\), the operator \(R_{G}\) is said to be \(\mathfrak{G}\)-equivariant if and only if [14, 17]:

\[[R_{G}(\theta),V_{s}[g]]=0,\forall g\in\mathfrak{G},\forall\theta\in\mathbb{R} \tag{5}\]

or equivalently,

\[[G,V_{s}[g]]=0,\forall g\in\mathfrak{G}. \tag{6}\]

The definition of _equivariant_ can also be extended to QNNs. We call that a QNN, \(\mathcal{U}_{\theta}\), is _\(\mathfrak{G}\)-equivariant_ if and only if it consists of equivariant quantum operators, i.e. \(\mathcal{U}_{\theta}\) commutes with all the components in the symmetric group \(\mathfrak{G}\).

There exist several methods to construct the equivariant gateset [19], but in this paper, we will focus on the _twirling method_, which is the most practical approach for small symmetry groups [32]. Consider an arbitrary generator \(X\). Then, we define a twirled operator \(\mathcal{T}_{\mathfrak{G}}\) as :

\[\mathcal{T}_{\mathfrak{G}}[X]=\frac{1}{|\mathfrak{G}|}\sum_{g\in\mathfrak{G}} V_{s}[g]^{\dagger}XV_{s}[g]. \tag{7}\]

It corresponds to a projector of the operator \(X\) onto all symmetry group elements, commuting with \(V_{s}[g]\) for all \(g\in\mathfrak{G}\).

Finally, an observable \(O\) is \(\mathfrak{G}\)-invariant, if :

\[V_{s}[g]^{\dagger}OV_{s}[g]=O,\ \forall g\in\mathfrak{G}, \tag{8}\]

i.e. if \(O\) commutes with \(V_{s}[g]\) for all \(g\in\mathfrak{G}\). By taking all three components, the equivariance of QNN leads to the invariance of the final prediction:

\[y(g[\mathbf{x}]) =\left\langle\psi(g[\mathbf{x}])\right|\mathcal{U}(\boldsymbol{ \theta})^{\dagger}O\mathcal{U}(\boldsymbol{\theta})\left|\psi(g[\mathbf{x}])\right\rangle\] \[=\left\langle\psi(\mathbf{x})\right|V_{s}^{\dagger}\mathcal{U}( \boldsymbol{\theta})^{\dagger}O\mathcal{U}(\boldsymbol{\theta})V_{s}\left| \psi(\mathbf{x})\right\rangle\] \[=\left\langle\psi(\mathbf{x})\right|\mathcal{U}(\boldsymbol{ \theta})^{\dagger}O\mathcal{U}(\boldsymbol{\theta})\left|\psi(\mathbf{x}) \right\rangle=y(\mathbf{x}) \tag{9}\]

Overall, we have a trade-off between the equivariance and the expressibility of the QNN by constraining the quantum operators in the model based on the geometric prior of the dataset. GQML reduces the search space for training and brings advantages in many folds, such as trainability [18], convergence rate [33], and generalization power [14, 18].

## III GQML for image classification

In this section, we will introduce Equivariant Quantum Convolutional Neural Networks (EquivQCNNs) for image classification invariant under the \(p4m\) wallpaper symmetry group, \(\mathfrak{G}_{p4m}\), which corresponds to the planar square symmetry group. It consists of 8 components :

* the identity \(e\),
* the rotation \(r\), \(r^{2}\) and \(r^{3}\) of \(90^{\circ},180^{\circ},270^{\circ}\) around the origin,
* the reflection \(t_{x}\) and \(t_{y}\) in the \(x\) and \(y\) axis,
* the reflection in the two diagonals.

In this paper, we will focus on six components out of them, the rotation \(r\) and the reflection in the main axis, \(t_{x}\) and \(t_{y}\).

### _Equivariant Data embedding_

We will start by constructing the data embedding method for the reflectional and rotational symmetry of images. Amplitude encoding is one of the most fundamental methods for mapping classical data into quantum states [34]. In general, each pixel coordinate is associated with a computational basis by visualizing the 2D image as a 1D vector, but this complicates the manipulation of 2D symmetry.
We propose a _coordinate-aware_ amplitude (CAA) embedding method, which facilitates finding the unitary representation of \(p4m\) symmetry group. The main idea of the CAA embedding is that we can explicitly denote the \(x\) and \(y\) coordinates by using the first \(n\) qubits to represent the \(x\)-coordinate and the second \(n\) qubits for the \(y\)-coordinate of the pixel.

Let us consider a training set \(\mathcal{X}\) of 2-dimensional images with \(N\times N\) pixels, denoted as \(\mathbf{x}=\{x_{ij}\}\) with \(i,j=0,...,N-1\), each of which is associated with a hot encoded label \(\ell\in\{0,1\}\in\mathcal{Y}\). The CAA embedding maps the input image \(\mathbf{x}\) into a quantum state \(\ket{\psi(x)}\in\mathcal{H}\) as follows:

\[\ket{\psi(x)}=\sum_{i=0}^{N-1}\sum_{j=0}^{N-1}x_{ij}\ket{i}\ket{j} \tag{10}\]

where \(N=2^{n}\). For simplicity, let us denote \(q_{1:n}\) the first \(n\)-qubits for \(x\)-coordinates and \(q_{n+1:2n}\) the second \(n\)-qubits for \(y\)-coordinates.

From the CAA embedding formulation, it is straightforward to find the induced representation of \(p4m\) group elements. Fig. 1 visualizes CAA embedding of 2D images and the action of the symmetry elements on the computational basis states. Let us denote \(V_{x}\) and \(V_{y}\) the induced representation of the reflections, \(t_{x}\) and \(t_{y}\) respectively, and \(V_{r}\) for rotation of \(90^{\circ}\), \(r\), which are defined as follows :

\[V_{x}=X^{\otimes n}\otimes\mathbb{I}^{\otimes n}=X_{1:n}, \tag{11}\]

\[V_{y}=\mathbb{I}^{\otimes n}\otimes X^{\otimes n}=X_{n+1:2n}, \tag{12}\]

\[V_{r}=(X^{\otimes n}\otimes\mathbb{I}^{\otimes n})\otimes_{i=0}^{n-1}SWAP_{i, i+n}=V_{x}V_{r}^{\prime}, \tag{13}\]

with \(V^{\prime}r=\otimes_{i=0}^{n-1}SWAP_{i,i+n}\) Therefore, the quantum gates, which are equivariant with respect to \(p4m\) symmetry, should commute with all the induced representation, \(V_{p4m}=\{V_{x},V_{y},V_{r}\}\) :

\[U \in\texttt{comm}\{V_{x},V_{y},V_{r}\}=\texttt{comm}\{V_{x},V_{y},V_{r}^{\prime}\}\] \[=\texttt{comm}\{X_{1:n},X_{n:2n},\otimes_{i=0}^{n-1}SWAP_{i,i+n }\}, \tag{14}\]

where \(\texttt{comm}\) denotes the commutator of the unitary operators.

### _Equivariant Quantum Convolutional Neural Networks_

First proposed by Iris Cong, _et al._[35], Quantum Convolutional Neural Networks (QCNNs) is the quantum analogue of classical Convolutional Neural Networks (CNNs). QCNNs have exhibited success in different tasks, including quantum many-body problems [35], phase detection [8], and image classification [36], taking advantage of avoiding the barren plateaus with shallow circuit depth [11].

QCNN consists of two components, _convolutional filters_, which are \(k\)-body local quantum gates for \(k<n\), and the pooling layers, to reduce the two qubit states into one qubit state. In most of the cases, we have \(k=2\) for convolutional filters, but in this paper, we will also introduce the case with \(k>2\) to maintain the equivariance. Especially QCNN maintains the translational invariance of input data by sharing identical parameters between the filters inside each layer.

Following the definition of equivariance and the method presented in Section II, we construct the equivariant ansatz of the convolutional filters for \(\mathfrak{G}_{p4m}\). To start with, we can easily find out that the architecture of QCNN respects the equivariance with respect to \(V_{r}^{\prime}\) as we repeat the same gate with the same parameter on qubit \(i\) and \(i+n\) if we have an even \(n\).

The ansatz symmetrization for the other symmetries requires more insights. We will consider the generator gateset, which only consists of Pauli strings up to 2-body local operation :

\[G=\{X,Y,Z,Y_{1}Y_{2},Z_{1}Z_{2}\}. \tag{15}\]

For a single qubit gate, it is trivial to notice that only Pauli \(X\) gates commute with \(V_{x},V_{y}\), while for \(k\)-qubit gates for \(k>1\), we need to explore two cases separately.

1. \(G\) **constrained to \(q_{1:n}\)****OR**\(q_{n+1:2n}\) Considering only \(2\)-body quantum gates, finding \(U\in\texttt{comm}(X_{1:n},X_{n:2n})\) can be simplified into finding \(U\in\texttt{comm}(X_{1}X_{2})\). We can easily find out that both \(Y_{1}Y_{2}\) and \(Z_{1}Z_{2}\) commute with \(X_{1}X_{2}\) applied on two qubits.

Fig. 1: Schematic diagram of the action of \(p4m\) symmetry on 2D images of size \(4\times 4\) encoded using CAA embedding method with \(2\) qubits. The pixel at position \((i,j)\) is associated with a computational basis \(\ket{i}\ket{j}\).
Indeed, using the Twirling method, we have :

\[\mathcal{T}_{X_{1}X_{2}}(Y_{1}Y_{2}) =\frac{1}{2}\Big{(}Y_{1}Y_{2}+(X_{1}X_{2})^{\dagger}(Y_{1}Y_{2})(X _{1}X_{2})\Big{)}\] \[=\frac{1}{2}(Y_{1}Y_{2}+X_{1}Y_{1}X_{1}X_{2}Y_{2}X_{2})\] \[=\frac{1}{2}(Y_{1}Y_{2}+(-Y_{1})(-Y_{2})).\] \[=Y_{1}Y_{2}. \tag{16}\]

Similarly, we can show that \(Z_{1}Z_{2}\) is the equivariant operator with respect to \(X_{1}X_{2}\). Thus, we obtain the equivariant generator gateset :

\[G_{s,1}=\{Y_{1}Y_{2},Z_{1}Z_{2}\}. \tag{17}\]
2. \(G\) **applied on both \(q_{1:n}\) AND \(q_{n+1:2n}\)** Unlike the first case, where the Pauli \(X\) gate in \(V_{x}\) and \(V_{y}\) acts equally on two qubits with \(X\otimes X\), the weight of Pauli gates is unbiased in this case. We can easily notice that \(G_{s,1}\) acting on \(q_{n}\) and \(q_{n+1}\) do not commute with \(V_{x}\) and \(V_{y}\), as : \[[X_{1}\otimes\mathbb{I}_{2},Y_{1}Y_{2}]=-[Y_{1}Y_{2},X_{1}\otimes\mathbb{I}_{ 2}].\] (18) Indeed, in order to construct an equivariant operator, we need an even number of Pauli Y or Pauli Z gates applied on both \(q_{1:\ n}\) and \(q_{n+1:\ 2n}\)[19]. Therefore, the smallest equivariant quantum gates are : \[G_{s,2}=\{P_{\sigma}P_{\sigma^{\prime}}P_{\sigma^{\prime}}|P_{\sigma,\sigma^{ \prime}}\in\{X,Y,Z\}\}\] (19)

By exponentiating the equivariant generators found above, we can construct the convolutional filter ansatz, which is equivariant with respect to \(V_{p4m}\). Fig. 3 summarizes the equivariant two-qubit convolutional filter ansatz, \(U_{2}\) and the four-qubit ansatz, \(U_{4}\). Using the \(U_{2}\) and \(U_{4}\), we propose two QCNN models, Equivariant QCNN (EquivQCNN) and Approximately Equivariant QCNN (Appr-EquivQCNN), as shown in Fig. 2. In both cases, we first apply the two-qubit convolutional filters on \(q_{1:n}\), and \(q_{n+1:2n}\) separately, without connecting them, which can be considered as the preliminary scanning phase. Then, in EquivQCNN, \(U_{4}\) ansatz is used as the convolutional filter and connects \(q_{1:n}\), and \(q_{n+1:2n}\), leading the fully equivariant model. On the other hand, in Appr-EquivQCNN, \(U_{2}\) ansatz is repeated for the learning layers acting on \(q_{n}\), and \(q_{n+1}\). We add a limited noise to the equivariant model to increase the expressibility by slightly breaking the symmetry. With this noise, we aim to find a crossing point between the expressibility and the equivariance so that it is expressible enough to learn the training samples but, at the same time, not excessively expressible to generalize.

### _Approximately Invariant Measurement_

In this section, we propose an _Approximately Invariant Measurement_, with the detailed process summarized in Fig. 4. For simplicity, we will consider the binary classification case.

Let us call \(q_{i_{m}}\in q_{1:n}\) and \(q_{i_{m}+n}\in q_{n+1:2n}\) with \(i_{m}\in[1,..,n]\) the qubits which are not traced out in EquivQCNN and measured at the end of the circuit. First, we apply an \(R_{z}(\phi)\) and a Hadamard gate on both \(q_{i_{m}}\) and \(q_{i_{m}+n}\), with \(\phi\) also a trained parameter. Then, we measure the probability distribution of state \(|0\rangle\) and \(|1\rangle\) on each of the qubits separately, obtaining \([p_{0},p_{1}]\) and \([p_{0}^{\prime},p_{1}^{\prime}]\) respectively. As the other qubits are traced out, only the two-qubit state is left at the end of

Fig. 3: Parameterized quantum circuits ansatz, \(U_{2}\) (yellow rectangle) and \(U_{4}\) (blue rectangle), used the convolutional filters equivariant with respect to \(p4m\) symmetry group.

Fig. 2: A Schematic diagram of (a) EquivQCNN and (b) Appr-EquivQCNN for an example of 8 qubits to classify image of size \(16\times 16\). They consist of \(U_{2}\) (yellow rectangle) and \(U_{4}\) (blue rectangle) convolutional filters (c.f. Fig. 3), followed by pooling layers (green circle). Both models contain a preliminary _scanning_ phase, where \(U_{2}\) acts on \(q_{1:n}\) and \(q_{n+1:2n}\) separately. EquivQCNN then consists of \(U_{4}\) ansatz, while Appr-EquivQCNN is subject to a small noise by connecting \(q_{1:n}\) and \(q_{n+1:2n}\) with \(U_{2}\) gate.
the quantum circuit. Denoting the final quantum state on the qubit \(q_{i_{m}}\) and \(q_{i_{m}+1}\) as \(\ket{\psi_{f}}=r_{0}e^{i\theta_{0}}\ket{00}+r_{1}e^{i\theta_{1}}\ket{01}+r_{2}e^{ i\theta_{2}}\ket{10}+r_{3}e^{i\theta_{3}}\ket{11}\), the proposed measurement on \(q_{i_{m}}\) returns the probability distribution :

\[p_{0}= \frac{1}{2}\big{[}r_{0}^{2}+r_{1}^{2}+2r_{0}r_{1}\cos(2\phi-\theta _{0}+\theta_{1})\] \[+r_{2}^{2}+r_{3}^{2}+2r_{2}r_{3}\cos(2\phi-\theta_{2}+\theta_{3}) \big{]}, \tag{20}\]

\[p_{1}= \frac{1}{2}\big{[}r_{0}^{2}+r_{1}^{2}-2r_{0}r_{1}\cos(2\phi-\theta _{0}+\theta_{1})\] \[+r_{2}^{2}+r_{3}^{2}-2r_{2}r_{3}\cos(2\phi-\theta_{2}+\theta_{3}) \big{]}. \tag{21}\]

First of all, we can easily notice that the measurement is invariant with respect to \(V_{r}^{\prime}\) as we are summing up the final measurement on \(q_{i_{m}}\) and \(q_{i_{m}+n}\). Now, let us prove that it is equivariant with a certain error rate \(\epsilon\). Similarly, let us call \([p_{0}^{x},p_{1}^{x}]\) the final probability of the image reflected with respect to the \(x\)-axis for the final state \(V_{x}\ket{\psi_{f}}=r_{1}e^{i\theta_{1}}\ket{00}+r_{0}e^{i\theta_{0}}\ket{01} +r_{3}e^{i\theta_{3}}\ket{10}+r_{2}e^{i\theta_{2}}\ket{11}\) with a bit flip on qubit \(q_{i_{m}}\). By performing the same computation, we can compute the difference between \(p_{0}\) and \(p_{0}^{x}\) :

\[p_{0}-p_{0}^{x} =r_{0}r_{1}\big{[}\cos(2\phi-\theta_{0}+\theta_{1})-\cos(2\phi+ \theta_{0}-\theta_{1})\big{]}\] \[+r_{2}r_{3}\big{[}\cos(2\phi-\theta_{2}+\theta_{3})-\cos(2\phi+ \theta_{2}-\theta_{3})\big{]}\] \[=\sin(2\phi)\big{[}r_{0}r_{1}\sin(\theta_{1}-\theta_{0})+r_{2}r_ {3}\sin(\theta_{3}-\theta_{2})\big{]}\] \[\leq\frac{1}{2}\epsilon\big{[}\sin(\theta_{2}-\theta_{1})+\sin( \theta_{3}-\theta_{2})], \tag{22}\]

with \(\epsilon=\sin(2\phi)\). The last inequality uses \(\max r_{0}r_{1}+r_{2}r_{3}=\frac{1}{2}\) while taking into account the fact that \(r_{0}^{2}+r_{1}^{2}+r_{2}^{2}+r_{3}^{2}=1\). This proves that with \(\phi\approx 0\) or \(\phi\approx\frac{\pi}{2}\), we can say that the measurement is _approximately invariant_ with respect to \(V_{x}\), and also \(V_{y}\) by using the same justification. The presence of the \(R_{z}\) gate loosens the constraint imposed by the symmetry and adds an extra degree of freedom to the training. By trading off the _full_ invariance and expressibility, we allow exploring larger search space for better performance.

We can generalize this measurement for \(L\)-class classification by measuring \(\log_{2}L\) qubits at \(q_{1:n}\) and \(q_{n+1:2n}\) qubits separately and summing them up. This way of measurement corresponds to the _Softmax_ activation function at the end of the neural network. Thus, we use the binary cross entropy to calculate the training loss,

\[\mathcal{L}_{\mathbf{\theta}}(\mathbf{x})=-\sum_{i=1}^{L}\ell_{i}\log p_{i}(\mathbf{ \theta};\mathbf{x}), \tag{23}\]

where \(\ell=[\ell_{1},\ell_{1},...,\ell_{L}]\) with \(\ell_{i}\in\{0,1\}\) is the one-hot encoded target label. The state with the highest probability will correspond to the class with which the input image is associated.

For the following, we will consider two different types of measurements :

1. \(M_{1}\) : \(\phi\) is constrained to zero, \(\phi=0\),
2. \(M_{2}\) : \(\phi\) is updated during the training, \(\phi\neq 0\).

## IV Result

In this section, we present our preliminary results of the EquivQCNN training for binary image classification applied to two different image datasets, shown on Fig. 5. The first dataset contains the spin distribution of the 2D lattice Ising model with \(16\times 16\) interacting spins, simulated using Metropolis Monte Carlo with the Hamiltonian [37]:

\[H=-J\sum_{\langle ij\rangle}s_{i}s_{j}, \tag{24}\]

where \(s_{i}\in\{-1,1\}\) corresponds to the spin on site \(i\), \(J\) the interaction between two spins and \(\langle ij\rangle\) the pairs of the nearest neighbours. At low temperature \(T\), the spins are ordered, pointing all in the same direction, and as the temperature increases, we reach the critical temperature \(T_{c}\) where we observe the phase transition from an ordered phase to a

Fig. 4: Approximately Invariant Measurement process. We apply \(R_{z}(\phi)\) and \(H\) gate on two qubits, \(q_{i_{m}}\in q_{1:n}\) and \(q_{i_{m}+n}\in q_{n+1:2n}\), and measure the probability distribution on each qubits separately. The final label is computed by summing up the two distributions and taking its half.

Fig. 5: Examples of the Ising model and the extended MNIST image samples with size \(16\times 16\) used for binary classification. Each row corresponds to each class.
disordered phase. By taking the periodic boundary condition, the Ising model dataset is reflectional and rotational symmetric by construction. We aim to classify the order phase from the disordered phase using EquivQCNN.

The second dataset is the extended MNIST dataset, which also includes randomly reflected and rotated handwritten digit images. In this paper, we present the results for the classification of digits \(4\) and \(5\), downsampled into \(16\times 16\) pixels.

We compare the performance of EquivQCNN with a non-equivariant QCNN with a similar number of parameters, using a convolutional filter that generates an arbitrary two-qubit \(SO_{4}\) state [36]. For all the models, the initial parameters are sampled randomly from a uniform distribution, \([-0.1,0.1]\). The parameters are updated with ADAM optimizers, using the learning rate of \(0.01\), \(\beta_{1}=0.5\) and \(\beta_{2}=0.999\).

To prove the generalization power of the EquivQCNN, we train the models for different training set size, \(N_{s}=2^{i}\cdot 10\) for \(i=1,...,10\) with the batch size \(N_{bs}=2^{i}\) to maintain the same number of updates in each epoch. Tab. I and Fig. 6 summarize the test accuracy obtained at the end of the training with different QCNN architectures. Note that the number of samples in the test set is always the same regardless of the number of training samples.

We can observe that EquivQCNN and Appr-EquivQCNN with \(M_{2}\) measurement have higher test accuracy for all \(N_{s}\), especially for small \(N_{s}\). In particular, in the case of the Ising model, Appr-EquivQCNN with \(M_{2}\) outperforms the non-equivariant model only using 256 times less number of training samples. This certainly proves that the equivariance helps to improve the generalization power as expected.

One interesting point is that EquivQCNN gives the best result for MNIST, while Appr-EquivQCNN with \(M_{2}\) measurement outperforms EquivQCNN for the Ising model. This difference might be explained by the fact that the Ising model is subject to a stricter symmetry by its construction, compared to the extended MNIST, where the symmetry is artificially created by random reflection and rotation. Thus, injecting noise into the model with Appr-EquivQCNN helps training for the Ising dataset, which is not the case for MNIST.

## V Conclusion

In this paper, we introduced the Equivariant QCNN for the planar wallpaper symmetry group \(p4m\), including reflection and \(90^{\circ}\) rotation in image classification. Furthermore, our study suggests the possibility of injection of noises into the GQML model in order to find the best crossing point between expressibility and equivariance. The proposed models are tested for two different datasets, the Ising model and the extended MNIST dataset, and compared with the non-equivariant model. The results obtained clearly proved that the EquivQCNN outperforms the non-equivariant one in terms of generalization power, especially with a small training set size. Previous studies on QML have already proven that it has a high generalization power with a small training set size [7]. This work demonstrated that we can further improve the generalization thanks to the induced bias added by the geometric prior to the dataset.

For our future research, we plan to compare the EquivQCNN with the problem-agnostic model, not only in terms of test accuracy but also in other factors, such as local effective dimension, overparameterization, barren plateaus, etc. Ultimately, we extend the test to a more realistic use case with a larger image size where symmetry is an essential component for the training, such as Earth Observation images, and show the practical advantage of EquivQCNN.

Fig. 6: The test accuracy obtained at the end of QCNN training for Ising and extended MNIST dataset with different training sample numbers. The solid line corresponds to the average over the five runs, and the dashed line the best one among them. The test accuracy for EquivQCNN and ApprEquivQCNN with \(M_{2}\) are always higher than the non-equivariant QCNN, proving their generalization power.

\begin{table}
\begin{tabular}{c||c|c||c|c}  & \multicolumn{2}{c||}{Ising} & \multicolumn{2}{c}{MNIST} \\ \hline \(n_{samples}\) & \(40\) & \(10240\) & \(40\) & \(10240\) \\ \hline Non-Equiv. & \(77.6\pm 0.1\) & \(83.0\pm 2.0\) & \(66.7\pm 2.1\) & \(72.9\pm 0.5\) \\ Equiv. & \(74.2\pm 0.2\) & \(75.8\pm 0.3\) & \(\mathbf{77.5\pm 1.0}\) & \(74.5\pm 4.7\) \\ Appr-Eq. 1 & \(84.8\pm 2.2\) & \(85.4\pm 2.0\) & \(52.9\pm 0.1\) & \(72.7\pm 2.4\) \\ Appr-Eq. 2 & \(\mathbf{86.4\pm 3.4}\) & \(\mathbf{89.3\pm 2.9}\) & \(69.7\pm 2.9\) & \(\mathbf{76.2\pm 1.8}\) \\ \end{tabular}
\end{table} TABLE I: The test accuracy at the end of the QCNN training for Ising and extended MNIST with \(n_{samples}=40\) and \(10240\) training samples (best result in bold).
## Acknowledgement

This work was carried out as part of the quantum computing for earth observation (QC4EO) initiative of ESA \(\Phi\)-lab, partially funded under contract 4000135723/21/I-DT-lr, in the FutureEO programme. MG and SF are supported by CERN through the CERN QTI.
