Skip to main content

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


  1. 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]
    
  2. Update PyPI if necessary:

    pip install --upgrade pip
    
  3. Install the package:

    pip install Folderesque --extra-index-url https://download.pytorch.org/whl/cu124
    

Usage

  1. Create a new project or workspace.

  2. Copy the folder of images that you want to upscale to the workspace.

  3. Download the pre-trained model:

    • Place your pretrained model in the project directory. The example for this script uses the RealESRGAN_x4plus_anime_6B.pth model.
    • Download from Real-ESRGAN repository.
  4. 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
    
  5. Ensure that INPUT_PATH and MODEL_PATH points to the correct path of your input folder and the model path respectively.

  6. 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:

Troubleshooting


Common Issues:

  1. CUDA Out of Memory:

    • Reduce TILE_SIZE.
    • Decrease THREAD_WORKERS.
    • Decrease BATCH_SIZE.
  2. Command not recognized:

    • You may want to add the folder path of your environment to the system's path.
    • Alternatively, you can use python -m prefix 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)

Source distribution for Folderesque 0.1.2
File Size Uploaded
folderesque-0.1.2.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Folderesque 0.1.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page