github 地址为:https://github.com/toshas/torch-fidelity

API说明地址:Miscellaneous — torch-fidelity 0.4.0-beta documentation

1、安装:

安装方式一: (只会安装到0.3.0)

pip install torch-fidelity

安装方式二: (可以安装到0.4.0)

pip install -e git+https://github.com/toshas/torch-fidelity.git@master#egg=torch-fidelity

2、API 使用:

  • --gpu 0 使用GPU 0进行计算
  • --input1 输入文件夹1(源图像文件夹)
  • --input2 输入文件夹2(生成的图像文件夹)
  • --input1-model-num-samples 输入文件夹1的采样数
  • --input2-model-num-samples 输入文件夹2的采样数
  • Inception Score (ISC) --isc
  • Fréchet Inception Distance (FID) --fid
  • Kernel Inception Distance (KID) --kid
  • Precision and Recall (PRC) --prc
  • Perceptual Path Length (PPL)【对生成图片除了要求清晰、多样之外。我们还希望生成模型可以结合不同的训练图片的特征。比如说我取一个人的发型,取另一个人的脸型,然后结合生成一张图片。也就是生成器能否很好的把不同图片的特征分离出来,论文StyleGAN提出了Perceptual Path Length(PPL)用来评估这个指标。】 --ppl
  • --samples-find-deep 递归的找文件夹下的所有图像文件
  • --kid-subset-size N(当你的图像数量比较少的时候,通过添加 --kid-subset-size N 来使KID的计算生效

3、示例

fidelity --gpu 0 --fid --kid --prc --ppl --samples-find-deep --input1 ./input_images --input2 ./output_images

Logo

更多推荐