MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / __call__

Method __call__

monai/visualize/class_activation_maps.py:302–316  ·  view source on GitHub ↗

Compute the activation map with upsampling and postprocessing. Args: x: input tensor, shape must be compatible with `nn_module`. class_idx: index of the class to be visualized. Default to argmax(logits) layer_idx: index of the target layer if the

(self, x, class_idx=None, layer_idx=-1, **kwargs)

Source from the content-addressed store, hash-verified

300 return output.reshape(b, 1, *spatial) # resume the spatial dims on the selected class
301
302 def __call__(self, x, class_idx=None, layer_idx=-1, **kwargs): # type: ignore[override]
303 """
304 Compute the activation map with upsampling and postprocessing.
305
306 Args:
307 x: input tensor, shape must be compatible with `nn_module`.
308 class_idx: index of the class to be visualized. Default to argmax(logits)
309 layer_idx: index of the target layer if there are multiple target layers. Defaults to -1.
310 kwargs: any extra arguments to be passed on to the module as part of its `__call__`.
311
312 Returns:
313 activation maps
314 """
315 acti_map = self.compute_map(x, class_idx, layer_idx, **kwargs)
316 return self._upsample_and_post_process(acti_map, x)
317
318
319class GradCAM(CAMBase):

Callers

nothing calls this directly

Calls 2

compute_mapMethod · 0.95

Tested by

no test coverage detected