You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

The Edges That Vanish β€” Reproducibility Package

Code, raw results and figures accompanying the paper:

The Edges That Vanish: A Reproducible Assessment of Amplitude Permutation, Circuit Cost and Metric Choice in Quantum Hadamard Edge Detection

Every number, table and figure in the paper is produced by the single notebook in this repository. No result is hand-edited.


What this study does

Quantum Hadamard Edge Detection (QHED) encodes an image into the amplitudes of a quantum state and extracts edges with a small number of gates. The construction most often used in the literature applies the Hadamard gate directly to the least significant qubit of the data register β€” and, in doing so, structurally discards half of the neighbouring pixel pairs.

This repository implements both constructions, compares them against four classical operators under a single evaluation protocol, and measures the end-to-end circuit cost, the device-noise sensitivity and the measurement budget that quantum edge detection actually requires.

Finding Value
Improvement from the amplitude-permutation correction (ODS-F1) 0.480 β†’ 0.798 (+66.3%)
Share of two-qubit gate cost from state preparation (N = 1024) 59.0%
Error rate at which edge quality drops more than 15% pβ‚‚ = 0.001
Shots per scan line for near-saturation quality β‰ˆ 16 384

Quick start

Google Colab (recommended)

Upload QHED_Comparative_Study.ipynb and choose Runtime β†’ Run all. No GPU is required. Expected runtime is 18–22 minutes on a standard CPU runtime.

Local

python -m venv .venv && source .venv/bin/activate    # Windows: .venv\Scripts\activate
pip install -r requirements.txt
jupyter lab QHED_Comparative_Study.ipynb             # then run all cells

The final cell writes every artefact to results/ and packages it as qhed_results.zip.


Repository layout

.
β”œβ”€β”€ QHED_Comparative_Study.ipynb   single notebook β€” produces everything
β”œβ”€β”€ requirements.txt               pinned dependency versions
β”œβ”€β”€ LICENSE                        MIT
β”œβ”€β”€ CITATION.cff                   citation metadata
└── results/
    β”œβ”€β”€ figures/                   14 figures (13 from the notebook + the pipeline diagram)
    β”œβ”€β”€ csv/                       13 machine-readable result tables  ← filled by the notebook
    β”œβ”€β”€ latex/                     9 tables as \input-ready LaTeX      ← filled by the notebook
    β”œβ”€β”€ environment.json           interpreter and library fingerprint ← written by the notebook
    β”œβ”€β”€ findings_summary.txt       auto-filled numeric summary          ← written by the notebook
    └── paper_outline.txt          section plan and limitations         ← written by the notebook

The final notebook cell writes every table and text artefact into results/ and packages the folder as qhed_results.zip. See results/README.md.


Mapping from paper to artefacts

Paper Artefact
Table I β€” edge detection quality csv/table1_quality.csv
Table II β€” tolerance sensitivity csv/table2a_tolerance.csv
Table III β€” resolution sensitivity csv/table2b_resolution.csv
Table IV β€” noise robustness csv/table3_noise_FoM.csv
Table V β€” circuit cost scaling csv/table4_scaling.csv
Table VI β€” device noise csv/table5_device_noise.csv
Table VII β€” measurement budget csv/table6_shots.csv
Table VIII β€” ranking stability csv/table8_rank_stability.csv
Table IX β€” targeted hypotheses csv/table9_hypotheses.csv
Figures 2–12 figures/

Figure 1 (the pipeline diagram) is drawn separately and is not produced by the notebook.


Reproducibility

Determinism. All randomness is seeded. The global seed is 42. Noise realisations are seeded per (image, noise type, level) triple.

A note on seeding. An earlier version of this code derived those per-condition seeds from Python's built-in hash(). Python salts string hashing differently in every interpreter process (see PYTHONHASHSEED), so those "seeded" noise realisations were in fact different on every run. The current version uses zlib.crc32, which is stable across processes, platforms and Python versions. If you are adapting this code, do not seed from hash() on strings.

Verification built into the notebook. Before any experiment runs, a unit-test cell compares the circuit output against the analytic neighbour gradient |f_i βˆ’ f_{i+1}|. The largest absolute deviation over N = 8 … 64 is on the order of 10⁻¹⁴, at the limit of double-precision arithmetic. If this assertion fails, the notebook stops.

Environment. The reference run used:

Component Version
Python 3.12.3
Qiskit 2.5.1
Qiskit Aer 0.17.2
NumPy 2.4.4
scikit-image 0.26.0
OpenCV 4.13.0

The notebook re-prints this fingerprint at run time and writes it to results/environment.json.

Expected drift. Quality metrics (Tables I–IV, VI–IX) should reproduce exactly. Circuit depth and gate counts (Table V) depend on the Qiskit transpiler and may shift by a few percent under a different Qiskit minor version; the qualitative conclusion β€” that state preparation dominates the two-qubit gate cost β€” is not affected.


Method in brief

  1. Dataset β€” eight synthetic shapes plus a binary silhouette, generated directly at the target resolution. Ground-truth edges come from a morphological boundary of the binary mask.

    Down-sampling a larger image is deliberately avoided: it fragments the one-pixel-wide ground-truth map and deletes roughly 54% of its edge pixels, which artificially rewards detectors producing fragmented output. The notebook prints this loss figure as a diagnostic.

  2. Encoding β€” QPIE amplitude encoding, c = f / β€–fβ€–, on n = logβ‚‚N qubits.

  3. Circuit β€” full-boundary QHED on n + 1 qubits: H(qβ‚€) β†’ D₍₂^(n+1)β‚Ž β†’ H(qβ‚€), where D is a decrement (amplitude-permutation) gate built from a chain of multi-controlled X gates. Odd-index amplitudes carry the neighbour gradient.

  4. Evaluation β€” Pratt Figure of Merit as the primary metric; F1 at a matching tolerance of ρ = 1 px as secondary, with the tolerance derived from the BSDS scaling rule (0.0075 Γ— image diagonal). Threshold sweep over 33 levels (ODS and OIS protocols).

  5. Statistics β€” Friedman test with Nemenyi critical difference, pairwise Wilcoxon tests with Holm correction, and five pre-specified hypotheses reported with rank-biserial effect sizes.


Runtime breakdown

Stage Approx. time
Setup, unit tests, circuit diagrams 1 min
Experiment 1 β€” edge quality (64 Γ— 64) 1 min
Experiment 2 β€” tolerance and resolution sweeps 3 min
Experiment 3 β€” noise robustness (32 Γ— 32) 5 min
Experiment 4 β€” circuit cost scaling < 1 min
Experiment 5 β€” device noise and shot budget 3 min
Statistics, export, packaging 1 min

The resolution sweep at S = 128 is the single most expensive step. Reduce RES_GRID if you want a faster pass.


Limitations

  • Ground-truth edges are derived from synthetic and silhouette images. No human-annotated benchmark (e.g. BSDS500) was used.
  • Experiments run on classical simulation only; no real quantum hardware.
  • The device-noise model assumes uniform depolarisation. Qubit-specific relaxation, read-out error and cross-talk are not modelled, and state preparation is treated as ideal β€” so the reported degradation is a lower bound.
  • The QHED-full+S variant applies a classical smoothing post-process and is therefore a hybrid pipeline, not a fully quantum algorithm.

Citation

If you use this code, please cite both the paper and this archive. See CITATION.cff for machine-readable metadata.


License

MIT β€” see LICENSE.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support