question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LabelSampler Memory Consumption

See original GitHub issue

Hi All, I am using Label Sampler as follows:

psize = (144,144,80)
sampler = torchio.data.LabelSampler(psize)
patches_queue = torchio.Queue(subjects_dataset, max_length=1,
                                samples_per_volume=1,
                                sampler=sampler, num_workers=4,
                                shuffle_subjects=False, shuffle_patches=True, verbose=False)

The LabelSampler seems to consume CPU memory upwards of 120GB. I have 160ish training images. I am using about 6 augmentations with probability = 0.1.

However, when I use the exact same configuration, but with UniformSampler, the CPU memory requirement is much lesser.

Any reason this is happening? Thanks for your help, Megh

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
meghbhaleraocommented, Dec 29, 2020

Thanks a lot @fepegar for your detailed analysis.

I observed one thing. When I am doing padding for LabelSampler and WeightedSampler as per our discussion here: https://github.com/fepegar/torchio/issues/392 - like this:

psize = (144,144,80)
psize_pad = list(np.asarray(np.round(np.divide(psize,2)), dtype=int))
padder = Pad(psize_pad, padding_mode = 'symmetric') # for modes: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
subject = padder(subject)

By doing this padding I observed that the memory requirement shoots up by a lot (>125GB). I am trying to investigate what the issue might be. Thanks again, Megh

1reaction
meghbhaleraocommented, Dec 27, 2020

Thank you @fepegar. Sure, I will try using WeightedSampler and let you know. Will try making a dummy dataset and let you know. Thanks again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Patch samplers - Training - TorchIO
Samplers are used to randomly extract patches from volumes. They are called with a sample generated by a SubjectsDataset and return a Python...
Read more >
Memory Consumption of DistributedSampler too large when ...
use DistributedSampler as its sampler; it could be find that .tolist() operation would cause many times of memory than original torch.Tensor ...
Read more >
DistributedSampler memory consumption in PyTorch 0.4.0
At runtime each memory consumption is about 8G, when training on single GPUs, single machine; And each memory consumption has increased from ...
Read more >
Stream felte | Listen to felte (Label Sampler) playlist online for free ...
Listen to felte (Label Sampler), a playlist curated by felte on desktop and mobile. ... Public Memory - Lunar (The Sight Below Remix)....
Read more >
Just A Memory | Endangered Species - V4 Visions - Bandcamp
Just A Memory by Endangered Species, released 01 February 2021.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found