Most layers, such as tf., have parameters that are learned during training. Most of deep learning consists of chaining together simple layers. Hopefully, these representations are meaningful for the problem at hand. Layers extract representations from the data fed into them. The basic building block of a neural network is the layer. ![]() Plt.imshow(train_images, cmap=plt.cm.binary)īuilding the neural network requires configuring the layers of the model, then compiling the model. To verify that the data is in the correct format and that you're ready to build and train the network, let's display the first 25 images from the training set and display the class name below each image. It's important that the training set and the testing set be preprocessed in the same way: train_images = train_images / 255.0 Scale these values to a range of 0 to 1 before feeding them to the neural network model. If you inspect the first image in the training set, you will see that the pixel values fall in the range of 0 to 255: plt.figure() The data must be preprocessed before training the network. Again, each image is represented as 28 x 28 pixels: test_images.shapeĪnd the test set contains 10,000 images labels: len(test_labels) Likewise, there are 60,000 labels in the training set: len(train_labels)Įach label is an integer between 0 and 9: train_labelsĪrray(, dtype=uint8) The following shows there are 60,000 images in the training set, with each image represented as 28 x 28 pixels: train_images.shape Let's explore the format of the dataset before training the model. ![]() 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] Since the class names are not included with the dataset, store them here to use later when plotting the images: class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', These correspond to the class of clothing the image represents: LabelĮach image is mapped to a single label. The labels are an array of integers, ranging from 0 to 9. The images are 28x28 NumPy arrays, with pixel values ranging from 0 to 255.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |