Skip to content

Commit 53e9dfe

Browse files
authored
feat: Removes warnings for torchvision and matplotlib (#224)
* feat: Removes torchvision warnings * feat: Removes matplotlib warnings
1 parent 88eb30f commit 53e9dfe

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies = [
3737
# cf. https://github.com/pytorch/vision/issues/4934
3838
# https://github.com/frgfm/Holocron/security/dependabot/5
3939
"Pillow>=8.4.0,!=9.2.0",
40-
"matplotlib>=3.0.0,<4.0.0",
40+
"matplotlib>=3.7.0,<4.0.0",
4141
]
4242

4343
[project.optional-dependencies]

tests/test_methods_activation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def test_base_cam_constructor(mock_img_model):
9-
model = mobilenet_v2(pretrained=False).eval()
9+
model = mobilenet_v2(weights=None).eval()
1010
for p in model.parameters():
1111
p.requires_grad_(False)
1212
# Check that multiple target layers is disabled for base CAM
@@ -39,7 +39,7 @@ def _verify_cam(activation_map, output_size):
3939
],
4040
)
4141
def test_img_cams(cam_name, target_layer, fc_layer, num_samples, output_size, batch_size, mock_img_tensor):
42-
model = mobilenet_v2(pretrained=False).eval()
42+
model = mobilenet_v2(weights=None).eval()
4343
for p in model.parameters():
4444
p.requires_grad_(False)
4545
kwargs = {}

tests/test_methods_gradient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _verify_cam(activation_map, output_size):
2626
],
2727
)
2828
def test_img_cams(cam_name, target_layer, output_size, batch_size, mock_img_tensor):
29-
model = mobilenet_v2(pretrained=False).eval()
29+
model = mobilenet_v2(weights=None).eval()
3030
for p in model.parameters():
3131
p.requires_grad_(False)
3232

@@ -79,7 +79,7 @@ def test_video_cams(cam_name, target_layer, output_size, mock_video_model, mock_
7979

8080

8181
def test_smoothgradcampp_repr():
82-
model = mobilenet_v2(pretrained=False).eval()
82+
model = mobilenet_v2(weights=None).eval()
8383

8484
# Hook the corresponding layer in the model
8585
with gradient.SmoothGradCAMpp(model, "features.18.0") as extractor:

tests/test_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

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

torchcam/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
55

66
import numpy as np
7-
from matplotlib import cm
7+
from matplotlib import colormaps as cm
88
from PIL import Image
99

1010

0 commit comments

Comments
 (0)