AI resizing for VapourSynth using LIIF
Up- or downscaling to arbitrary resolutions and aspect ratios. For example to go from 720x480 to 720x540, or to remove small black borders and stretch, or to downscale with less detail loss. For large upscaling factors dedicated upscaling models are usually better and faster.
Installation
pip install -U vs_liif
- This package requires PyTorch with CUDA.
Usage
import vs_liif
clip = vs_liif.resize(clip, width=None, height=None, src_left=0.0, src_top=0.0, src_width=None, src_height=None, batch_size=100000, backend="cuda")
clip
Input clip must be in RGB format.
width, height (optional)
Output width and height in pixel.
src_width, src_height (optional)
Selects a window from the source frame to resize starting from top left. Works like vapoursynths built-in resizers.
src_left, src_top (optional)
Shifts the entire frame, or the window selected by src_width and src_height.
Allows for subpixel and negative shift. Works like vapoursynths built-in resizers.
batch_size (optional)
The amount of pixels to process at once. Lower reduces VRAM usage, but may be slower.
There seems to be a goldilock zone for speed. To find it go up/down in 50000 steps.
backend (optional)
The backend used to run the LIIF model:
cpuCPU mode (very slow).cudaGPU mode. Requires an Nvidia GPU (fast).
[!TIP] With large resize factors, the model sometimes exhibits a color shift. To fix this try vs_colorfix.
Benchmarks
Benchmarks were done on a RTX 4090 GPU.
|
|
Acknowledgements
Orignal code from "Learning Continuous Image Representation with Local Implicit Image Function" or LIIF.
VapourSynth functions created with the help of ViktorThink.
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 vs_liif-1.2.0.tar.gz.
File metadata
- Download URL: vs_liif-1.2.0.tar.gz
- Upload date:
- Size: 17.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ca2754d090da740dd51469aa90153c0152e58586cdbfd338d655b4d8c49995c
|
|
| MD5 |
79b8a87d5e328e016eaec6fb09b6ebd3
|
|
| BLAKE2b-256 |
b45b28de37490e7d8dbd743da2dfcebbf285a4ba5716ba3e4bdad0c99bcf5a1d
|
Provenance
The following attestation bundles were made for vs_liif-1.2.0.tar.gz:
Publisher:
publish.yml on pifroggi/vs_liif
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vs_liif-1.2.0.tar.gz -
Subject digest:
0ca2754d090da740dd51469aa90153c0152e58586cdbfd338d655b4d8c49995c - Sigstore transparency entry: 2461821761
- Sigstore integration time:
-
Permalink:
pifroggi/vs_liif@22ceee88c8db03d27832a0860887d665798bc517 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/pifroggi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22ceee88c8db03d27832a0860887d665798bc517 -
Trigger Event:
release
-
Statement type:
File details
Details for the file vs_liif-1.2.0-py3-none-any.whl.
File metadata
- Download URL: vs_liif-1.2.0-py3-none-any.whl
- Upload date:
- Size: 17.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c82d3081ae814dbfe75a3357f0eb630061fdf1a356ca0694a445e632b674ed1c
|
|
| MD5 |
c73eb7f83abf0898afef15ce5b74bfdb
|
|
| BLAKE2b-256 |
c1b5453bebc592252385458af293a49381df40d80e295ee6926894b831966b66
|
Provenance
The following attestation bundles were made for vs_liif-1.2.0-py3-none-any.whl:
Publisher:
publish.yml on pifroggi/vs_liif
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vs_liif-1.2.0-py3-none-any.whl -
Subject digest:
c82d3081ae814dbfe75a3357f0eb630061fdf1a356ca0694a445e632b674ed1c - Sigstore transparency entry: 2461821886
- Sigstore integration time:
-
Permalink:
pifroggi/vs_liif@22ceee88c8db03d27832a0860887d665798bc517 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/pifroggi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22ceee88c8db03d27832a0860887d665798bc517 -
Trigger Event:
release
-
Statement type: