Skip to content

Commit

Permalink
force scikit-image==0.18.3 (#182)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #182

Reviewed By: galrotem

Differential Revision: D49295173

fbshipit-source-id: 53af6f9190368f6175fb9f900dc28e8ba5e34dfc
  • Loading branch information
JKSenthil authored and facebook-github-bot committed Sep 15, 2023
1 parent da41711 commit e0444c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 1 addition & 15 deletions torcheval/metrics/image/ssim.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,14 @@

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


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.
Expand All @@ -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))
Expand Down

0 comments on commit e0444c6

Please sign in to comment.