O repositorio vinha com ~178 MB, e a maior parte era o ambiente virtual `.local/`
versionado — 350 ficheiros, um venv inteiro dentro do git. Um clone limpo trazia um
ambiente que nao serve a ninguem e reconstroi-se a partir do requirements.txt, que ja
existe: sai do indice, o `.gitignore` passa a cobri-lo e o `.bashrc` pessoal que estava
versionado sai com ele. O repositorio fica com 72 ficheiros versionados em vez de 421.
Anonimizacao — dois defeitos que deixavam dados em bruto num repositorio publico:
* `escalao()` devolvia a idade tal e qual quando o valor nao caia em nenhum intervalo,
o que deixou a idade exacta de dois participantes (menores) nas tabelas. Passa a
cobrir todo o intervalo (`<18` abaixo do primeiro escalao, `65+` acima do ultimo) e a
nunca devolver valor em bruto; o `pseudo()` fica idempotente para uma segunda
passagem nao mexer em ids ja pseudonimizados.
* `t_userid()` pseudonimizava `id` e `user_id` mas nao `session_id`, o que deixou
`app_ss_test.session_id` numerico contra `app_ss_session.id` pseudonimo — a juncao
das duas tabelas dava 0 de 202 e o `compute_mos.py` rebentava. O `session_id` leva
agora o mesmo pseudo e a juncao volta a fechar 202/202.
* `results/webapp/tests.csv`, que e o input do `anova.py`, ainda trazia a idade do
observador em anos (minimo 9). Passa a trazer o grupo etario com os intervalos que o
proprio `anova.py` ja usava, e o `anova.py` le o rotulo em vez de fazer `pd.cut`.
A mudanca e neutra: o `pd.cut` original sobre as idades originais da exactamente os
mesmos rotulos nas 12775 linhas, o `MOS_debiased` sai com max|dif| = 0, as p-values
do `anova_significance.csv` sao iguais e os cinco PNG saem byte a byte identicos.
`results/webapp/detailed_mos.csv` passa a ser o que o proprio `compute_mos.py` produz
hoje sobre as tabelas publicadas: 555 imagens e as 12775 avaliacoes, em vez das 10339
do ficheiro anterior.
`tests/run.sh` corre 26 verificacoes sem GPU e sem base de dados — forma das tabelas,
idades so em rotulos (nas tabelas e no tests.csv), ids pseudonimos, juncao, ausencia de
formas de credencial, ambito da licenca, e a analise subjectiva a reproduzir o que esta
versionado. Nove sao negativas: reintroduzem o defeito numa fixture e exigem que a
verificacao o apanhe. Sai != 0 quando falha.
O README passa ao formato uniforme (o que e, requisitos, instalar, usar, testes,
estrutura, licenca), diz o que nao corre aqui e por que, e mantem o que ja estava
decidido sobre a licenca (MIT com ambito, os nove ficheiros listados em LICENSE-NOTES.md
e a atribuicao dos dados). O LICENSE e o LICENSE-NOTES.md nao foram alterados.
isr
Image quality assessment: a subjective study with 202 participants, the objective full-reference IQA metrics it is compared against, and the fusion pipelines that predict MOS from those metrics.
What it is
The work has three parts, and they live in three directories.
metrics/objective/full_reference/ — full-reference IQA metrics implemented in Python, in eleven modules: color.py, frequency.py, gradient.py, information.py, perceptual.py, pixel.py, psnr.py, region.py, ssim.py, structural.py, wavelet.py. Each exposes a compute_all that takes a reference and a distorted image and returns a dict of scores: PSNR and PSNR-B (pixel.py), SSIM, MS-SSIM, CW-SSIM, G-SSIM, W-SSIM, IW-SSIM, FSIM, R-SSIM, GMS+CMS (ssim.py, structural.py, gradient.py), and the information- and frequency-domain families (information.py, frequency.py, wavelet.py). The images themselves are not in the repository — only the metric values already computed from them (data/).
metrics/subjective/ — the study. pre_processing.py exports four tables from PostgreSQL (the connection string is built from ISR_DB_PASSWORD, see Requirements); post_processing.py and compute_mos.py turn the ratings into a MOS per image (555 images, 12 775 ratings); anova.py residualises the demographic bias out of the MOS and runs the ANOVA on what is left. anonymise_tables.py is the script that pseudonymised the participant tables — see License and metrics/subjective/tables/DATA-SOURCES.md.
scripts/ — compute_objective.py walks reference/distorted pairs and writes the metric values to CSV; full_ref_analysis.py correlates each metric with the MOS (PLCC, SRCC, MSE, MAE — the output is results/iqa_correlation/train/correlation_results.csv, with ranked scatter plots in the same directory); pipeline_fusion.py (830 lines) fuses the full-reference metrics into a regressor that predicts MOS, with Optuna tuning, k-fold selection and pseudo-MOS generation; compute_subjective.py ties the subjective side together.
Requirements
-
Python 3 with
pip. Therequirements.txtlists the 17 packages the code actually imports:catboost,joblib,lightgbm,matplotlib,numpy,optuna,pandas,psycopg2-binary,PyWavelets,scikit-image,scikit-learn,scipy,seaborn,sewar,shap,statsmodels,xgboost. They are not pinned on purpose — see the header of that file. -
The subjective analysis needs only part of that list.
compute_mos.pyandanova.pyrun onnumpy,pandas,scipy,scikit-learn,statsmodels,seabornandmatplotlib.torch,catboost,xgboost,lightgbm,optuna,shap,sewar,scikit-imageandPyWaveletsare for the objective metrics and the fusion pipelines, and are several GB. -
pre_processing.pyneeds a reachable PostgreSQL with the study tables, and the password in the environment:export ISR_DB_PASSWORD='<your-database-password>' python metrics/subjective/pre_processing.pyThe password is not in the code and there is no default: without the variable the script stops with a
RuntimeError. -
compute_objective.pyandpipeline_fusion.pyneed the image corpus, which is not distributed here.
Install / Build
# canonical copy on the self-hosted Gitea (aneto/isr), mirrored to GitHub:
git clone https://github.com/ags-neto/isr.git
cd isr
python3 -m venv ~/.venvs/isr
~/.venvs/isr/bin/python -m pip install -r requirements.txt
For the subjective analysis only, the light subset is enough and installs in a minute:
~/.venvs/isr/bin/python -m pip install numpy pandas scipy scikit-learn statsmodels seaborn matplotlib
Nothing needs to be built and there is no GPU requirement. The environment used to produce the published results is described in the report, not fixed here.
Usage
# MOS per image (555 images) from the anonymised study tables
python metrics/subjective/compute_mos.py
# -> results/webapp/detailed_mos.csv
# debiased MOS + ANOVA + the significance table and the plots
python metrics/subjective/anova.py
# -> results/pipeline_unbias/tests_debiased.csv
# -> results/pipeline_unbias/anova_significance.csv
# -> the five .png in results/pipeline_unbias/, and mos_debiased.csv under data/
# objective metrics over a corpus of reference/distorted pairs (needs the images)
python scripts/compute_objective.py
# the fusion pipeline: tune, select k, predict MOS (needs the images and the heavy deps)
python scripts/pipeline_fusion.py fuse --iqa-train data/labeled/train/iqa.csv \
--iqa-distorted data/distorted/iqa.csv --out results/pipeline_fusion
Tests
./tests/run.sh
tests/run.sh exits non-zero when anything fails. It checks, without a GPU and without the database:
| Check | Expectation |
|---|---|
| index is free of environment junk | no .local/, __pycache__ or .pyc among the tracked files |
.gitignore |
excludes .local/ |
| study table shape | 202 participants, 202 sessions, 12 775 ratings |
age column, study tables |
only labels (<18, 18-24, …, 65+) — never a raw number |
age column, tests.csv |
only the age groups anova.py uses (<18, 18-25, 26-35, 36-50, 51+) — never a raw number |
| identifiers | every participant/session id is a pseudonym (U + 10 hex) |
| join key | app_ss_test.session_id joins app_ss_session.id, 202/202 |
| secrets | no tracked file has a literal password=, an sk-… key, an AWS key, a private key or a database URL that carries a password inline |
| licence scope | LICENSE-NOTES.md lists 9 files and all 9 exist |
| analysis | compute_mos.py yields 555 images and accounts for all 12 775 ratings |
| analysis | anova.py reproduces tests_debiased.csv, tolerance `max |
The reproducibility claim is not "approximate". Re-running the debiasing on the tables as they are published reproduces the committed results to floating-point precision: MOS_debiased in tests_debiased.csv to max|dif| = 2.5e-12, and data/labeled/train/mos_debiased.csv to max|dif| = 4.9e-13 — i.e. ~1e-12, the limit of the arithmetic, not a loosened tolerance.
What the tests do not run, and why:
| Not run | Why |
|---|---|
scripts/compute_objective.py |
needs the image corpus (not in the repository) and scikit-image / PyWavelets / sewar |
scripts/pipeline_fusion.py |
needs the images plus torch, catboost, xgboost, lightgbm, optuna, shap — several GB |
metrics/subjective/pre_processing.py |
needs a live PostgreSQL and ISR_DB_PASSWORD (and psycopg2-binary) |
Those are reported as not run, never as passed. The two analysis checks that do run (compute_mos.py, anova.py) skip cleanly if pandas is not installed, and say so.
Nine of the checks are negative: they reintroduce the defect in a throwaway fixture — a .pyc back in the index, a .local/ path, an age of 9, a literal password, an OpenAI/AWS/private key, a password-bearing URL, a LICENSE-NOTES.md without the nine entries — and require the check to fail on it. One more negative pins the opposite: a password = os.environ.get(...) must not be reported as a secret.
Structure
metrics/objective/full_reference/ 11 modules of full-reference IQA metrics
metrics/subjective/ study: DB export, MOS, ANOVA, anonymisation
metrics/subjective/tables/ the study tables (anonymised) + DATA-SOURCES.md
scripts/ objective metrics, correlation, fusion pipelines
data/ metric values and MOS per split (no images)
results/iqa_correlation/train/ metric-vs-MOS correlations, ranked scatter plots
results/pipeline_noreference/k6/ no-reference pipeline, fold k6: model.pth, metrics, predictions
results/pipeline_unbias/ debiased MOS, ANOVA table, the five plots
results/webapp/ the tables the study app produced
tests/ run.sh + the checks above
third_party/magface a gitlink with no content and no .gitmodules (empty in a clone)
LICENSE, LICENSE-NOTES.md MIT and its scope
The virtualenv used during development (.local/) used to be tracked — 350 files, why a clone came down at ~178 MB. It is out of the index now and ignored; a fresh clone reproduces the environment from requirements.txt instead.
License
MIT, with a scope: only for the code and text authored by André Neto. Nine tracked files carry an institutional copyright header (Copyright (c) 2024/2025 Institute of Systems and Robotics) and are not covered by the MIT licence — the rights stay with the institution, and no authorisation from it to relicense them is recorded here. The list and the scope are in LICENSE-NOTES.md; the MIT text is in LICENSE.
The nine files: metrics/__init__.py, metrics/objective/__init__.py, metrics/objective/full_reference/__init__.py, metrics/subjective/__init__.py, metrics/subjective/pre_processing.py, metrics/subjective/post_processing.py, metrics/subjective/compute_mos.py, metrics/subjective/anova.py, scripts/compute_subjective.py.
Data is not covered by that licence either:
- The participant data (
app_user_user.csv,app_ss_session.csv,app_ss_test.csv,app_user_feedback.csv, and the derivedresults/webapp/tests.csv) is personal data, anonymised: the identifiers are pseudonyms derived from a private salt that is not in this repository, the age became a bracket, and the free text was stripped of contacts.results/webapp/tests.csvcarries the observer age as the groupanova.pyalready used, so no age in years is published anywhere. What it is and how it was treated is inmetrics/subjective/tables/DATA-SOURCES.mdand in the header ofmetrics/subjective/anonymise_tables.py. - The London Faces base (
london_faces_info.csv,london_faces_ratings.csv) is the Face Research Lab London Set, by Lisa DeBruine & Benedict Jones (2017), University of Glasgow — under CC BY 4.0, reused here with the attribution written in the sameDATA-SOURCES.md.