dataset数据集下载
时间: 2023-09-15 17:15:29 浏览: 239
Informer模型实战案例(代码+数据集+参数讲解)ProbSparse自注意力机制
5星 · 资源好评率100%
您可以使用以下代码在线下载FashionMNIST数据集:
```python
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())
```
如果您遇到了"RuntimeError: Dataset not found"错误,这可能是由于本地路径错误导致的。请确保路径的格式正确,并在路径末尾添加一个"/"。例如,路径应该是"C:/Users/Lenovos41/Datasets/FashionMNIST/"。
如果您已经下载了数据集,您可以使用以下代码导入数据集,将"root"参数改为您的本地地址:
```python
mnist_train = torchvision.datasets.FashionMNIST(root='C:/Users/Lenovos41/Datasets/FashionMNIST', train=True, download=False, transform=transforms.ToTensor())
mnist_test = torchvision.datasets.FashionMNIST(root='C:/Users/Lenovo-s41/Datasets/FashionMNIST', train=False, download=False, transform=transforms.ToTensor())
```
请注意,下载数据集时,将"download"参数设置为True,而导入数据集时,将"download"参数设置为False,以避免重复下载数据集。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [深度学习-如何下载以及导入Datasets数据集](https://blog.csdn.net/z_mawkish/article/details/105154887)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文