Skip to content

About

Offline AI upscaler for images and video.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

LucidFrame

Offline AI upscaler for images and video. Drop a file, pick a model, get up to 4× the resolution — entirely on your own computer. Nothing is uploaded, there is no account, and there is nothing to set up.

LucidFrame comparing an original photo (left) with its 4× upscale (right)

  • Modern models — RealPLKSR (2024) for photos and anime, a compact network for fast video.
  • Restore pipeline — several models work together. Blocky JPEGs and out-of-focus photos are repaired before upscaling, and small or damaged faces are rebuilt afterwards. It decides by itself what an image needs. Details and results below.
  • Photos and video — images up to 4×; video keeps its frame rate and audio, with optional "smooth" playback that doubles the frame rate with RIFE frame interpolation (scene cuts are held, not blended).
  • Fast on whatever you have — DirectML on any Windows GPU (NVIDIA, AMD, Intel), CoreML on Apple Silicon, CPU everywhere. It picks the best one and falls back automatically if something goes wrong.
  • Private by design — no network access, no listening port, no telemetry. Originals are never modified or overwritten.
  • Real before/after viewer — draggable divider, zoom to 100%, batch queue with progress and cancel.

Install

Just want to use it?

Download the installer for your system from the Releases page and run it. That's the whole setup — the AI models are included, and nothing is downloaded on first launch.

System File Notes
Windows 10/11 (64-bit) LucidFrame-*-win-x64.exe One-click, per-user install, no admin prompt. GPU acceleration works out of the box. If SmartScreen warns about an unknown publisher, choose More info → Run anyway (builds are not code-signed yet).
macOS (Apple Silicon) LucidFrame-*-mac-arm64.dmg Drag to Applications. Builds are not notarized yet: right-click the app → Open the first time.
Linux (64-bit) LucidFrame-*-linux-x86_64.AppImage or .deb AppImage: chmod +x it and run. Runs on CPU (see GPU on Linux).

Run from source

You need Node.js 22.12 or newer. That's all — no Python, no virtual environments, no separate backend to start.

git clone https://github.com/Cosmos-0118/LucidFrame.git
cd LucidFrame
npm install
npm start

npm start builds the interface if needed, downloads the AI model files the first time (about 205 MB, checked against pinned SHA-256 hashes, so it resumes cleanly if interrupted) and opens the app. After that it works offline. To fetch them ahead of time: npm run models. Installers already contain the models and never download anything.

Using it

  1. Drop images or videos onto the window (or Choose files / folder). Several at once is fine — they form a queue.
  2. Pick a model and a scale. Photo/Anime for the best quality, Fast for video or when you're in a hurry.
  3. Click Upscale. Results are saved next to the original as name_lucid_4x.png (or into a folder you choose). Existing files are never overwritten.
  4. Drag the divider to compare, scroll to zoom, double-click to jump between fit and 100%.

Restore: multiple models working together

