diff --git a/pyproject.toml b/pyproject.toml index b929f91..21d2bec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] diff --git a/tests/test_methods_activation.py b/tests/test_methods_activation.py index 56841da..76f7f7e 100644 --- a/tests/test_methods_activation.py +++ b/tests/test_methods_activation.py @@ -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 @@ -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 = {} diff --git a/tests/test_methods_gradient.py b/tests/test_methods_gradient.py index 0def8eb..aa54a2c 100644 --- a/tests/test_methods_gradient.py +++ b/tests/test_methods_gradient.py @@ -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) @@ -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: diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 8c5230d..d3e2f30 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -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)) diff --git a/torchcam/utils.py b/torchcam/utils.py index 877b66a..8428baa 100644 --- a/torchcam/utils.py +++ b/torchcam/utils.py @@ -4,7 +4,7 @@ # See LICENSE or go to for full license details. import numpy as np -from matplotlib import cm +from matplotlib import colormaps as cm from PIL import Image