In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "Pytorch Fashion Minst Data Set Reading Method". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn the "Pytorch Fashion Minst Data Set Reading Method" together!
This chapter mainly illustrates the problem of reading data sets, aiming at the problem of reading and writing Fashion Mnist data sets in trochvision;
The specific read training set and test set are:
mnist_train = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=True, download=True, transform=transforms.ToTensor())mnist_test = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=False, download=True, transform=transforms.ToTensor())
There are two parameters to note, train represents whether to participate in training, and the last parameter represents the transformation of the content of the data set into the representation of the tensor;
Batch training can still be done using DataLoader and batch_size;
train_iter = torch.utils.data.DataLoader(mnist_train, batch_size=batch_size, shuffle=True, num_workers=num_workers)test_iter = torch.utils.data.DataLoader(mnist_test, batch_size=batch_size, shuffle=False, num_workers=num_workers)
train_iter, which is a batch data structure, divided into 235 batches according to batch_size;
For each traversal of train_iter, also use the for loop to feed data one by one;
And DataLoader can use multi-thread to read, so the reading time is faster;
start = time.time() for X, y in train_iter: continue print ('%.2f sec' % (time.time() - start)) Thank you for your reading. The above is the content of "Pytorch Fashion Minst Data Set Reading Method". After learning this article, I believe that everyone has a deeper understanding of the Pytorch Fashion Minst Data Set Reading Method. The specific use situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.