Created
December 10, 2021 02:20
-
-
Save e96031413/634dd935b922fc4aef734a563131d6d6 to your computer and use it in GitHub Desktop.
從PyTorch的Tensor資料中,將資料保存成實體圖片檔案
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torchvision.utils import save_image | |
features, imgs, labels, image_path = get_features_trained_weight(model, transform_dataset) | |
img1 = imgs[1] #第1張圖片 | |
img1 = torch.from_numpy(img1) #格式轉換 | |
save_image(img1, 'img1.png') #保存成'img1.png' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment