jiupinjia / neural-magic-eye

Neural Magic Eye: Learning to See and Understand the Scene Behind an Autostereogram, arXiv:2012.15692.
https://jiupinjia.github.io/neuralmagiceye/
MIT License
70 stars 12 forks source link

ImportError: cannot import name 'compare_ssim' from 'skimage.measure' #2

Closed itsxmeow closed 3 years ago

itsxmeow commented 3 years ago
diff --git a/utils.py b/utils.py
index af2ecb3..4f8af86 100644
--- a/utils.py
+++ b/utils.py
@@ -2,7 +2,8 @@ import numpy as np
 import matplotlib.pyplot as plt
 import cv2
 import random
-from skimage.measure import compare_ssim as sk_cpt_ssim
+#from skimage.measure import compare_ssim as sk_cpt_ssim
+from skimage import measure

 import torch
 from torchvision import utils
@@ -26,7 +27,8 @@ def cpt_ssim(img, img_gt, normalize=False):
         img = (img - img.min()) / (img.max() - img.min() + 1e-9)
         img_gt = (img_gt - img_gt.min()) / (img_gt.max() - img_gt.min() + 1e-9)

-    SSIM = sk_cpt_ssim(img, img_gt, data_range=1.0)
+    #SSIM = sk_cpt_ssim(img, img_gt, data_range=1.0)
+    SSIM = measure.compare_ssim(img, img_gt, data_range=1.0)

     return SSIM
jiupinjia commented 3 years ago

@bluestories, thanks for your feedback! I will be updating this part shortly!

jiupinjia commented 3 years ago

@bluestories, this bug has been fixed! Thanks again! I'm closing this issue, pls let me know if there is any other problem.