title: In Image processing after applying the preprocessing technique, why do we need to de-process the images for the further computation of the image
body: <p>Actually, I was working on a guided project on (neural style transfer) in which I came across the concept of preprocessing and then deprocessing of the image. It will be great if anyone can help me in understanding this concept.</p>
  <pre><code>  from torchvision import transforms as T
  
  def preprocess(img_path,max_size = 500):
    image = Image.open(img_path).convert('RGB')
  
    if max(image.size) &gt; max_size:
      size = max_size
    else:
      size = max(image.size)
  
    img_transform = T.Compose([
                               T.Resize(size),
                               T.ToTensor(),
                               T.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
    ])
  
    image = img_transform(image)
    image = image.unsqueeze(0)
    return image
  </code></pre>
  <p>....</p>
  <pre><code># Deprocess image 
  import numpy as np 
  import matplotlib.pyplot as plt 
  
  def deprocess(tensor): 
  
    image = tensor.to('cpu').clone()
    image = image.numpy()
    image = image.squeeze(0) #(1,3,224,224) -&gt; (3,224,224)
    image = image.transpose(1,2,0) #(3,224,224) -&gt; (224,224,3)
    image = image*np.array([0.229, 0.224,0.225])+np.array([0.485,0.456,0.406])
    image = image.clip(0,1)
  
    return image 
  
  content_d = deprocess(content_p)
  style_d = deprocess(style_p)
  print(&quot;Deprecess content :&quot;,content_d.shape)
  print(&quot;Deprocess style :&quot;,style_d.shape)
  
  fig, (ax1,ax2) = plt.subplots(1,2,figsize = (20,10))
  ax1.imshow(content_d)
  ax2.imshow(style_d)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/xxekG.png" rel="nofollow noreferrer">Code Image for preprocessing</a></p>
  <p><a href="https://i.stack.imgur.com/Acq2G.png" rel="nofollow noreferrer">Code Image for deprocessing</a></p>
  <p>I would like to know that can we perform further computation of image by just preprocessed image without actually deprocessing it ?</p>