66 lines
2.8 KiB
Markdown
66 lines
2.8 KiB
Markdown
# IQA-PyTorch Toolbox — All-in-One
|
|
|
|
## Model Info
|
|
|
|
- **GitHub:** <https://github.com/chaofengc/IQA-PyTorch>
|
|
- **PyPI:** `pip install pyiqa`
|
|
- **License:** Apache 2.0
|
|
- **Contents:** 30+ IQA metrics including MUSIQ, TOPIQ, BRISQUE, NIQE, LPIPS, FID, NIMA, DBCNN, CLIP-IQA, LIQE, Q-Align (Q-ReAlign), and more
|
|
- **Latest updates (2026):**
|
|
- Jun 2026: Added Q-ReAlign (Qwen3.5-VL backbone) — 3 sizes: mini (0.8B), lite (4B), pro (9B)
|
|
- May 2026: Added FGResQ
|
|
- Dec 2025: Added DMM, MACLIP, AFINE
|
|
- Jan 2025: Added QualiCLIP variants
|
|
- **Results calibrated:** Against official MATLAB scripts when available
|
|
- **GPU accelerated:** PyTorch implementations are faster than MATLAB counterparts
|
|
|
|
## Why It Matters
|
|
|
|
This toolbox lets you test multiple IQA models on your wedding photos without installing each separately. Useful for benchmarking and comparison. It's the single easiest way to run BRISQUE + NIQE + MUSIQ + other metrics in one codebase.
|
|
|
|
```bash
|
|
# List all available metrics
|
|
pyiqa -ls
|
|
|
|
# Test multiple metrics on a directory
|
|
pyiqa musiq niqe brisque -t ./wedding-photos/ --device cuda
|
|
|
|
# Python API — all metrics in one import
|
|
import pyiqa
|
|
import torch
|
|
|
|
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
|
|
|
# Create any metric
|
|
brisque = pyiqa.create_metric('brisque', device=device)
|
|
musiq = pyiqa.create_metric('musiq', device=device)
|
|
niqe = pyiqa.create_metric('niqe', device=device)
|
|
|
|
# Check scoring direction
|
|
print(f"BRISQUE lower_better: {brisque.lower_better}") # True
|
|
print(f"MUSIQ lower_better: {musiq.lower_better}") # False (higher = better)
|
|
print(f"NIQE lower_better: {niqe.lower_better}") # True
|
|
|
|
# Batch inference
|
|
import glob
|
|
for path in glob.glob('./wedding-photos/*.jpg'):
|
|
score_b = brisque(path)
|
|
score_m = musiq(path)
|
|
score_n = niqe(path)
|
|
```
|
|
|
|
## Available Metrics (relevant to wedding photo sorting)
|
|
|
|
| Metric | Type | Score Direction | GPU Required | Notes |
|
|
|--------|------|----------------|--------------|-------|
|
|
| brisque | NR-IQA | Lower better | No (CPU) | Blur/noise detection |
|
|
| niqe | NR-IQA | Lower better | No (CPU) | Blur/noise detection, opinion-unaware |
|
|
| musiq | NR-IQA (Transformer) | Higher better | Yes (~4GB) | Aesthetic + technical combined |
|
|
| toqip | NR-IQA (Transformer) | Higher better | Yes (~2GB) | Modern, self-supervised |
|
|
| clip_iqa | NR-IQA (CLIP) | Higher better | Yes (~2GB) | CLIP-based aesthetic |
|
|
| liqe | NR-IQA (CLIP) | Higher better | Yes (~2GB) | CLIP-based quality |
|
|
| lpips | FR-IQA (Perceptual) | Lower better | Yes (~1GB) | Needs reference image |
|
|
| fid | FR-IQA (Distribution) | Lower better | Yes (~5GB) | Needs reference dataset |
|
|
| nima | NR-IQA (CNN) | Higher better | Yes (~1GB) | Neural IMage Assessment |
|
|
| dbcnn | FR-IQA (CNN) | Higher better | Yes (~2GB) | Needs reference image |
|