Skip to content

Commit 481ef51

Browse files
authored
Adds Anchor tests (#2971)
* tries adding anchor tests * fixes lint * tries fixing * tries one more time * fixes the test
1 parent 120f70f commit 481ef51

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import torch
2+
import unittest
3+
from torchvision.models.detection.anchor_utils import AnchorGenerator
4+
from torchvision.models.detection.image_list import ImageList
5+
6+
7+
class Tester(unittest.TestCase):
8+
def test_incorrect_anchors(self):
9+
incorrect_sizes = ((2, 4, 8), (32, 8), )
10+
incorrect_aspects = (0.5, 1.0)
11+
anc = AnchorGenerator(incorrect_sizes, incorrect_aspects)
12+
image1 = torch.randn(3, 800, 800)
13+
image_list = ImageList(image1, [(800, 800)])
14+
feature_maps = [torch.randn(1, 50)]
15+
self.assertRaises(ValueError, anc, image_list, feature_maps)

0 commit comments

Comments
 (0)