The raised ValueError is actually raised from the numpy array pic, which apparently does not have three dimensions:
x = np.random.randn(10, 10)
x.transpose((2, 0, 1))
> ValueError: axes don't match array

Could you print the shape of image before passing it to the transformation?