图像质量评估模型
本仓库包含了接入 DiffSynth-Studio 的多款主流图像质量评估模型权重。支持图文语义对齐、人类视觉偏好、纯图像美学以及数据集分布等多个维度的评测。
评估效果效果展示
prompt: A cat is sitting on a stone.
指标总览
| 指标名称 | 输入要求 | 输出结果 |
|---|---|---|
| PickScore | prompt + PIL 图像 | 人类视觉偏好分数 |
| ImageReward | prompt + PIL 图像 | 人类视觉偏好分数 |
| HPSv2 | prompt + PIL 图像 | 人类视觉偏好分数 |
| HPSv3 | prompt + PIL 图像 | 人类视觉偏好分数 |
| CLIP Score | prompt + PIL 图像 | 图文相似度 |
| Aesthetic | PIL 图像 | 美学分数 |
| UnifiedReward | prompt + PIL 图像 | 多维评分 |
| FID | 参考图目录 + 生成图目录 | 分布距离 |
快速使用
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -e .
- 示例 1:使用 PickScore 评估图文偏好
from diffsynth.metrics import PickScoreMetric, ModelConfig
from modelscope import dataset_snapshot_download
from PIL import Image
dataset_snapshot_download(
"DiffSynth-Studio/diffsynth_example_dataset",
allow_file_pattern="flux/FLUX.1-dev/*",
local_dir="./data/diffsynth_example_dataset",
)
image = Image.open("data/diffsynth_example_dataset/flux/FLUX.1-dev/1.jpg").convert("RGB")
prompt = "a dog"
metric = PickScoreMetric.from_pretrained(
model_config=ModelConfig(model_id="DiffSynth-Studio/ImageMetrics", origin_file_pattern="PickScore/model.safetensors"),
device="cuda"
)
score = metric.compute(prompt, image)[0]
print(f"PickScore score:: {score:.3f}")
- 示例 2:使用 Aesthetic 评估纯美学质量
from diffsynth.metrics import AestheticMetric, ModelConfig
from modelscope import dataset_snapshot_download
from PIL import Image
dataset_snapshot_download(
"DiffSynth-Studio/diffsynth_example_dataset",
allow_file_pattern="flux/FLUX.1-dev/*",
local_dir="./data/diffsynth_example_dataset",
)
image = Image.open("data/diffsynth_example_dataset/flux/FLUX.1-dev/1.jpg").convert("RGB")
metric = AestheticMetric.from_pretrained(
model_config=ModelConfig(model_id="DiffSynth-Studio/ImageMetrics", origin_file_pattern="Aesthetic/model.safetensors"),
device="cuda"
)
score = metric.compute(image)[0]
print(f"Aesthetic score: {score:.3f}")
关于所有指标的详细使用方法和说明,请参考 DiffSynth-Studio 的相关文档。
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

