assignment2
assignment2
1
Prepare Dataset
# Reshape the data to add a channel dimension for CNN
trainX = np . expand_dims ( trainX , axis = -1)
testX = np . expand_dims ( testX , axis = -1)
x = Flatten () ( inputs )
x = Dense (64 , activation = ’ sigmoid ’) ( x )
x = Dense (128 , activation = ’ sigmoid ’) ( x )
x = Dense (128 , activation = ’ sigmoid ’) ( x )
x = Dense (64 , activation = ’ sigmoid ’) ( x )
2
x = MaxPooling2D ((2 , 2) ) ( x )
x = Conv2D (128 , (3 , 3) , activation = ’ relu ’ , padding = ’ same ’) ( x )
x = MaxPooling2D ((2 , 2) ) ( x )
x = Flatten () ( x )