We have already read about building and compiling models in Chapter 3, Implementing a Deep Learning Model Using Keras. Let's build a simple neural network, and then we will start building the model. In this section, we will add the layers to be used in our deep learning model:
- We will first import the important libraries from Keras:
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
- Let's design the CNN with the following code. We add our first layer as the convolution layer with a filter of 32, kernal_size set to (3,3), and ReLU as our activation function. Then, we add a convolution layer with a filter value of 64 with ReLU as our activation function. Then, we added a maxpooling layer. Finally, we drop out and flatten a dense layer with a filter size of 128 and our ReLU activation function. Finally, we add one more dropout layer:
model = tf.keras.Sequential()
model.add(tf.keras.layers.Conv2D(10, kernel_size...