happy-jihye / Cartoon-StyleGAN

Fine-tuning StyleGAN2 for Cartoon Face Generation
632 stars 119 forks source link

Colab notebook error because of compare_ssim #12

Open tristansyates opened 2 years ago

tristansyates commented 2 years ago

Thanks for providing this code!

When trying to run the following cell in the the Colaboratory notebook to project an input image to latent space :

#Project your own image and Make Eigenvector of latent spaces (by pretrained model)

!python projector.py --ckpt=/content/Cartoon-StyleGan2/networks/ffhq256.pt --factor='networks/factor' --e_ckpt=/content/Cartoon-StyleGan2/networks/encoder_ffhq.pt \
                            --files=/content/Cartoon-StyleGan2/celea.jpg 

I get the following error:

ImportError: cannot import name 'compare_ssim' from 'skimage.measure' (/usr/local/lib/python3.7/dist-packages/skimage/measure/init.py)

This seems to be because /usr/local/lib/python3.7/dist-packages/skimage/measure/__init__.py uses 'skimage.measure.compare_ssim' when it was recently changed to 'skimage.metrics.structural_similarity'

Link talking about skimage update: https://github.com/williamfzc/stagesepx/issues/150

nampyohong commented 2 years ago

change line in "lpips/init.py", line 7

from from skimage.measure import compare_ssim

to from skimage.metrics import structural_similarity as compare_ssim