An upscaler can only enlarge what is in the picture. If the picture is a low-quality JPEG, it enlarges the compression blocks; if it is out of focus, it enlarges the blur; if a face is a few dozen pixels wide, it invents a wrong one. So LucidFrame runs a small pipeline around the upscaler, entirely on your machine:

 photo ─► 1. Clean up ─► 2. Upscale ─► 3. Restore faces ─► result
          (blocks, blur)   (your model)   (small / damaged faces)
  1. Clean up (RealPLKSR 1×, trained on JPEG damage and blur). In Auto it runs only when it detects 8×8 JPEG blocking or a soft, out-of-focus image, and blends in more gently for borderline cases. Clean, sharp photos are left alone (forcing it on those makes them worse).
  2. Upscale with the model you chose.
  3. Restore faces (YuNet finds faces and landmarks, RestoreFormer++ rebuilds each aligned face from the original pixels, and the result is colour-matched and blended in along the face's outline, found by a face-parsing model). In Auto it acts on small or degraded faces and fades out as a face gets large and already detailed; Always restores every face.

Each stage can be set to Auto, On/Always or Off in the app (Restore section) or on the command line (--cleanup, --faces). The result bar says what was applied.

Faces from three photos: the input, the photo model alone, the previous release, the current Restore and the original

Output of the current app (new Photo model) through the command line. Faces at the 75th, 50th and 25th percentile of the change from the previous release (top to bottom), not the best ones. The face restorer itself is unchanged, so faces look much as before; a face of a dozen pixels (middle row) cannot be recovered by any model.

Two things make Restore faithful. The face is rebuilt from the original pixels, not from the upscaler's output (which has already invented detail for a small face, and a restorer that starts from an invention drifts further from the real person). And it is blended in along the face's true outline (a face-parsing model), not through a fixed oval that dragged background and hair along with it. When this design replaced the earlier Restore (October 2026), LPIPS fell on 94–95% of faces (by 0.022–0.026) and identity rose on 71–99% of them (by 0.029–0.046).

Measured through the app itself (tools/bench/compare_scenes.py): 12 public-domain NASA group photos, 80 faces, degraded three ways, 4× results compared with the original at its own size. LPIPS is perceptual distance (lower is better); identity is the cosine similarity of ArcFace face embeddings (higher is better, 1.0 is the same person).

Input Method LPIPS Identity
640 px wide, JPEG q50 Photo model only 0.202 0.630
Previous release 0.175 0.678
Restore now 0.175 0.677
640 px wide, soft, JPEG q60 Photo model only 0.237 0.522
Previous release 0.200 0.576
Restore now 0.199 0.564
960 px wide, JPEG q70 Photo model only 0.149 0.849
Previous release 0.132 0.857
Restore now 0.132 0.860

Against the previous release (December 2026: new Photo model, re-tuned cleanup) faces come out the same, within the measurement's margin, except identity on soft photos, 0.012 lower: about a third of a face's pixels still come from the upscaled image, which is now cleaned more strongly. Face restoration raises identity over the Photo model alone by 0.01–0.05 in every case.

Honest notes: the degradations are synthetic and the faces come from one kind of photo (crew portraits), so this is a benchmark of this pipeline against its predecessor, not a promise about your photos. On a single image the result can go either way: on one portrait with four degradations the current Restore tied or was slightly worse on perceptual distance in three of four cases, which is why averages over many faces are shown. PSNR/SSIM do not improve in the hardest cases (they penalise any invented detail). Face restoration invents plausible detail, so a person's likeness can change slightly: the default blend strength (--face-strength 0.7) was chosen because identity and perceptual quality are both flat to best there; lower it, or switch faces off, if fidelity matters more than looks. Block-aligned pixel art can be mistaken for compression; set cleanup to Off for it.

Models

All four upscalers ship with the app and run offline, together with the four Restore components and the RIFE frame interpolator for Smooth motion (about 141 MB).

Model Scale Best for Speed*
Photo 4× native Photographs, scans, web images ~100 s per input megapixel
Anime & Art 4× native Anime, cartoons, illustrations ~105 s per input megapixel
Fast 2× native Video, quick previews, anything ~5 s per input megapixel
Fast Anime 2× native Anime video ~6 s per input megapixel

*CPU only, measured on a 4-core server CPU; a modern desktop CPU is faster and a GPU is far faster. A 1920×1080 photo is 2 MP. Any scale from 2× to 4× works with any model: a 4× model is resized down for 2×/3×, a 2× model is applied twice for 3×/4×.

How the Photo model was chosen

The Photo pipeline was re-benchmarked against every newer free model we could find (December 2026), on 42 photos (30 from DIV2K, 12 NASA scenes) shrunk 4× and degraded three ways: clean, web JPEG (quality 75) and rough (blur, sensor noise, JPEG quality 55). Each 4× result is compared with the original. LPIPS and DISTS measure how different it looks (lower is better); PSNR measures pixel accuracy (higher is better). Every GPU result was checked against the CPU.

Crops from three photos: the input, the previous Photo model, the current one, and the original

Each row is the photo with the median improvement for that kind of damage, not the best one. Inputs are enlarged so the pixels line up; crops are 2× zoomed without smoothing.

Photo is now 4xBHI_realplksr_dysample_real (same author and architecture family as before, same file size, about the same speed), plus a re-tuned Auto cleanup. Through the full pipeline (tools/bench/bench_tweaks.py):

Input LPIPS (before → now) DISTS (before → now) PSNR dB (before → now) Now looks better on (LPIPS / DISTS)
Clean 0.153 → 0.147 0.056 → 0.047 26.3 → 27.3 57% / 79% of photos
Web JPEG 0.256 → 0.230 0.105 → 0.091 24.8 → 25.4 93% / 90%
Rough 0.335 → 0.316 0.143 → 0.128 23.6 → 24.0 69% / 88%
All 0.248 → 0.231 0.101 → 0.089 24.9 → 25.6 73% / 86%

What was tried (raw models, all 126 inputs, tools/bench/bench_upscalers.py):

4× model LPIPS DISTS PSNR GPU time vs Photo Verdict
4xNomosWebPhoto_RealPLKSR (previous Photo) 0.254 0.103 24.9 1× replaced
4xBHI_realplksr_dysample_real 0.239 0.094 25.9 1× chosen
4xHEART (2026, attention) GAN 0.236 0.095 26.1 5–12× best on clean photos, too slow for the gain
4xNERVE (2026) GAN / fidelity 0.281 / 0.358 0.113 / 0.135 26.0 / 27.0 ~2× higher PSNR, looks worse
4xNomos2_realplksr_dysample 0.265 0.114 24.6 1× good on web JPEGs only
Real-ESRGAN x4plus (2021) 0.253 0.118 24.7 0.6× best on rough, poor on clean
4xBHI_dat2_real — — — ~6× over 2 s per GPU tile: not shippable

The 2× models were checked the same way: Fast stays. PULSE (2026) is better on clean video frames but falls apart on compressed ones (on LPIPS it loses on 98–100% of JPEG inputs), and NERVE 2× is better on damaged frames but 27× slower, which defeats the point of Fast.

Tweaks measured on top of the model, and kept only when they helped:

  • Auto cleanup thresholds (kept). Cleanup before upscaling helped every rough photo in the test (at its best strength, LPIPS + DISTS fell by 0.01–0.16) and hurts clean ones. Auto now starts cleaning at a blockiness of 1.14 instead of 1.25, at 75% strength, full from 1.29; on held-out photos this beat the old setting in 10 of 10 cross-validation splits. It cleans 90% of the rough inputs (was 38%), 10% of web JPEGs and 5% of clean photos. The face restorer keeps reading pixels cleaned with the gentler, face-calibrated curve: given the stronger cleanup, it lost likeness on 80 benchmark faces.
  • Test-time averaging (rejected). Averaging over 2 flips or 8 flips/rotations raises PSNR but looks worse (LPIPS 0.244 / 0.267 vs 0.239): it averages away the generated texture.
  • Weight blending with Nomos2 (rejected). BHI was fine-tuned from Nomos2, so their weights can be mixed; 85/15 and 70/30 blends were worse than BHI alone.

GPU correctness. The benchmark found that DirectML (on an AMD RX 9060 XT) returned systematically wrong output for the DySample upsampler in the Photo and Anime models above 256 px tiles: the same wrong pixels on every run, which no self-check based on the output alone can see. The Anime model in earlier releases was affected. The cause is a single GridSample whose output exceeds ~256 MB; the models are now exported with one GridSample per channel group (same arithmetic), which matches the CPU at every tile size. LUCIDFRAME_TEST_GPU=1 node --test tests/gpu.test.js compares every model on the GPU with the CPU at every tile size the app may use.

Speed. Same photos, same output quality, previous release vs now (RX 9060 XT, DirectML, command line, PNG output):

Job Before Now
One 1200×800 web photo 10.6 s 7.8 s (1.35×)
One damaged 800 px JPEG (cleanup + upscale) 14.7 s 9.6 s (1.54×)
Four photos in one batch 42.1 s 35.3 s (1.19×)

Where it comes from: the GPU window size is chosen per image (fixed 512 px windows spent up to 40% of the work on padding and overlap; 448 px needs 23% less for a 1200×800 photo), a model that has passed the GPU self-check on this GPU and driver skips it next time (a driver update re-runs it), the cleanup and upscaling models stay loaded together during a batch, and the next tile is prepared while the GPU works on the current one.

Smooth motion

Smooth doubles a video's frame rate. It now builds each new frame with RIFE v4.26, a neural frame interpolator, instead of ffmpeg's minterpolate. A scene cut is held (the previous frame repeats) instead of being blended into a ghost of both shots. If the model cannot run, the app falls back to minterpolate and says so.

Middle frames built by ffmpeg minterpolate and by RIFE, next to the real middle frame

Middlebury sequences: frames 9 and 11 in, frame 10 out. Rows are the 75th and 50th percentile of improvement; crops are where the motion is.

Method (20 frame pairs, Middlebury) PSNR SSIM LPIPS Better than minterpolate on
ffmpeg minterpolate (before) 31.14 0.911 0.064 —
RIFE v4.26 (now) 31.62 0.923 0.025 20 of 20 pairs (LPIPS)

On the GPU, RIFE takes about 90 ms per 720p frame and 145 ms per 1080p frame (RX 9060 XT, DirectML), small next to the upscaling itself.

Command line

The same engine, without a window — handy for scripts and batch jobs:

npm run cli -- photo.jpg                       # best photo model, 4×
npm run cli -- clip.mp4 -m fast -s 2           # video, fast model, 2×
npm run cli -- *.png -m anime --out-dir out    # batch
npm run cli -- doctor                          # verify models, GPU/CPU inference, codecs, ffmpeg
npm run cli -- old-portrait.jpg --cleanup on --faces always    # force both Restore stages
npm run cli -- logo.png --cleanup off --faces off              # plain upscale, no extras

Run npm run cli -- --help for every option (--format, --quality, --smooth, --cleanup, --faces, --face-strength, --device, --json…).

Troubleshooting

Use Help → Run self-check… in the app (press Alt to show the menu on Windows/Linux), or npm run doctor from source. It checks that the models and Restore components are intact, runs a real inference and each Restore stage, and reports which device is used, in a few seconds.

  • It's slow. Check the device chip in the bottom-left of the app. "CPU" means no GPU was found; use the Fast model, or a smaller scale. On Windows and Apple Silicon a GPU is used automatically.
  • Logs live in %APPDATA%\LucidFrame\logs (Windows), ~/Library/Application Support/LucidFrame/logs (macOS) or ~/.config/LucidFrame/logs (Linux). Help → Open log folder opens them.
  • "The processing engine stopped unexpectedly". The machine most likely ran out of memory. Use a smaller scale or the Fast model. The app restarts its engine by itself; nothing needs to be relaunched.
  • Linux AppImage won't start on Ubuntu 24.04+. The app detects the OS restriction on Chromium's sandbox and adapts. If you still hit issues, run it with --no-sandbox.

Environment variables (all optional): LUCIDFRAME_DEVICE = auto · cpu · dml · cuda · coreml; LUCIDFRAME_MODELS (models folder); LUCIDFRAME_FFMPEG (use your own ffmpeg); LUCIDFRAME_LOG_LEVEL = debug · info · warn · error; LUCIDFRAME_DML_DEVICE (DirectML adapter index, default 0).

GPU on Linux

The Windows (DirectML) and macOS (CoreML) builds are GPU-accelerated with no extra steps. On Linux the packaged AppImage/.deb run on CPU. NVIDIA owners can run from source: npm install fetches ONNX Runtime's CUDA provider, which is used automatically when the CUDA runtime libraries are installed on the machine.

How it works

 ┌──────────────┐  IPC (no network)  ┌───────────┐  messages  ┌────────────────────────────────┐
 │ React UI     │◄──────────────────►│ Electron  │◄──────────►│ Engine process                 │
 │ (sandboxed)  │                    │ main      │            │ ONNX Runtime · sharp · ffmpeg  │
 └──────────────┘                    └───────────┘            └────────────────────────────────┘
  • Engine (src/engine): tiled inference with mirrored context and cross-faded overlaps (no visible seams), automatic device selection (DirectML → CUDA → CoreML → CPU) with fallback to smaller tiles and then CPU if a GPU runs out of memory. Videos stream through two ffmpeg processes — decode → model → encode — so no frames are written to disk, the frame rate is preserved and audio is carried over.
  • App (src/main, src/renderer): the UI never touches the filesystem or the network. It refers to files by id, media is served through unguessable tokens, every IPC call is validated, and a strict Content-Security-Policy forbids remote code. The engine runs in its own process, so a crash can't take the window down.
  • Restore (src/engine/restore): blockiness and softness detectors, YuNet face detection, similarity-transform alignment, RestoreFormer++ restoration from the source pixels, colour matching and face-parsing mask blending. Optional stages: if one cannot run, the job still finishes and says so.
  • Models (models/): ONNX files verified by SHA-256 before use. tools/convert_models.py rebuilds them from the pinned upstream weights.

Development

npm run dev          # UI with hot reload + the app
npm test             # engine, models, ffmpeg, CLI, host protocol, security helpers
npm run test:e2e     # drives the real Electron app (on Linux: xvfb-run npm run test:e2e)
npm run pack         # unpacked app in release/   ·   npm run smoke:packaged to check it
npm run dist         # installer for the current OS (CI builds all three: see .github/workflows)

To cut a release, push a tag like v2.3.0; GitHub Actions writes that version into package.json, builds the Windows installer (LucidFrame-2.3.0-win-x64.exe) and attaches it to the release. (CI and release builds for macOS and Linux are switched off for now; macOS and Linux users can run from source with npm install && npm start.)

Where the model files live

The converted .onnx files (about 205 MB) are not in git: they are assets of a GitHub release named by "release" in models/manifest.json, and the manifest pins each file's size and SHA-256. npm run models (also run automatically by npm start, npm test, npm run pack and CI) downloads whatever is missing, refuses anything whose hash does not match, and leaves no half-written files. CI caches them by manifest hash. Set LUCIDFRAME_MODELS_URL to use a mirror.

To change a model: run tools/convert_models.py --release models-N (needs Python once; see its header; the face restorer and face parser are built by tools/convert_faces.py instead), upload the resulting .onnx files as assets of a new release tagged models-N (a normal GitHub release; untick "Set as the latest release"), and commit the updated models/manifest.json. The manifest names a single release, so that release must hold every file the manifest lists, not only the ones that changed. End users and normal development never need Python.

Upgrading from v1

v1 was a Python/FastAPI backend (PyTorch, Real-ESRGAN, GFPGAN) started alongside an Electron front end, with PowerShell setup scripts. v2 replaces that stack:

v1 v2
Setup Python 3.11, venv, PowerShell scripts, model downloads, ffmpeg download npm install && npm start — or just an installer
Processes Electron + separate backend on localhost:8000 Electron + an internal engine process, no port
Models Real-ESRGAN x4plus/x2plus/anime (2021), GFPGAN RealPLKSR (2024) and compact models, bundled
Video Every frame written to PNG, fixed 25 fps Streamed through ffmpeg, original fps and audio kept
Filters Sharpen, denoise, brightness, contrast, saturation, presets Removed — models do the enhancing
Face restore GFPGAN toggle (PyTorch) Restore pipeline: RestoreFormer++ in ONNX, with face detection, alignment and parsing, plus JPEG/blur cleanup
Platforms Windows only Windows, macOS (Apple Silicon), Linux

Credits & licenses

LucidFrame is MIT licensed. The bundled models are CC-BY-4.0 and require attribution; see NOTICES.md for the models, authors, and every third-party component.

About

Offline AI upscaler for images and video.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages