  One of the most promising applications of quantum computing is the processing
of graphical data like images. Here, we investigate the possibility of
realizing a quantum pattern recognition protocol based on swap test, and use
the IBMQ noisy intermediate-scale quantum (NISQ) devices to verify the idea. We
find that with a two-qubit protocol, swap test can efficiently detect the
similarity between two patterns with good fidelity, though for three or more
qubits the noise in the real devices becomes detrimental. To mitigate this
noise effect, we resort to destructive swap test, which shows an improved
performance for three-qubit states. Due to limited cloud access to larger IBMQ
processors, we take a segment-wise approach to apply the destructive swap test
on higher dimensional images. In this case, we define an average overlap
measure which shows faithfulness to distinguish between two very different or
very similar patterns when simulated on real IBMQ processors. As test images,
we use binary images with simple patterns, greyscale MNIST numbers and MNIST
fashion images, as well as binary images of human blood vessel obtained from
magnetic resonance imaging (MRI). We also present an experimental set up for
applying destructive swap test using the nitrogen vacancy centre (NVs) in
diamond. Our experimental data show high fidelity for single qubit states.
Lastly, we propose a protocol inspired from quantum associative memory, which
works in an analogous way to supervised learning for performing quantum pattern
recognition using destructive swap test.
