/Qiskit-Hackathon

Primary LanguageJupyter Notebook

Qiskit-Hackathon

Title

  • Quantum image dataset loading

Description

  • This project converts given image dataset to quantum processable data(qubits) by utilizing PCA for dimensionality reduction and initial states for generating qubits. It can analyze the number of PCA components and produce the transformed qubits of an image dataset for a chosen IBM quantum device or simulator. The variance percentage that is being kept by PCA is also given as feedback to the user.

Link to Issue

Issue 44

Requirements:

You need to have the following installed on your system

Installation

  • Git clone the repo
git clone https://github.com/moswil/Qiskit-Hackathon
  • Change directory to Qiskit-Hackathon, I will refer to this directory as project-root-directory from now
cd Qiskit-Hackathon
  • Run the following command to have project set up
  • Create virtual environment
python -m venv qiskit-env
  • For Linux or Mac Users activate it as below
source qiskit-env/bin/activate
  • For Windows Users, activate it as follows
qiskit-env\\Scripts\\activate.bat
  • Install the project dependencies
pip install -r requirements.txt

Local or Online?

  1. Online
    • If you want to Experiment the IBM Q Experience, you need to create an account on IBM Quantum Computing
    • Then go to settings and copy your token
    • Create a file name as .env in your project-root-directory
    • In the .env file create a key-value pair as shown below
    TOKEN='your-token`
    
    • Replace 'your-token' with the actual account token
    • Just run the code on the next section
  2. Offline / Local
    • Just follow the next section

Update the main.py file

  • Change the DIR variable to the directory that contains your images
  • Then run
python main.py

Output

Original Image (Classical data)

Quantified Image (Quantum Data)

  • bloch

  • circuit

Steps:

  • Image preprocessing
    • Image reading
    • Image resizing (cropping)
    • normalization
    • dimensionality reduction (PCA)
  • Quantum Encoding