{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "_pRpIwnaOnb3" }, "source": [ "# 🦙 **LaMa: Resolution-robust Large Mask Inpainting with Fourier Convolutions**\n", "\n", "[[Project page](https://advimman.github.io/lama-project/)] [[GitHub](https://github.com/advimman/lama)] [[arXiv](https://arxiv.org/abs/2109.07161)] [[Supplementary](https://ashukha.com/projects/lama_21/lama_supmat_2021.pdf)] [[BibTeX](https://senya-ashukha.github.io/projects/lama_21/paper.txt)]\n", "\n", "
\n", "Our model generalizes surprisingly well to much higher resolutions (~2k❗️) than it saw during training (256x256), and achieves the excellent performance even in challenging scenarios, e.g. completion of periodic structures.\n", "
\n", "\n", "# Try it yourself!👇\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "id": "RwXRMaNHW4r5" }, "outputs": [], "source": [ "#@title Run this sell to set everything up\n", "print('\\n> Cloning the repo')\n", "!git clone https://github.com/advimman/lama.git\n", "\n", "print('\\n> Install dependencies')\n", "!pip install torch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 torchtext==0.9\n", "!pip install -r lama/requirements.txt --quiet\n", "!pip install wget --quiet\n", "!pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html --quiet\n", "\n", "\n", "print('\\n> Changing the dir to:')\n", "%cd /content/lama\n", "\n", "print('\\n> Download the model')\n", "!curl -L $(yadisk-direct https://disk.yandex.ru/d/ouP6l8VJ0HpMZg) -o big-lama.zip\n", "!unzip big-lama.zip\n", "\n", "print('>fixing opencv')\n", "!pip uninstall opencv-python-headless -y --quiet\n", "!pip install opencv-python-headless==4.1.2.30 --quiet\n", "\n", "\n", "print('\\n> Init mask-drawing code')\n", "import base64, os\n", "from IPython.display import HTML, Image\n", "from google.colab.output import eval_js\n", "from base64 import b64decode\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import wget\n", "from shutil import copyfile\n", "import shutil\n", "\n", "\n", "\n", "canvas_html = \"\"\"\n", "\n", "