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.

using a GridSampler with a Queue

See original GitHub issue

Right now this doesn’t exactly make sense, e.g. you need to pass samples_per_volume to Queue which is not quite coherent, and it’s not clear how to pass arguments (specifically patch_overlap) to the GridSampler.

(Use case: I want my validation to be done deterministically and from the entire image which is however too big to be segmented in a single pass, even without gradients. I guess there are also some minor issues with computing validation metrics on the patches rather than after stitching the patches but this is a start.)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
fepegarcommented, Apr 22, 2020

If you don’t need to assemble the volume, you can still use the code from the notebook minus the aggregator bits. Here’s some pseudocode:

metrics = {}
for each sample in validation dataset:
    get tensor from sample
    sampler = grid_sampler(tensor)
    metrics_subject = []
    for patch in sampler:
        patch_x, patch_y = prepare_patch(patch)
        metric = get_metric(patch_x, patch_y)
        metrics_subject.append(metric)
    metrics[subject] = metrics_subject

After thinking a bit more and looking at the code, I think the problem with the snippet above is that the GridSampler should take a sample as input, not just a tensor, like the other samplers. I’ll see what I can do and come up with a solution.

0reactions
allcontributors[bot]commented, May 15, 2020

@fepegar

I’ve put up a pull request to add @bcdarwin! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Queue with different samples_per_volume for each volume
Ideally, one would set sample_per_volume=number_of_2D_slices in combination to UniformSampler. To avoid this, I was tempted to use GridSampler, however, ...
Read more >
Patch samplers - Training - TorchIO
A patches list is filled with patches extracted by the sampler, and the queue is shuffled once it has reached a specified maximum...
Read more >
Using Queues - SAS Help Center
By using multiple queues, you can control the workflow of jobs that are processed on the grid. By default, SAS uses a queue...
Read more >
TorchIO: Tools for loading, augmenting and writing 3D ...
torchio is a Python package containing a set of tools to efficiently read, sample and write 3D medical images in deep learning applications ......
Read more >
TorchIO tutorial.ipynb - Colaboratory - Google Colab
In this tutorial, we will train a 3D U-Net to perform brain segmentation from T1-weighted MRI using the Information eXtraction from Images (IXI)...
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