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.
Metadata
Release files for msiq-metrics 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msiq_metrics-0.1.0.tar.gz | 12.3 kB | Without provenance | Details for msiq_metrics-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msiq_metrics-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for msiq_metrics-0.1.0-py3-none-any.whl |
Total release size: 24.9 kB
Release files / msiq_metrics-0.1.0.tar.gz
| Download URL | msiq_metrics-0.1.0.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cbbe36d5531825e6a2434ecfb5bb85579c40d142d8b1b5ad7297a4a431d714b
|
|
BLAKE2b-256 checksum How to use checksums |
37a66923a0144be9411f4313255fa152325c067d30300ff2b444400bc59b02c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.1
|
Release files / msiq_metrics-0.1.0-py3-none-any.whl
| Download URL | msiq_metrics-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
478140ff8677ed59a241895c55649b66d71b4b616f552e90b21ed879419c4d58
|
|
BLAKE2b-256 checksum How to use checksums |
cbd75f1aa096b96200188b325dd22d9670c2683ba9b5c130b57e63060c026293
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.1
|
Security for msiq-metrics 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.