{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", "execution": { "iopub.execute_input": "2025-05-28T14:54:48.313943Z", "iopub.status.busy": "2025-05-28T14:54:48.313460Z", "iopub.status.idle": "2025-05-28T14:55:22.207673Z", "shell.execute_reply": "2025-05-28T14:55:22.206730Z", "shell.execute_reply.started": "2025-05-28T14:54:48.313914Z" }, "trusted": true }, "outputs": [], "source": [ "!cp -r /kaggle/input/anime-image-resolution-enhancement-psnr/* /kaggle/working/" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Install Dependencies" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2025-05-28T14:55:22.209489Z", "iopub.status.busy": "2025-05-28T14:55:22.209262Z", "iopub.status.idle": "2025-05-28T14:59:44.299212Z", "shell.execute_reply": "2025-05-28T14:59:44.298421Z", "shell.execute_reply.started": "2025-05-28T14:55:22.209467Z" }, "trusted": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/kaggle/working/Real-ESRGAN\n", "\u001b[31mERROR: You must give at least one requirement to install (see \"pip help install\")\u001b[0m\u001b[31m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m172.5/172.5 kB\u001b[0m \u001b[31m72.0 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m46.8/46.8 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m297.8/297.8 kB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.5/5.5 MB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m0:00:01\u001b[0m00:01\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m256.2/256.2 kB\u001b[0m \u001b[31m322.9 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m\n", "\u001b[?25h Building wheel for basicsr (setup.py) ... \u001b[?25l\u001b[?25hdone\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m178.0/178.0 kB\u001b[0m \u001b[31m4.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m\n", "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.6/59.6 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h Building wheel for filterpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m52.2/52.2 kB\u001b[0m \u001b[31m1.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h/usr/local/lib/python3.11/dist-packages/setuptools/__init__.py:94: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.\n", "!!\n", "\n", " ********************************************************************************\n", " Requirements should be satisfied by a PEP 517 installer.\n", " If you are using pip, you can try `pip install --use-pep517`.\n", " ********************************************************************************\n", "\n", "!!\n", " dist.fetch_build_eggs(dist.setup_requires)\n", "/usr/local/lib/python3.11/dist-packages/setuptools/command/develop.py:41: EasyInstallDeprecationWarning: easy_install command is deprecated.\n", "!!\n", "\n", " ********************************************************************************\n", " Please avoid running ``setup.py`` and ``easy_install``.\n", " Instead, use pypa/build, pypa/installer or other\n", " standards-based tools.\n", "\n", " See https://github.com/pypa/setuptools/issues/917 for details.\n", " ********************************************************************************\n", "\n", "!!\n", " easy_install.initialize_options(self)\n", "/usr/local/lib/python3.11/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.\n", "!!\n", "\n", " ********************************************************************************\n", " Please avoid running ``setup.py`` directly.\n", " Instead, use pypa/build, pypa/installer or other\n", " standards-based tools.\n", "\n", " See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.\n", " ********************************************************************************\n", "\n", "!!\n", " self.initialize_options()\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.3/2.3 GB\u001b[0m \u001b[31m411.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.1/6.1 MB\u001b[0m \u001b[31m64.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m63.3/63.3 MB\u001b[0m \u001b[31m28.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m96.4/96.4 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "pytorch-lightning 2.5.1.post0 requires torch>=2.1.0, but you have torch 2.0.1+cu118 which is incompatible.\n", "torchaudio 2.6.0+cu124 requires torch==2.6.0, but you have torch 2.0.1+cu118 which is incompatible.\u001b[0m\u001b[31m\n", "\u001b[0m" ] } ], "source": [ "# !git clone https://github.com/xinntao/Real-ESRGAN.git\n", "# or\n", "#!git clone https://github.com/danhtran2mind/Real-ESRGAN.git\n", "%cd Real-ESRGAN\n", "!pip install --use-pep517 -q\n", "!pip install basicsr==1.4.2 -q\n", "!pip install facexlib -q\n", "!pip install gfpgan -q\n", "!pip install -r requirements.txt -q\n", "!python setup.py develop --quiet\n", "!pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118 -q\n", "!pip install numpy==1.26.4 -q" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2025-05-28T14:59:44.300935Z", "iopub.status.busy": "2025-05-28T14:59:44.300363Z", "iopub.status.idle": "2025-05-28T14:59:46.751076Z", "shell.execute_reply": "2025-05-28T14:59:46.750556Z", "shell.execute_reply.started": "2025-05-28T14:59:44.300907Z" }, "trusted": true }, "outputs": [], "source": [ "from pathlib import Path\n", "from tqdm import tqdm\n", "from tabulate import tabulate\n", "import os\n", "import numpy as np\n", "from PIL import Image\n", "import math\n", "import subprocess\n", "import torch\n", "import shutil\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-05-28T15:00:50.298038Z", "iopub.status.busy": "2025-05-28T15:00:50.297439Z", "iopub.status.idle": "2025-05-28T15:00:50.631694Z", "shell.execute_reply": "2025-05-28T15:00:50.631081Z", "shell.execute_reply.started": "2025-05-28T15:00:50.298008Z" }, "trusted": true }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "649cd7ec63324c22b8346263ae068e29", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Fetching 2 files: 0%| | 0/2 [00:00