Skip to content

Commit

Permalink
feat: Removes torchvision warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm committed Oct 19, 2023
1 parent 88eb30f commit 72d9e33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/test_methods_activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def test_base_cam_constructor(mock_img_model):
model = mobilenet_v2(pretrained=False).eval()
model = mobilenet_v2(weights=None).eval()
for p in model.parameters():
p.requires_grad_(False)
# Check that multiple target layers is disabled for base CAM
Expand Down Expand Up @@ -39,7 +39,7 @@ def _verify_cam(activation_map, output_size):
],
)
def test_img_cams(cam_name, target_layer, fc_layer, num_samples, output_size, batch_size, mock_img_tensor):
model = mobilenet_v2(pretrained=False).eval()
model = mobilenet_v2(weights=None).eval()
for p in model.parameters():
p.requires_grad_(False)
kwargs = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_methods_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _verify_cam(activation_map, output_size):
],
)
def test_img_cams(cam_name, target_layer, output_size, batch_size, mock_img_tensor):
model = mobilenet_v2(pretrained=False).eval()
model = mobilenet_v2(weights=None).eval()
for p in model.parameters():
p.requires_grad_(False)

Expand Down Expand Up @@ -79,7 +79,7 @@ def test_video_cams(cam_name, target_layer, output_size, mock_video_model, mock_


def test_smoothgradcampp_repr():
model = mobilenet_v2(pretrained=False).eval()
model = mobilenet_v2(weights=None).eval()

# Hook the corresponding layer in the model
with gradient.SmoothGradCAMpp(model, "features.18.0") as extractor:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def test_classification_metric():
model = mobilenet_v3_small(pretrained=False)
model = mobilenet_v3_small(weights=None)
with LayerCAM(model, "features.12") as extractor:
metric = metrics.ClassificationMetric(extractor, partial(torch.softmax, dim=-1))

Expand Down

0 comments on commit 72d9e33

Please sign in to comment.