Skip to main content

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

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:

  • cpu CPU mode (very slow).
  • cuda GPU 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.

720x480
Resize Factor Average FPS
0.25x (180x120) ~45 fps
0.5x (360x240) ~34 fps
to 720x540 ~14 fps
1.5x (1080x720) ~8 fps
2x (1440x960) ~5 fps
1440x1080
Resize Factor Average FPS
0.25x (360x270) ~8 fps
0.5x (720x540) ~6 fps
1.5x (2160x1620) ~1.5 fps
2x (2880x2160) ~1 fps

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

vs_liif-1.2.0.tar.gz (17.6 MB view details)

Uploaded Source

Built Distribution

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

vs_liif-1.2.0-py3-none-any.whl (17.4 MB view details)

Uploaded Python 3

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

Hashes for vs_liif-1.2.0.tar.gz
Algorithm Hash digest
SHA256 0ca2754d090da740dd51469aa90153c0152e58586cdbfd338d655b4d8c49995c
MD5 79b8a87d5e328e016eaec6fb09b6ebd3
BLAKE2b-256 b45b28de37490e7d8dbd743da2dfcebbf285a4ba5716ba3e4bdad0c99bcf5a1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vs_liif-1.2.0.tar.gz:

Publisher: publish.yml on pifroggi/vs_liif

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for vs_liif-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c82d3081ae814dbfe75a3357f0eb630061fdf1a356ca0694a445e632b674ed1c
MD5 c73eb7f83abf0898afef15ce5b74bfdb
BLAKE2b-256 c1b5453bebc592252385458af293a49381df40d80e295ee6926894b831966b66

See more details on using hashes here.

Provenance

The following attestation bundles were made for vs_liif-1.2.0-py3-none-any.whl:

Publisher: publish.yml on pifroggi/vs_liif

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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