A cleaner, modernized reboot of Real-ESRGAN focused on best practices, up-to-date hardware support, and pragmatic developer ergonomics.
This effort is based on the original Real-ESRGAN project (see README-original.md). The goal is to preserve the proven quality while improving reliability, clarity, and performance on current-generation GPUs, notably NVIDIA RTX 50‑series (Blackwell architecture, e.g., RTX 5090).
Classic entry points remain familiar while we introduce incremental, low‑risk improvements. Backward compatibility is kept where possible; new options are additive.
Automatic detection and selection of your most capable GPU based on compute capability and memory, with special optimizations for RTX 50-series (Blackwell) architecture. No more manual device configuration—just plug and play.
CPU-safe weight loading with explicit device routing ensures stable operation across diverse hardware configurations. Cleaner CLI with better error handling reduces setup friction and troubleshooting time.
Purpose-built for latest CUDA stacks and cutting-edge GPUs including RTX 5090 and future Blackwell-class hardware. Memory-aware GPU selection maximizes performance on high-end systems.
Quality-of-life improvements throughout the inference pipeline reduce user friction and make professional-grade upscaling more accessible to everyone.
Improved texture regeneration maintains fine detail fidelity during upsampling while preserving natural appearance. Enhanced face restoration with robust quality assurance delivers superior results.
Consistent device handling, logging, and input validation across both image and video inference paths for a seamless user experience.
Streamlined dependency management with optional extras for specific features like face enhancement, keeping installations lean and focused.
- Runs on modern CUDA‑capable NVIDIA GPUs, auto‑selecting the most capable GPU when not explicitly set
- Prepared for RTX 50‑series (Blackwell) by evaluating GPU compute capability and total memory to select the best device
- CPU execution is supported when explicitly requested
The following modules are within the Reboot scope. Initial updates have been applied where noted.
-
inference_realesrgan.py
- Added
--device {gpu|cpu}(default:gpu) - Respects
--gpu-idwhen provided; otherwise auto‑selects the most capable GPU - Safer input filtering: excludes directories and only processes image files
- Keeps classic usage and model selection behavior intact
- Added
-
inference_realesrgan_video.py
- In scope for alignment with the image inference path (device handling, input validation, logging). Work in progress
-
requirements.txt
- In scope for dependency hygiene. Targeting compatibility with recent PyTorch/CUDA stacks while staying lean
-
torchvision_patch.py
- Ensures a compatibility patch is applied early to avoid import/runtime conflicts with torchvision variants
-
realesrgan/utils.py
- Added
_get_most_capable_gpu()to rank GPUs by compute capability (major.minor) and total memory, then pick the best - Device selection prefers the best GPU by default, respects
--gpu-idwhen set, and uses CPU only when explicitly requested - Loads weights on CPU for safety, then moves the model to the chosen device
- Added
Requirements: Python 3.8+ recommended, recent PyTorch build (with CUDA for GPU runs)
Install (example):
# optional venv
# python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python setup.py developImage inference examples:
# Default (GPU, auto‑select best GPU)
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs
# Force CPU
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --device cpu
# Pick a specific GPU
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --gpu-id 1
# Arbitrary output scale and face enhancement
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --outscale 3.5 --face_enhanceVideo inference (planned alignment):
# The video script will mirror the same device behavior (WIP)
python inference_realesrgan_video.py -n RealESRGAN_x4plus -i inputs/video --device gpu --gpu-id 0--device gpu(default):- If
--gpu-idis provided, uses that GPU - Otherwise, auto‑selects the “most capable” GPU based on compute capability and memory
- If
--device cpu: force CPU execution, ignoring any--gpu-id
- Texture regeneration: improve fidelity on fine textures during upsampling while preserving natural appearance
- Face restoration: higher‑quality face fixes, with improved robustness and better quality assurance (QA) checks
- Align video inference with image inference improvements (device handling, logging, input validation)
- Dependency hygiene and optional extras (e.g., selective installs for face enhancement)
- This reboot is iterative. We keep changes focused and low‑risk while improving defaults and clarity
- The original documentation (README.md) remains the source of truth for full feature descriptions and background. This reboot README highlights the modernization path and practical improvements
- Based on the original Real‑ESRGAN project. See README.md and upstream repository for details and citations
- License follows the original project’s license. See LICENSE