Closed f-amerehi closed 1 year ago
Hello :)
For purely visualization purposes, the images are clipped to mean +- 2.5 * std before normalizing to [0, 1]. There is an example of this in the code where the images are logged.
If you naively normalize to [0,1], the extreme pixel values in the distilled images will result in low overall visual contrast.
Hope this helps! If not, could you share what your images look like?
Thank you @GeorgeCazenavette very much for quick reply! Here you are these are the images
The code is also here:
images = torch.load("imagefruit/images_best.pt")
labels = torch.load("imagefruit/labels_best.pt")
v = images
v_min = torch.min(v)
v_max = torch.max(v)
new_max = 1
new_min=0
v_p = (v - v_min)/(v_max - v_min)*(new_max - new_min) + new_min
col = 5
rows = math.ceil(len(v_p)/col)
fig,axs = plt.subplots(rows,col,figsize=(col*2,rows*2))
for (i,ax) in enumerate(axs.flatten()):
image = v_p[i]
pic = image.numpy().transpose((1,2,0))
ax.imshow(pic)
ax.axis('off')
plt.tight_layout()
plt.show()
Yeah your images look correct, they'll just be prettier if you clip them before normalizing.
Check the section at line 256 of distill.py (I would link it directly, but I can't figure out how to do that from my phone.)
Thank you @GeorgeCazenavette so much!
Hi @GeorgeCazenavette
Hope that all is well. I'm trying to load images via
images = torch.load("imagefruit/images_best.pt")
. However, when I try to plot them, I get the error ofHow can I normalize the data? I tried minmax normalization but the outputs are opaque and not similar to the ones that you have in the here.
Thanks