Thanks or the reply!
Wouldn’t this only work if you can first transform your ndarray into a PIL image as transforms.Grayscale requires PIL images?
I get this error: TypeError: img should be PIL Image. Got <class 'numpy.ndarray'>