Get startedGet started for free

Train a deep CNN to classify clothing images

Training a deep learning model is very similar to training a single layer network. Once the model is constructed (as you have done in the previous exercise), the model needs to be compiled with the right set of parameters. Then, the model is fit by providing it with training data, as well as training labels. After training is done, the model can be evaluated on test data.

The model you built in the previous exercise is available in your workspace.

This exercise is part of the course

Image Modeling with Keras

View Course

Exercise instructions

  • Compile the model to use the categorical cross-entropy loss function and the Adam optimizer.
  • Train the network with train_data for 3 epochs with batches of 10 images each.
  • Use randomly selected 20% of the training data as validation data during training.
  • Evaluate the model with test_data, use a batch size of 10.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Compile model
model.____(optimizer=____, 
              loss='categorical_crossentropy', 
              metrics=['accuracy'])

# Fit the model to training data 
model.____(____, ____, 
          validation_split=0.2, 
          epochs=3, batch_size=10)

# Evaluate the model on test data
model.____(____, ____, batch_size=10)
Edit and Run Code