Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'compare_ssim' from 'skimage.measure'. I need help as I cannot start train.py #22

Open
LinuxBeaver opened this issue Jul 22, 2021 · 3 comments

Comments

@LinuxBeaver
Copy link

Hello, I am having trouble running train.py

(base) [contrast@cosmos SkyAR-main]$ python train.py \

--dataset cvprw2020-ade20K-defg
--checkpoint_dir checkpoints
--vis_dir val_out
--in_size 384
--max_num_epochs 200
--lr 1e-4
--batch_size 8
--net_G coord_resnet50
Traceback (most recent call last):
File "train.py", line 4, in
import utils
File "/home/contrast/Desktop/SkyAR-main/utils.py", line 4, in
from skimage.measure import compare_ssim as sk_cpt_ssim
ImportError: cannot import name 'compare_ssim' from 'skimage.measure' (/home/contrast/Applications/mc/lib/python3.8/site-packages/skimage/measure/init.py)
(base) [contrast@cosmos SkyAR-main]$

@jiupinjia
Copy link
Owner

Hi @LinuxBeaver, you can remove line 4 in utils.py and try again. Please let me know whether it works. Thanks!

@2zZz2
Copy link

2zZz2 commented Jun 10, 2022

I have the same problem and I fixed it by replacing "from skimage.measure import compare_ssim as sk_cpt_ssim" by "from skimage import measure" and replace "sk_cpt_ssim(_, )" by "measure.compare_ssim(, _)" in code.

Magamanny added a commit to Magamanny/SkyAR that referenced this issue Aug 4, 2022
Change compare_ssim to structural_similarity in the import. In Version 0.16 of scikit-learn the names was changed.
reference: https://scikit-image.org/docs/stable/api_changes.html
@michaelskyba
Copy link

I haven't tried replacing the code but jiupinjia's suggestion of removing line 4 worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants