{"id":21802796,"url":"https://github.com/ata4/esrgan-launcher","last_synced_at":"2026-03-14T08:06:27.937Z","repository":{"id":145032155,"uuid":"209976647","full_name":"ata4/esrgan-launcher","owner":"ata4","description":"Enhanced launcher script for ESRGAN","archived":false,"fork":false,"pushed_at":"2022-04-22T09:56:52.000Z","size":40,"stargazers_count":33,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T09:40:10.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ata4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-21T11:52:24.000Z","updated_at":"2025-02-17T12:28:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc2e50a0-5b59-4764-a6b3-b2e4ef90ad11","html_url":"https://github.com/ata4/esrgan-launcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata4%2Fesrgan-launcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata4%2Fesrgan-launcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata4%2Fesrgan-launcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata4%2Fesrgan-launcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ata4","download_url":"https://codeload.github.com/ata4/esrgan-launcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248765978,"owners_count":21158296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T11:32:59.108Z","updated_at":"2026-03-14T08:06:27.885Z","avatar_url":"https://github.com/ata4.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This script is a ESRGAN implementation based on the [original ESRGAN repository](https://github.com/xinntao/ESRGAN) for upscaling images. It's primarily meant to replace the very rudimentary test.py of the original repo with a more powerful and intuitive command line interface and close the gap between the two ESRGAN model architectures.\r\n\r\n## Models\r\n\r\nThe script differentiates between two types of models: primary models (``--model``) and filter models. Filter models also exist in two variants: pre-filter (``--pre-filter``) and post-filter (``--post-filter``). Filter models are typically 1x scale models, but they don't necessarily have to.\r\n\r\nThe file processing works like this: for each primary model, go through each input file, then apply all pre-filter models, then the current primary model, then all post-filter models and write the result to the output directory. Each primary model will have its own output sub-directory, which is named by the chain of models being used.\r\n\r\nBoth the \"old arch\" and the \"new arch\" ESRGAN model format is supported. The scale is determined from the model dict structure and therefore doesn't have to and, in fact, can't be specified manually. Scales other than 4x are supported for the \"new arch\" format, although only in theory, since I haven't encountered any model files for scales other than 4x in the wild.\r\n\r\nModels can be interpolated on the fly by providing a list of path/weight pairs, separated by path separators. For example, for a 25/25/50 mix of three models, the argument must be specified as followed:\r\n\r\n```\r\n--model model1.pth:25:model2.pth:25:model3.pth:50\r\n```\r\n\r\nThe path separator depends on the platform. It's \":\" on Unix/Linux/MacOS and \";\" on Windows.\r\n\r\nNote that the weights don't have to add up to 100, since the model alpha is calculated by the weight divided by the total weight. So in the example above, it's perfectly fine to use 1/1/2 instead. Also keep in mind that not all models can be interpolated without issues.\r\n\r\nFor a list of freely available models to download, take a look at the [upscale.wiki model database](https://upscale.wiki/wiki/Model_Database).\r\n\r\n## Tiling\r\n\r\nSince upscaling images can take a lot of (V)RAM, the script splits large input images into smaller tiles, upscales those one by one and puts them back together in memory by default. Some overlapping is applied to compensate artifacts near the border of the tiles. The result still varies slightly compared to upscaling the image in one go, but it should be barely noticeable. Still, it's recommended to experiment with the ``--tilesize`` argument to find the maximum value that your GPU supports to reduce its impact on the output.\r\n\r\n## Command line examples\r\n\r\nUpscale all images in folder `input` and put the result in `output` using all files from folder `models`.\r\n\r\n```\r\nmain.py input output --model models\r\n```\r\n\r\n---\r\n\r\nUpscale image `teapot.png` in folder `input` and put the result in `output` using all .pth files from folder `models` starting with `4x`. Keep in mind that quotes are required for the path for wildcards to work!\r\n\r\n```\r\nmain.py input/teapot.png output --model \"models/4x*.pth\"\r\n```\r\n\r\n---\r\n\r\nUpscale all images in folder `input` and put the result in `output` using the model files `Manga109Attempt.pth` and `RRDB_ESRGAN_x4.pth`.\r\n\r\n```\r\nmain.py input output --model models/Manga109Attempt.pth --model models/RRDB_ESRGAN_x4.pth\r\n```\r\n\r\n---\r\n\r\nUpscale all images in folder `input` and put the result in `output` using a 25/75 interpolation between `Manga109Attempt.pth` and `RRDB_ESRGAN_x4.pth` as model under Linux (Windows: use `;` instead of `:`).\r\n\r\n```\r\nmain.py input output --model models/Manga109Attempt.pth:25:models/RRDB_ESRGAN_x4.pth:75\r\n```\r\n\r\n---\r\n\r\nUpscale all images in folder `input` and put the result in `output`. Apply the filter models `1x_JPEG_40-60.pth` and `1x_normals_generator_general_215k.pth`, then upscale using the model file `RRDB_ESRGAN_x4.pth` and finally, apply the filter model `1x_DeSharpen.pth`.\r\n\r\n```\r\nmain.py input output --prefilter models/1x_JPEG_40-60.pth --prefilter models/1x_normals_generator_general_215k.pth --model models/RRDB_ESRGAN_x4.pth --postfilter models/1x_DeSharpen.pth\r\n```\r\n\r\n---\r\n\r\nUpscale all images in folder `input` and put the result in `output` using all files from folder `models` with GPU acceleration and a tile size of 1024 pixels.\r\n\r\n```\r\nmain.py input output --device cuda --tilesize 1024 --model models\r\n```\r\n\r\n## Docker\r\n\r\nA Dockerfile and docker-compose file is included to easily create a pyTorch runtime environment for the script.\r\n\r\nThe recommended command to run the container is:\r\n\r\n```\r\ndocker-compose run --rm main [arguments]\r\n```\r\n\r\nFor CPU-only mode, use this command instead:\r\n\r\n```\r\ndocker-compose run --rm main-cpu [arguments]\r\n```\r\n\r\nNote that the scripts and models are not integrated into the container by default and are mounted from the base directory as a volume for easy editing instead.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fata4%2Fesrgan-launcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fata4%2Fesrgan-launcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fata4%2Fesrgan-launcher/lists"}