Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Convolutional Encoder/Decoder Architectures

GPU is available, using GPU Tesla T4

Dataset: MNIST

For this example, we’ll use MNIST. But since we’re using torch now, we can use the MNIST located in torchvision

Training dataset has length 48000
Training dataset has length 12000
Training dataset has length 10000
Input has shape torch.Size([1, 28, 28]) and the output is 6
<Figure size 960x720 with 10 Axes>
<Figure size 960x720 with 1 Axes>
<seaborn.axisgrid.PairGrid at 0x7f2ac74281d0>
<Figure size 1588.25x1500 with 20 Axes>
<Figure size 960x720 with 4 Axes>

CNN definition

torch.Size([1, 28, 28])

Autoencoder training

Loading...
Loading...
Epoch 1 | Train loss 0.047 | Val loss 0.041
Loading...
Loading...
Epoch 2 | Train loss 0.039 | Val loss 0.038
Loading...
Loading...
Epoch 3 | Train loss 0.038 | Val loss 0.037
Loading...
Loading...
Epoch 4 | Train loss 0.037 | Val loss 0.037
Loading...
Loading...
Epoch 5 | Train loss 0.036 | Val loss 0.036
Loading...
Loading...
Epoch 6 | Train loss 0.036 | Val loss 0.035
Loading...
Loading...
Epoch 7 | Train loss 0.035 | Val loss 0.035
Loading...
Loading...
Epoch 8 | Train loss 0.035 | Val loss 0.035
Loading...
Loading...
Epoch 9 | Train loss 0.035 | Val loss 0.035
Loading...
Loading...
Epoch 10 | Train loss 0.035 | Val loss 0.034
<Figure size 375x375 with 1 Axes>

Inference

<Figure size 1500x600 with 10 Axes>
Loading...
<seaborn.axisgrid.PairGrid at 0x7f2ac457c850>
<Figure size 1213.25x1125 with 12 Axes>

Visualizing latent space

<Figure size 960x720 with 3 Axes>
tensor([[-2.0000, -2.0000, -2.0000, -2.0000, -2.0000, -2.0000, -2.0000, -2.0000],
        [-1.4286, -1.4286, -1.4286, -1.4286, -1.4286, -1.4286, -1.4286, -1.4286],
        [-0.8571, -0.8571, -0.8571, -0.8571, -0.8571, -0.8571, -0.8571, -0.8571],
        [-0.2857, -0.2857, -0.2857, -0.2857, -0.2857, -0.2857, -0.2857, -0.2857],
        [ 0.2857,  0.2857,  0.2857,  0.2857,  0.2857,  0.2857,  0.2857,  0.2857],
        [ 0.8571,  0.8571,  0.8571,  0.8571,  0.8571,  0.8571,  0.8571,  0.8571],
        [ 1.4286,  1.4286,  1.4286,  1.4286,  1.4286,  1.4286,  1.4286,  1.4286],
        [ 2.0000,  2.0000,  2.0000,  2.0000,  2.0000,  2.0000,  2.0000,  2.0000]])
tensor([[-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000],
        [-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000],
        [-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000],
        [-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000],
        [-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000],
        [-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000],
        [-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000],
        [-2.0000, -1.4286, -0.8571, -0.2857,  0.2857,  0.8571,  1.4286,  2.0000]])
torch.Size([64, 3])
(64, 1, 28, 28)
<Figure size 960x720 with 64 Axes>