Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions latent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,49 @@
" print(\"Downloaded as custom_settings.cfg\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Super Resolution with SwinIR"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# SUPER RESOLUTION\n",
"\n",
"%cd /content\n",
"!git clone https://github.com/voodoohop/SwinIR\n",
"%cd /content/SwinIR\n",
"!wget -c \"https://github.com/JingyunLiang/SwinIR/releases/download/v0.0/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth\" -P experiments/pretrained_models\n",
"\n",
"!pip install timm\n",
"!sudo apt install imagemagick\n",
"\n",
"from predict import Predictor\n",
"p = Predictor()\n",
"p.setup()\n",
"\n",
"from glob import glob\n",
"from tqdm import tqdm\n",
"\n",
"images = glob(f\"{outputs_path}/*.jpg\") + glob(f\"{outputs_path}/*.png\") + glob(f\"{outputs_path}/*.jpeg\")\n",
"images = list(sorted(images))\n",
"\n",
"tmp_output = \"/tmp/sr_output\"\n",
"!rm -rf $tmp_output\n",
"!mkdir -p $tmp_output\n",
"\n",
"for image_file in tqdm(images):\n",
" print(\"Upscaling\", image_file, \"with SwinIR\")\n",
" path = p.predict(image_file)\n",
" !mv \"{path}\" \"{image_file}\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down