Skip to content

test_rgb2hsv is flaky #2433

Closed
Closed
@fmassa

Description

@fmassa

It looks like test_rgb2hsv is flaky and fails sometimes.

https://app.circleci.com/pipelines/github/pytorch/vision/3217/workflows/77e60582-2ddc-46db-933f-33c45c27387c/jobs/178179/tests

Example error that we get

    def test_rgb2hsv(self):
        shape = (3, 150, 100)
        for _ in range(20):
            img = torch.rand(*shape, dtype=torch.float)
            ft_hsv_img = F_t._rgb2hsv(img).permute(1, 2, 0).flatten(0, 1)
    
            r, g, b, = img.unbind(0)
            r = r.flatten().numpy()
            g = g.flatten().numpy()
            b = b.flatten().numpy()
    
            hsv = []
            for r1, g1, b1 in zip(r, g, b):
                hsv.append(colorsys.rgb_to_hsv(r1, g1, b1))
    
            colorsys_img = torch.tensor(hsv, dtype=torch.float32)
    
            max_diff = (colorsys_img - ft_hsv_img).abs().max()
>           self.assertLess(max_diff, 1e-5)
E           AssertionError: tensor(1.) not less than 1e-05

test\test_functional_tensor.py:118: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions