-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bb55dec
Showing
69 changed files
with
8,909 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 93c38a4049d0bbd55fbf3da93109d298 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Getting Started | ||
================ | ||
|
||
Setup | ||
----- | ||
|
||
Begin by creating a new Python environment or activating an existing one for working with the `piQture` library. You set up a Python virtual environment `venv` or a Conda environment and use `pip` or `conda` to install the `piQture` package. | ||
|
||
Here's how you can create a conda environment and manage a Python environment: | ||
|
||
.. code:: sh | ||
# Create a new conda environment | ||
conda create -n piqture_env python=3.x | ||
# Activate the conda environment | ||
conda activate piqture_env | ||
Installation | ||
------------ | ||
|
||
Once the Python environment is activated, the required `piQture` package can be installed using `pip`. You can install the latest version directly from PyPI. | ||
|
||
.. code:: sh | ||
pip install piqture | ||
To create a development environment, and install `piQture` from source, you can refer to section :ref:`Install from Source <installation_from_source>`. | ||
|
||
.. _installation_from_source: | ||
|
||
Installation from Source | ||
------------------------ | ||
|
||
To set up a development environment and install `piQture` from source, follow these steps: | ||
|
||
1. Start by cloning the `piQture` repository from GitHub. | ||
|
||
.. code:: sh | ||
# Clone the GitHub repository. | ||
git clone https://github.com/SaashaJoshi/piQture.git | ||
2. Activate the Python environment and navigate to the `piQture` repository directory. Then, inside the Python environment, install the required dependencies from the `requirements.txt` configuration file. | ||
|
||
.. code:: sh | ||
# Install the required dependencies | ||
pip install -r requirements.txt | ||
3. Install `piQture` in editable mode to make changes to the source code. | ||
|
||
.. code:: sh | ||
# Install from source in editable mode | ||
pip install -e . | ||
Your development environment is set up, and `piQture` is installed from source. You can now start making changes to the code, running tests, and contributing to the project as a developer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. piQture documentation master file, created by | ||
sphinx-quickstart on Wed Apr 24 19:35:42 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to piQture's documentation! | ||
=================================== | ||
|
||
**piQture** is a Python and Qiskit-based toolkit designed to simplify the development, execution, and training of Quantum Machine Learning (QML) models tailored for image processing tasks. This library seamlessly integrates with the Qiskit SDK, providing a convenient and user-friendly workflow for leveraging the potential of quantum computing for advanced image processing. | ||
|
||
|
||
Contribution Guidelines | ||
----------------------- | ||
|
||
We welcome contributions! Whether you're a quantum enthusiast or a Python developer, your input is valuable. Check out our Contribution Guidelines to get started. | ||
|
||
Authors and Citation | ||
-------------------- | ||
|
||
Saasha Joshi | ||
|
||
Table of Contents | ||
------------------ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
getting_started | ||
modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
piqture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
Data Loader | ||
============================ | ||
|
||
`piqture.data_loader.mnist_data_loader` module | ||
----------------------------------------------- | ||
|
||
This module provides a `load_mnist_dataset` function that simplifies loading the MNIST dataset for machine learning and deep learning experiments. It supports custom batch sizes, label selection, image resizing, and normalization options. | ||
|
||
.. automodule:: piqture.data_loader.mnist_data_loader | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Overview | ||
-------- | ||
|
||
The `load_mnist_dataset` function in this module is designed to streamline the process of loading and preparing the MNIST dataset for image-based machine learning models, especially those involving quantum machine learning or custom image processing workflows. | ||
|
||
Features | ||
-------- | ||
|
||
- Supports custom image resizing to specified dimensions. | ||
- Optionally filters specific labels from the MNIST dataset. | ||
- Integrates custom normalization using `MinMaxNormalization`. | ||
- Provides separate training and testing DataLoaders. | ||
|
||
.. note:: | ||
|
||
Make sure that the `torch` and `torchvision` libraries are installed, as these are used internally for dataset handling and transformations. | ||
|
||
Function Documentation | ||
---------------------- | ||
|
||
**`load_mnist_dataset`** | ||
|
||
.. autofunction:: piqture.data_loader.mnist_data_loader.load_mnist_dataset | ||
|
||
Usage Example | ||
------------- | ||
|
||
Here's an example of how to use the `load_mnist_dataset` function to load the MNIST dataset and apply custom configurations: | ||
|
||
.. code-block:: python | ||
from piqture.data_loader import mnist_data_loader | ||
# Load MNIST dataset with custom configurations | ||
train_loader, test_loader = mnist_data_loader.load_mnist_dataset( | ||
img_size=(32, 32), # Resize images to 32x32 | ||
batch_size=64, # Set batch size to 64 | ||
labels=[0, 1, 2], # Include only labels 0, 1, and 2 | ||
normalize_min=0.0, # Normalize minimum value to 0.0 | ||
normalize_max=1.0 # Normalize maximum value to 1.0 | ||
) | ||
# Print some batch information | ||
for images, labels in train_loader: | ||
print(f"Batch image shape: {images.shape}") | ||
print(f"Batch labels: {labels}") | ||
break | ||
Parameters | ||
---------- | ||
|
||
- **`img_size`** (*int* or *tuple[int, int]*, optional): | ||
- Size to which MNIST images will be resized. | ||
- If an integer, images will be resized to a square of that size. | ||
- If a tuple, it should specify `(height, width)` for the images. | ||
- **Default:** `28` (images are resized to 28x28 pixels). | ||
|
||
- **`batch_size`** (*int*, optional): | ||
- Specifies the number of samples per batch for training and testing DataLoaders. | ||
- If not specified, the batch size defaults to `1`. | ||
|
||
- **`labels`** (*list[int]*, optional): | ||
- A list of integers representing the labels to include in the dataset. | ||
- For example, setting `labels=[0, 1]` will include images of digits 0 and 1 only. | ||
|
||
- **`normalize_min`** (*float*, optional): | ||
- Minimum value for pixel normalization. | ||
- **Default:** `None` (no normalization). | ||
|
||
- **`normalize_max`** (*float*, optional): | ||
- Maximum value for pixel normalization. | ||
- **Default:** `None` (no normalization). | ||
|
||
Returns | ||
------- | ||
|
||
- **`Tuple[torch.utils.data.DataLoader, torch.utils.data.DataLoader]`**: | ||
- A tuple containing: | ||
- **Training DataLoader**: A PyTorch DataLoader for training data. | ||
- **Testing DataLoader**: A PyTorch DataLoader for testing data. | ||
|
||
Related Functions and Classes | ||
----------------------------- | ||
|
||
**`collate_fn`** | ||
|
||
The `collate_fn` function is used to filter and organize batches based on the specified `labels`. It only includes images that match the desired labels. | ||
|
||
.. autofunction:: piqture.data_loader.mnist_data_loader.collate_fn | ||
|
||
Dependencies | ||
------------ | ||
|
||
- **torch**: Required for creating PyTorch DataLoaders. | ||
- **torchvision**: Required for dataset loading and transformations. | ||
- **piqture.transforms.MinMaxNormalization**: Custom normalization transform available in the `piqture.transforms` module. | ||
|
||
Handling Edge Cases | ||
------------------- | ||
|
||
The function performs type checking and validation to ensure that the input parameters are valid: | ||
|
||
- **`img_size`**: Raises a `TypeError` if the value is not of type `int` or `tuple[int, int]`. | ||
- **`batch_size`**: Raises a `TypeError` if the value is not an integer. | ||
- **`labels`**: Raises a `TypeError` if the value is not a list. | ||
|
||
Refer to the `source code <https://github.com/SaashaJoshi/piqture>`_ for additional implementation details and advanced configurations. | ||
|
||
.. seealso:: | ||
|
||
- `torchvision.datasets.MNIST <https://pytorch.org/vision/stable/datasets.html#mnist>`_ | ||
- `piqture.transforms.MinMaxNormalization <https://piqture.readthedocs.io/en/latest/transforms.html#piqture.transforms.MinMaxNormalization>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Image Embeddings | ||
============================================ | ||
|
||
piqture.embeddings.image\_embeddings.frqi module | ||
------------------------------------------------ | ||
|
||
.. automodule:: piqture.embeddings.image_embeddings.frqi | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.embeddings.image\_embeddings.ineqr module | ||
------------------------------------------------- | ||
|
||
.. automodule:: piqture.embeddings.image_embeddings.ineqr | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.embeddings.image\_embeddings.mcrqi module | ||
------------------------------------------------- | ||
|
||
.. automodule:: piqture.embeddings.image_embeddings.mcrqi | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.embeddings.image\_embeddings.neqr module | ||
------------------------------------------------ | ||
|
||
.. automodule:: piqture.embeddings.image_embeddings.neqr | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Embeddings | ||
========================== | ||
|
||
Submodules | ||
----------- | ||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
piqture.embeddings.image_embeddings | ||
|
||
piqture.embeddings.amplitude\_encoder module | ||
-------------------------------------------- | ||
|
||
.. automodule:: piqture.embeddings.amplitude_encoder | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.embeddings.angle\_encoding module | ||
----------------------------------------- | ||
|
||
.. automodule:: piqture.embeddings.angle_encoding | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
piqture.embeddings.image\_embedding module | ||
------------------------------------------ | ||
|
||
.. automodule:: piqture.embeddings.image_embedding | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Gates | ||
===================== | ||
|
||
piqture.gates.two\_qubit\_unitary module | ||
---------------------------------------- | ||
|
||
.. automodule:: piqture.gates.two_qubit_unitary | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.gates.unitary\_block module | ||
----------------------------------- | ||
|
||
.. automodule:: piqture.gates.unitary_block | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Mixin | ||
===================== | ||
|
||
piqture.mixin.image\_embedding\_mixin module | ||
-------------------------------------------- | ||
|
||
.. automodule:: piqture.mixin.image_embedding_mixin | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Neural Network Layers | ||
======================================= | ||
|
||
piqture.neural\_networks.layers.base\_layer module | ||
-------------------------------------------------- | ||
|
||
.. automodule:: piqture.neural_networks.layers.base_layer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.neural\_networks.layers.convolutional\_layer module | ||
----------------------------------------------------------- | ||
|
||
.. automodule:: piqture.neural_networks.layers.convolutional_layer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.neural\_networks.layers.fully\_connected\_layer module | ||
-------------------------------------------------------------- | ||
|
||
.. automodule:: piqture.neural_networks.layers.fully_connected_layer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.neural\_networks.layers.pooling\_layer module | ||
----------------------------------------------------- | ||
|
||
.. automodule:: piqture.neural_networks.layers.pooling_layer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Neural Networks | ||
================================ | ||
|
||
|
||
Submodules | ||
----------- | ||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
piqture.neural_networks.layers | ||
|
||
piqture.neural\_networks.qcnn module | ||
------------------------------------ | ||
|
||
.. automodule:: piqture.neural_networks.qcnn | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.neural\_networks.quantum\_autoencoder module | ||
---------------------------------------------------- | ||
|
||
.. automodule:: piqture.neural_networks.quantum_autoencoder | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
piqture.neural\_networks.quantum\_neural\_network module | ||
-------------------------------------------------------- | ||
|
||
.. automodule:: piqture.neural_networks.quantum_neural_network | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
Oops, something went wrong.