<jupyter_start><jupyter_text>Convolutional Network Model Train for 5 epochsObserve the loss decreasing while training.<jupyter_code>%%capture
!python ConvolutionalNetwork.py --max_epochs=5<jupyter_output><empty_output><jupyter_text>Inspect logs⚠️ Make sure to **Stop** the cell execution after observing the logsAfter only **5 epochs**, the model achieves **98.5% accuracy** on the MNIST test data set.It performs better than the previous neural network model.<jupyter_code>!tensorboard --logdir=./lightning_logs<jupyter_output>^C<jupyter_text>Load trained modelCheckpoints are saved incrementally for each training session under `./lightning_logs/version_X`.<jupyter_code>__import__("sys").path.append("..")
import utils
from ConvolutionalNetwork import ConvolutionalNetwork

model = utils.load_trained_model_for_evaluation(ConvolutionalNetwork, 3)
print(model)<jupyter_output>ConvolutionalNetwork(
  (seq): Sequential(
    (0): Conv2d(1, 16, kernel_size=(5, 5), stride=(1, 1))
    (1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (2): ReLU()
    (3): Conv2d(16, 32, kernel_size=(3, 3), stride=(1, 1))
    (4): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (5): ReLU()
    (6): Flatten(start_dim=1, end_dim=-1)
    (7): Linear(in_features=800, out_features=10, bias=True)
    (8): LogSoftmax(dim=1)
  )
)<jupyter_text>Predict MNIST labels<jupyter_code>import torch
import random

test_len = model.mnist_test.data.shape[0]

for i in range(0, 10):
    orig_img, orig_label = model.mnist_test[random.randint(0, test_len)]
    orig_img = orig_img.view(1, 1, 28, 28)
    classes = model(orig_img)
    predicted_label = torch.max(classes.data, 1).indices.item()

    print("Original label: ", orig_label, "Predicted label: ", predicted_label)
    utils.plot_images([orig_img.view(28, 28)])<jupyter_output>Original label:  8 Predicted label:  8