I am currently working on a project about Quantum Image Encoding, mainly with FRQI and NEQR algorithms. These codification methods use different circuit architectures (and not only parameters) depending on the image you are working with. My idea was to append an ansatz to these circuits and assess if it is possible to perform a classification task. However, the Qiskit functions that I have tried (VQC, QNN, TwoLayerQNN...) can only take classical data as inputs (as far as I know). I can't either use this encoding circuit as a feature map, as these circuits will change depending on the input (as I explained before). I was wondering if any of you know how to solve this problem, by taking the Quantum output of my encoding circuit and using it as an input for an ansatz. Thank you so much!!
1 Answer
To my knowledge, encoding of quantum machine learning is still a hot research topic. Hence, in short, I think you could propose your own new encoding method for this condition.
Here, we can make a simple example. Let's take FRQI as example.
https://qiskit.org/textbook/ch-applications/image-processing-frqi-neqr.html
After FRQI State quantum state representing the image, we could get a subcircuit. Then you could directly take this subcircuit as the encoding of quantum machine learning. For instance,
https://qiskit.org/textbook/ch-machine-learning/machine-learning-qiskit-pytorch.html
def __init__(self, n_qubits, backend, shots):
# --- Circuit definition ---
self._circuit = qiskit.QuantumCircuit(n_qubits)
all_qubits = [i for i in range(n_qubits)]
self.theta = qiskit.circuit.Parameter('theta')
self._circuit.h(all_qubits)
self._circuit.barrier()
self._circuit.ry(self.theta, all_qubits)
self._circuit.measure_all()
# ---------------------------
self.backend = backend
self.shots = shots
You can replace the angle encoding here with the subcircuit of FRQI State you just made.