{"cells": [{"cell_type": "markdown", "id": "57b870be", "metadata": {"papermill": {"duration": 0.009484, "end_time": "2025-04-03T19:24:25.582651", "exception": false, "start_time": "2025-04-03T19:24:25.573167", "status": "completed"}, "tags": []}, "source": ["\n", "# Tutorial 8: Deep Autoencoders\n", "\n", "* **Author:** Phillip Lippe\n", "* **License:** CC BY-SA\n", "* **Generated:** 2025-04-03T19:24:19.069528\n", "\n", "In this tutorial, we will take a closer look at autoencoders (AE).\n", "Autoencoders are trained on encoding input data such as images into a smaller feature vector,\n", "and afterward, reconstruct it by a second neural network, called a decoder.\n", "The feature vector is called the \"bottleneck\" of the network as we aim to compress the input data into a smaller amount of features.\n", "This property is useful in many applications, in particular in compressing data or comparing images on a metric beyond pixel-level comparisons.\n", "Besides learning about the autoencoder framework, we will also see the \"deconvolution\"\n", "(or transposed convolution) operator in action for scaling up feature maps in height and width.\n", "Such deconvolution networks are necessary wherever we start from a small feature vector\n", "and need to output an image of full size (e.g. in VAE, GANs, or super-resolution applications).\n", "This notebook is part of a lecture series on Deep Learning at the University of Amsterdam.\n", "The full list of tutorials can be found at https://uvadlc-notebooks.rtfd.io.\n", "\n", "\n", "---\n", "Open in [{height=\"20px\" width=\"117px\"}](https://colab.research.google.com/github/PytorchLightning/lightning-tutorials/blob/publication/.notebooks/course_UvA-DL/08-deep-autoencoders.ipynb)\n", "\n", "Give us a \u2b50 [on Github](https://www.github.com/Lightning-AI/lightning/)\n", "| Check out [the documentation](https://lightning.ai/docs/)\n", "| Join us [on Discord](https://discord.com/invite/tfXFetEZxv)"]}, {"cell_type": "markdown", "id": "c32021b8", "metadata": {"papermill": {"duration": 0.008778, "end_time": "2025-04-03T19:24:25.599804", "exception": false, "start_time": "2025-04-03T19:24:25.591026", "status": "completed"}, "tags": []}, "source": ["## Setup\n", "This notebook requires some packages besides pytorch-lightning."]}, {"cell_type": "code", "execution_count": 1, "id": "93bc076c", "metadata": {"colab": {}, "colab_type": "code", "execution": {"iopub.execute_input": "2025-04-03T19:24:25.617872Z", "iopub.status.busy": "2025-04-03T19:24:25.617123Z", "iopub.status.idle": "2025-04-03T19:24:26.819076Z", "shell.execute_reply": "2025-04-03T19:24:26.817595Z"}, "id": "LfrJLKPFyhsK", "lines_to_next_cell": 0, "papermill": {"duration": 1.214152, "end_time": "2025-04-03T19:24:26.822107", "exception": false, "start_time": "2025-04-03T19:24:25.607955", "status": "completed"}, "tags": []}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.\u001b[0m\u001b[33m\r\n", "\u001b[0m"]}, {"name": "stdout", "output_type": "stream", "text": ["\r\n", "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m25.0.1\u001b[0m\r\n", "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\r\n"]}], "source": ["! pip install --quiet \"seaborn\" \"numpy <3.0\" \"pytorch-lightning >=2.0,<2.6\" \"matplotlib\" \"torchvision\" \"torch >=1.8.1,<2.7\" \"tensorboard\" \"torchmetrics >=1.0,<1.8\""]}, {"cell_type": "markdown", "id": "6e7f448e", "metadata": {"papermill": {"duration": 0.013412, "end_time": "2025-04-03T19:24:26.849894", "exception": false, "start_time": "2025-04-03T19:24:26.836482", "status": "completed"}, "tags": []}, "source": ["