mahmoodlab / CLAM

Data-efficient and weakly supervised computational pathology on whole slide images - Nature Biomedical Engineering
http://clam.mahmoodlab.org
GNU General Public License v3.0
1.02k stars 340 forks source link

Error in plotting heatmap #192

Closed dawalisi closed 5 months ago

dawalisi commented 1 year ago

Here the coords are lists and this statement can only read individual coords image image

invisprints commented 1 year ago

I also meet some errors when I run CUDA_VISIBLE_DEVICES=0,1 python create_heatmaps.py --config config_template.yaml. It says:

Traceback (most recent call last):
  File "~/CLAM/create_heatmaps.py", line 371, in <module>
    compute_from_patches(wsi_object=wsi_object, clam_pred=Y_hats[0], model=model, feature_extractor=feature_extractor, batch_size=exp_args.batch_size, **wsi_kwargs,
  File "~/CLAM/vis_utils/heatmap_utils.py", line 77, in compute_from_patches
    A[score_idx] = score2percentile(A[score_idx], ref_scores)
ValueError: could not broadcast input array from shape (195,) into shape (1,)

I haven't made any changes to the code and config.

vlermakov commented 1 year ago

@invisprints I had the same issue, and fixed it by changing this one line in heatmap_utils.py: line 23

def score2percentile(score, ref): percentile = percentileofscore(ref.squeeze(), score.squeeze()) return percentile

hemo0826 commented 7 months ago

@invisprints I had the same issue, and fixed it by changing this one line in heatmap_utils.py: line 23

def score2percentile(score, ref): percentile = percentileofscore(ref.squeeze(), score.squeeze()) return percentile

image Hello and thank you for your advice! After I changed the code as you suggested, it appears to take up a lot of existing memory when running create_heatmaps! May I ask if you are in the same situation?

fedshyvana commented 5 months ago

Hi, it appears you are trying to create the heatmap at a very high resolution. You can change vis_level in the config file to be larger (i.e. lower resolution).