Using np.clip, np.transpose and plt.imshow for Image Processing

np.clip(reconstructed,0,1)
plt.imshow(np.transpose(reconstructed,(1,2,0)))
plt.show()
  1. The first line uses np.clip to restrict the values in the array reconstructed to be between 0 and 1. This is done to make sure that the image data falls within a valid range for image representation.
  2. The second line uses np.transpose to change the dimensions of the reconstructed array from (C,H,W) to (H,W,C), where C is the number of channels (e.g. RGB), H is the height, and W is the width. Uses plt.imshow to display the image using Matplotlib, a plotting library.
  3. The thir line calls plt.show to actually display the image.