def test_overlay_rotated_instances(self):
    (H, W) = (100, 150)
    img = (np.random.rand(H, W, 3) * 255)
    num_boxes = 50
    boxes_5d = torch.zeros(num_boxes, 5)
    boxes_5d[:, 0] = torch.FloatTensor(num_boxes).uniform_(((- 0.1) * W), (1.1 * W))
    boxes_5d[:, 1] = torch.FloatTensor(num_boxes).uniform_(((- 0.1) * H), (1.1 * H))
    boxes_5d[:, 2] = torch.FloatTensor(num_boxes).uniform_(0, max(W, H))
    boxes_5d[:, 3] = torch.FloatTensor(num_boxes).uniform_(0, max(W, H))
    boxes_5d[:, 4] = torch.FloatTensor(num_boxes).uniform_((- 1800), 1800)
    rotated_boxes = RotatedBoxes(boxes_5d)
    labels = [str(i) for i in range(num_boxes)]
    v = Visualizer(img, self.metadata)
    output = v.overlay_instances(boxes=rotated_boxes, labels=labels).get_image()
    self.assertEqual(output.shape, img.shape)
def test_overlay_rotated_instances(self):
    (H, W) = (100, 150)
    img = (np.random.rand(H, W, 3) * 255)
    num_boxes = 50
    boxes_5d = torch.zeros(num_boxes, 5)
    boxes_5d[:, 0] = torch.FloatTensor(num_boxes).uniform_(((- 0.1) * W), (1.1 * W))
    boxes_5d[:, 1] = torch.FloatTensor(num_boxes).uniform_(((- 0.1) * H), (1.1 * H))
    boxes_5d[:, 2] = torch.FloatTensor(num_boxes).uniform_(0, max(W, H))
    boxes_5d[:, 3] = torch.FloatTensor(num_boxes).uniform_(0, max(W, H))
    boxes_5d[:, 4] = torch.FloatTensor(num_boxes).uniform_((- 1800), 1800)
    rotated_boxes = RotatedBoxes(boxes_5d)
    labels = [str(i) for i in range(num_boxes)]
    v = Visualizer(img, self.metadata)
    output = v.overlay_instances(boxes=rotated_boxes, labels=labels).get_image()
    self.assertEqual(output.shape, img.shape)