Python Script to process and upscale images in specified folders using RRDB models.
Project description
Python script for running and inferencing image upscaling models on image folders using optimization techniques like batched tile processing and automatic mixed precision (AMP).
Prerequisites
- Python 3.7+
- NVIDIA GPU that supports CUDA version 12.4 or higher (This Script uses PyTorch with CUDA 12.4).
Installation
-
Create a virtual environment using Python's module or using Anaconda Prompt and activate the environment.
python -m venv [env_name] .\[env_name]\Scripts\activate
or
conda create --name [env_name] conda activate [env_name]
-
Update PyPI if necessary:
pip install --upgrade pip
-
Install the package:
pip install Folderesque --extra-index-url https://download.pytorch.org/whl/cu124
Usage
-
Create a new project or workspace.
-
Copy the folder of images that you want to upscale to the workspace.
-
Download the pre-trained model:
- Place your pretrained model in the project directory. The example for this script uses the
RealESRGAN_x4plus_anime_6B.pthmodel. - Download from Real-ESRGAN repository.
- Place your pretrained model in the project directory. The example for this script uses the
-
Create a config.py file with contents matching the one shown below:
INPUT_PATH = "daskruns" OUTPUT_PATH = "testscaling" MODEL_PATH = "models\RealESRGAN_x4plus_anime_6B.pth" SCALE_FACTOR = 4 DEVICE = "cuda" TILE_SIZE = 400 THREAD_WORKERS = 4 BATCH_SIZE = 16
-
Ensure that INPUT_PATH and MODEL_PATH points to the correct path of your input folder and the model path respectively.
-
To run the script, copy the path of the config file and run the command:
Folderesque --conf [conf_path]
Output images are saved with "ESRGAN_" prefix in the filenames.
❤ Credits
Immense thanks to:
- Real-ESRGAN authors: Xintao Wang
- BasicSR framework: BasicSR
Troubleshooting
Common Issues:
-
CUDA Out of Memory:
- Reduce
TILE_SIZE. - Decrease
THREAD_WORKERS. - Decrease
BATCH_SIZE.
- Reduce
-
Command not recognized:
- You may want to add the folder path of your environment to the system's path.
- Alternatively, you can use
python -mprefix when running commands.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file folderesque-0.1.2.tar.gz.
File metadata
- Download URL: folderesque-0.1.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83a88992cee4b272f960c5bb3f333b78a3324769f6fbb5f83af023ae5fbad2ed
|
|
| MD5 |
64fb9d1694f3f31014bc727dd55450a1
|
|
| BLAKE2b-256 |
7450e67e4af04ea2f20aae0010c09dacbd9e4ceae58d9aef420061043fd6e56f
|
File details
Details for the file folderesque-0.1.2-py3-none-any.whl.
File metadata
- Download URL: folderesque-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
998b48d151a7ad665b670c95f0e521494f2bef2d26bd8967116347e90e8febd2
|
|
| MD5 |
f0926172b5b40ac3dc4ad6220b284354
|
|
| BLAKE2b-256 |
a3734b4567cedd89aea98997eb9bede91770d0b2fc39586df0c6869b691ff1a1
|