当前位置: 首页>>代码示例>>Python>>正文


Python cifar100.load_data方法代码示例

本文整理汇总了Python中keras.datasets.cifar100.load_data方法的典型用法代码示例。如果您正苦于以下问题:Python cifar100.load_data方法的具体用法?Python cifar100.load_data怎么用?Python cifar100.load_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在keras.datasets.cifar100的用法示例。


在下文中一共展示了cifar100.load_data方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_imdb

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_imdb(self):
        print('imdb')
        (X_train, y_train), (X_test, y_test) = imdb.load_data() 
开发者ID:lllcho,项目名称:CAPTCHA-breaking,代码行数:5,代码来源:test_datasets.py

示例2: test_cifar

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_cifar(self):
        print('cifar10')
        (X_train, y_train), (X_test, y_test) = cifar10.load_data()
        print(X_train.shape)
        print(X_test.shape)
        print(y_train.shape)
        print(y_test.shape)

        print('cifar100 fine')
        (X_train, y_train), (X_test, y_test) = cifar100.load_data('fine')
        print(X_train.shape)
        print(X_test.shape)
        print(y_train.shape)
        print(y_test.shape)

        print('cifar100 coarse')
        (X_train, y_train), (X_test, y_test) = cifar100.load_data('coarse')
        print(X_train.shape)
        print(X_test.shape)
        print(y_train.shape)
        print(y_test.shape) 
开发者ID:lllcho,项目名称:CAPTCHA-breaking,代码行数:23,代码来源:test_datasets.py

示例3: load_cifar10

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def load_cifar10() :
    (train_data, train_labels), (test_data, test_labels) = cifar10.load_data()
    # train_data = train_data / 255.0
    # test_data = test_data / 255.0

    train_data, test_data = normalize(train_data, test_data)

    train_labels = to_categorical(train_labels, 10)
    test_labels = to_categorical(test_labels, 10)

    seed = 777
    np.random.seed(seed)
    np.random.shuffle(train_data)
    np.random.seed(seed)
    np.random.shuffle(train_labels)


    return train_data, train_labels, test_data, test_labels 
开发者ID:taki0112,项目名称:ResNet-Tensorflow,代码行数:20,代码来源:utils.py

示例4: load_cifar100

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def load_cifar100() :
    (train_data, train_labels), (test_data, test_labels) = cifar100.load_data()
    # train_data = train_data / 255.0
    # test_data = test_data / 255.0
    train_data, test_data = normalize(train_data, test_data)

    train_labels = to_categorical(train_labels, 100)
    test_labels = to_categorical(test_labels, 100)

    seed = 777
    np.random.seed(seed)
    np.random.shuffle(train_data)
    np.random.seed(seed)
    np.random.shuffle(train_labels)


    return train_data, train_labels, test_data, test_labels 
开发者ID:taki0112,项目名称:ResNet-Tensorflow,代码行数:19,代码来源:utils.py

示例5: load_mnist

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def load_mnist() :
    (train_data, train_labels), (test_data, test_labels) = mnist.load_data()
    train_data = np.expand_dims(train_data, axis=-1)
    test_data = np.expand_dims(test_data, axis=-1)

    train_data, test_data = normalize(train_data, test_data)

    train_labels = to_categorical(train_labels, 10)
    test_labels = to_categorical(test_labels, 10)

    seed = 777
    np.random.seed(seed)
    np.random.shuffle(train_data)
    np.random.seed(seed)
    np.random.shuffle(train_labels)


    return train_data, train_labels, test_data, test_labels 
开发者ID:taki0112,项目名称:ResNet-Tensorflow,代码行数:20,代码来源:utils.py

示例6: load_fashion

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def load_fashion() :
    (train_data, train_labels), (test_data, test_labels) = fashion_mnist.load_data()
    train_data = np.expand_dims(train_data, axis=-1)
    test_data = np.expand_dims(test_data, axis=-1)

    train_data, test_data = normalize(train_data, test_data)

    train_labels = to_categorical(train_labels, 10)
    test_labels = to_categorical(test_labels, 10)

    seed = 777
    np.random.seed(seed)
    np.random.shuffle(train_data)
    np.random.seed(seed)
    np.random.shuffle(train_labels)


    return train_data, train_labels, test_data, test_labels 
开发者ID:taki0112,项目名称:ResNet-Tensorflow,代码行数:20,代码来源:utils.py

