Open rst1991 opened 1 year ago
@cchen-cc Can you please help in generating pseudolabels. I am not able to visualize it.
After reading the data from .npz files, you can then plot it out.
@cchen-cc I am able to read data from .npz file but I am not able to plot it.
import matplotlib.pyplot as plt import numpy as np from numpy import load from torchvision import transforms from PIL import Image import PIL
data = load('/data3/sfd/SFDA-DPL-main/generate_pseudo/pseudolabel_D2.npz', allow_pickle=True) lst = data.files for item in lst: print(item) print(data[item]) my_array=data[data.files[0]]
dfile = "/data3/sfd/SFDA-DPL-main/generate_pseudo/pseudolabel_D2.npz" images = np.load(dfile,allow_pickle=True)["arr_0"] tensor=images tran = transforms.ToPILImage() img = tran(tensor) img.show()
You can use plt.imshow() to plot the image.
@cchen-cc import matplotlib.pyplot as plt import numpy as np from torchvision import transforms from PIL import Image import PIL
dfile = "/data3/sfd/SFDA-DPL-main/generate_pseudo/pseudolabel_D2.npz" images = np.load(dfile,allow_pickle=True)["arr_0"] plt.imshow(images)
Traceback (most recent call last):
File "readlabel.py", line 51, in
Pseudolabels are saved in .npz format. How to visualize it ?