模块:tf.keras.datasets。设置下载数据集的位置(目录)
Module: tf.keras.datasets. Set where (directory) to download the dataset
我正在使用 tf.keras.datasets 下载 CIFAR 10 数据集,我想知道图像的下载位置。
我一直在寻找是否有设置下载图片位置的功能,但我没有找到。我在 Internet 上搜索过,唯一找到的是如何使用 Tensorflow 创建我自己的数据集。
我的代码是:
from tensorflow.keras import datasets
(train_images, train_labels), (test_images, test_labels) = datasets.cifar10.load_data()
# Normalize pixel values to be between 0 and 1
train_images, test_images = train_images / 255.0, test_images / 255.0
在使用load_data()
功能之前如何设置下载图片的位置?
根据 source, the output (train_images, train_labels), (test_images, test_labels)
are "Tuple of Numpy arrays". Therefore, when you call load_data()
they are loaded into your memory from their origin (https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz). If you want to download them as well, you will have to do that separately on your own (some inspiration could be taken from here)。请记住,函数名称是 load_data()
,而不是 download_data()
,其中 load
指的是内存,download
指的是磁盘。
我正在使用 tf.keras.datasets 下载 CIFAR 10 数据集,我想知道图像的下载位置。
我一直在寻找是否有设置下载图片位置的功能,但我没有找到。我在 Internet 上搜索过,唯一找到的是如何使用 Tensorflow 创建我自己的数据集。
我的代码是:
from tensorflow.keras import datasets
(train_images, train_labels), (test_images, test_labels) = datasets.cifar10.load_data()
# Normalize pixel values to be between 0 and 1
train_images, test_images = train_images / 255.0, test_images / 255.0
在使用load_data()
功能之前如何设置下载图片的位置?
根据 source, the output (train_images, train_labels), (test_images, test_labels)
are "Tuple of Numpy arrays". Therefore, when you call load_data()
they are loaded into your memory from their origin (https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz). If you want to download them as well, you will have to do that separately on your own (some inspiration could be taken from here)。请记住,函数名称是 load_data()
,而不是 download_data()
,其中 load
指的是内存,download
指的是磁盘。