Skip to content

Commit

Permalink
Adds Anchor tests (pytorch#2971)
Browse files Browse the repository at this point in the history
* tries adding anchor tests

* fixes lint

* tries fixing

* tries one more time

* fixes the test
  • Loading branch information
oke-aditya authored and vfdev-5 committed Dec 4, 2020
1 parent 2b08579 commit d3fdb71
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_models_detection_anchor_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import torch
import unittest
from torchvision.models.detection.anchor_utils import AnchorGenerator
from torchvision.models.detection.image_list import ImageList


class Tester(unittest.TestCase):
def test_incorrect_anchors(self):
incorrect_sizes = ((2, 4, 8), (32, 8), )
incorrect_aspects = (0.5, 1.0)
anc = AnchorGenerator(incorrect_sizes, incorrect_aspects)
image1 = torch.randn(3, 800, 800)
image_list = ImageList(image1, [(800, 800)])
feature_maps = [torch.randn(1, 50)]
self.assertRaises(ValueError, anc, image_list, feature_maps)

0 comments on commit d3fdb71

Please sign in to comment.