I want to know how i can encode 2D images with amplitude encoding? without flattening the matrix into vector.
Hi @sassan_moradi,
Unfortunately qml.AmplitudeEmbedding only takes a features vector of dimension (2^len(wires),)
, or less if pad_with is specified. You can try making your own implementation if you want, although the recommended way would be to flatten the matrix and use qml.AmplitudeEmbedding
.
Hey @CatalinaAlbornoz,
thanks for your answer. I will try to do it.
No problem @sassan_moradi, let me know if you manage to make it work for your use-case!
If it helps you can test your implementation using a simple dataset such as the bars and stripes one used in our tensor networks demo.
I hope this helps!
Hey @CatalinaAlbornoz, thanks. I figured it out how to do it. It is not something new. There are two simple methods: FRQI and NEQR. Ja. Once i am done, i will let you now.
That’s great to hear @sassan_moradi !
Hey @CatalinaAlbornoz, i did NEQR method. i attached the code. The code is based on NEQR method in this book: Quantum Image Processing | SpringerLink(see page 42). As you can see the quantum circuit, there are a lot of control on BasisEmbedding. How can i decompose these gates
neqr.py (1.1 KB)
efficiently into single qubits and CNOT with Pennylane? Without decomposition, it can be hard to run it for large-scale images.
Hi @sassan_moradi, the question of efficient decompositions is still an open research problem. Large-scale images are generally not well-suited for quantum computers. You may try using techniques like QCNN as explained in this demo but there’s no guarantee that this will work for more complicated images.