0

I'm trying to pre-process WSI images using PyTorch. I have stored the WSI images in google drive and mounted it to my google colab pro account(which is having 35GB ram) and trying to read them. To read the images, I'm using openslides. Images were in .tiff format.

wsi = openslide.open_slide(path)

The WSI images were around the average size of 100k x 100k pixels and were taken from miccai2020 pathology challenge. When I run the code, the colab runs out of ram and restarts the session. As I noticed the ram runs out while openslide is trying to read the WSI image from the given path. Can anyone identify the issue and give me a solution?

SjAnupa
  • 102
  • 10
  • If that's a regular RGB image, it will require at least 30GB to read the whole thing in. More if it has an alpha channel or is more than 8 bits per channel. – Mark Ransom Sep 07 '21 at 21:40
  • 1
    WSIs are typically not read in all in one go, they are processed tile-wise. Read in a small region, process it, write out the result, then read in the next small region, etc. – Cris Luengo Sep 08 '21 at 03:02
  • You can also read in the whole slide scaled down, to identify the regions of interest, then process only those regions in the tile-wise process. – Cris Luengo Sep 08 '21 at 03:04
  • @MarkRansom it has 35GB, but the issue occurs when initiating given line above. Do openslides has a limit for a image to read? Because image is around 1GB size with mentioned pixel size. – SjAnupa Sep 08 '21 at 07:27
  • Unfortunately I don't know anything about openslide specifically or I might have left an answer instead of a comment. But I do know that image files are often compressed so you can't judge their memory requirements by the file size. You're talking about a 10 gigapixel image, which is huge by anybody's standards. – Mark Ransom Sep 08 '21 at 14:47

0 Answers0