是否有办法为python IDLE导入compare_ssim ?



我尝试在IDLE中运行python代码以使用此命令行导入compare_ssim,

从skimage。度量导入compare_ssim:导入compare_ssim的代码

from keras.layers import Input, Dense
from keras.models import Model
from keras.callbacks import ModelCheckpoint
import matplotlib.pyplot as plt
import numpy as np
import cv2
import math
from PIL import Image
from keras import backend as K
from keras.layers import Conv2D, MaxPooling2D, UpSampling2D, Flatten
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
from skimage.measure import compare_ssim
import argparse
import imutils
import cv2
#from maskalgo import getMask
from DefectSniffer import sniff
import time

但是我有这个错误:错误显示在空闲

Python 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
=============== RESTART: C:UsersUserDesktopkerasTraining.py ===============
Traceback (most recent call last):
File "C:UsersUserDesktopkerasTraining.py", line 13, in <module>
from skimage.measure import compare_ssim
ImportError: cannot import name 'compare_ssim' from 'skimage.measure' (C:UsersUserAppDataLocalProgramsPythonPython37libsite-packagesskimagemeasure__init__.py)
>>> 

如何解决这个问题?请和谢谢你。

As per - https://github.com/scikit-image/scikit-image/blob/b38fd6f02917db2965f5faf2e6e18fc197b8d6c8/skimage/metrics/_structural_similarity.py#L17

versionchanged:: 0.16此函数从skimage.measure.compare_ssim重命名为skimage.metrics.structural_similarity

skimage。度量库现在已重命名。而不是

from skimage.measure import compare_ssim

使用

from skimage.metrics import structural_similarity

相关内容

  • 没有找到相关文章

最新更新