This save is very simple, because after using pytorch to load the FashionMNIST data set, such a file will be generated
There are two files inside
So loading is very simple
import torch
import cv2
import numpy as np
train_data=torch.load("training.pt")[0].numpy()
test_data=torch.load("test.pt")[0].numpy()
print(train_data.shape)
print(test_data.shape)
#print(test_data[0])
for i in range(train_data.shape[0]):
cv2.imwrite("train\\"+str(i)+".jpg",train_data[i][:,:,np.newaxis])
for i in range(test_data.shape[0]):
cv2.imwrite("test\\"+str(i)+".jpg",test_data[i][:,:,np.newaxis])
Create new train and test folders under the path before running
operation result