Menu

Training and Evaluating the CNN Model

Training and Evaluating the CNN Model

Train the CNN using the training dataset.

Code

cnn.fit(X_train, y_train, epochs=5)

Explanation

The CNN learns hierarchical image features during training. Each epoch improves the model's ability to classify different image categories.

Evaluating the CNN Model

Evaluate the trained CNN.

Code

cnn.evaluate(X_test, y_test)

Explanation

The testing dataset is used to measure the CNN's performance on unseen images. The evaluation results indicate how accurately the model can classify new images.