示例#1
0
def test_point_assigner_with_empty_boxes_and_gt():
    """Test corner case where an image might predict no points and no gt."""
    self = PointAssigner()
    points = torch.FloatTensor([])
    gt_bboxes = torch.FloatTensor([])
    assign_result = self.assign(points, gt_bboxes)
    assert len(assign_result.gt_inds) == 0
示例#2
0
def test_point_assigner():
    self = PointAssigner()
    points = torch.FloatTensor([[0, 0, 1], [10, 10, 1], [5, 5, 1],
                                [32, 32, 1]]  # [x, y, stride]
                               )
    gt_bboxes = torch.FloatTensor([[0, 0, 10, 9], [0, 10, 10, 19]])
    assign_result = self.assign(points, gt_bboxes)
    expected_gt_inds = torch.LongTensor([1, 2, 1, 0])
    assert torch.all(assign_result.gt_inds == expected_gt_inds)
示例#3
0
def test_point_assigner_with_empty_gt():
    """
    Test corner case where an image might have no true detections
    """
    self = PointAssigner()
    points = torch.FloatTensor([[0, 0, 1], [10, 10, 1], [5, 5, 1],
                                [32, 32, 1]]  # [x, y, stride]
                               )
    gt_bboxes = torch.FloatTensor([])
    assign_result = self.assign(points, gt_bboxes)

    expected_gt_inds = torch.LongTensor([0, 0, 0, 0])
    assert torch.all(assign_result.gt_inds == expected_gt_inds)