Python 3.x 在fastai库中使用download_data()和untar_data()
我使用fastai库中的dowload_data()函数从kaggle下载了Fashion MNIST数据集Python 3.x 在fastai库中使用download_data()和untar_data(),python-3.x,image-processing,deep-learning,fast-ai,Python 3.x,Image Processing,Deep Learning,Fast Ai,我使用fastai库中的dowload_data()函数从kaggle下载了Fashion MNIST数据集 downloaded_data=下载_数据(“https://www.kaggle.com/zalando-research/fashionmnist/download“” 输出- PosixPath('/root/.fastai/data/download.tgz') 下载_数据并将其保存为.tgz文件,现在我使用untar_data() path=untar_data('/root/
downloaded_data=下载_数据(“https://www.kaggle.com/zalando-research/fashionmnist/download“”
输出-
PosixPath('/root/.fastai/data/download.tgz')
下载_数据并将其保存为.tgz文件,现在我使用untar_data()
path=untar_data('/root/.fastai/data/download.tgz')
输出-
PosixPath('/root/.fastai/data/download.tgz')
它没有提取.tgz文件。如何在fastai library中使用此数据集?在fastai library中,下载的数据会提供一个
pathlib.PosixPath
文件,而不是确切的文件,您需要使用另一个解压缩库来提取数据
如果您只需要来自fast ai的MNIST数据,这里有一个更简单的方法:
from fastai import datasets
import gzip, pickle
MNIST_URL='http://deeplearning.net/data/mnist/mnist.pkl'
path = datasets.download_data(MNIST_URL, ext='.gz')
with gzip.open(path, 'rb') as f:
((x_train, y_train), (x_valid, y_valid), _) = pickle.load(f, encoding='latin-1')