一次下载所有Keras数据集

使用下面的代码可以一次下载所有Keras的dataset。

也可以直接下载我已经下好的解压到%UserProfile%\.keras\目录下,也就是C:\Users\\.keras\

数据集比较大,分成4部分,方便下载。

Keras数据集-fashion-mnist: https://download.csdn.net/download/hansel/11133067
Keras数据集-npz格式(minist, boston_housing, reuters, imdb): https://download.csdn.net/download/hansel/11133063
Keras数据集-CIFAR100: https://download.csdn.net/download/hansel/11133062
Keras数据集-CIFAR10: https://download.csdn.net/download/hansel/11133047

 

# Download all datasets of Keras
# Saved to C:\Users\\.keras\datasets\
# That is %UserProfile%\.keras\datasets\
# files: 
#   [cifar-10-batches-py] [cifar-100-python] [fashion-mnist]
#   boston_housing.npz cifar-10-batches-py.tar.gz cifar-100-python.tar.gz      
#   imdb.npz   mnist.npz  reuters.npz
# .npz is zip of *.npy which is numpy saved array
import keras

def download_datasets():
    print("Checking boston housing ...")
    keras.datasets.boston_housing.load_data()
    print("Checking cifar10 ...")
    keras.datasets.cifar10.load_data()
    print("Checking cifar100 ...")
    keras.datasets.cifar100.load_data()
    print("Checking fashion_mnist ...")
    keras.datasets.fashion_mnist.load_data()
    print("Checking imdb ...")
    keras.datasets.imdb.load_data()
    print("Checking mnist ...")
    keras.datasets.mnist.load_data()
    print("Checking reuters ...")
    keras.datasets.reuters.load_data()


def main():
    download_datasets()

if __name__ == '__main__':
    main()

 

你可能感兴趣的:(深度学习,Python)