A way to reverse the normalization does not seem to exist. However it is pretty straightforward to create a simple class that does so.
def __init__(self, mean, std):
self.mean = mean
self.std = std
def __call__(self, tensor):
tensor (Tensor): Tensor image of size (C, H, W) to be normalized.
Tensor: Normalized image.
for t, m, s in zip(tensor, self.mean, self.std):
# The normalize code -> t.sub_(m).div_(s)
You instantiate it with the same arguments used for the normalize. and then use it the same way
unorm = UnNormalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225))