diff --git a/dev-requirements.txt b/dev-requirements.txt index e12f16d3..d807e0d9 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -5,5 +5,5 @@ pytest-timeout pytest-cov Cython>=0.28.5 scikit-learn>=0.22 -scikit-image>=0.18.3 +scikit-image==0.18.3 torchtnt-nightly diff --git a/torcheval/metrics/image/ssim.py b/torcheval/metrics/image/ssim.py index 78cda212..d6c36130 100644 --- a/torcheval/metrics/image/ssim.py +++ b/torcheval/metrics/image/ssim.py @@ -11,12 +11,7 @@ import torch -try: - from skimage.metrics import structural_similarity - - _SKIMAGE_AVAILABLE = True -except ImportError: - _SKIMAGE_AVAILABLE = False +from skimage.metrics import structural_similarity from torcheval.metrics.metric import Metric @@ -24,13 +19,6 @@ TStructuralSimilarity = TypeVar("TStructuralSimilarity") -def _validate_skimage_available() -> None: - if not _SKIMAGE_AVAILABLE: - raise RuntimeError( - "scikit-image is required. Please make sure ``scikit-image`` is installed." - ) - - class StructuralSimilarity(Metric[torch.Tensor]): """ Compute the structural similarity index (SSIM) between two sets of images. @@ -44,8 +32,6 @@ def __init__( self: TStructuralSimilarity, device: Optional[torch.device] = None, ) -> None: - _validate_skimage_available() - super().__init__(device=device) self._add_state("mssim_sum", torch.tensor(0, device=device, dtype=torch.float))