Skip to main content

Real ESRGAN-TPU

Real-ESRGAN-TPU: Video/Image Resolution Upscaling Application. This application uses the open-source Real-ESRGAN series of models from Tencent ARC Lab, transplanted to the SG2300X series of chip products using the Sophon SDK, enabling hardware-accelerated inference with local TPU. This application can upscale video/image resolution to 2560x1920 pixels and provides multiple optimized models for different scenarios, enabling targeted optimization for real-world scenes and anime videos.

Includes real face enhancement models: CodeFormer and GFPGAN. Includes RMBG for background removal, allowing DIY backgrounds (e.g., ID photo backgrounds). This application uses Gradio to achieve a user-friendly interactive interface.

Application Installation

  • Clone the repository

    git clone https://github.com/zifeng-radxa/Real-ESRGAN-tpu_Web.git
  • Clone the face enhancement toolbox

    cd Real-ESRGAN-tpu_Web
    git clone https://github.com/zifeng-radxa/FACEXLIB.git
  • Create a virtual environment

    You must create a virtual environment to avoid impacting the normal operation of other applications. Refer to this guide for virtual environment usage.

    python3 -m virtualenv .venv
    source .venv/bin/activate
  • Download dependencies

    pip3 install --upgrade pip setuptools wheel
    pip3 install -r requirements.txt
    pip3 install https://github.com/radxa-edge/TPU-Edge-AI/releases/download/v0.1.0/tpu_perf-1.2.31-py3-none-manylinux2014_aarch64.whl
  • Download models

    python3 download_models.py
  • Start the application

    • Start with Gradio
    bash run_gr.sh

    Access the application through port 7860 of the Airbox IP address in your browser.

Application Display

re_1.webp

re_4.webp