Skip to main content

Multi-scale Hierarchical Representation of Quantum Images

Project description

MHRQI: Multi-scale Hierarchical Representation of Quantum Images

PyPI CI License

MHRQI is a Python-based framework for representing images using hierarchical quantum circuits. It provides a multi-scale quad-tree decomposition to improve the robustness and efficiency of quantum image representations.


🚀 Key Features

  • MHRQI Core: A robust Object-Oriented framework for hierarchical quantum image encoding.

  • MHRQIResult: A powerful results object for automated decoding, reconstruction, and metric calculation.

  • Multi-scale Encoding: Maps image data to quantum states using a hierarchical qudit structure.

  • Denoising Application: A functional extension for quantum denoising based on sibling smoothing and hierarchical consistency.

  • Standardized Benchmarks: Built-in BenchmarkSuite for comparison against classical denoisers (BM3D, NL-Means, SRAD).

  • Medical Specialization: optimized and tested on medical imaging datasets (e.g., OCT scans).

🛠️ Installation

# Clone the repository
git clone https://github.com/Keno-00/MHRQI.git
cd MHRQI

# Install dependencies and package in editable mode
pip install -e .

💻 Usage

Command Line Interface

MHRQI provides a comprehensive CLI for running the denoising pipeline.

# Run denoising with default settings
mhrqi --denoise

# Specify image size and number of shots
mhrqi --size 16 --shots 100000 --denoise

# Use a specific input image
mhrqi --img resources/drusen1.jpeg --denoise

Use mhrqi --help to see all available options.

Python API (Library Usage)

You can use MHRQI as a dependency in your own projects (e.g., a "Quantum Vision Suite").

import cv2
import numpy as np
from mhrqi import MHRQI
from mhrqi.utils import general as utils

# 1. Prepare image
img = cv2.imread("image.jpg", cv2.GRAYSCALE)
img_resized = cv2.resize(img, (16, 16))
img_normalized = img_resized.astype(np.float64) / 255.0

# 2. Initialize MHRQI model
depth = 4 # for 16x16 image (log2(16))
model = MHRQI(depth=depth)

# 3. Generate hierarchical coordinate matrix and upload data
hierarchical_coord_matrix = utils.generate_hierarchical_coord_matrix(16, 2)
model.upload(hierarchical_coord_matrix, img_normalized)

# 4. Apply denoising (optional)
model.apply_denoising()

# 5. Simulate
result = model.simulate(shots=10000)

# 6. Reconstruct image using the powerful Result object
img_recon = result.reconstruct()

# 7. Compute quality metrics (MSE, SSIM, NIQE, etc.)
metrics = result.compute_metrics(reference_image=img_normalized)
print(f"Metrics: {metrics}")

# 8. Plot the result
result.plot(title="Denoised OCT Scan")

📂 Project Structure

MHRQI/
├── mhrqi/                  # Main package
│   ├── core/               # Quantum circuit implementations
│   ├── utils/              # General & visualization utilities
│   ├── benchmarks/         # Scaling and comparison suites
│   └── cli/                # Command-line interface logic
├── docs/                   # Documentation source (MkDocs)
├── tests/                  # Unit and integration tests
├── pyproject.toml          # Project metadata and configuration
└── .github/                # CI/CD workflows and templates

📚 Documentation

For detailed guides and API documentation, see the docs/ folder or visit the documentation site:

pip install -e .[docs]
mkdocs serve

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for setup instructions and development workflows.

📝 Citation

If you use this work in your research, please cite:

TODO: add here preprint or citation when paper has been published

📄 License

This project is licensed under the Apache License 2.0 - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mhrqi-0.1.3.dev0.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mhrqi-0.1.3.dev0-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

Details for the file mhrqi-0.1.3.dev0.tar.gz.

File metadata

  • Download URL: mhrqi-0.1.3.dev0.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mhrqi-0.1.3.dev0.tar.gz
Algorithm Hash digest
SHA256 77ce10cd1a738872db78ba90f5a1a2c93677328ce64bbb9b199f4ca8f6abd837
MD5 dc647132ad55a1815f606bd9b0535a4c
BLAKE2b-256 cee7a537fce1f9af045286ea06354310e1447496ee64e4df1fb12aafbbf84ee3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mhrqi-0.1.3.dev0.tar.gz:

Publisher: publish.yml on Keno-00/MHRQI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mhrqi-0.1.3.dev0-py3-none-any.whl.

File metadata

  • Download URL: mhrqi-0.1.3.dev0-py3-none-any.whl
  • Upload date:
  • Size: 45.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mhrqi-0.1.3.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 1edfbfc37c24fe9d128109cca0b0caa5f88bf2f6f2b4d3bedd0422b0e385eca9
MD5 d1362e50f8c192b019058adf699927f4
BLAKE2b-256 97a93784f0ca46201895f2d56b11fa1e4e77ff2fb2e1a6a637ef28f37d93ac15

See more details on using hashes here.

Provenance

The following attestation bundles were made for mhrqi-0.1.3.dev0-py3-none-any.whl:

Publisher: publish.yml on Keno-00/MHRQI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page