Skip to content

Instantly share code, notes, and snippets.

@fepegar
Created October 14, 2021 16:04
Show Gist options
  • Save fepegar/5d9e66d8302a110975efa932cd1ab2a0 to your computer and use it in GitHub Desktop.
Save fepegar/5d9e66d8302a110975efa932cd1ab2a0 to your computer and use it in GitHub Desktop.
TorchIO Resize demo
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@romainVala
Copy link

This resize transform is very confusing ... Actually I do not see when it may be usefull ?
have you an example where it should be used ?

For this example, I would also add alternative option with tio.Resample, that makes the job correctly, or CropOrPad (although I would recomand resample, to be sure to have the same final field of view (and not just the same dimention)

@fepegar
Copy link
Author

fepegar commented Oct 15, 2021

This is the standard resizing transform found in other frameworks for (2D) augmentation, like imgaug, TorchVision, etc. I added a usage example in the PR: fepegar/torchio#642

I am planning to use it for augmentation of short video clips, because I don't mind that they look slightly distorted.

Maybe it was never a good idea to add it. I recently added a warning to the docs. Hopefully that will make things clear enough.

@romainVala
Copy link

romainVala commented Oct 15, 2021

i may miss the point, but why not using resample, that will keep the ratio unchanged (even for a picture, it is better that having a deformed image ... no?

@fepegar
Copy link
Author

fepegar commented Oct 15, 2021

I have, say, 800x600 videos and I want them to be, say, 200x200. I could resample and crop or pad, or I could just resize, if I don't mind the distortion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment