nekhtiari/image-similarity-measures
:chart_with_upwards_trend: Implementation of eight evaluation metrics to access the similarity between two images. The eight metrics are as follows: RMSE, PSNR, SSIM, ISSM, FSIM, SRE, SAM, and UIQ.
Image Similarity Measures
是什么 – 一个小型 Python 库(及配套 CLI),用于计算两张图像的相似程度。实现了 RMSE、PSNR、SSIM、FSIM 等八种经典相似度/质量指标,这些指标在遥感和计算机视觉研究中非常常见。
为何重要 – 当你训练或测试图像处理模型(如超分辨率、去噪或卫星图像重建)时,需要一种定量方式来判断输出是否接近真实值。此包以即用形式提供这些数值,既可通过 Python 代码调用,也可通过命令行使用。
如何获取 – 使用 pip 安装(Python ≥ 3.10):
pip install image-similarity-measures
可选地,通过 extras 添加 FSIM 指标加速(pyfftw)或 TIFF 处理支持(rasterio):
pip install image-similarity-measures[speedups]
pip install image-similarity-measures[rasterio]
命令行使用 – 比较两个文件并输出包含所选指标的 JSON 对象:
image-similarity-measures \
--org_img_path=a.tif \
--pred_img_path=b.tif \
--metric=rmse --metric=psnr # 重复 --metric 可添加更多指标,或使用 "all"
该工具期望 通道最后 的数组(高度 × 宽度 × 通道)。
Python 使用 – 调用高层 evaluation 辅助函数,或直接调用任意指标:
from image_similarity_measures.evaluate import evaluation
results = evaluation(
org_img_path="example/lafayette_org.tif",
pred_img_path="example/lafayette_pred.tif",
metrics=["rmse", "psnr"]
)
# 或单个指标
from image_similarity_measures.quality_metrics import rmse
score = rmse(org_img, pred_img)
可扩展性 – 项目欢迎贡献(开发指南请参见 README-dev.md)。
引用 – 若在出版物中使用该代码,请引用作者 2020 年发表于 ISPRS Annals 的关于多光谱卫星图像超分辨率的论文。
以上所有细节均直接取自项目的 README。
相关
- 项目
- 项目
- 项目
- 项目