Skip to content

How to optimize TorchIO's read operation? #568

Answered by fepegar
sarthakpati asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, @sarthakpati. Good question!

It depends. When you instantiate an image, the data is not loaded. If you put it into a subject and you put that subject into a dataset, nothing is loaded until you actually need the data (e.g., for a transform). In the SubjectsDataset the loaded data is from a deep copied version of the subject, so the original instance is untouched. If you do load the data from the original subject instance, you won't need to read from disk every single time. I suppose you could use that approach if you have slow I/O and a lot of RAM.

from contextlib import contextmanager

import torch
import psutil  # installed it with pip
from tqdm import tqdm
import torchio as tio


def 

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
2 replies
@sarthakpati
Comment options

@fepegar
Comment options

Comment options

You must be logged in to vote
7 replies
@sarthakpati
Comment options

@fepegar
Comment options

@Geeks-Sid
Comment options

@romainVala
Comment options

@fepegar
Comment options

Answer selected by sarthakpati
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants