赞
踩
import lpips import os import utils_image as util loss_fn_alex = lpips.LPIPS(net='vgg')#也可以选择alex inputpath = r'E:\testresult'#(alex:0.1009) (vgg:0.1879) gtpath=r'F:\eval_normal' imgs=os.listdir(path) losssum=0.0 count=0 for img in imgs: ig=util.imread_uint(inputpath +'/'+img,3) input=util.uint2tensor3(ig) #print(path+'/'+img,pathgt + '/normal' + img[3:]) gt = util.imread_uint(gtpath+ '/' + img, 3) #gt = util.imread_uint(pathgt + '/normal' + img[3:], 3) input = util.uint2tensor3(ig) gt = util.uint2tensor3(gt) loss=loss_fn_alex(input,gt) losssum=losssum+loss count+=1 print(img,loss.item()) print(losssum/count)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。