signal-grad-cam 2.0.0__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of signal-grad-cam might be problematic. Click here for more details.
- {signal_grad_cam-2.0.0/signal_grad_cam.egg-info → signal_grad_cam-2.0.2}/PKG-INFO +2 -2
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/README.md +1 -1
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/setup.py +1 -1
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam/cam_builder.py +6 -7
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2/signal_grad_cam.egg-info}/PKG-INFO +2 -2
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/LICENSE +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/pyproject.toml +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/setup.cfg +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam/__init__.py +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam/pytorch_cam_builder.py +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam/tensorflow_cam_builder.py +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam.egg-info/SOURCES.txt +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam.egg-info/dependency_links.txt +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam.egg-info/not-zip-safe +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam.egg-info/requires.txt +0 -0
- {signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: signal_grad_cam
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: SignalGrad-CAM aims at generalising Grad-CAM to one-dimensional applications, while enhancing usability and efficiency.
|
|
5
5
|
Home-page: https://github.com/samuelepe11/signal_grad_cam
|
|
6
6
|
Author: Samuele Pe
|
|
@@ -159,7 +159,7 @@ See the [open issues](https://github.com/bmi-labmedinfo/signal_grad_cam/issues)
|
|
|
159
159
|
## <i>NEW!</i> Updates in SignalGrad-CAM
|
|
160
160
|
<p align="justify">Compared to previous versions, SignalGrad-CAM now offers the following enhancements:</p>
|
|
161
161
|
|
|
162
|
-
* <p align="justify"><i>Support for regression tasks:</i> SGrad-CAM can now handle regression-based models. Previously, substantial adjustments were required for these tasks, similar to those still needed for segmentation or generative models.</p>
|
|
162
|
+
* <p align="justify"><i>Support for regression tasks:</i> SGrad-CAM can now handle regression-based models. Previously, substantial adjustments were required for these tasks, similar to those still needed for segmentation or generative models, now it is only required to set as True the parameter <i>`is_regression_network`</i> in the constructor function.</p>
|
|
163
163
|
* <p align="justify"><i>Contrastive explanations:</i> Users can generate and visualize contrastive explanations by specifying one or more foil classes via the parameter <i>`contrastive_foil_classes`</i>.</p>
|
|
164
164
|
* <p align="justify"><i>3D-CNN support for videos and volumetric data:</i> After expliciting the time axis in the constructor with the parameter <i>`time_axs`</i>, the same functions used for 1D and 2D data now work seamlessly for 3D-CNNs. Outputs include GIF files for quick visualization of 3D activation maps. For a more detailed analysis, users can also request separate PNG images for each volume slice (across the indicated time axis) or video frame using the parameter <i>`show_single_video_frames`</i>.</p>
|
|
165
165
|
|
|
@@ -136,7 +136,7 @@ See the [open issues](https://github.com/bmi-labmedinfo/signal_grad_cam/issues)
|
|
|
136
136
|
## <i>NEW!</i> Updates in SignalGrad-CAM
|
|
137
137
|
<p align="justify">Compared to previous versions, SignalGrad-CAM now offers the following enhancements:</p>
|
|
138
138
|
|
|
139
|
-
* <p align="justify"><i>Support for regression tasks:</i> SGrad-CAM can now handle regression-based models. Previously, substantial adjustments were required for these tasks, similar to those still needed for segmentation or generative models.</p>
|
|
139
|
+
* <p align="justify"><i>Support for regression tasks:</i> SGrad-CAM can now handle regression-based models. Previously, substantial adjustments were required for these tasks, similar to those still needed for segmentation or generative models, now it is only required to set as True the parameter <i>`is_regression_network`</i> in the constructor function.</p>
|
|
140
140
|
* <p align="justify"><i>Contrastive explanations:</i> Users can generate and visualize contrastive explanations by specifying one or more foil classes via the parameter <i>`contrastive_foil_classes`</i>.</p>
|
|
141
141
|
* <p align="justify"><i>3D-CNN support for videos and volumetric data:</i> After expliciting the time axis in the constructor with the parameter <i>`time_axs`</i>, the same functions used for 1D and 2D data now work seamlessly for 3D-CNNs. Outputs include GIF files for quick visualization of 3D activation maps. For a more detailed analysis, users can also request separate PNG images for each volume slice (across the indicated time axis) or video frame using the parameter <i>`show_single_video_frames`</i>.</p>
|
|
142
142
|
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="signal_grad_cam",
|
|
8
|
-
version="2.0.
|
|
8
|
+
version="2.0.2",
|
|
9
9
|
description="SignalGrad-CAM aims at generalising Grad-CAM to one-dimensional applications, while enhancing usability"
|
|
10
10
|
" and efficiency.",
|
|
11
11
|
keywords="XAI, class activation maps, CNN, time series",
|
|
@@ -108,7 +108,7 @@ class CamBuilder:
|
|
|
108
108
|
"overconfident predictions can cause the Sigmoid to saturate, leading to empty or null "
|
|
109
109
|
"maps. To prevent this, modify your network to output logits directly.\n"
|
|
110
110
|
"Make sure the provided model is set to inference mode ('eval') if using PyTorch. For "
|
|
111
|
-
"TensorFlow/Keras models, ensure the model is built—i.e., it must have defined 'inputs' "
|
|
111
|
+
"TensorFlow/Keras models, ensure the model is built — i.e., it must have defined 'inputs' "
|
|
112
112
|
"and 'output' attributes.\n"
|
|
113
113
|
"Network layers found (name: type):")
|
|
114
114
|
self._get_layers_pool(show=True, extend_search=extend_search)
|
|
@@ -732,9 +732,9 @@ class CamBuilder:
|
|
|
732
732
|
w_idx = 1
|
|
733
733
|
h_idx = 2
|
|
734
734
|
if not self.input_transposed:
|
|
735
|
-
dim_reshape = (data_shape_list[i][
|
|
735
|
+
dim_reshape = (data_shape_list[i][self.time_axs], data_shape_list[i][w_idx], data_shape_list[i][h_idx])
|
|
736
736
|
else:
|
|
737
|
-
dim_reshape = (data_shape_list[i][
|
|
737
|
+
dim_reshape = (data_shape_list[i][self.time_axs], data_shape_list[i][h_idx], data_shape_list[i][w_idx])
|
|
738
738
|
else:
|
|
739
739
|
dim_reshape = (1, data_shape_list[i][self.time_axs])
|
|
740
740
|
if self.time_axs:
|
|
@@ -1318,7 +1318,7 @@ class CamBuilder:
|
|
|
1318
1318
|
return norm
|
|
1319
1319
|
|
|
1320
1320
|
@staticmethod
|
|
1321
|
-
def __print_justify(text: str, n_characters: int =
|
|
1321
|
+
def __print_justify(text: str, n_characters: int = 100) -> None:
|
|
1322
1322
|
"""
|
|
1323
1323
|
Prints a message in a fully justified format within a specified line width.
|
|
1324
1324
|
|
|
@@ -1345,15 +1345,14 @@ class CamBuilder:
|
|
|
1345
1345
|
|
|
1346
1346
|
:return:
|
|
1347
1347
|
- frames: A list of np.ndarrays representing frames to be saved as a GIF animation. This parameter should be
|
|
1348
|
-
|
|
1349
|
-
maps.
|
|
1348
|
+
provided only for 3D (video/volume) explanations and it is set to None for 1D or 2D maps.
|
|
1350
1349
|
"""
|
|
1351
1350
|
frames = []
|
|
1352
1351
|
norm = plt.Normalize(vmin=cam.min(), vmax=cam.max())
|
|
1353
1352
|
time_axs = 0 if self.time_axs is None else self.time_axs
|
|
1354
1353
|
for idx in range(cam.shape[time_axs]):
|
|
1355
1354
|
video_slice = np.take(video, idx, axis=time_axs) if video is not None else None
|
|
1356
|
-
cam_slice =
|
|
1355
|
+
cam_slice = cam[0]
|
|
1357
1356
|
cam_slice = (plt.get_cmap("inferno")(cam_slice / 255)[:, :, :3] * 255).astype(np.uint8)
|
|
1358
1357
|
fig, ax = plt.subplots(figsize=(10, 4), dpi=300)
|
|
1359
1358
|
ax.axis("off")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: signal_grad_cam
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: SignalGrad-CAM aims at generalising Grad-CAM to one-dimensional applications, while enhancing usability and efficiency.
|
|
5
5
|
Home-page: https://github.com/samuelepe11/signal_grad_cam
|
|
6
6
|
Author: Samuele Pe
|
|
@@ -159,7 +159,7 @@ See the [open issues](https://github.com/bmi-labmedinfo/signal_grad_cam/issues)
|
|
|
159
159
|
## <i>NEW!</i> Updates in SignalGrad-CAM
|
|
160
160
|
<p align="justify">Compared to previous versions, SignalGrad-CAM now offers the following enhancements:</p>
|
|
161
161
|
|
|
162
|
-
* <p align="justify"><i>Support for regression tasks:</i> SGrad-CAM can now handle regression-based models. Previously, substantial adjustments were required for these tasks, similar to those still needed for segmentation or generative models.</p>
|
|
162
|
+
* <p align="justify"><i>Support for regression tasks:</i> SGrad-CAM can now handle regression-based models. Previously, substantial adjustments were required for these tasks, similar to those still needed for segmentation or generative models, now it is only required to set as True the parameter <i>`is_regression_network`</i> in the constructor function.</p>
|
|
163
163
|
* <p align="justify"><i>Contrastive explanations:</i> Users can generate and visualize contrastive explanations by specifying one or more foil classes via the parameter <i>`contrastive_foil_classes`</i>.</p>
|
|
164
164
|
* <p align="justify"><i>3D-CNN support for videos and volumetric data:</i> After expliciting the time axis in the constructor with the parameter <i>`time_axs`</i>, the same functions used for 1D and 2D data now work seamlessly for 3D-CNNs. Outputs include GIF files for quick visualization of 3D activation maps. For a more detailed analysis, users can also request separate PNG images for each volume slice (across the indicated time axis) or video frame using the parameter <i>`show_single_video_frames`</i>.</p>
|
|
165
165
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{signal_grad_cam-2.0.0 → signal_grad_cam-2.0.2}/signal_grad_cam.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|