0

I'm using tf.keras.datasets to download CIFAR 10 dataset and I wondering where the images are downloaded.

I've been searching if there is a function to set where to download the images, but I haven't found any. I have searched over the Internet and the only thing I have found is how to create my own dataset using Tensorflow.

My code is:

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

How can I set where to download the images before using the function load_data()?

VansFannel
  • 41,682
  • 96
  • 329
  • 561
  • I don't think you can set the download folder, what would be the point of doing that? – Dr. Snoopy Oct 30 '20 at 10:44
  • @Dr.Snoopy Because I want to delete them when they are not used anymore and to check if they are download and if I use them very often, they will be downloaded every time. – VansFannel Oct 30 '20 at 12:28

1 Answers1

1

According to the 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). Remember, the function name is load_data(), and not download_data(), where load refers to memory, and download refers to disk.

Marcus
  • 702
  • 1
  • 14