Skip to main content

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


  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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

folderesque-0.1.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

folderesque-0.1.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

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

Hashes for folderesque-0.1.2.tar.gz
Algorithm Hash digest
SHA256 83a88992cee4b272f960c5bb3f333b78a3324769f6fbb5f83af023ae5fbad2ed
MD5 64fb9d1694f3f31014bc727dd55450a1
BLAKE2b-256 7450e67e4af04ea2f20aae0010c09dacbd9e4ceae58d9aef420061043fd6e56f

See more details on using hashes here.

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

Hashes for folderesque-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 998b48d151a7ad665b670c95f0e521494f2bef2d26bd8967116347e90e8febd2
MD5 f0926172b5b40ac3dc4ad6220b284354
BLAKE2b-256 a3734b4567cedd89aea98997eb9bede91770d0b2fc39586df0c6869b691ff1a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page