-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b847545
commit 820652b
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
## High-resolution image classification with real quantum computers. | ||
This folder contains the code that has been used in the paper [1] to experimentally classify high-resolution images of _ants_ and _bees_ with real quantum processors provided by IBM and Rigetti. | ||
|
||
The model is a hybrid neural network composed of a classical block (ResNet18) and a variational "dressed quantum circuit" [1], which has been numerically optimized according to the classical-to-quantum (CQ) transfer learning paradigm. | ||
|
||
This code can be used to test the optimized model with two alternative quantum processing units (QPUs): | ||
1. Rigetti Aspen-4-4Q-A. | ||
2. IBM Q 5, Tenerife (ibmq4x). | ||
|
||
 | ||
|
||
## Contents | ||
* `test_on_QPU.py`: Python script to test the hybrid classical-quantum image classifier with IBM or Rigetti quantum processors. | ||
|
||
* `quantum_weights.pt`: pre-trained model loaded by `test_on_QPU.py` to initialize the variational parameters of the hybrid network. | ||
|
||
## Usage and examples | ||
|
||
To test the model with the Rigetti backend: | ||
|
||
1. Make sure to satisfy all requirements (see next section). | ||
2. Login to the a QVM provided by Rigetti. | ||
3. Download or clone the repository in the QVM. | ||
4. Download the _Hymenoptera_ dataset as described in the main README file of the repo. | ||
5. Edit the file `test_on_QPU.py` and set `backend = 'rigetti'`. | ||
6. Run the command `python3 test_on_QPU.py`. | ||
|
||
To test the model with the IBM backend: | ||
|
||
1. Make sure to satisfy all requirements (see next section). | ||
2. Download or clone the repository. | ||
3. Download the _Hymenoptera_ dataset as described in the main README file the repo. | ||
4. Edit the local file `test_on_QPU.py` and set `backend = 'ibm'`. | ||
4. Moreover, set your personal IBM token by editing `token = '<your token>'`. | ||
5. Run the command `python3 test_on_QPU.py`. | ||
|
||
## Requirements | ||
|
||
Testing the model with the Rigetti backend requires having a Rigetti QCS account with access to a remote quantum virtual machine (QVM). In the QVM, the Python library PennyLane should be installed together with the associated PyTorch and Rigetti plugins. | ||
|
||
Testing the model with the IBM backend requires having an IBM Q Experience account with access to a remote quantum virtual machine (QVM). In the QVM, the Python library PennyLane should be installed together with the associated PyTorch and Rigetti plugins. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.