liveBook · Manning

Shift

As explained in Deep Learning with PyTorch, Second Edition

A data augmentation transform that translates an image or volume by a spatial offset, often with resampling at non-integer positions.

Shift augments a CT sample by moving it a small, random distance along one or more spatial axes. The transformed sample remains useful while helping the model handle positional variation. section 14.6.1

The implementation stores the offset in an affine transformation matrix, creates a sampling grid with affine_grid, and resamples the tensor with grid_sample. section 14.6.1

Random offset

For each of three axes, choose a random value between -1 and 1, multiply it by augmentation_dict['offset'], and place the result in the transformation matrix.

How Deep Learning with PyTorch, Second Edition covers it

How deep it goes
Implements offsets through affine matrices, grid generation, and resampling rather than treating shifting as a surface-level definition.
Examples
Demonstrates random three-axis offsets applied to CT chunks through PyTorch tensor operations.
What it assumes
Assumes familiarity with CT chunks, tensors, affine matrices, and a configurable augmentation pipeline.
What you can do after
Apply random offsets with PyTorch affine_grid and grid_sample inside a CT augmentation pipeline.
How it connects
Connects data augmentation with affine transformation, resampling, translation invariance, and caching order.

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with PyTorch, Second Edition. The section links point to the parts of the book it draws on.