tf.keras.datasets.cifar100.load_data
Stay organized with collections
Save and categorize content based on your preferences.
Loads the CIFAR100 dataset.
tf.keras.datasets.cifar100.load_data(
label_mode='fine'
)
This is a dataset of 50,000 32x32 color training images and
10,000 test images, labeled over 100 fine-grained classes that are
grouped into 20 coarse-grained classes. See more info at the
CIFAR homepage.
Args |
label_mode
|
one of "fine" , "coarse" .
If it is "fine" , the category labels
are the fine-grained labels, and if it is "coarse" ,
the output labels are the coarse-grained superclasses.
|
Returns |
Tuple of NumPy arrays: (x_train, y_train), (x_test, y_test) .
|
x_train
: uint8
NumPy array of grayscale image data with shapes
(50000, 32, 32, 3)
, containing the training data. Pixel values range
from 0 to 255.
y_train
: uint8
NumPy array of labels (integers in range 0-99)
with shape (50000, 1)
for the training data.
x_test
: uint8
NumPy array of grayscale image data with shapes
(10000, 32, 32, 3)
, containing the test data. Pixel values range
from 0 to 255.
y_test
: uint8
NumPy array of labels (integers in range 0-99)
with shape (10000, 1)
for the test data.
Example:
(x_train, y_train), (x_test, y_test) = keras.datasets.cifar100.load_data()
assert x_train.shape == (50000, 32, 32, 3)
assert x_test.shape == (10000, 32, 32, 3)
assert y_train.shape == (50000, 1)
assert y_test.shape == (10000, 1)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-07 UTC."],[],[],null,["# tf.keras.datasets.cifar100.load_data\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/v3.3.3/keras/src/datasets/cifar100.py#L13-L85) |\n\nLoads the CIFAR100 dataset. \n\n tf.keras.datasets.cifar100.load_data(\n label_mode='fine'\n )\n\nThis is a dataset of 50,000 32x32 color training images and\n10,000 test images, labeled over 100 fine-grained classes that are\ngrouped into 20 coarse-grained classes. See more info at the\n[CIFAR homepage](https://www.cs.toronto.edu/%7Ekriz/cifar.html).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `label_mode` | one of `\"fine\"`, `\"coarse\"`. If it is `\"fine\"`, the category labels are the fine-grained labels, and if it is `\"coarse\"`, the output labels are the coarse-grained superclasses. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| Tuple of NumPy arrays: `(x_train, y_train), (x_test, y_test)`. ||\n\n\u003cbr /\u003e\n\n**`x_train`** : `uint8` NumPy array of grayscale image data with shapes\n`(50000, 32, 32, 3)`, containing the training data. Pixel values range\nfrom 0 to 255.\n\n**`y_train`** : `uint8` NumPy array of labels (integers in range 0-99)\nwith shape `(50000, 1)` for the training data.\n\n**`x_test`** : `uint8` NumPy array of grayscale image data with shapes\n`(10000, 32, 32, 3)`, containing the test data. Pixel values range\nfrom 0 to 255.\n\n**`y_test`** : `uint8` NumPy array of labels (integers in range 0-99)\nwith shape `(10000, 1)` for the test data.\n\n#### Example:\n\n (x_train, y_train), (x_test, y_test) = keras.datasets.cifar100.load_data()\n assert x_train.shape == (50000, 32, 32, 3)\n assert x_test.shape == (10000, 32, 32, 3)\n assert y_train.shape == (50000, 1)\n assert y_test.shape == (10000, 1)"]]