Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Keras; Convolutional Neural Network ( CNN ) ; ten - class classifier for CIFAR - 1 0 dataset: Use cifar 1 0 function in keras.datasets
Keras; Convolutional Neural Network CNN; tenclass classifier for CIFAR dataset:
Use cifar function in keras.datasets to load CIFAR dataset. Split it into the training and testing sets. Define a validation set by randomly selecting of the training images along with their corresponding labels. This will be the validationdata
Scale the pixel values of the images in all the sets to a value between and Perform this process by dividing the image values with Note: No need to flatten the images.
Convert the label vectors for all the sets to binary class matrices using tocategorical Keras function.
Using Keras library, build a CNN with the following design: convolutional blocks, flattening layer, FC layer with nodes, and output layer. Each convolutional block consists of two backtoback Conv layers followed by max pooling. The filter size is xx imagedepth. The number of filters is in the first convolutional block and in the second block. Use the following network architecture as a reference:
For students registered with SAS, please contact your instructor for help with this content.
Compile, train, and then evaluate:
Compile the network. Make sure to select a correct loss function for this classification problem. Use Adam optimizer Adam learning rate of
Use ModelCheckpoint to save the best model based on the lowest validation loss.
Train the network for epochs with a batch size of Remember to assign the validation set to validationdata in the fit function.
Plot the training and validation loss for all the epochs in one plot.
Use the evaluate Keras function to find the training and validation loss and the accuracy. Report the results.
Now define another model with the same architecture in d and then:
Compile the network. Make sure to select a correct loss function for this classification problem. Use Adam optimizer Adam learning rate of
Use ModelCheckpoint to save the best model based on the lowest validation loss.
Create an image data generator in Keras for realtime data augmentation. The augmentation operations are rotation degrees range width and height shift range and horizontal flip.
Train the network for epochs with a batch size of Remember to use the image data generator. Assign the validation set to validationdata in the fit function.
Plot the training and validation loss for all the epochs in one plot.
Use the evaluate Keras function to find the training and validation loss and the accuracy. Report the results.
What do you observe from the validation loss in both step e and f Is the model overfitting or underfitting the training data? Explain.
Now define another model with the same architecture in d except that this time you need to add batch normalization layers to the CNN network.
Add normalization layer after all the convolutional and fully connected layers not the output layer Add them before the activation layers and be noted that there is no need for the bias in the convolutional or fully connected layers.
Compile the network. Make sure to select a correct loss function for this classification problem. Use Adam optimizer Adam learning rate of
Use ModelCheckpoint to save the best model based on the lowest validation loss.
Train the network for epochs with a batch size of Remember to assign the validation set to validationdata in the fit function.
Plot the training and validation loss for all the epochs in one plot.
Use the evaluate Keras function to find the training and validation loss and
What do you observe from the training loss in both steps e and h Explain.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started