Useful Tip: Transforms supported for point regression, `TensorPoint`

I’ve always been confused as to which transforms work for keypoints (or anything else) as our y's get transformed depending on the x. In v2 you can look at the type dispatch for which transforms can be applied for what. I thought I’d make a quick list for those that need to know for their problems. This is especially useful as in most of the recent papers, the only augmentation I’ve seen is a flip left right or a rotation, and fastai offers a bit more than that!

General Augmentation (Push to the GPU/Batch transforms):

  • Rotate, FlipItem, DihedralItem, Zoom, Warp, FlipBatch
  • RandomResizedCropGPU

Cropping (Initial CPU transforms):

  • CropPad, RandomCrop, Resize, RandomResizedCrop

Hope this helps someone :slight_smile:

For those that are wanting to see the source code to understand what I mean, see here:


Best would be to use the GPU versions, since they’re quite a bit faster.

1 Like

Noted! I’ll edit them in :slight_smile: Thanks. Actually @jeremy I can’t seem to find the GPU versions, only for RandomResizedCrop. Am I looking at the right spot?

IIRC all the affine tfms are GPU - and there’s also flip_batch. Best to check the notebook, rather than the auto-generated py file.


Got it :slight_smile: I thought I had heard something like that. Thanks for solidifying that for me!