How to use the torchgeometry.color.RgbToHsv function in torchgeometry

To help you get started, we’ve selected a few torchgeometry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kornia / kornia / test / test_color.py View on Github external
[[13., 14.],
                              [14., 14.]],

                             [[8., 8.],
                              [8., 8.]]])  # 3x2x2

        expected = torch.tensor([[[0.0641, 0.0714],
                                  [0.0714, 0.0714]],

                                 [[0.6190, 0.6364],
                                  [0.6364, 0.6364]],

                                 [[21.0000, 22.0000],
                                  [22.0000, 22.0000]]])  # 3x2x2
        f = color.RgbToHsv()
        data = data.repeat(2, 1, 1, 1)  # 2x3x2x2
        print(data.shape)
        expected = expected.repeat(2, 1, 1, 1)  # 2x3x2x2
        print(expected.shape)
        print(f(data).shape)
        assert_allclose(f(data), expected, atol=1e-4, rtol=1e-5)
github kornia / kornia / test / test_color.py View on Github external
def test_gradcheck(self):

        data = torch.tensor([[[[21., 22.],
                               [22., 22.]],

                              [[13., 14.],
                               [14., 14.]],

                              [[8., 8.],
                               [8., 8.]]]])  # 3x2x2

        data = utils.tensor_to_gradcheck_var(data)  # to var

        assert gradcheck(color.RgbToHsv(), (data,),
                         raise_exception=True)
github kornia / kornia / test / test_color.py View on Github external
[[13., 14.],
                              [14., 14.]],

                             [[8., 8.],
                              [8., 8.]]])

        expected = torch.tensor([[[0.0641, 0.0714],
                                  [0.0714, 0.0714]],

                                 [[0.6190, 0.6364],
                                  [0.6364, 0.6364]],

                                 [[21.0000, 22.0000],
                                  [22.0000, 22.0000]]])

        f = color.RgbToHsv()
        assert_allclose(f(data), expected, atol=1e-4, rtol=1e-5)