Skip to content
Snippets Groups Projects
Unverified Commit b44048ae authored by Zaida Zhou's avatar Zaida Zhou Committed by GitHub
Browse files

[Fix] Fix failed unit tests caused by the new released numpy (#838)

* [Fix] Fix failed unit tests caused by the new released numpy

* minor fix
parent 4147e976
No related branches found
No related tags found
No related merge requests found
......@@ -364,21 +364,21 @@ class TestVisualizer(TestCase):
visualizer.draw_polygons(torch.tensor([[1, 1], [2, 2], [16, 4]]))
def test_draw_binary_masks(self):
binary_mask = np.random.randint(0, 2, size=(10, 10)).astype(np.bool)
binary_mask = np.random.randint(0, 2, size=(10, 10)).astype(bool)
visualizer = Visualizer(image=self.image)
visualizer.draw_binary_masks(binary_mask)
visualizer.draw_binary_masks(torch.from_numpy(binary_mask))
# multi binary
binary_mask = np.random.randint(0, 2, size=(2, 10, 10)).astype(np.bool)
binary_mask = np.random.randint(0, 2, size=(2, 10, 10)).astype(bool)
visualizer = Visualizer(image=self.image)
visualizer.draw_binary_masks(binary_mask, colors=['r', (0, 255, 0)])
# test the error that the size of mask and image are different.
with pytest.raises(AssertionError):
binary_mask = np.random.randint(0, 2, size=(8, 10)).astype(np.bool)
binary_mask = np.random.randint(0, 2, size=(8, 10)).astype(bool)
visualizer.draw_binary_masks(binary_mask)
# test non binary mask error
binary_mask = np.random.randint(0, 2, size=(10, 10, 3)).astype(np.bool)
binary_mask = np.random.randint(0, 2, size=(10, 10, 3)).astype(bool)
with pytest.raises(AssertionError):
visualizer.draw_binary_masks(binary_mask)
......@@ -495,7 +495,7 @@ class TestVisualizer(TestCase):
def test_chain_call(self):
visualizer = Visualizer(image=self.image)
binary_mask = np.random.randint(0, 2, size=(10, 10)).astype(np.bool)
binary_mask = np.random.randint(0, 2, size=(10, 10)).astype(bool)
visualizer.draw_bboxes(torch.tensor([1, 1, 2, 2])). \
draw_texts('test', torch.tensor([5, 5])). \
draw_lines(x_datas=torch.tensor([1, 5]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment