ImportError: cannot import name ‘compare_ssim‘ from ‘skimage.measure‘解决办法

错误

在load skimage中的ssim函数时抛出以下错误:
ImportError: cannot import name ‘compare_ssim’ from ‘skimage.measure’

原因:

使用conda命令conda install scikit-image安装的是最新版本的scikit-image,其中的调用方式发生变化。

解决办法

from skimage.metrics import structural_similarity

类似问题解决办法
PSNR调用也有问题!

PSNR

from skimage.metrics import peak_signal_noise_ratio
refer to offical document

MSE

from skimage.metrics import mean_squared_error
refer to offical document

NRMSE

from skimage.metrics import normalized_root_mse
refer to offical document

remark

如果是老版本的scikit-image,加载SSIM,PSNR,MSE,NRMSE的方式如下

from skimage.measure import compare_ssim as ssim
from skimage.measure import compare_psnr as psnr
from skimage.measure import compare_mse as mse
from skimage.measure import compare_nrmse as nrmse

你可能感兴趣的:(conda,python,CV,深度学习,python)