binli123 / dsmil-wsi

DSMIL: Dual-stream multiple instance learning networks for tumor detection in Whole Slide Image
MIT License
377 stars 88 forks source link

About multiscale features and execution speed #90

Open Ysc-shark opened 9 months ago

Ysc-shark commented 9 months ago

Hi,thanks for sharing your great work and it really helps me a lot.I have 2 questions to ask.

First,Your paper discusses experiments with 20×+5× multiscale features, showing promising results. However, the downloadable features appear to be only from the single-scale 20× resolution. Could you please provide the 20×+5× features?

Second,I tried running the model on the features you provided, but the model's execution speed is quite slow. It takes nearly 2 days to complete 200 epochs, and the GPU utilization remains around 2% throughout the process. The GPU memory usage is also very low, only consuming a small portion. I'm using a Tesla P100 GPU. Is this normal? How can I improve the execution speed?

Many thanks, Yu Sicheng

GeorgeBatch commented 9 months ago
  1. For multiscale patches and features see: https://github.com/binli123/dsmil-wsi/issues/67
  2. The current code supports 1 slide per batch, so you can not utilise a greater portion of your GPU
  3. Loading features from csv's with pandas, extracting numpy arrays, converting to torch tensors and putting on a GPU is slow. You can go through all csv files once before training and save the features as torch tensors with torch.save() with torhc.float32 data type (so you do not need to convert afterwards). Then, during training, you can load torch tensors with torch.load(). Even faster (but less neat), if you pass your gpu device in a map_location argument of torch.load(), you can load them directly onto your GPU without loading them onto a CPU beforehand.
Ysc-shark commented 9 months ago
  1. For multiscale patches and features see: TCGA-lung: please share the training-validation / test split #67
  2. The current code supports 1 slide per batch, so you can not utilise a greater portion of your GPU
  3. Loading features from csv's with pandas, extracting numpy arrays, converting to torch tensors and putting on a GPU is slow. You can go through all csv files once before training and save the features as torch tensors with torch.save() with torhc.float32 data type (so you do not need to convert afterwards). Then, during training, you can load torch tensors with torch.load(). Even faster (but less neat), if you pass your gpu device in a map_location argument of torch.load(), you can load them directly onto your GPU without loading them onto a CPU beforehand.

Thanks for your reply, it's very helpful to me. I have two more questions to ask

  1. Regarding multi-scale patches, in #67, you mentioned encountering issues when downloading TCGA Multiscale features. I've encountered the same problem. Have you solved it?
  2. I'm currently using the scripts deepzoom_tiler.py and compute_feats.py from this project to extract features. However, for the Camelyon16 dataset, as far as I understand, there are slides with both 20× and 40× magnifications. If I want to extract patches with 20×+5× magnifications, is the following command correct? _python deepzoomtiler.py -m 0 2 -b 20 -d CAMELYON16 -v tif In the readme.md, the author mentioned: Camelyon16 consists of mixed magnifications so to reproduce: _python deepzoomtiler.py -m 1 -b 20 -d Camelyon16 -v tif Does this mean that for the Camelyon16 dataset, m=1 corresponds to 20× resolution?
GeorgeBatch commented 9 months ago

@Ysc-shark

  1. For me, the downloaded multiscale features were split into separate zip files. I extracted the contents and put them together. There were no other complications.
  2. This command python deepzoom_tiler.py -m 0 2 -b 20 -d CAMELYON16 -v tif will extract patches with 20×+5× magnifications under 2 conditions:
Ysc-shark commented 8 months ago

@Ysc-shark

  1. For me, the downloaded multiscale features were split into separate zip files. I extracted the contents and put them together. There were no other complications.
  2. This command python deepzoom_tiler.py -m 0 2 -b 20 -d CAMELYON16 -v tif will extract patches with 20×+5× magnifications under 2 conditions:

Thanks a lot