Deep_Learning 4 - SaranAkkiraju/Python_and_Deep_Learning_Programming_ICP GitHub Wiki
Objective
- Adding layers and checking the accuracy
- Visualizing the graph and loss with TensorBoard
- predict the first 4 images of the test data. Then, print the actual label for those 4 images (label means the probability associated with them) to check if the model predicted correctly or not.
Importing libraries Keras, Numpy
Data Read
- Reading the cifar10 data.
- Splitting the data into test and train
Data Pre-Processing
- Converting into float type and dividing it by 255to normalize the data.
- Converting the categorical data to numerical data.
Creating Model and Adding layers
- Initializing the deep learning sequential model.
- Adding below layers to the existing model
- Adding Conv2D layer is activation: Relu output-shape 64 feature maps with a size of 3×3
- Adding dropout layer 0.2
- Adding Conv2D layer is activation: Relu output-shape 128 feature maps with a size of 3×3
- Adding MaxPooling2D layer of pool size (2,2)
- Flatting the layer
- No of neurons in the dense layer is 1024, activation: Relu and dropout of 0.2
- No of neurons in the dense layer is 512, activation: Relu and dropout of 0.2
- Adding a final layer of softmax to generate the predicted outputs.
- No of epochs were given is 2, as per the system configurations constrains.
- The loss function used is categorical_crossentropy and LR is 0.01, a metric used is accuracy
- Accuracy is 39.59%
- As of now, we can see that the accuracy is reduced and but if we increase the no of epochs on both the cases the second case could yield more accuracy than the 1st.
Model Performance
Seeing the first 4 numerical labeled data in the test, and then do inferencing to check what the prediction of the fitted model.
Check the same index value in the predicted values it should be highest compared to other 9 values then it is predicted correctly. The third image has 1 for the 9th class and see the values in the predicted values, it is the highest values.