Skip to content

Commit

Permalink
feat: Removes warnings for torchvision and matplotlib (#224)
Browse files Browse the repository at this point in the history
* feat: Removes torchvision warnings

* feat: Removes matplotlib warnings
  • Loading branch information
frgfm authored Oct 19, 2023
1 parent 88eb30f commit 53e9dfe
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies = [
# cf. https://github.com/pytorch/vision/issues/4934
# https://github.com/frgfm/Holocron/security/dependabot/5
"Pillow>=8.4.0,!=9.2.0",
"matplotlib>=3.0.0,<4.0.0",
"matplotlib>=3.7.0,<4.0.0",
]

[project.optional-dependencies]
Expand Down
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
2 changes: 1 addition & 1 deletion torchcam/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.

import numpy as np
from matplotlib import cm
from matplotlib import colormaps as cm
from PIL import Image


Expand Down

0 comments on commit 53e9dfe

Please sign in to comment.