示例7: convert

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def convert():
    train = 'train//'
    val = 'validation//'

    (X_train, y_train), (X_test, y_test) = cifar100.load_data(label_mode='fine')

    for i in range(len(X_train)):
        x = X_train[i]
        y = y_train[i]
        path = train + str(y[0])
        x = cv2.resize(x, (224, 224), interpolation=cv2.INTER_CUBIC)
        if not os.path.exists(path):
            os.makedirs(path)
        cv2.imwrite(path + '//' + str(i) + '.jpg', x)

    for i in range(len(X_test)):
        x = X_test[i]
        y = y_test[i]
        path = val + str(y[0])
        x = cv2.resize(x, (224, 224), interpolation=cv2.INTER_CUBIC)
        if not os.path.exists(path):
            os.makedirs(path)
        cv2.imwrite(path + '//' + str(i) + '.jpg', x) 
开发者ID:xiaochus,项目名称:MobileNetV2,代码行数:25,代码来源:convert.py

示例8: test_reuters

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_reuters(self):
        print('reuters')
        (X_train, y_train), (X_test, y_test) = reuters.load_data() 
开发者ID:lllcho,项目名称:CAPTCHA-breaking,代码行数:5,代码来源:test_datasets.py

示例9: test_mnist

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_mnist(self):
        print('mnist')
        (X_train, y_train), (X_test, y_test) = mnist.load_data()
        print(X_train.shape)
        print(X_test.shape)
        print(y_train.shape)
        print(y_test.shape) 
开发者ID:lllcho,项目名称:CAPTCHA-breaking,代码行数:9,代码来源:test_datasets.py

示例10: test_cifar

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_cifar():
    # only run data download tests 20% of the time
    # to speed up frequent testing
    random.seed(time.time())
    if random.random() > 0.8:
        (x_train, y_train), (x_test, y_test) = cifar10.load_data()
        assert len(x_train) == len(y_train) == 50000
        assert len(x_test) == len(y_test) == 10000
        (x_train, y_train), (x_test, y_test) = cifar100.load_data('fine')
        assert len(x_train) == len(y_train) == 50000
        assert len(x_test) == len(y_test) == 10000
        (x_train, y_train), (x_test, y_test) = cifar100.load_data('coarse')
        assert len(x_train) == len(y_train) == 50000
        assert len(x_test) == len(y_test) == 10000 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:16,代码来源:test_datasets.py

示例11: test_reuters

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_reuters():
    # only run data download tests 20% of the time
    # to speed up frequent testing
    random.seed(time.time())
    if random.random() > 0.8:
        (x_train, y_train), (x_test, y_test) = reuters.load_data()
        assert len(x_train) == len(y_train)
        assert len(x_test) == len(y_test)
        assert len(x_train) + len(x_test) == 11228
        (x_train, y_train), (x_test, y_test) = reuters.load_data(maxlen=10)
        assert len(x_train) == len(y_train)
        assert len(x_test) == len(y_test)
        word_index = reuters.get_word_index()
        assert isinstance(word_index, dict) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:16,代码来源:test_datasets.py

示例12: test_mnist

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_mnist():
    # only run data download tests 20% of the time
    # to speed up frequent testing
    random.seed(time.time())
    if random.random() > 0.8:
        (x_train, y_train), (x_test, y_test) = mnist.load_data()
        assert len(x_train) == len(y_train) == 60000
        assert len(x_test) == len(y_test) == 10000 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:10,代码来源:test_datasets.py

示例13: test_imdb

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_imdb():
    # only run data download tests 20% of the time
    # to speed up frequent testing
    random.seed(time.time())
    if random.random() > 0.8:
        (x_train, y_train), (x_test, y_test) = imdb.load_data()
        (x_train, y_train), (x_test, y_test) = imdb.load_data(maxlen=40)
        assert len(x_train) == len(y_train)
        assert len(x_test) == len(y_test)
        word_index = imdb.get_word_index()
        assert isinstance(word_index, dict) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:13,代码来源:test_datasets.py

示例14: test_boston_housing

# 需要导入模块: from keras.datasets import cifar100 [as 别名]
# 或者: from keras.datasets.cifar100 import load_data [as 别名]
def test_boston_housing():
    # only run data download tests 20% of the time
    # to speed up frequent testing
    random.seed(time.time())
    if random.random() > 0.8:
        (x_train, y_train), (x_test, y_test) = boston_housing.load_data()
        assert len(x_train) == len(y_train)
        assert len(x_test) == len(y_test) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:10,代码来源:test_datasets.py


注:本文中的keras.datasets.cifar100.load_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。