ImportError: cannot import name 'compare_ssim' from 'skimage.measure'
Closed this issue · 2 comments
scikit-image-0.17.2
scikit-learn-0.23.2
ImportError: cannot import name 'compare_ssim' from 'skimage.measure'
May I ask which version of scikit-image are you using?
Thank you
Hi, it's fine to use this version, but the import command need to be replaced by "from skimage.measure import structural_similarity" as the "compare_ssim" is already removed from 0.18.0.
Hi HighWay Wu,
Thanks for your reply. I only changed your code "from skimage.measure import compare_ssim, compare_psnr" --> "from skimage.measure import structural_similarity", The comment I have run "python main.py --model SLI train"
`Train/Val SLI model:
Traceback (most recent call last):
File "main.py", line 960, in
model.train()
File "main.py", line 684, in train
for cnt, items in enumerate(self.train_loader):
File "/home/xiaoxin/.virtualenvs/r-reticulate/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in next
data = self._next_data()
File "/home/xiaoxin/.virtualenvs/r-reticulate/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data
return self._process_data(data)
File "/home/xiaoxin/.virtualenvs/r-reticulate/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
data.reraise()
File "/home/xiaoxin/.virtualenvs/r-reticulate/lib/python3.8/site-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
IndexError: Caught IndexError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/xiaoxin/.virtualenvs/r-reticulate/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
data = fetcher.fetch(index)
File "/home/xiaoxin/.virtualenvs/r-reticulate/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/xiaoxin/.virtualenvs/r-reticulate/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "main.py", line 41, in getitem
return self.load_item(idx)
File "main.py", line 47, in load_item
Ig = cv2.imread(self.file + self.filelist[idx])
IndexError: list index out of range
`
Thank you