Skip to content

Commit

Permalink
Add tests for contigous masks (#1975)
Browse files Browse the repository at this point in the history
* Empty-Commit

* Added extra tests

* Updated test
  • Loading branch information
ternaus authored Oct 8, 2024
1 parent 27fee7d commit ef227fd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,15 @@ def test_to_tensor_v2_on_non_contiguous_array_with_horizontal_flip():
masks = [image[:, :, 0]] * 2

transform(image=image, masks=masks)

def test_to_tensor_v2_on_non_contiguous_array_with_random_rotate90():
transforms = A.Compose([
A.RandomRotate90(p=1.0),
ToTensorV2(),
])

img = np.random.randint(0, 256, (640, 480, 3)).astype(np.uint8)
masks = [np.random.randint(0, 2, (640, 480)).astype(np.uint8) for _ in range(4)]
transformed = transforms(image=img, masks=masks)
assert transformed["image"].numpy().shape == (3, 640, 480)
assert transformed["masks"][0].shape == (640, 480)

0 comments on commit ef227fd

Please sign in to comment.