From 86eb29d4a451a2c1dbbc29a1bc179b27b3f927ba Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 26 Apr 2022 13:18:16 -0500 Subject: [PATCH] Resolve this function has been removed in latest skimage. `from skimage.measure import compare_ssim` Change to `skimage.metrics.structural_similarity` see https://github.com/williamfzc/stagesepx/issues/150 for similar issue --- lpips/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lpips/__init__.py b/lpips/__init__.py index 89e5bba2..accfe43f 100755 --- a/lpips/__init__.py +++ b/lpips/__init__.py @@ -21,8 +21,8 @@ def psnr(p0, p1, peak=255.): return 10*np.log10(peak**2/np.mean((1.*p0-1.*p1)**2)) def dssim(p0, p1, range=255.): - from skimage.measure import compare_ssim - return (1 - compare_ssim(p0, p1, data_range=range, multichannel=True)) / 2. + from skimage.metrics import structural_similarity + return (1 - structural_similarity(p0, p1, data_range=range, multichannel=True)) / 2. def tensor2np(tensor_obj): # change dimension of a tensor object into a numpy array