Skip to content

Fashion-MNIST, CIFAR-10 and Imagenette #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@misc{kiwit2025efficientdata,
title={Low-Depth MNIST},
author={Florian Kiwit and Bernhard Jobst and Andre Luckow and Frank Pollmann and Carlos Riofrío},
howpublished = {\url{https://pennylane.ai/datasets/low-depth-mnist}}
year={2025}}
70 changes: 70 additions & 0 deletions content/other/low-depth-image-circuits/cifar-10/dataset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"slug": "low-depth-cifar-10",
"class": {
"slug": "low-depth-cifar-10",
"name": "LowDepthCIFAR10",
"attributeList": [
{
"name": "circuit_layout_d4",
"pythonType": "list",
"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."
},
{
"name": "circuit_layout_d8",
"pythonType": "list",
"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."
},
{
"name": "params_d4",
"pythonType": "list",
"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)."
},
{
"name": "params_d8",
"pythonType": "list",
"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)."
},
{
"name": "exact_state",
"pythonType": "list[np.ndarray]",
"doc": "A list of numpy arrays. Each numpy array defines a quantum state that exactly encodes an CIFAR-10 image."
},
{
"name": "labels",
"pythonType": "list",
"doc": "A list of the correct labels for each image."
}
]
},
"collection": {
"$path": "/other/low-depth-image-circuits/_meta/collection.json"
},
"data": [
{
"dataUrl": "https://datasets.cloud.pennylane.ai/user/d9948558-2bea-4c31-99c6-13fa3208ff75",
"parameters": {
"name": "low-depth-cifar-10"
},
"extra": {}
}
],
"downloadName": "low-depth-cifar-10",
"features": [
{
"slug": "dataset-attributes",
"title": "Dataset Attributes",
"type": "DATA",
"content": {
"$path": "features/dataset-attributes.md"
}
}
],
"meta": {
"$path": "meta.json"
},
"extra": {
"defaultParameters": {
"name": "low-depth-cifar-10"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
|Name|Type|Description|
|-|-|-|
|`circuit_layout_d4`|`list`|Circuits layout defined as lists of operations and wires they act on with a circuit depth of 4.|
|`circuit_layout_d8`|`list`|Circuits layout defined as lists of operations and wires they act on with a circuit depth of 8.|
|`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 (MCRQI).|
|`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 (MCRQI).|
|`labels`|`list`|A list of the correct labels for each image.|
|`exact_state`|`list`|A list of numpy arrays. Each numpy array defines an MCRQI state that exactly encodes a CIFAR-10 image.|
43 changes: 43 additions & 0 deletions content/other/low-depth-image-circuits/cifar-10/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"abstract": null,
"authors": [
{
"name": "Florian Kiwit",
"username": "flokiwit"
},
{
"name": "Bernhard Jobst"
},
{
"name": "Andre Luckow"
},
{
"name": "Frank Pollmann"
},
{
"name": "Carlos Riofrío"
}
],
"based_on_papers": true,
"citation": {
"$path": "citation.txt"
},
"changelog": [
"version 0.1 : initial public release"
],
"license": "[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/deed.en)",
"sourceCodeUrl": null,
"tags": [
"Other"
],
"title": "Low-Depth CIFAR-10",
"description": "This dataset contains images from the CIFAR-10 dataset encoded as quantum states.",
"usingThisDataset": {
"$path": "using_this_dataset.md"
},
"heroImage": "https://assets.cloud.pennylane.ai/datasets/generic/hero/Datasets_GenericHero_2.png",
"thumbnail": "Dataset_CIFAR10_thumb.png",
"extra": {},
"dateOfLastModification": "2025-04-23",
"dateOfPublication": "2025-04-23"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Data for benchmarking machine learning models, generated for an upcoming paper: *Typical Machine Learning Datasets as Low-Depth Quantum Circuits*.

**Description of the dataset**

The [CIFAR-10 dataset](https://www.cs.toronto.edu/~kriz/learning-features-2009-TR.pdf) contains 60,000 32×32 color images across 10 categories (e.g., airplanes, cars, birds, and cats), with 6,000 images per category. Here, we provide circuit parameters that approximate the [Multi-Channel Representation of Quantum Images (MCRQI)](https://ieeexplore.ieee.org/document/6051718) of each image in the CIFAR-10 dataset.

**Additional details**

- The class labels are integers from 0 to 9.
- 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.
- 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.
- The `exact_state` entry contains a list of numpy arrays representing MCRQI states that exactly encode Imagenette images. This significantly increases the file size and can be omitted during download if not needed.

**Example usage**

```python
import pennylane as qml
import jax

[dataset_params] = qml.data.load("low-depth-cifar-10")

def get_circuit(circuit_layout):
dev = qml.device("default.qubit", wires=13)
@jax.jit
@qml.qnode(dev)
def circuit(params):
counter = 0
for gate, wire in circuit_layout:

if gate == "RY":
qml.RY(params[counter], wire)
counter += 1

elif gate == "CNOT":
qml.CNOT(wire)

return qml.state()

return circuit

# Example for running the circuit with depth 4
circuit_layout_d4 = dataset_params.circuit_layout_d4
circuit_d4 = get_circuit(circuit_layout_d4)
state_d4 = circuit_d4(dataset_params.params_d4[0])

# Example for running the circuit with depth 8
circuit_layout_d8 = dataset_params.circuit_layout_d8
circuit_d8 = get_circuit(circuit_layout_d8)
state_d8 = circuit_d8(dataset_params.params_d8[0])
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@misc{kiwit2025efficientdata,
title={Low-Depth MNIST},
author={Florian Kiwit and Bernhard Jobst and Andre Luckow and Frank Pollmann and Carlos Riofrío},
howpublished = {\url{https://pennylane.ai/datasets/low-depth-mnist}}
year={2025}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"slug": "low-depth-fashion-mnist",
"class": {
"slug": "low-depth-fashion-mnist",
"name": "LowDepthFashionMNIST",
"attributeList": [
{
"name": "circuit_layout_d4",
"pythonType": "list",
"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."
},
{
"name": "circuit_layout_d8",
"pythonType": "list",
"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."
},
{
"name": "params_d4",
"pythonType": "list",
"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)."
},
{
"name": "params_d8",
"pythonType": "list",
"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)."
},
{
"name": "exact_state",
"pythonType": "list[np.ndarray]",
"doc": "A list of numpy arrays. Each numpy array defines a quantum state that exactly encodes an Fashion-MNIST image."
},
{
"name": "labels",
"pythonType": "list",
"doc": "A list of the correct labels for each image."
}
]
},
"collection": {
"$path": "/other/low-depth-image-circuits/_meta/collection.json"
},
"data": [
{
"dataUrl": "https://datasets.cloud.pennylane.ai/user/54d8b630-61c9-4e32-a0a5-2aceac9b278f",
"parameters": {
"name": "low-depth-fashion-mnist"
},
"extra": {}
}
],
"downloadName": "low-depth-fashion-mnist",
"features": [
{
"slug": "dataset-attributes",
"title": "Dataset Attributes",
"type": "DATA",
"content": {
"$path": "features/dataset-attributes.md"
}
}
],
"meta": {
"$path": "meta.json"
},
"extra": {
"defaultParameters": {
"name": "low-depth-fashion-mnist"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
|Name|Type|Description|
|-|-|-|
|`circuit_layout_d4`|`list`|Circuits layout defined as lists of operations and wires they act on with a circuit depth of 4.|
|`circuit_layout_d8`|`list`|Circuits layout defined as lists of operations and wires they act on with a circuit depth of 8.|
|`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).|
|`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).|
|`labels`|`list`|A list of the correct labels for each image.|
|`exact_state`|`list`|A list of numpy arrays. Each numpy array defines an FRQI state that exactly encodes a Fashion-MNIST image.|
43 changes: 43 additions & 0 deletions content/other/low-depth-image-circuits/fashion-mnist/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"abstract": null,
"authors": [
{
"name": "Florian Kiwit",
"username": "flokiwit"
},
{
"name": "Bernhard Jobst"
},
{
"name": "Andre Luckow"
},
{
"name": "Frank Pollmann"
},
{
"name": "Carlos Riofrío"
}
],
"based_on_papers": true,
"citation": {
"$path": "citation.txt"
},
"changelog": [
"version 0.1 : initial public release"
],
"license": "[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/deed.en)",
"sourceCodeUrl": null,
"tags": [
"Other"
],
"title": "Low-Depth Fashion-MNIST",
"description": "This dataset contains images from the Fashion-MNIST dataset encoded as quantum states.",
"usingThisDataset": {
"$path": "using_this_dataset.md"
},
"heroImage": "https://assets.cloud.pennylane.ai/datasets/generic/hero/Datasets_GenericHero_2.png",
"thumbnail": "Dataset_FashionMNIST_thumb.png",
"extra": {},
"dateOfLastModification": "2025-04-23",
"dateOfPublication": "2025-04-23"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Data for benchmarking machine learning models, generated for an upcoming paper: *Typical Machine Learning Datasets as Low-Depth Quantum Circuits*.

**Description of the dataset**

The [Fashion-MNIST dataset](https://arxiv.org/abs/1708.07747) has 28x28 grayscale images of 70,000 fashion items across 10 categories (e.g., T-shirts, trousers, shoes), 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 Fashion-MNIST dataset.

**Additional details**

- The class labels are integers from 0 to 9.
- 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.
- 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.
- The `exact_state` entry contains a list of numpy arrays representing FRQI states that exactly encode Imagenette images. This significantly increases the file size and can be omitted during download if not needed.

**Example usage**

```python
import pennylane as qml
import jax

[dataset_params] = qml.data.load("low-depth-fashion-mnist")

def get_circuit(circuit_layout):
dev = qml.device("default.qubit", wires=11)
@jax.jit
@qml.qnode(dev)
def circuit(params):
counter = 0
for gate, wire in circuit_layout:

if gate == "RY":
qml.RY(params[counter], wire)
counter += 1

elif gate == "CNOT":
qml.CNOT(wire)

return qml.state()

return circuit

# Example for running the circuit with depth 4
circuit_layout_d4 = dataset_params.circuit_layout_d4
circuit_d4 = get_circuit(circuit_layout_d4)
state_d4 = circuit_d4(dataset_params.params_d4[0])

# Example for running the circuit with depth 8
circuit_layout_d8 = dataset_params.circuit_layout_d8
circuit_d8 = get_circuit(circuit_layout_d8)
state_d8 = circuit_d8(dataset_params.params_d8[0])
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@misc{kiwit2025efficientdata,
title={Low-Depth MNIST},
author={Florian Kiwit and Bernhard Jobst and Andre Luckow and Frank Pollmann and Carlos Riofrío},
howpublished = {\url{https://pennylane.ai/datasets/low-depth-mnist}}
year={2025}}
Loading