Skip to content

Commit cd20275

Browse files
fkiwitDSGuala
andauthored
Added quantum images (#67)
* Added quanatum images * move images to new class * add images * add dummy quality parameter * add trial URLs * trial values for classes * update collections * Change to the compact data format * pre-release updates * forgot brackets, small copy updates * update citation link --------- Co-authored-by: Florian Kiwit <[email protected]> Co-authored-by: Diego <[email protected]> Co-authored-by: Diego <[email protected]>
1 parent 851ca87 commit cd20275

File tree

8 files changed

+175
-0
lines changed

8 files changed

+175
-0
lines changed
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"slug": "low-depth-image-circuits",
3+
"title": "Low-Depth Image Circuits",
4+
"about": "This collection contains datasets from an upcoming paper, Typical Machine Learning Datasets as Low-Depth Quantum Circuits. These datasets contain quantum circuits that encode images as quantum states and can be used for benchmarking supervised quantum machine learning models.",
5+
"thumbnail": "DatasetCollections_QuantumImages.png"
6+
}
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@misc{kiwit2025efficientdata,
2+
title={Low-Depth MNIST},
3+
author={Florian Kiwit and Bernhard Jobst and Carlos Riofrío},
4+
howpublished = {\url{https://pennylane.ai/datasets/low-depth-mnist}}
5+
year={2025}}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"slug": "low-depth-mnist",
3+
"class": {
4+
"slug": "low-depth-mnist",
5+
"name": "LowDepthMNIST",
6+
"attributeList": [
7+
{
8+
"name": "circuit_layout_d4",
9+
"pythonType": "list",
10+
"doc": "Circuits layout consiting of CNOTs and RY gates defined as lists of operations and wires they act on with a circuit depth of 4."
11+
},
12+
{
13+
"name": "circuit_layout_d8",
14+
"pythonType": "list",
15+
"doc": "Circuits layout consiting of CNOTs and RY gates defined as lists of operations and wires they act on with a circuit depth of 8."
16+
},
17+
{
18+
"name": "params_d4",
19+
"pythonType": "list",
20+
"doc": "Circuit parameters as list of RY angles. When plugged in to the circuit layout with a depth of 8, the circuit approximates the flexible representation of quantum images (FRQI)."
21+
},
22+
{
23+
"name": "params_d8",
24+
"pythonType": "list",
25+
"doc": "Circuit parameters as list of RY angles. When plugged in to the circuit layout with a depth of 8, the circuit approximates the flexible representation of quantum images (FRQI)."
26+
},
27+
{
28+
"name": "exact_state",
29+
"pythonType": "list[np.ndarray]",
30+
"doc": "A list of numpy arrays. Each numpy array defines a quantum state that exactly encodes an MNIST image."
31+
},
32+
{
33+
"name": "labels",
34+
"pythonType": "list",
35+
"doc": "A list of the correct labels for each image."
36+
}
37+
]
38+
},
39+
"collection": {
40+
"$path": "/other/low-depth-image-circuits/_meta/collection.json"
41+
},
42+
"data": [
43+
{
44+
"dataUrl": "https://datasets.cloud.pennylane.ai/user/d6ac7296-d1d7-4b39-9e39-fa191b9902ec",
45+
"parameters": {
46+
"name": "low-depth-mnist"
47+
},
48+
"extra": {}
49+
}
50+
],
51+
"downloadName": "low-depth-mnist",
52+
"features": [
53+
{
54+
"slug": "dataset-attributes",
55+
"title": "Dataset Attributes",
56+
"type": "DATA",
57+
"content": {
58+
"$path": "features/dataset-attributes.md"
59+
}
60+
}
61+
],
62+
"meta": {
63+
"$path": "meta.json"
64+
},
65+
"extra": {
66+
"defaultParameters": {
67+
"name": "low-depth-mnist"
68+
}
69+
}
70+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
|Name|Type|Description|
2+
|-|-|-|
3+
|`circuit_layout_d4`|`list`|Circuits layout defined as lists of operations and wires they act on with a circuit depth of 4.|
4+
|`circuit_layout_d8`|`list`|Circuits layout defined as lists of operations and wires they act on with a circuit depth of 8.|
5+
|`params_d4`|`list`|Circuit parameters as list of RY angles. When plugged in to the circuit layout with a depth of 8, the circuit approximates the flexible representation of quantum images (FRQI).|
6+
|`params_d8`|`list`|Circuit parameters as list of RY angles. When plugged in to the circuit layout with a depth of 8, the circuit approximates the flexible representation of quantum images (FRQI).|
7+
|`labels`|`list`|A list of the correct labels for each image.|
8+
|`exact_state`|`list`|A list of numpy arrays. Each numpy array defines an FRQI state that exactly encodes an MNIST image.|
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"abstract": null,
3+
"authors": [
4+
{
5+
"name": "Florian Kiwit",
6+
"username": "flokiwit"
7+
},
8+
{
9+
"name": "Bernhard Jobst"
10+
},
11+
{
12+
"name": "Carlos Riofrío"
13+
}
14+
],
15+
"based_on_papers": true,
16+
"citation": {
17+
"$path": "citation.txt"
18+
},
19+
"changelog": [
20+
"version 0.1 : initial public release"
21+
],
22+
"license": "[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/deed.en)",
23+
"sourceCodeUrl": null,
24+
"tags": [
25+
"Other"
26+
],
27+
"title": "Low-Depth MNIST",
28+
"description": "This dataset contains images from the MINST dataset encoded as quantum states.",
29+
"usingThisDataset": {
30+
"$path": "using_this_dataset.md"
31+
},
32+
"heroImage": "https://assets.cloud.pennylane.ai/datasets/generic/hero/Datasets_GenericHero_2.png",
33+
"thumbnail": "Dataset_MNIST_thumb.png",
34+
"extra": {},
35+
"dateOfLastModification": "2025-03-19",
36+
"dateOfPublication": "2025-03-19"
37+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Data for benchmarking machine learning models, generated for an upcoming paper: *Typical Machine Learning Datasets as Low-Depth Quantum Circuits*.
2+
3+
**Description of the dataset**
4+
5+
The [MNIST dataset](https://ieeexplore.ieee.org/document/6296535) has 28x28 grayscale images of 70,000 hand-drawn digits from 0 to 9, totalling 10 categories, with 7,000 images per category. Here, we provide circuit parameters that approximate the [Flexible Representation of Quantum Images (FRQI)](https://link.springer.com/article/10.1007/s11128-010-0177-y) of each image in the MNIST dataset.
6+
7+
**Additional details**
8+
9+
- The class labels are integers from 0 to 9.
10+
- Implementing the circuits in this dataset and obtaining the final state with PennyLane's `qml.state()` outputs a state vector. This state vector must be processed to recover the original image.
11+
- The dataset contains two circuits per image: those with a depth of four, which are shallower, and those with a depth of eight, which provide more accurate approximations of the exact state.
12+
13+
**Example usage**
14+
15+
```python
16+
import pennylane as qml
17+
import jax
18+
19+
[ds] = qml.data.load("low-depth-mnist")
20+
21+
def get_circuit(circuit_layout):
22+
dev = qml.device("default.qubit", wires=11)
23+
@jax.jit
24+
@qml.qnode(dev)
25+
def circuit(params):
26+
counter = 0
27+
for gate, wire in circuit_layout:
28+
29+
if gate == "RY":
30+
qml.RY(params[counter], wire)
31+
counter += 1
32+
33+
elif gate == "CNOT":
34+
qml.CNOT(wire)
35+
36+
return qml.state()
37+
38+
return circuit
39+
40+
# Example for running the circuit with depth 4
41+
circuit_layout_d4 = dataset_params.circuit_layout_d4
42+
circuit_d4 = get_circuit(circuit_layout_d4)
43+
state_d4 = circuit_d4(dataset_params.params_d4[0])
44+
45+
# Example for running the circuit with depth 8
46+
circuit_layout_d8 = dataset_params.circuit_layout_d8
47+
circuit_d8 = get_circuit(circuit_layout_d8)
48+
state_d8 = circuit_d8(dataset_params.params_d8[0])
49+
```

0 commit comments

Comments
 (0)