Workaround is to use opencv_transforms instead which works properly, it is a rewrite of Pytorch’s transforms to be OpenCV based instead of PIL, so it’s also faster:

  
      
      GitHub
  
  
    

jbohnslav/opencv_transforms 10

OpenCV implementation of Torchvision's image augmentations - jbohnslav/opencv_transforms