Jasna Slashes GPU Memory 77% While Running 5x Faster on Video Restoration
A trending open-source pipeline uses TensorRT and transformer-based detectors to reconstruct mosaic-censored regions in video at up to 5x the speed of prior tools.
Takeaways
- Jasna is a trending open-source GPU pipeline for restoring mosaic-censored regions in Japanese adult video.
- Up to 4.7x faster than Lada on 4K and 5.3x on long-form 1080p using an RTX 5090.
- Peak VRAM cut roughly 4x by compiling TensorRT engines at fixed batch sizes.
- Uses RF-DETR for detection, scene-cut gating, and temporal crossfade for flicker-free output.
- Requires RTX 20-series or newer; AMD ROCm support is experimental, no secondary models.
- Free under AGPL-3.0; $15+ supporters unlock unet-4x and SD 1.5 image models.
Jasna, a Python project for reconstructing mosaic-censored regions in Japanese adult videos and images, has passed 2,300 GitHub stars. Its narrow application combines several broadly useful inference techniques: a transformer detector ahead of an inpainting network, fixed-batch TensorRT engines, automatic GPU memory management, and scene-aware temporal processing.
The code builds on Lada and uses mosaic_restoration_1.2, a model trained by Lada’s author. Jasna contributes the surrounding engineering, including a faster detection stage, lower VRAM consumption, side-by-side VR180 support, interactive segment editing, and optional secondary upscalers.
Detection first, restoration second
Jasna detects censored regions in each frame, then sends those regions through the restoration model in temporal clips. RF-DETR v6 is the default detector, while larger RF-DETR and YOLO variants trade additional compute for detection quality.
Video-specific controls prevent adjacent frames from being processed as unrelated images. Temporal overlap and crossfades reduce flicker at clip boundaries, while hard-cut detection stops the system from blending restoration data across scene changes.
- Segment editor: Previews footage, limits processing to selected ranges, and supports zooming and panning.
- Native player: Seeks through restored frames without first writing a completed output file.
- Streaming mode: Sends processed video to a browser player or a compatible Stash fork.
- VR180 handling: Processes side-by-side footage per eye and supports studio-specific restoration settings.
Fixed engines shrink the memory curve
The repository reports its main benchmarks on an RTX 5090 paired with an Intel Core i9-13900K. The figures compare Jasna with Lada under project-defined test conditions, so codec settings, model selection, driver versions, and input characteristics remain relevant when reproducing them.
| Input | Versions | Lada | Jasna | Speedup |
|---|---|---|---|---|
| 720p clip | Lada 0.11.0, Jasna 0.9.1 | Not specified | Not specified | 3.4× |
| 1080p clip | Lada 0.11.0, Jasna 0.9.1 | Not specified | Not specified | 3.6× |
| 2160p H.264 clip | Lada 0.11.0, Jasna 0.9.1 | 4:56 | 1:03 | 4.7× |
| 3 h 10 min, 1080p | Lada, Jasna 0.9.0 | 1:34:51 | 18:01 | 5.3× |
Version 0.9.1 also changes how restoration sub-engines are built. TensorRT engines use fixed batch sizes instead of matching the selected temporal clip length, which prevents a long clip setting from inflating the engine’s memory allocation.
| Resolution | Jasna 0.4.1 | Jasna 0.9.1 | Reduction |
|---|---|---|---|
| 720p | 19.9 GiB | 4.6 GiB | 77% |
| 1080p | 21.4 GiB | 5.6 GiB | 74% |
| 2160p | 30.5 GiB | 10.9 GiB | 64% |
The reported peaks place 720p and 1080p processing within an 8 GiB memory budget and 2160p within 12 GiB. Actual headroom depends on the GPU, active display workloads, selected models, and input video.
Jasna stages waiting frames in system RAM when GPU memory runs low. Core detection and restoration remain on the GPU, while the queue can spill into host memory instead of immediately failing with an out-of-memory error. That fallback may reduce throughput because frames must cross the PCIe bus.
Check the GPU before downloading
Jasna ships as prebuilt packages for supported operating systems and GPU vendors. It has no CPU inference path, and its documented hardware requirements exclude NVIDIA GTX 10-series cards.
| Platform | GPU requirement | Driver or runtime |
|---|---|---|
| NVIDIA on Windows | GTX 16-series, RTX 20-series, or newer | NVIDIA driver 610 or later |
| NVIDIA on Linux | GTX 16-series, RTX 20-series, or newer | NVIDIA driver 580 or later |
| AMD | ROCm-supported GPU | Experimental support |
The first NVIDIA launch compiles TensorRT engines for the installed GPU and usually takes 15 to 60 minutes. Jasna stores the resulting files in model_weights and reuses compatible engines across later runs and application upgrades. Moving to different GPU hardware can require another compilation.
The command-line interface accepts individual videos, still images, and directories:
jasna --input input.mp4 --output output.mkv
jasna --input photo.png --output restored.png
jasna --input input_folder --output output_folder
If processing exhausts VRAM, the project recommends reducing the maximum clip size from 180 frames to 60. Smaller clips lower memory pressure, although they may affect throughput and increase the number of temporal boundaries.
AGPL code, gated model weights
Jasna’s application code uses the AGPL-3.0 license. Developers distributing modified builds or exposing them as a network service should review the license’s source-sharing requirements, along with the separate terms attached to model weights and third-party tools.
A cumulative contribution of $15 unlocks supporter models through a key delivered via Unifans or Buy Me a Coffee. The gated options include the unet-4x secondary upscaler and an experimental Stable Diffusion 1.5 image-restoration model.
On NVIDIA hardware, Jasna can chain secondary processing through unet-4x, NVIDIA RTX Video Super Resolution, or Topaz Video AI. These tools target large mosaics, close-ups, and 4K footage, where the primary model may produce soft results. Secondary restoration is currently unavailable on AMD, and external products such as Topaz may require their own licenses.
Mosaics leave no recoverable ground truth
Because mosaicing irreversibly replaces source pixels, the restoration network predicts plausible details from surrounding visual context and cannot recover the original pixels. Fine detail, anatomy, and identity cues may be invented, particularly when mosaics are large, move rapidly, or cover most of the available context.
Outputs therefore lack evidentiary reliability. Adult material also raises consent, privacy, distribution, and jurisdiction-specific legal issues, so legitimate deployment requires authorization to process and distribute the source content.
Engineering patterns that transfer
Developers building other GPU video systems can apply several of Jasna’s design choices:
- Separate detection from reconstruction. A fast detector limits expensive restoration work to relevant regions and allows either model to be replaced independently.
- Compile a small set of fixed engine shapes. Temporal clip length can then remain a scheduler setting instead of determining TensorRT’s memory footprint.
- Treat memory pressure as a queueing problem. Staging pending frames in host RAM gives the scheduler another option before terminating the job.
- Respect temporal boundaries. Overlap improves continuity within a shot, while scene-cut detection prevents unrelated frames from sharing restoration context.
- Keep the inference path specialized. Requiring supported GPUs simplifies performance tuning and avoids maintaining slower CPU fallback implementations.
The project roadmap lists possible SeedVR integration, further performance and VRAM reductions, and replacements for both the detector and restoration model. Its current implementation already provides a compact reference for converting a research-oriented video model into a lower-memory, interactive inference pipeline, with project-reported speedups ranging from 3.4× to 5.3×.