mahmoodlab / HIPT

Hierarchical Image Pyramid Transformer - CVPR 2022 (Oral)
Other
509 stars 89 forks source link

name 'get_patch_attention_scores' is not defined #47

Closed Lewislou closed 1 year ago

Lewislou commented 1 year ago

Hi,

Where is the 'get_patch_attention_scores' function?

Here is the error when perform 256 x 256 Demo (Saving Attention Maps Individually)


NameError Traceback (most recent call last) /tmp/ipykernel_3452983/1904309063.py in 4 create_patch_heatmaps_indiv(patch=patch, model256=model256, 5 output_dir=output_dir, fname='patch', ----> 6 cmap=light_jet, device256=device256)

/data1/partitionA/CUHKSZ/histopath_2022/codes/histopathology_pretraining/HIPT/HIPT_4K/hipt_heatmap_utils.py in create_patch_heatmaps_indiv(patch, model256, output_dir, fname, threshold, offset, alpha, cmap, device256) 174 patch1 = patch.copy() 175 patch2 = add_margin(patch.crop((16,16,256,256)), top=0, left=0, bottom=16, right=16, color=(255,255,255)) --> 176 b256_1, a256_1 = get_patch_attention_scores(patch1, model256, device256=device256) 177 b256_1, a256_2 = get_patch_attention_scores(patch2, model256, device256=device256) 178 save_region = np.array(patch.copy())

NameError: name 'get_patch_attention_scores' is not defined

sofileon commented 1 year ago

Hi! I found the get_patch_attention_scores function here HIPT_4K/attention_visualization_utils.py :)