π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Adapt tests according to new HSV and HLS bounds
Paua9f66096e42e
diff --git a/kornia/augmentation/augmentations.py b/kornia/augmentation/augmentations.pyindex 0b7a79727..6fda9ac35 100644--- a/kornia/augmentation/augmentations.py+++ b/kornia/augmentation/augmentations.py@@ -5,6 +5,7 @@ from torch.distributions import Uniformfrom kornia.geometry.transform.flips import hflipfrom kornia.color.adjust import AdjustBrightness, AdjustContrast, AdjustSaturation, AdjustHue+from kornia.geometry import piUnionType = Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]FloatUnionType = Union[torch.Tensor, float, Tuple[float, float], List[float]]@@ -242,7 +243,7 @@ def color_jitter(input: torch.Tensor, brightness: FloatUnionType = 0.,float('-inf'), float('inf')), device=device, dtype=dtype)contrast_bound: torch.Tensor = _check_and_bound(contrast, 'contrast', center=1., device=device, dtype=dtype)saturation_bound: torch.Tensor = _check_and_bound(saturation, 'saturation', center=1., device=device, dtype=dtype)- hue_bound: torch.Tensor = _check_and_bound(hue, 'hue', bounds=(-.5, .5), device=device, dtype=dtype)+ hue_bound: torch.Tensor = _check_and_bound(hue, 'hue', bounds=(-pi.item(), pi.item()), device=device, dtype=dtype)input = input.unsqueeze(0)input = input.view((-1, (*input.shape[-3:])))diff --git a/test/augmentation/test_augmentation.py b/test/augmentation/test_augmentation.pyindex 928bc80af..220a1da5d 100644--- a/test/augmentation/test_augmentation.py+++ b/test/augmentation/test_augmentation.py@@ -476,26 +476,25 @@ class TestColorJitter:[0.6000, 0.5000, 0.4000],[0.7000, 0.8000, 1.0000]],- [[1.0000, 0.6578, 0.7000],- [0.6789, 0.3000, 0.2000],+ [[1.0000, 0.5251, 0.6167],+ [0.6126, 0.3000, 0.2000],[0.8000, 0.1000, 0.2000]],- [[0.3634, 0.8000, 0.6948],- [0.9000, 0.3526, 0.2526],- [0.7737, 0.5840, 0.7103]]],-+ [[0.5623, 0.8000, 0.7000],+ [0.9000, 0.3084, 0.2084],+ [0.7958, 0.4293, 0.5335]]],[[[0.1000, 0.2000, 0.3000],- [0.6726, 0.5000, 0.4000],+ [0.6116, 0.5000, 0.4000],[0.7000, 0.8000, 1.0000]],- [[1.0000, 0.3547, 0.5031],- [0.6000, 0.3484, 0.2484],- [0.7758, 0.1000, 0.2000]],+ [[1.0000, 0.4769, 0.5846],+ [0.6000, 0.3077, 0.2077],+ [0.7961, 0.1000, 0.2000]],- [[0.8179, 0.8000, 0.7000],+ [[0.6347, 0.8000, 0.7000],[0.9000, 0.3000, 0.2000],- [0.8000, 0.2305, 0.3063]]]])+ [0.8000, 0.3730, 0.4692]]]])assert_allclose(f(input), expected)@@ -520,26 +519,26 @@ class TestColorJitter:[0.6000, 0.5000, 0.4000],[0.7000, 0.8000, 1.0000]],- [[1.0000, 0.6578, 0.7000],- [0.6789, 0.3000, 0.2000],+ [[1.0000, 0.5251, 0.6167],+ [0.6126, 0.3000, 0.2000],[0.8000, 0.1000, 0.2000]],- [[0.3634, 0.8000, 0.6948],- [0.9000, 0.3526, 0.2526],- [0.7737, 0.5840, 0.7103]]],+ [[0.5623, 0.8000, 0.7000],+ [0.9000, 0.3084, 0.2084],+ [0.7958, 0.4293, 0.5335]]],[[[0.1000, 0.2000, 0.3000],- [0.6726, 0.5000, 0.4000],+ [0.6116, 0.5000, 0.4000],[0.7000, 0.8000, 1.0000]],- [[1.0000, 0.3547, 0.5031],- [0.6000, 0.3484, 0.2484],- [0.7758, 0.1000, 0.2000]],+ [[1.0000, 0.4769, 0.5846],+ [0.6000, 0.3077, 0.2077],+ [0.7961, 0.1000, 0.2000]],- [[0.8179, 0.8000, 0.7000],+ [[0.6347, 0.8000, 0.7000],[0.9000, 0.3000, 0.2000],- [0.8000, 0.2305, 0.3063]]]])+ [0.8000, 0.3730, 0.4692]]]])assert_allclose(f(input), expected)@@ -564,26 +563,26 @@ class TestColorJitter:[0.6000, 0.5000, 0.4000],[0.7000, 0.8000, 1.0000]],- [[1.0000, 0.6578, 0.7000],- [0.6789, 0.3000, 0.2000],+ [[1.0000, 0.5251, 0.6167],+ [0.6126, 0.3000, 0.2000],[0.8000, 0.1000, 0.2000]],- [[0.3634, 0.8000, 0.6948],- [0.9000, 0.3526, 0.2526],- [0.7737, 0.5840, 0.7103]]],+ [[0.5623, 0.8000, 0.7000],+ [0.9000, 0.3084, 0.2084],+ [0.7958, 0.4293, 0.5335]]],[[[0.1000, 0.2000, 0.3000],- [0.6726, 0.5000, 0.4000],+ [0.6116, 0.5000, 0.4000],[0.7000, 0.8000, 1.0000]],- [[1.0000, 0.3547, 0.5031],- [0.6000, 0.3484, 0.2484],- [0.7758, 0.1000, 0.2000]],+ [[1.0000, 0.4769, 0.5846],+ [0.6000, 0.3077, 0.2077],+ [0.7961, 0.1000, 0.2000]],- [[0.8179, 0.8000, 0.7000],+ [[0.6347, 0.8000, 0.7000],[0.9000, 0.3000, 0.2000],- [0.8000, 0.2305, 0.3063]]]])+ [0.8000, 0.3730, 0.4692]]]])assert_allclose(f(input), expected)