signal-grad-cam 0.1.6__tar.gz → 0.1.7__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: signal_grad_cam
3
- Version: 0.1.6
3
+ Version: 0.1.7
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.6",
8
+ version="0.1.7",
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",
@@ -207,12 +207,13 @@ class TorchCamBuilder(CamBuilder):
207
207
  if len(outputs.shape) == 2 and outputs.shape[1] > 1:
208
208
  target_probs = torch.softmax(target_scores, dim=1)
209
209
  else:
210
+ p = torch.sigmoid(outputs)
210
211
  if len(outputs.shape) == 1:
211
212
  target_scores = torch.stack([-outputs, outputs], dim=1)
213
+ target_probs = torch.stack([1 - p, p], dim=1)
212
214
  elif len(outputs.shape) == 2 and outputs.shape[1] == 1:
213
215
  target_scores = torch.cat([-outputs, outputs], dim=1)
214
- p = torch.sigmoid(outputs)
215
- target_probs = torch.stack([1 - p, p], dim=1)
216
+ target_probs = torch.cat([1 - p, p], dim=1)
216
217
 
217
218
  target_probs = target_probs[:, target_class].cpu().detach().numpy()
218
219
 
@@ -222,12 +222,13 @@ class TfCamBuilder(CamBuilder):
222
222
  if len(outputs.shape) == 2 and outputs.shape[1] > 1:
223
223
  target_probs = tf.nn.softmax(target_scores, axis=1)
224
224
  else:
225
+ p = tf.math.sigmoid(outputs)
225
226
  if len(outputs.shape) == 1:
226
227
  target_scores = tf.stack([-outputs, outputs], axis=1)
228
+ target_probs = tf.stack([1 - p, p], axis=1)
227
229
  elif len(outputs.shape) == 2 and outputs.shape[1] == 1:
228
230
  target_scores = tf.concat([-outputs, outputs], axis=1)
229
- p = tf.math.sigmoid(outputs)
230
- target_probs = tf.stack([1 - p, p], axis=1)
231
+ target_probs = tf.concat([1 - p, p], axis=1)
231
232
 
232
233
  target_scores = target_scores[:, target_class]
233
234
  target_probs = target_probs[:, target_class]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: signal-grad-cam
3
- Version: 0.1.6
3
+ Version: 0.1.7
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