This repository presents an innovative approach to integrating a Haar-Quanvolutional Neural Network with the Oral Cancer dataset, leveraging the PyTorch-Quantum Library for its implementation.
.
├── data
├── Images
├── hcnn.py
├── hcnn_cross_fold.py
├── LICENSE
├── kernel.py
├── labels.csv
├── requirements.txt
├── results.yml
├── README.md
The Oral Cancer dataset is essential for this project and needs to be downloaded separately from: A histopathological image repository of normal epithelium of Oral Cavity and Oral Squamous Cell Carcinoma.
First, clone the repository:
git clone https://github.com/Next-di-mension/qnn-qhw.git && cd qnn-qhw
Due to specific version requirements for the PyTorch-Quantum
module, it's recommended to create a new virtual environment:
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
- Use
hcnn.py
for the PyTorch implementation to train and test the model. - Use
hcnn_cross_fold.py
for the TensorFlow implementation. - Before training, specify the path to the
labels.csv
file which contains labels for the train and test data.
The proposed model is a hybrid, consisting of a quanvolutional filter and classical layer sections. The quanvolutional filter uses random quantum circuits, similar to convolutional filters in classical neural networks, for local data transformation and feature extraction.
The quantum Haar wavelet (QHW) is a state localized in both time and energy domains, suitable for analyzing quantum states at various energy scales. The QHWT decomposes a quantum state into coefficients, revealing its energy distribution. The effective description of QHWT in quantum circuits involves Hadamard gates and a permutation matrix
Sample convolutions generated from the model are shown below: