Train a deep CNN with pooling to classify images
Training a CNN with pooling layers is very similar to training of the deep networks that y have seen before. Once the network is constructed (as you did in the previous exercise), the model needs to be appropriately compiled, and then training data needs to be provided, together with the other arguments that control the fitting procedure.
The following model
from the previous exercise is available in your workspace:
Convolution => Max pooling => Convolution => Flatten => Dense
This exercise is part of the course
Image Modeling with Keras
Exercise instructions
- Compile this model to use the categorical cross-entropy loss function and the Adam optimizer.
- Train the model for 3 epochs with batches of size 10.
- Use 20% of the data as validation data.
- Evaluate the model on
test_data
withtest_labels
(also batches of size 10).
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Compile the model
____
# Fit to training data
____
# Evaluate on test data
____