Esempio n. 1
0
def save_attention_map(self, attention_map):
    """Saves an attention map."""
    medcam_utils.save_attention_map(filename=self.medcam_dict['output_dir'] +
                                    "/" + self.medcam_dict['current_layer'] +
                                    "/attention_map_" +
                                    str(self.medcam_dict['counter']),
                                    attention_map=attention_map,
                                    heatmap=self.medcam_dict['heatmap'])
    self.medcam_dict['counter'] += 1
Esempio n. 2
0
def save_attention_map(self, attention_map, raw_input=None):
    """Saves an attention map."""
    medcam_utils.save_attention_map(filename=self.medcam_dict['output_dir'] +
                                    "/" + self.medcam_dict['current_layer'] +
                                    "/attention_map_" +
                                    str(self.medcam_dict['counter']),
                                    attention_map=attention_map,
                                    heatmap=bool(raw_input is not None),
                                    raw_input=raw_input)
    self.medcam_dict['counter'] += 1
Esempio n. 3
0
def _save_attention_map(self, attention_map, layer_output_dir, j, k,
                        raw_input):
    """Internal method for saving saving an attention map."""
    if self.medcam_dict['save_pickle']:
        self.medcam_dict['pickle_maps'].append(attention_map)
    if self.medcam_dict['save_maps']:
        medcam_utils.save_attention_map(
            filename=layer_output_dir + "/attention_map_" +
            str(self.medcam_dict['counter']) + "_" + str(j) + "_" + str(k),
            attention_map=attention_map,
            heatmap=self.medcam_dict['heatmap'],
            raw_input=raw_input)
Esempio n. 4
0
def save(attention_map, filename, heatmap, raw_input=None):
    medcam_utils.save_attention_map(filename,
                                    attention_map,
                                    heatmap=heatmap,
                                    raw_input=raw_input)
Esempio n. 5
0
def save(attention_map, filename, raw_input=None):
    medcam_utils.save_attention_map(filename, attention_map, heatmap=bool(raw_input is not None), raw_input=raw_input)
Esempio n. 6
0
def save(attention_map, filename, heatmap):
    medcam_utils.save_attention_map(filename, attention_map, heatmap)