Prediction on whole slide histology images

(Joan Gibert Fernandez) #1


I am completely new to this forum so apologize in advance if someone asks something similar (didn’t find any).

I am starting to work with whole slide histology images with different classification purposes (tumor type, subtype, etc). As some of you already know, the files that you manage are extremely high resolution (sometimes 100,000x100,000 pixels and 10GB+). So, as you imagine, I am tiling the image to 224x224 size patches BUT I am kind of stucked with the labeling and/or the patch prediction aggregation. Since I do not have enough time to manually curate every patch and see if the sample have or not tumor tissue, I am more prone to use the second approach (differently from the breast dataset in kaggle). In order to do this I found this approach linked from this post that could solve my problem (the whole git is based on PyTorch, so great point here).

However, I would like to know if this could be implemented using fastai library. Any advice on this?



(Joan Gibert Fernandez) #2

Hi @imrandude,

I found your post some hours ago.

How did you implement fastai pipeline using whole slide images? Did you tile and input them as a databunch?



(Joan Gibert Fernandez) #3

As an update on the issue, I found this thread in tensorflow forum. Seems that decreasing batch size to 1 and with a CPU, you could input kind of a big image without tiling.

Guess that it would take forever to train but I would give it a try. Any thoughts on this?


(Imran) #4

What is the type of tissue sample you are working with? Is your requirement to create a mask on whole slide images or any other?


(Joan Gibert Fernandez) #5


I am actually doing quite a “simple” binary classification using TCGA whole slide images from Digital Slide Archive. Concretely, I want to build a CNN that differentiates LUAD from LUSC WSI.

As you may imagine, the WSI have not only tumoral tissue, so I am not sure which is the best way to 1) tile the WSI (if necessary) 2) train 3) predict and 4) merge predictions in a meaningful way (there is a great post about this in my first comment)

Any thoughts? :slight_smile:


(Imran) #6

Just in case you missed it from the original medium post, the code below is the implementation.

Now I have not tried this with FastAI, but given that the paper has used ResNet for patch classification, we can use FastAI for much more effective training.


(Joan Gibert Fernandez) #7

Yes, I end up in the post because of the paper published with this git. I guess that I could try to tile the images and use them for the training using fastai library.

However, my first post was in the direction on how to manage the prediction of the tiles in the test set in fastai. Since the WSI have non-tunoral tissue, I was wondering if fastai has some kind of function to deal with this ‘merging predictions’ issue. Do you have any idea?

Hope now is clearer what I was asking and thank you for the feedback!