FID使用(Frechet Inception Distance score)

来源于文章题目:GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium

地址:https://arxiv.org/abs/1706.08500

代码地址:GitHub - bioinf-jku/TTUR: Two time-scale update rule for training GANs


介绍:

Frechet Inception 距离得分(Frechet Inception Distance score,FID)是计算真实图像和生成图像的特征向量之间距离的一种度量。

FID 从原始图像的计算机视觉特征的统计方面的相似度来衡量两组图像的相似度,这种视觉特征是使用 Inception v3 图像分类模型计算的得到的。分数越低代表两组图像越相似,或者说二者的统计量越相似,FID 在最佳情况下的得分为 0.0,表示两组图像相同。(其中文件夹1与文件夹2的图像数量可以不一致

https://github.com/mseitzer/pytorch-fidicon-default.png?t=N7T8https://github.com/mseitzer/pytorch-fid

首先安装:

pip install pytorch-fid==0.1.1


使用方式:

python -m pytorch_fid path/to/dataset1 path/to/dataset2

用 --gpu N表示使用第N个GPU

例如命令:

python -m pytorch_fid groundtruth input --gpu 0

如果要使用CPU,直接把--gpu 0删除就可以了,直接 

python -m pytorch_fid groundtruth input

示例:

 例如在该项目下使用该命令:

python -m pytorch_fid datasets/colorization/sidd/val/groundtruth datasets/colorization/sidd/val/input --gpu 0

 最终得到得分:


有一些网友遇到的bug:

1、AttributeError: module 'os' has no attribute 'sched_getaffinity

pip install pytorch-fid==0.2.1

这是因为你安装的版本是:0.2.1,然后你现在用的是windows而不是linux,如果你想要在windows上运行,只需要将--number_workers设置为0就可以了:

--device cpu/cuda

python -m pytorch_fid c/input_images/ c/output_images/ --num-workers 0 --device cpu


2024-5月更新

目前最新版的FID(0.3.0)计算,与原始的计算方式不同:

pip install pytorch-fid

使用方法:

python -m pytorch_fid path/to/dataset1 path/to/dataset2

使用GPU计算:

python -m pytorch_fid path/to/dataset1 path/to/dataset2 --device cuda:0

其中--device cuda:N, where N is the index of the GPU to use.

GitHub - mseitzer/pytorch-fid: Compute FID scores with PyTorch.

  • 33
    点赞
  • 167
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 66
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 66
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞越太平洋.

太谢谢了

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值