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.
Metadata
Release files for Folderesque 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| folderesque-0.1.2.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| folderesque-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / folderesque-0.1.2.tar.gz
| Download URL | folderesque-0.1.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83a88992cee4b272f960c5bb3f333b78a3324769f6fbb5f83af023ae5fbad2ed
|
|
BLAKE2b-256 checksum How to use checksums |
7450e67e4af04ea2f20aae0010c09dacbd9e4ceae58d9aef420061043fd6e56f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / folderesque-0.1.2-py3-none-any.whl
| Download URL | folderesque-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
998b48d151a7ad665b670c95f0e521494f2bef2d26bd8967116347e90e8febd2
|
|
BLAKE2b-256 checksum How to use checksums |
a3734b4567cedd89aea98997eb9bede91770d0b2fc39586df0c6869b691ff1a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|