Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

ColorMap tests coverage (#2825)

João Gustavo A. Amorimf6dde2028b8f
diff --git a/tests/color/test_colormap.py b/tests/color/test_colormap.py
index 28182da6f..e5571c728 100644
--- a/tests/color/test_colormap.py
+++ b/tests/color/test_colormap.py
@@ -1,7 +1,7 @@
import pytest
import torch
-from kornia.color import AUTUMN, ApplyColorMap, ColorMap, apply_colormap
+from kornia.color import AUTUMN, ApplyColorMap, ColorMap, ColorMapType, apply_colormap
from kornia.core import tensor
from testing.base import BaseTester, assert_close
@@ -65,8 +65,9 @@ class TestApplyColorMap(BaseTester):
apply_colormap(torch.rand(size=(5, 1, 1), dtype=dtype, device=device), cm)
@pytest.mark.parametrize("shape", [(2, 1, 4, 4), (1, 4, 4), (4, 4)])
- def test_cardinality(self, shape, device, dtype):
- cm = ColorMap(base="autumn", device=device, dtype=dtype)
+ @pytest.mark.parametrize("cmap_base", ColorMapType)
+ def test_cardinality(self, shape, device, dtype, cmap_base):
+ cm = ColorMap(base=cmap_base, device=device, dtype=dtype)
input_tensor = torch.randint(0, 63, shape, device=device, dtype=dtype)
actual = apply_colormap(input_tensor, cm)
diff --git a/tests/contrib/models/test_rt_detr.py b/tests/contrib/models/test_rt_detr.py
index f5f3803c9..c0047f475 100644
--- a/tests/contrib/models/test_rt_detr.py
+++ b/tests/contrib/models/test_rt_detr.py
@@ -16,6 +16,7 @@ from testing.base import BaseTester, assert_close
"backbone_factory",
(partial(ResNetD.from_config, 18), partial(ResNetD.from_config, 50), partial(PPHGNetV2.from_config, "L")),
)
def test_backbone(backbone_factory, device, dtype):
backbone = backbone_factory().to(device, dtype)
assert hasattr(backbone, "out_channels")
diff --git a/tests/feature/test_affine_shape_estimator.py b/tests/feature/test_affine_shape_estimator.py
index f4efd6618..58900b162 100644
--- a/tests/feature/test_affine_shape_estimator.py
+++ b/tests/feature/test_affine_shape_estimator.py
@@ -105,6 +105,7 @@ class TestLAFAffNetShapeEstimator(BaseTester):
out = ori(laf, inp)
assert out.shape == laf.shape
+ @pytest.mark.slow
def test_pretrained(self, device):
inp = torch.rand(1, 1, 32, 32, device=device)
laf = torch.rand(1, 1, 2, 3, device=device)