Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tests/metrics/test_compute_multiscalessim_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestMultiScaleSSIMMetric(unittest.TestCase):

def test2d_gaussian(self):
def test_2d_gaussian(self):
set_determinism(0)
preds = torch.abs(torch.randn(1, 1, 64, 64))
target = torch.abs(torch.randn(1, 1, 64, 64))
Expand All @@ -34,7 +34,7 @@ def test2d_gaussian(self):
expected_value = 0.023176
self.assertAlmostEqual(expected_value, result.item(), 4)

def test2d_uniform(self):
def test_2d_uniform(self):
set_determinism(0)
preds = torch.abs(torch.randn(1, 1, 64, 64))
target = torch.abs(torch.randn(1, 1, 64, 64))
Expand All @@ -47,7 +47,7 @@ def test2d_uniform(self):
expected_value = 0.022655
self.assertAlmostEqual(expected_value, result.item(), 4)

def test3d_gaussian(self):
def test_3d_gaussian(self):
set_determinism(0)
preds = torch.abs(torch.randn(1, 1, 64, 64, 64))
target = torch.abs(torch.randn(1, 1, 64, 64, 64))
Expand All @@ -60,19 +60,19 @@ def test3d_gaussian(self):
expected_value = 0.061796
self.assertAlmostEqual(expected_value, result.item(), 4)

def input_ill_input_shape2d(self):
def test_input_ill_input_shape2d(self):
metric = MultiScaleSSIMMetric(spatial_dims=3, weights=[0.5, 0.5])

with self.assertRaises(ValueError):
metric(torch.randn(1, 1, 64, 64), torch.randn(1, 1, 64, 64))

def input_ill_input_shape3d(self):
def test_input_ill_input_shape3d(self):
metric = MultiScaleSSIMMetric(spatial_dims=2, weights=[0.5, 0.5])

with self.assertRaises(ValueError):
metric(torch.randn(1, 1, 64, 64, 64), torch.randn(1, 1, 64, 64, 64))

def small_inputs(self):
def test_small_inputs(self):
metric = MultiScaleSSIMMetric(spatial_dims=2)

with self.assertRaises(ValueError):
Expand Down
Loading