skycrapers / TecoGAN-PyTorch

A PyTorch Reimplementation of TecoGAN: Temporally Coherent GAN for Video Super-Resolution
Apache License 2.0
231 stars 45 forks source link

skimage.measure.compare_ssim not present in current version of skimage #27

Closed findalexli closed 2 years ago

findalexli commented 2 years ago

I was having issues with Traceback (most recent call last): File "/home/alex/TecoGAN-PyTorch/./codes/main.py", line 9, in from models import define_model File "/home/alex/TecoGAN-PyTorch/codes/models/init.py", line 1, in from .vsr_model import VSRModel File "/home/alex/TecoGAN-PyTorch/codes/models/vsr_model.py", line 7, in from .networks import define_generator File "/home/alex/TecoGAN-PyTorch/codes/models/networks/init.py", line 1, in from .tecogan_nets import FRNet, SpatioTemporalDiscriminator, SpatialDiscriminator File "/home/alex/TecoGAN-PyTorch/codes/models/networks/tecogan_nets.py", line 12, in from metrics.model_summary import register, parse_model_info File "/home/alex/TecoGAN-PyTorch/codes/metrics/init.py", line 1, in from .metric_calculator import MetricCalculator File "/home/alex/TecoGAN-PyTorch/codes/metrics/metric_calculator.py", line 13, in from .LPIPS.models.dist_model import DistModel File "/home/alex/TecoGAN-PyTorch/codes/metrics/LPIPS/models/init.py", line 7, in from skimage.measure import compare_ssim ImportError: cannot import name 'compare_ssim' from 'skimage.measure' (/home/alex/anaconda3/envs/fastai/lib/python3.9/site-packages/skimage/measure/init.py)

According to the following post, the replacing the import with structural_similarity replacement works https://stackoverflow.com/a/67966335

themis0888 commented 2 years ago

You can fix this problem by replacing from skimage.measure import compare_ssim to from skimage.metrics import structural_similarity as compare_ssim in TecoGan-PyTorch/codes/metrics/LPIPS/models/__init__.py