Development of a quantum convolutional neural network for image classification. This code specializes in binary classification. Different convolution and embedding methods will be used for testing.
Use python main.py to run the benchmark.
-
data.py- Prepares a dataset. Currently, it transforms the 28x28 px image to a 16x16 px image in order to fit it into 8 qubits. Therefore, it returns the data in 1-D arrays.
- The function
data_load_and_processloads the dataset, normalizes the images, resizes them, and adjusts the labels for binary classification. - The dataset is filtered in the way of having just two possible classes in the dataset, this is done to simplify the model.
-
embedding.py- Contains functions for embedding classical data into quantum states.
- The
data_embeddingfunction takes the preprocessed data and embeds it into a quantum state using amplitude encoding.
-
QCNN_circuit.py- Defines the quantum convolutional neural network (QCNN) circuit. This file contains the overall architecture of the QCNN.
- The
qcnnfunction constructs the QCNN circuit and returns the output probabilities.
-
components.py- Defines unitary operations and layers used in the QCNN. .
-
training.py- Contains the training loop for the QCNN. This file includes functions to train the QCNN using a specified dataset. Corrently used "mse"
- The
circuit_trainingfunction trains the QCNN using the Adam optimizer and returns the loss history and trained parameters.
-
utils.py- Contains smaller functions used in the code.
-
Quantum Convolutional Neural Networks
Henderson et al.
arXiv:2108.00661
Original paper inspiring this implementation -
PennyLane Quantum Machine Learning
Xanadu AI
PennyLane Documentation
Quantum framework used for circuit construction -
MNIST Dataset
Yann LeCun et al.
Official MNIST Website
Standard handwritten digit dataset -
Fashion-MNIST Dataset
Zalando Research
GitHub Repository
Clothing item classification dataset -
Quantum Computation and Quantum Information
Michael A. Nielsen & Isaac L. Chuang
Cambridge University Press (2010)
The standard textbook on quantum computing fundamentals
ISBN: 978-1-107-00217-3