Moment-based Scale-Invariant Quality metrics for image super-resolution diagnostics
Project description
MSIQ Metrics
msiq-metrics is a compact Python package for Moment-based Scale-Invariant Quality (MSIQ) diagnostics.
MSIQ is not intended as a universal perceptual image-quality metric. It is a complementary, model-free and scale-free diagnostic measure for checking whether an image-processing or super-resolution procedure preserves the global scale-invariant moment geometry of the reference image.
Installation
For local development:
pip install -e .
After publication on PyPI:
pip install msiq-metrics
Basic usage
from skimage import data
from skimage.transform import resize
from msiq import msiq, msiq_report
reference = data.camera() / 255.0
test = resize(reference, (768, 768), preserve_range=True)
score = msiq(reference, test, order=4, channel_mode="gray", distance="rmse")
print(score)
report = msiq_report(reference, test, order=4, channel_mode="gray")
print(report["channel_scores"])
Color protocols
MSIQ can be computed not only on grayscale images but also in several color representations:
msiq(gt, sr, channel_mode="gray")
msiq(gt, sr, channel_mode="rgb")
msiq(gt, sr, channel_mode="y")
msiq(gt, sr, channel_mode="ycbcr")
msiq(gt, sr, channel_mode="hsv")
msiq(gt, sr, channel_mode="hsv_circular")
The hsv_circular mode represents hue using two channels,
[ \cos(2\pi H),\qquad \sin(2\pi H), ]
which avoids the artificial discontinuity of hue at the 0/1 boundary.
Moment matrix
The normalized central geometric moments are represented as a matrix
[ \mathcal{N}N(I)=\bigl(\nu{pq}(I)\bigr)_{0\leq p,q\leq N}. ]
Distances can be computed on the full square region or on the triangular region (p+q\leq N):
msiq(gt, sr, order=6, region="triangular")
msiq(gt, sr, order=6, region="square")
Distances
Supported distances:
msiq(gt, sr, distance="rmse")
msiq(gt, sr, distance="frobenius")
msiq(gt, sr, distance="mae")
msiq(gt, sr, distance="max")
msiq(gt, sr, distance="weighted", weighting="inverse_order")
Protocol comparison
from msiq import compare_protocol
rows = compare_protocol(
gt,
sr,
order=4,
channel_modes=["gray", "y", "rgb", "hsv_circular"],
distances=["rmse", "weighted"],
)
Scale robustness diagnostic
from msiq.diagnostics import scale_robustness_test
rows = scale_robustness_test(
image,
scales=[0.5, 0.75, 1.5, 2.0, 3.0],
order=4,
channel_mode="gray",
)
This diagnostic is useful because normalized moments are exactly scale-invariant in the continuous setting, while every discrete implementation is only an approximation.
Citation
A formal citation will be added after the corresponding paper is published.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file msiq_metrics-0.1.0.tar.gz.
File metadata
- Download URL: msiq_metrics-0.1.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cbbe36d5531825e6a2434ecfb5bb85579c40d142d8b1b5ad7297a4a431d714b
|
|
| MD5 |
ecbaf4ea02d85845cb5a961bcf13fb38
|
|
| BLAKE2b-256 |
37a66923a0144be9411f4313255fa152325c067d30300ff2b444400bc59b02c3
|
File details
Details for the file msiq_metrics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: msiq_metrics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
478140ff8677ed59a241895c55649b66d71b4b616f552e90b21ed879419c4d58
|
|
| MD5 |
21e443bce50e3f244da5d1e007b835dc
|
|
| BLAKE2b-256 |
cbd75f1aa096b96200188b325dd22d9670c2683ba9b5c130b57e63060c026293
|