qiskit-machine-learning icon indicating copy to clipboard operation
qiskit-machine-learning copied to clipboard

Quantum CNN

Open Gopal-Dahale opened this issue 2 years ago • 7 comments

What should we add?

I wanted to contribute a new tutorial on Quantum CNN using Pytorch Lightning. I am following this approach using jupyter notebooks.

The implementation uses sklearn 'blobs dataset to perform binary classification of 2-dimensional data points. It features Quantum convolution and pooling layers. Shall I create a pull request for this?

Gopal-Dahale avatar Jun 07 '22 19:06 Gopal-Dahale

Hi, thanks a lot for the suggestion and sorry for the long delay. I think, such a tutorial is a good idea. We don't have pytorch lightning on the dependencies list, so please make use of plain pytorch. If you have any questions let me know.

adekusar-drl avatar Jun 13 '22 18:06 adekusar-drl

Hi, we already have code written with Qiskit for generating quantum circuits for the exact same tutorial referenced. But it is not published anywhere. Let think what's the best way to proceed.

dlasecki avatar Jun 29 '22 11:06 dlasecki

@dlasecki I'd love see some progress on this topic, I don't have time to work on this on my own or in a collaboration with anybody. So any ideas are very welcome!

adekusar-drl avatar Jun 29 '22 11:06 adekusar-drl

@dlasecki I tried to follow the code of the referenced tutorial in qiskit and used TorchConnector to train it, but the model does not seem to converge and it takes a lot of time to finish even a single epoch. Using GPU is not beneficial as the number of samples are less (~100) and even when I used GPU the per cent utilization was negligible.

In the torch connector tutorial, the authors use only 2 qubits when here using 16 qubits (images resized to 4 x 4) is taking quite a time.

Gopal-Dahale avatar Jun 29 '22 11:06 Gopal-Dahale

@Gopal-Dahale may we help somehow?

adekusar-drl avatar Jun 29 '22 11:06 adekusar-drl

Let

@Gopal-Dahale may we help somehow?

Let me make the code a little bit readable. You can find my current progress here. I was also trying to make a single qubit CNN using this as a reference.

Gopal-Dahale avatar Jun 29 '22 11:06 Gopal-Dahale

@dlasecki I tried to follow the code of the referenced tutorial in qiskit and used TorchConnector to train it, but the model does not seem to converge and it takes a lot of time to finish even a single epoch. Using GPU is not beneficial as the number of samples are less (~100) and even when I used GPU the per cent utilization was negligible.

In the torch connector tutorial, the authors use only 2 qubits when here using 16 qubits (images resized to 4 x 4) is taking quite a time.

Hi, if your code is in a good shape for us to follow, you might open a draft PR and we might have a look. Perhaps some things could be optimized or improved.

dlasecki avatar Jun 29 '22 11:06 dlasecki

Closed in #462

adekusar-drl avatar Aug 29 '22 21:08 adekusar-drl