Skip to content

Commit f336526

Browse files
authored
Stop detection models from downloading the backbone weights (#4929)
* Stop detection models from downloading the backbone weights * Fix linter
1 parent 1de53be commit f336526

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/test_models_detection_negative_samples.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def test_assign_targets_to_proposals(self):
9999
],
100100
)
101101
def test_forward_negative_sample_frcnn(self, name):
102-
model = torchvision.models.detection.__dict__[name](num_classes=2, min_size=100, max_size=100)
102+
model = torchvision.models.detection.__dict__[name](
103+
num_classes=2, min_size=100, max_size=100, pretrained_backbone=False
104+
)
103105

104106
images, targets = self._make_empty_sample()
105107
loss_dict = model(images, targets)
@@ -108,7 +110,9 @@ def test_forward_negative_sample_frcnn(self, name):
108110
assert_equal(loss_dict["loss_rpn_box_reg"], torch.tensor(0.0))
109111

110112
def test_forward_negative_sample_mrcnn(self):
111-
model = torchvision.models.detection.maskrcnn_resnet50_fpn(num_classes=2, min_size=100, max_size=100)
113+
model = torchvision.models.detection.maskrcnn_resnet50_fpn(
114+
num_classes=2, min_size=100, max_size=100, pretrained_backbone=False
115+
)
112116

113117
images, targets = self._make_empty_sample(add_masks=True)
114118
loss_dict = model(images, targets)
@@ -118,7 +122,9 @@ def test_forward_negative_sample_mrcnn(self):
118122
assert_equal(loss_dict["loss_mask"], torch.tensor(0.0))
119123

120124
def test_forward_negative_sample_krcnn(self):
121-
model = torchvision.models.detection.keypointrcnn_resnet50_fpn(num_classes=2, min_size=100, max_size=100)
125+
model = torchvision.models.detection.keypointrcnn_resnet50_fpn(
126+
num_classes=2, min_size=100, max_size=100, pretrained_backbone=False
127+
)
122128

123129
images, targets = self._make_empty_sample(add_keypoints=True)
124130
loss_dict = model(images, targets)

0 commit comments

Comments
 (0)