• 大小: 867KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-01
  • 语言: 其他
  • 标签: 深度学习  

资源简介

这是基于The Unreasonable Effectiveness of Deep Features as a Perceptual Metric 中所提到的感知相似度计算网络代码,里面有链接可供下载作者训练好的权重。供大家参考

资源截图

代码片段和文件信息

import argparse
from models import dist_model as dm
from util import util

parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(‘--path0‘ type=str default=‘./imgs/ex_ref.png‘)
parser.add_argument(‘--path1‘ type=str default=‘./imgs/ex_p0.png‘)
parser.add_argument(‘--use_gpu‘ action=‘store_true‘ help=‘turn on flag to use GPU‘)
opt = parser.parse_args()

## Initializing the model
model = dm.DistModel()
model.initialize(model=‘net-lin‘net=‘alex‘use_gpu=opt.use_gpu)

# Load images
img0 = util.im2tensor(util.load_image(opt.path0)) # RGB image from [-11]
img1 = util.im2tensor(util.load_image(opt.path1))

# Compute distance
dist01 = model.forward(img0img1)
print(‘Distance: %.3f‘%dist01)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-11-25 05:46  PerceptualSimilarity-master\
     文件          21  2018-11-25 05:46  PerceptualSimilarity-master\.gitignore
     文件        1671  2018-11-25 05:46  PerceptualSimilarity-master\Dockerfile
     文件        1357  2018-11-25 05:46  PerceptualSimilarity-master\LICENSE
     文件        9216  2018-11-25 05:46  PerceptualSimilarity-master\README.md
     文件        1142  2018-11-25 05:46  PerceptualSimilarity-master\__init__.py
     文件         754  2018-11-25 05:46  PerceptualSimilarity-master\compute_dists.py
     文件        1097  2018-11-25 05:46  PerceptualSimilarity-master\compute_dists_dirs.py
     目录           0  2018-11-25 05:46  PerceptualSimilarity-master\data\
     文件           0  2018-11-25 05:46  PerceptualSimilarity-master\data\__init__.py
     文件         167  2018-11-25 05:46  PerceptualSimilarity-master\data\base_data_loader.py
     文件        1482  2018-11-25 05:46  PerceptualSimilarity-master\data\custom_dataset_data_loader.py
     文件         476  2018-11-25 05:46  PerceptualSimilarity-master\data\data_loader.py
     目录           0  2018-11-25 05:46  PerceptualSimilarity-master\data\dataset\
     文件           0  2018-11-25 05:46  PerceptualSimilarity-master\data\dataset\__init__.py
     文件         237  2018-11-25 05:46  PerceptualSimilarity-master\data\dataset\base_dataset.py
     文件        1792  2018-11-25 05:46  PerceptualSimilarity-master\data\dataset\jnd_dataset.py
     文件        2411  2018-11-25 05:46  PerceptualSimilarity-master\data\dataset\twoafc_dataset.py
     文件        2261  2018-11-25 05:46  PerceptualSimilarity-master\data\image_folder.py
     目录           0  2018-11-25 05:46  PerceptualSimilarity-master\imgs\
     目录           0  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_dir0\
     文件        9464  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_dir0\0.png
     文件        9464  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_dir0\1.png
     目录           0  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_dir1\
     文件        7518  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_dir1\0.png
     文件       10078  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_dir1\1.png
     文件        7518  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_p0.png
     文件       10078  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_p1.png
     文件        9464  2018-11-25 05:46  PerceptualSimilarity-master\imgs\ex_ref.png
     文件      843458  2018-11-25 05:46  PerceptualSimilarity-master\imgs\fig1.png
     目录           0  2018-11-25 05:46  PerceptualSimilarity-master\models\
............此处省略35个文件信息

评论

共有 条评论