5e2f713a0601c85bb68723cd9e52a0884f517879,test/color/test_hls.py,TestRgbToHls,test_batch_rgb_to_hls,#TestRgbToHls#,39

Before Change



    def test_batch_rgb_to_hls(self):

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

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

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

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

                                 [[0.0569, 0.0588],
                                  [0.0588, 0.0588]],

                                 [[0.4483, 0.4667],
                                  [0.4667, 0.4667]]])  // 3x2x2
        f = kornia.color.RgbToHls()
        data = data.repeat(2, 1, 1, 1)  // 2x3x2x2
        expected = expected.repeat(2, 1, 1, 1)  // 2x3x2x2

After Change



    def test_batch_rgb_to_hls(self):

        data = torch.rand(3,5,5)

        // OpenCV
        data_cv = data.numpy().transpose(1, 2, 0)
        expected = cv2.cvtColor(data_cv, cv2.COLOR_RGB2HLS)

        expected[:,:,0] = 2*math.pi*expected[:,:,0]/360.
        expected = expected.transpose(2,0,1)

        // Kornia
        f = kornia.color.RgbToHls()

        data = data.repeat(2, 1, 1, 1)  // 2x3x2x2

        expected = np.expand_dims(expected,0)
        expected = expected.repeat(2, 0)  // 2x3x2x2
        assert_allclose(f(data), expected)

    def test_gradcheck(self):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 31

Instances


Project Name: arraiy/torchgeometry
Commit Name: 5e2f713a0601c85bb68723cd9e52a0884f517879
Time: 2019-11-13
Author: priba@cvc.uab.cat
File Name: test/color/test_hls.py
Class Name: TestRgbToHls
Method Name: test_batch_rgb_to_hls


Project Name: arraiy/torchgeometry
Commit Name: 6a85646b6d99b92ba436b227ee04c7344bb1f72a
Time: 2019-11-13
Author: priba@cvc.uab.cat
File Name: test/color/test_hsv.py
Class Name: TestHsvToRgb
Method Name: test_batch_hsv_to_rgb


Project Name: arraiy/torchgeometry
Commit Name: 060dfe2da846c7168f98dd9f46f47308e4317a9d
Time: 2019-11-13
Author: priba@cvc.uab.cat
File Name: test/color/test_hls.py
Class Name: TestHlsToRgb
Method Name: test_batch_hls_to_rgb