<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.selur.net/index.php?action=history&amp;feed=atom&amp;title=Vapoursynth_VSGAN</id>
	<title>Vapoursynth VSGAN - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.selur.net/index.php?action=history&amp;feed=atom&amp;title=Vapoursynth_VSGAN"/>
	<link rel="alternate" type="text/html" href="https://wiki.selur.net/index.php?title=Vapoursynth_VSGAN&amp;action=history"/>
	<updated>2026-11-19T04:56:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.selur.net/index.php?title=Vapoursynth_VSGAN&amp;diff=644&amp;oldid=prev</id>
		<title>Selur: New filter page (via create-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wiki.selur.net/index.php?title=Vapoursynth_VSGAN&amp;diff=644&amp;oldid=prev"/>
		<updated>2026-11-16T08:53:05Z</updated>

		<summary type="html">&lt;p&gt;New filter page (via create-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div style=&amp;quot;float:right; margin:0 0 1em 1em;&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;VSGAN&amp;#039;&amp;#039;&amp;#039; runs a PyTorch model you supply – an ESRGAN-family network or an EGVSR video model – on an NVIDIA GPU and scales the result back to the input size, so an upscaling model is used only for its cleaning effect. Several models can be chained, and an optional color fix matches the colors back to the source. To keep the larger size use [[Vapoursynth VSGAN Resize]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Filtering → Vapoursynth → Other&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Vapoursynth_VSGAN.png|none|VSGAN controls in Hybrid]]&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
Every frame is passed through the selected .pth model(s); there is no built-in model list. Each model enlarges the frame by its factor, and at the end Hybrid brings the result back to the input size with the chosen resizer. Without a model the filter is skipped.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* Windows, Hybrid&amp;#039;s torch add-on and an NVIDIA GPU with CUDA.&lt;br /&gt;
* One or more model files whose names start with the scale factor, e.g. &amp;quot;2x_name.pth&amp;quot; or &amp;quot;4x_name.pth&amp;quot;. Models without such a prefix are skipped with a message in the log.&lt;br /&gt;
* The color fix needs the color fix package.&lt;br /&gt;
&lt;br /&gt;
== Settings ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Parameter !! Range / values !! Hybrid default !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| Model / Select || load() || .pth file(s) || empty || Model to run; the factor is the number before &amp;quot;x_&amp;quot; in the file name.&lt;br /&gt;
|-&lt;br /&gt;
| Multi || – || on/off || off || Select several models, applied in order.&lt;br /&gt;
|-&lt;br /&gt;
| Overlap || overlap || none, 16 – 624 || none || Overlap of the tiles vsgan uses when the GPU memory runs out; none = vsgan&amp;#039;s default (16). Not used for EGVSR; not available with Duplicate aware.&lt;br /&gt;
|-&lt;br /&gt;
| 32bit || – || on/off || on || Full precision; off runs in half precision.&lt;br /&gt;
|-&lt;br /&gt;
| GPU ID || device || 0 – 8 || 0 || CUDA device.&lt;br /&gt;
|-&lt;br /&gt;
| Undo resize || – || on/off || on || With several models: resize back to the input size between the models. The final resize back to the input size always happens.&lt;br /&gt;
|-&lt;br /&gt;
| Resizer || – || Bilinear, Bicubic, Point, Lanczos, Spline16, Spline36, Spline64, DPID || Spline64 || Kernel used to resize back to the input size.&lt;br /&gt;
|-&lt;br /&gt;
| Duplicate aware || – || on/off || off || Processes only the first frame of a run of near-identical frames and repeats the result.&lt;br /&gt;
|-&lt;br /&gt;
| Threshold || – || 0.001 – 1 || 0.001 || Largest difference that still counts as a duplicate.&lt;br /&gt;
|-&lt;br /&gt;
| Requires: Luma scale / Matrix / Modulo || – || no, pc, tv / matrix list / 1 – 128 || pc / no / 1 || Overrides the range, matrix and size multiple Hybrid prepares for the model; &amp;quot;no&amp;quot; keeps Hybrid&amp;#039;s choice.&lt;br /&gt;
|-&lt;br /&gt;
| Fix Color: Mode, Radius, Wavelets, Planes, Fast || – || average/wavelet, radius 1 – 100, wavelets 1 – 15 || off (average, radius 10, wavelets 5, all planes) || Matches the colors of the output to the clip before the model; Radius and Fast with average, Wavelets with wavelet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Model F:/Hybrid/64bit/vsgan_models/2x_AniScale_30000.pth selected (no model is set by default), otherwise default settings, on a 10-bit YUV 4:2:0 source (640x356):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# changing range from limited to full range for vsVSGANFilter&lt;br /&gt;
clip = core.resize.Bicubic(clip, format=vs.YUV420P10, range_in_s=&amp;quot;limited&amp;quot;, range_s=&amp;quot;full&amp;quot;)&lt;br /&gt;
# setting color range to PC (full) range.&lt;br /&gt;
prop_name = &amp;#039;_Range&amp;#039; if core.core_version.release_major &amp;gt;= 74 else &amp;#039;_ColorRange&amp;#039;&lt;br /&gt;
clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_FULL})&lt;br /&gt;
# adjusting color space from YUV420P10 to RGBS for vsVSGANFilter&lt;br /&gt;
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s=&amp;quot;470bg&amp;quot;, range_in_s=&amp;quot;full&amp;quot;, range_s=&amp;quot;full&amp;quot;)&lt;br /&gt;
# filtering using VSGANFilter&lt;br /&gt;
from vsgan import ESRGAN&lt;br /&gt;
vsgan = ESRGAN(clip=clip, device=&amp;quot;cuda:0&amp;quot;)&lt;br /&gt;
model = &amp;quot;F:/Hybrid/64bit/vsgan_models/2x_AniScale_30000.pth&amp;quot;&lt;br /&gt;
vsgan.load(model)&lt;br /&gt;
vsgan.apply() # 1280x712&lt;br /&gt;
clip = vsgan.clip&lt;br /&gt;
# undo resizing 1280x712 to 640x356&lt;br /&gt;
clip = core.resize.Spline64(clip=clip, width=640, height=356) # resolution 640x356&lt;br /&gt;
# making sure 0-1 limits are respected&lt;br /&gt;
clip = core.vszip.Limiter(clip=clip, min=[0,0,0], max=[1,1,1])&lt;br /&gt;
# adjusting output color from RGBS to YUV420P10 for NVEncModel&lt;br /&gt;
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s=&amp;quot;470bg&amp;quot;, range_in_s=&amp;quot;full&amp;quot;, range_s=&amp;quot;full&amp;quot;, dither_type=&amp;quot;error_diffusion&amp;quot;)&lt;br /&gt;
# changing range from full to limited range for matching filter target luma scale&lt;br /&gt;
clip = core.resize.Bicubic(clip, format=vs.YUV420P10,range_in_s=&amp;quot;full&amp;quot;, range_s=&amp;quot;limited&amp;quot;)&lt;br /&gt;
# setting color range to TV (limited) range.&lt;br /&gt;
prop_name = &amp;#039;_Range&amp;#039; if core.core_version.release_major &amp;gt;= 74 else &amp;#039;_ColorRange&amp;#039;&lt;br /&gt;
clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How Hybrid calls it ==&lt;br /&gt;
* The clip is converted to 32-bit float RGB (16-bit float with 32bit off), full range; there is no size multiple unless Requires sets one.&lt;br /&gt;
* File names containing &amp;quot;EGVSR&amp;quot; use the EGVSR network, all others ESRGAN. The device is written as &amp;quot;cuda:&amp;quot; plus the GPU ID.&lt;br /&gt;
* Each model works on the output of the previous one, with a new network object per model. With Multi and Undo resize the clip is brought back to the input size between the models.&lt;br /&gt;
* With &amp;#039;&amp;#039;Duplicate aware&amp;#039;&amp;#039; Hybrid&amp;#039;s duplicate-aware script runs the model chain only on frames that are not duplicates.&lt;br /&gt;
* The color fix runs last.&lt;br /&gt;
* VSGAN also offers the [[Vapoursynth common filter options|common options]] (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).&lt;br /&gt;
* The ONNX counterpart for user-supplied models is [[Vapoursynth vsMLRT|vsMLRT]].&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== vsgan ===&lt;br /&gt;
vsgan (rlaphoenix) is a PyTorch module for super-resolution and restoration in VapourSynth. The installed version offers the ESRGAN and EGVSR networks; the ESRGAN loader detects from the model file whether it is a classic ESRGAN or a compact Real-ESRGAN network. vsgan first tries the whole frame and only on a CUDA out-of-memory error splits it into parts; the overlap hides the seams between them. EGVSR works on intervals of frames instead.&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
* [https://github.com/rlaphoenix/vsgan vsgan]&lt;br /&gt;
* [https://vsgan.readthedocs.io vsgan documentation]&lt;br /&gt;
* Hybrid&amp;#039;s tooltips&lt;br /&gt;
&lt;br /&gt;
[[Category:Vapoursynth Filters]]&lt;/div&gt;</summary>
		<author><name>Selur</name></author>
	</entry>
</feed>