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

Method compute_map

monai/visualize/class_activation_maps.py:194–206  ·  view source on GitHub ↗

Compute the actual feature map with input tensor `x`. Args: x: input to `nn_module`. class_idx: index of the class to be visualized. Default to `None` (computing `class_idx` from `argmax`) layer_idx: index of the target layer if there are multipl

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

Source from the content-addressed store, hash-verified

192 return self.compute_map(torch.zeros(*input_size, device=device), layer_idx=layer_idx, **kwargs).shape
193
194 def compute_map(self, x, class_idx=None, layer_idx=-1):
195 """
196 Compute the actual feature map with input tensor `x`.
197
198 Args:
199 x: input to `nn_module`.
200 class_idx: index of the class to be visualized. Default to `None` (computing `class_idx` from `argmax`)
201 layer_idx: index of the target layer if there are multiple target layers. Defaults to -1.
202
203 Returns:
204 activation maps (raw outputs without upsampling/post-processing.)
205 """
206 raise NotImplementedError()
207
208 def _upsample_and_post_process(self, acti_map, x):
209 # upsampling and postprocessing

Callers 1

feature_map_sizeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected