signal-grad-cam 0.1.4__tar.gz → 0.1.6__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-0.1.4 → signal_grad_cam-0.1.6}/PKG-INFO +1 -1
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/setup.py +1 -1
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam/cam_builder.py +19 -19
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam.egg-info/PKG-INFO +1 -1
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/LICENSE +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/README.md +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/pyproject.toml +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/setup.cfg +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam/__init__.py +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam/pytorch_cam_builder.py +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam/tensorflow_cam_builder.py +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam.egg-info/SOURCES.txt +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam.egg-info/dependency_links.txt +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam.egg-info/not-zip-safe +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam.egg-info/requires.txt +0 -0
- {signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/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: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
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
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="signal_grad_cam",
|
|
8
|
-
version="0.1.
|
|
8
|
+
version="0.1.6",
|
|
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",
|
|
@@ -92,15 +92,20 @@ class CamBuilder:
|
|
|
92
92
|
# Show available 1D or 2D convolutional layers
|
|
93
93
|
print()
|
|
94
94
|
print("SEARCHING FOR NETWORK LAYERS:")
|
|
95
|
-
self.__print_justify("Please
|
|
96
|
-
"and note the names of the layers that are of interest to you. If the desired
|
|
97
|
-
" present in the
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
95
|
+
self.__print_justify("Please verify that your network contains at least one 1D or 2D convolutional layer, "
|
|
96
|
+
"and take note of the names of the layers that are of interest to you. If the desired "
|
|
97
|
+
"layer is not present in the list below, it can still be accessed using the name by which "
|
|
98
|
+
"it is defined in the network.\n"
|
|
99
|
+
"Also, check whether the model ends with an activation function from the Softmax family "
|
|
100
|
+
"(such as Sigmoid or Softmax). Even if this activation function is not listed below, you "
|
|
101
|
+
"must indicate its presence using the appropriate argument in the 'get_cam' function. "
|
|
102
|
+
"Note that in binary classification networks (those ending with a Sigmoid function), "
|
|
103
|
+
"overconfident predictions can cause the Sigmoid to saturate, leading to empty or null "
|
|
104
|
+
"maps. To prevent this, modify your network to output logits directly.\n"
|
|
105
|
+
"Make sure the provided model is set to inference mode ('eval') if using PyTorch. For "
|
|
106
|
+
"TensorFlow/Keras models, ensure the model is built—i.e., it must have defined 'inputs' "
|
|
107
|
+
"and 'output' attributes.\n"
|
|
108
|
+
"Network layers found (name: type):")
|
|
104
109
|
self._get_layers_pool(show=True, extend_search=extend_search)
|
|
105
110
|
print()
|
|
106
111
|
|
|
@@ -192,7 +197,7 @@ class CamBuilder:
|
|
|
192
197
|
extra_preprocess_inputs_list=
|
|
193
198
|
extra_preprocess_inputs_list,
|
|
194
199
|
extra_inputs_list=extra_inputs_list,
|
|
195
|
-
|
|
200
|
+
eps=eps)
|
|
196
201
|
item_key = explainer_type + "_" + target_layer + "_class" + str(target_class)
|
|
197
202
|
cams_dict.update({item_key: cam_list})
|
|
198
203
|
predicted_probs_dict.update({item_key: output_probs})
|
|
@@ -578,8 +583,8 @@ class CamBuilder:
|
|
|
578
583
|
data_shape_list_processed = [tuple(data_element.shape) for data_element in data_list]
|
|
579
584
|
if len(set(data_shape_list_processed)) != 1:
|
|
580
585
|
data_list = [np.resize(x, data_shape_list_processed[0]) for x in data_list]
|
|
581
|
-
self.__print_justify("
|
|
582
|
-
"first item's dimensions for batching. To prevent this, provide one item at a "
|
|
586
|
+
self.__print_justify("\nInput data items have different shapes. Each item has been reshaped to match the"
|
|
587
|
+
" first item's dimensions for batching. To prevent this, provide one item at a "
|
|
583
588
|
"time.")
|
|
584
589
|
|
|
585
590
|
cam_list, target_probs = self._create_raw_batched_cams(data_list, target_class, target_layer, explainer_type,
|
|
@@ -691,7 +696,7 @@ class CamBuilder:
|
|
|
691
696
|
norm = self.__get_norm(map)
|
|
692
697
|
|
|
693
698
|
if map.shape[1] == 1:
|
|
694
|
-
aspect = int(map.shape[0] / aspect_factor) if map.shape[0]
|
|
699
|
+
aspect = int(map.shape[0] / aspect_factor) if map.shape[0] > aspect_factor else 100
|
|
695
700
|
map = np.transpose(map)
|
|
696
701
|
else:
|
|
697
702
|
if is_2d_layer:
|
|
@@ -706,14 +711,9 @@ class CamBuilder:
|
|
|
706
711
|
self.__set_colorbar(bar_ranges, i)
|
|
707
712
|
|
|
708
713
|
# Set title
|
|
709
|
-
'''if map.shape[0] > 1 and is_2d_layer:
|
|
710
|
-
title_h = 1
|
|
711
|
-
plt.subplots_adjust(top=0.85, bottom=0.2)
|
|
712
|
-
else:
|
|
713
|
-
title_h = 0.98'''
|
|
714
714
|
plt.title("CAM for class '" + str(self.class_names[target_class]) + "' (confidence = " +
|
|
715
715
|
str(np.round(predicted_probs[i] * 100, 2)) + "%) - true label " +
|
|
716
|
-
str(self.class_names[data_labels[i]]))
|
|
716
|
+
str(self.class_names[data_labels[i]]))
|
|
717
717
|
|
|
718
718
|
# Set axis
|
|
719
719
|
self.__set_axes(map, data_sampling_freq, dt, channel_names, time_names=time_names, axes_names=axes_names)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: signal-grad-cam
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{signal_grad_cam-0.1.4 → signal_grad_cam-0.1.6}/signal_grad_cam.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|