(self)
| 14 | |
| 15 | class TestVisualizer(unittest.TestCase): |
| 16 | def _random_data(self): |
| 17 | H, W = 100, 100 |
| 18 | N = 10 |
| 19 | img = np.random.rand(H, W, 3) * 255 |
| 20 | boxxy = np.random.rand(N, 2) * (H // 2) |
| 21 | boxes = np.concatenate((boxxy, boxxy + H // 2), axis=1) |
| 22 | |
| 23 | def _rand_poly(): |
| 24 | return np.random.rand(3, 2).flatten() * H |
| 25 | |
| 26 | polygons = [[_rand_poly() for _ in range(np.random.randint(1, 5))] for _ in range(N)] |
| 27 | |
| 28 | mask = np.zeros_like(img[:, :, 0], dtype=np.bool) |
| 29 | mask[:10, 10:20] = 1 |
| 30 | |
| 31 | labels = [str(i) for i in range(N)] |
| 32 | return img, boxes, labels, polygons, [mask] * N |
| 33 | |
| 34 | @property |
| 35 | def metadata(self): |
no outgoing calls
no test coverage detected