QualiSR-Lab: Reduced-Reference IQA for SR
Oleg Ryabinin1,2 | Evgeney Bogatyrev1,2,3 | Khaled Abud1,2,3 | Dmitriy Vatolin1,2,3
1Lomonosov Moscow State University, 119991, Moscow, Russia
2AI Center, Lomonosov Moscow State University
3MSU Institute for Artificial Intelligence, Lomonosov Moscow State University
Overview
This project studies which features extracted from Low-Resolution (LR) and Super-Resolution (SR) images are most informative for Image Quality Assessment (IQA). Its purpose is to assist researchers in studying the best features for their upscaled image quality metrics by providing a pipeline to extract the features and build a comprehensive graphical summary on their contribution to IQA and correlation of the resulting metric with human scores.
The proposed pipeline is:
-
Prepare labels and features
Compute image features and attach normalized quality labels. -
Train regressors
Fit regression models on the resulting tabular data to obtain a simple Reduced-Reference (RR) quality metric. -
Analyze feature importance and correlation
Evaluate feature importance and compute PLCC/SRCC to identify the most informative features for SR quality assessment.
The sections below describe the required data format and the workflow.
Installation and quickstart
Python 3.12 or 3.13 is required. From the repository root:
python -m pip install -c requirements.txt -e ".[regressors]"
qualisr-run-regressors
This runs Random Forest, XGBoost, and CatBoost on the packaged labels and precomputed features for 120 SR images. No image download is needed. Results and plots are written to plots/baseline@pca5/; add --no-plots to skip plotting.
For image feature extraction, install the additional dependencies:
python -m pip install -c requirements.txt -e ".[features,regressors]"
For the latest published version on PyPI:
python -m pip install "qualisr-lab[features,regressors]"
The Docker image includes regression dependencies and runs the bundled example without plots:
docker build -t qualisr-lab:0.3.0 .
mkdir -p plots
docker run --rm --mount type=bind,source="${PWD}/plots",target=/app/plots qualisr-lab:0.3.0
Create the local plots/ directory first if needed. The mount preserves results after the container exits. For an interactive shell, append bash and add -it to docker run.
Docker applies requirements.txt as constraints, including transitive dependencies. To build the complete pinned Linux/CUDA environment instead, use docker build --build-arg QUALISR_EXTRAS=all -t qualisr-lab:0.3.0-all .. The full environment is large and includes NVIDIA libraries; GPU execution also requires the container runtime's GPU support.
For the complete pinned environment locally, including notebook and development dependencies:
python -m pip install -r requirements.txt -e .
# Alternatively, from PyPI:
python -m pip install "qualisr-lab[all]"
# Or with Conda from the repository root:
conda env create -f environment.yml
The notebook extra provides IPython and an IPython kernel; the dev extra provides
pytest and Ruff. LightGBM and the separate shap package are optional integrations
outside the pinned environment; install them separately if needed. XGBoost's native
SHAP computation remains available with the regressors extra.
See dataset/readme.md for dataset download notes and the parser/sample interface for custom datasets.
Run with image datasets
Download QualiSR-Set120, then run commands from the repository root. The unified runner loads the configured datasets once and uses consistent sample IDs across feature extraction, artifact statistics, and regression.
Before running the full pipeline, edit configs/pipeline.json:
- Set each dataset's
rootandfeatures_root. - Select the feature groups and metrics needed for the experiment. Reference embeddings, generic timm embeddings, and embedding differences are disabled by default.
qualisr-run-pipeline --config configs/pipeline.json
The runner does not download datasets or generate artifact masks. It writes feature CSVs under features/, PCA outputs under features/pca/, and regression outputs under plots/ with the default paths. The default regressor inputs are NR metrics without Q-Align, RLFN-based FR metrics, and VGG/ResNet PCA-5 features.
Run individual stages with the same configuration:
qualisr-run-pipeline --config configs/pipeline.json --only-section references
qualisr-run-pipeline --config configs/pipeline.json --only-section features
qualisr-run-pipeline --config configs/pipeline.json --only-section pca statistics
qualisr-run-regressors --config configs/pipeline.json
An explicit dataset configuration requires the LR/SR image files. Omit --config for the image-free bundled example. For custom parsers, dataset roles, and path rules, see the dataset guide. For feature-family comparisons, transfer and grouped evaluation, see the paper experiment guide.
Python API
Run the bundled experiment without plots:
from qualisr import run_regressor_experiment
result = run_regressor_experiment(make_plots=False)
print(result["results"])
Run the regression stage of a configured image dataset:
from qualisr import run_pipeline
run_pipeline(
config_path="configs/pipeline.json",
only_section=["regressors"],
no_plots=True,
)
Reproduce the QualiSR-Set120 example
From the checkout with the regression dependencies installed:
bash reproduce_pipeline.sh cached --no-plots
Running the script without arguments also uses the precomputed QualiSR-Set120 features. The default output is reproduction/cached/baseline@pca5/. Pass --plots-root or set PLOTS_DIR to choose a fresh destination. This single grouped holdout uses the released QualiSR-Set120 labels and the five small CSVs bundled in the wheel.
To download the image dataset, or to recompute features from images:
bash reproduce_pipeline.sh download
python -m pip install -c requirements.txt -e ".[features,regressors]"
PLOTS_DIR=/path/to/new/qualisr-set120-run bash reproduce_pipeline.sh images
Both modes reuse an existing dataset. The default download is the paper's Hugging Face snapshot. Set DATASET_DIR for another destination. Use DATASET_SOURCE=gdrive with gdown and unzip installed, or set DATASET_ARCHIVE=/path/to/QualiSR-Set120.zip for a local archive. Use DATASET_SOURCE=skip for an existing image tree. The image workflow uses the released references and heatmaps. Set RUN_REFERENCE=1 to generate references with the repository inference scripts. DEVICE, FEATURE_GROUPS, PCA_COMPONENTS, FEATURES_DIR, PROFILE, PROFILE_FLOPS, and SAVE_SVG select image-run settings. The recorded configuration and, by default, newly computed features are under PLOTS_DIR. Use a fresh directory for each run.
The images workflow launches references, feature extraction, PCA, embedding differences, artifact statistics, and regression as separate commands, in that order. All stages use the recorded reproduce_pipeline_config.json and respect its enabled sections. To rerun one stage, pass that config to qualisr-run-pipeline --config /path/to/run/reproduce_pipeline_config.json --only-section pca (replace pca with the required section).
For a grouped QualiSR-Set120 experiment with the eight raw feature CSVs in the checkout, use the following command. It downloads or reuses the images for the source identity audit and fits PCA from the training rows. This example evaluates two fixed feature pools on one fold. Omit the model, fold and preset filters to run the full grouped matrix on QualiSR-Set120 alone.
bash reproduce_pipeline.sh set120 --output /path/to/new/qualisr-set120-fold \
--split-seeds 42 --fold-limit 1 --models randomforest \
--experiments nr,nr_ref --skip-tuning --skip-selection
To run the grouped comparisons on all four datasets, point QUALISR_DATA_ROOT
at the prepared images and feature CSVs. The evaluation section of
configs/paper.json sets the folds, seeds, regressors and PCA dimensions.
The experiment guide lists the required inputs and follow-on analyses.
QUALISR_DATA_ROOT=/path/to/datasets/iqa bash reproduce_pipeline.sh paper --output /path/to/new/grouped
Workflow
You may either launch the whole pipeline in a single command with your JSON config as in the previous section or do each step separately. The unified pipeline parses the configured datasets entries into one shared sample list; datasets may use a bundled parser, a parser function from a user Python file, or explicit labels/image directories. Multiple entries are combined in one run. See dataset/readme.md for the complete contract.
The standalone commands below retain their directory-based arguments for focused use outside the unified pipeline.
Step 0 (optional): Prepare reference images
Produce RLFN / SPAN / bicubic images for LR + SR pairs (used to compute FR metrics). The bundled realtime_sr/ directory is a clone-only convenience asset; pip installs do not include these scripts/checkpoints, so pass your own paths for RLFN/SPAN when running outside the repository.
qualisr-make-reference \
--lr-dir dataset/lr \
--sr-dirs PASD=dataset/sr/PASD SUPIR=dataset/sr/SUPIR RealESRGAN=dataset/sr/RealESRGAN \
--out-root dataset/ref \
--refs bicubic rlfn span \
--scale 4 \
--rlfn-script realtime_sr/RLFN/inference-RLFN.py \
--rlfn-ckpt realtime_sr/RLFN/rlfn-tuned-4x.pth \
--span-script realtime_sr/SPAN/inference-SPAN.py \
--span-ckpt realtime_sr/SPAN/span-tuned-4x.pth
Step 1: Compute image features
Compute FR / NR / VGG / ResNet / SigLIP2 features for SR images and save them into a single CSV file. VGG, ResNet, and timm embeddings can also be extracted from one configured SR-resolution reference type.
SR methods are passed as METHOD=DIR. Reference image filenames are expected in the format:
<sr_stem>@<sr_method>@<ref_name>.<ext>
qualisr-extract-features \
--sr-dirs PASD=dataset/sr/PASD SUPIR=dataset/sr/SUPIR RealESRGAN=dataset/sr/RealESRGAN \
--gt-dir dataset/hr \
--lr-dir dataset/lr \
--ref-dirs bicubic=dataset/ref/bicubic rlfn=dataset/ref/rlfn span=dataset/ref/span \
--features fr,nr,vgg,resnet,siglip \
--output features/image_features.csv \
--device cuda
To extract the corresponding embeddings from one reference type, select it with --embedding-reference and use the ref-vgg, ref-resnet, or ref-timm feature names. For example:
qualisr-extract-features \
--sr-dirs PASD=dataset/sr/PASD SUPIR=dataset/sr/SUPIR RealESRGAN=dataset/sr/RealESRGAN \
--ref-dirs bicubic=dataset/ref/bicubic \
--embedding-reference bicubic \
--features ref-vgg,ref-resnet \
--output features/reference_embeddings.csv \
--device cuda
In the unified pipeline, configure the reference once as features.common.embedding_reference. All enabled reference-embedding groups use that same reference.
Step 2: Apply PCA to high-dimensional features
Apply Principal Component Analysis (PCA) to high-dimensional feature blocks such as vgg_* and resnet_* in CSV files produced in Step 1.
qualisr-apply-pca \
--input features/image_features.csv \
--blocks vgg=vgg_ resnet=resnet_ \
--n-components 5 10 25 50 75 \
--test-size 0.2 \
--split-seed 42 \
--output-dir features/pca
For component-wise differences after PCA, independently fitted PCA coordinates are not comparable. Use paired mode to fit one basis on the stacked SR and reference training rows and transform both inputs:
qualisr-apply-pca \
--input features/vgg.csv \
--reference-input features/ref_vgg.csv \
--blocks vgg=vgg_ \
--reference-blocks vgg=ref_vgg_ \
--n-components 5 \
--output-dir features/pca \
--output-template vgg_shared_pca{n}.csv \
--reference-output-template ref_vgg_shared_pca{n}.csv
Step 3 (optional): Compute embedding differences
Compute signed, element-wise SR - reference differences. Rows are matched by sample_id, and block mappings explicitly identify the corresponding columns:
qualisr-embedding-difference \
--reference-input features/pca/ref_vgg_shared_pca5.csv \
--sr-input features/pca/vgg_shared_pca5.csv \
--blocks vgg_diff=vgg_pca_,vgg_pca_ \
--output features/vgg_diff_pca5.csv
The same command can operate on raw embeddings, for example with --blocks vgg_diff=ref_vgg_,vgg_.
Step 4: Compute artifact-mask statistics
Compute summary statistics for heatmaps stored as .npy, .npy.gz, or compatible compressed files. Input directories can be passed as PREFIX=DIR to ensure stable sample naming.
qualisr-compute-stats \
--heatmap-dirs PASD=dataset/heatmaps/PASD SUPIR=dataset/heatmaps/SUPIR RealESRGAN=dataset/heatmaps/RealESRGAN \
--output features/stats.csv \
--percentiles 5 95 \
--area-thresholds 0 0.5 0.75
Step 5: Fit regressors and analyze results
Train regressors and produce summary on feature importances and correlations. The correlation plot can also include direct NR/FR metric baselines from feature CSV files.
qualisr-run-regressors --config configs/pipeline.json
Training and validation datasets, their split behavior, and their feature roots are declared once in the top-level datasets list. See dataset/readme.md.
You can also use regressors.ipynb notebook for experiments; install .[regressors,notebook] to use it. It trains regressors, evaluates them, and visualizes:
- feature importances,
- PLCC/SRCC correlations,
- feature cross-correlation matrix,
- MOS/prediction scatter plot,
- comparisons across feature groups and model settings.
The first notebook cell describes the workflow for running experiments individually or in batches.
Example outputs:
Profiling
Add --profile to standalone feature extraction or statistics to write <output_stem>_profile.csv. Feature extraction also accepts --profile-flops, which reruns supported PyTorch model calls and implies profiling. FLOP values are estimates and may omit unsupported operations.
For regression, --profile writes runtime and prediction-cost estimates under the run's profiling/ directory. Supply --feature-profile-files (or profiling.feature_profile_files in the regressor config) for combined feature and regressor estimates. Unified feature/statistics profiling is configured in the corresponding JSON sections.
Feature Types
This section summarizes the feature groups used in the pipeline. For references and guidelines to adding custom features, address features/readme.md.
No-Reference (NR) metrics
NR metrics are widely used in SR-IQA because they do not require a perfect high-resolution reference image. Their main limitation is that they ignore information available in the input LR image, which may cause them to miss or even reward artifacts introduced by SR models.
Recommended NR metrics in this project, based on results from VSRQAD:
These metrics are computed through the PyIQA interface, so the list can be changed easily.
Full-Reference (FR) metrics
FR metrics are not always ideal for SR-IQA because they assume access to a perfect reference image. Still, they provide useful information about fidelity.
When true GT images are unavailable, the project uses pseudo-GT references: images obtained by upscaling the LR input with methods that are faithful to the LR image and do not introduce strong hallucinated content.
Reference upscaling methods used here:
Recommended FR metrics in this project, based on results from VSRQAD:
These metrics are also computed through PyIQA.
Pretrained encoder features (+ PCA)
Feature embeddings from pretrained encoders can capture semantic and perceptual information not covered by classical IQA metrics.
This project uses features extracted from:
Because these embeddings are often high-dimensional, Principal Component Analysis (PCA) can be applied before training regressors.
Artifact-mask statistics
Artifacts are common in modern deep-learning-based SR models. The working hypothesis of this project is:
Artifact-related information provides useful signals for assessing generated image quality.
An artifact mask is a single-channel tensor with values in the range [0, 1].
Masks for SR images must be computed beforehand with a suitable method such as Prominence-Aware Artifact Detector.
The project extracts the following summary statistics from artifact masks:
- min
- max
- mean
- median
- std
- percentiles
- thresholded artifact area
License
Project code is released under the BSD-3-Clause license. Third-party code, checkpoints, and datasets have separate terms; see third-party notices and the dataset guide.
Metadata
Release files for qualisr-lab 0.3.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 |
|---|---|---|---|---|
| qualisr_lab-0.3.0.tar.gz | 1.1 MB | Without provenance | Details for qualisr_lab-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qualisr_lab-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for qualisr_lab-0.3.0-py3-none-any.whl |
Total release size: 1.6 MB
Release files / qualisr_lab-0.3.0.tar.gz
| Download URL | qualisr_lab-0.3.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d10bc0c7a8a69286c324aec1ff946c755b2de5a5120d5f5fc9c5cf8bb981b422
|
|
BLAKE2b-256 checksum How to use checksums |
5b2d6159ac3e0623e1a626186553326605c5014480290e48aa5b028191d89c77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / qualisr_lab-0.3.0-py3-none-any.whl
| Download URL | qualisr_lab-0.3.0-py3-none-any.whl |
|---|---|
| Size | 535.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fbd16e80c561c187f76b9b4cec3b04bc4fc6b18d0fc53b648bac6936ef0abf24
|
|
BLAKE2b-256 checksum How to use checksums |
7e62c04352e0c8b4b8dd847bea806785dc72d5ea72c7d8d90e1c8a9bb6c0cba5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for qualisr-lab 0.3.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.