Skip to content

GPU-accelerated motion magnification - #18

Merged
joeljose merged 1 commit into
mainfrom
feature/gpu-acceleration
Mar 21, 2026
Merged

GPU-accelerated motion magnification#18
joeljose merged 1 commit into
mainfrom
feature/gpu-acceleration

Conversation

@joeljose

Copy link
Copy Markdown
Owner

Summary

  • Add --gpu flag for GPU-accelerated motion magnification via pytorch_wavelets + cuFFT (~5x speedup)
  • Switch default wavelet filters to near_sym_b/qshift_b (fewer block artifacts)
  • Add --biort/--qshift flags for wavelet filter selection
  • FFT-based CPU temporal filter optimization (2x CPU speedup)
  • Dockerfile.gpu, docker-build-gpu.sh, requirements-gpu.txt
  • Pre-flight memory estimation
  • 46 tests (32 CPU + 14 GPU)

Test plan

  • CPU lint passes (ruff)
  • 32 CPU tests pass
  • 45 GPU tests pass (1 skipped on CPU image)
  • End-to-end GPU pipeline on face.mp4 produces correct output
  • Boundary artifacts fixed (reflect-padded cuFFT)
  • GPU output visually verified at k=2, k=3, k=5

Fixes #12 #13 #14 #15 #16 #17

🤖 Generated with Claude Code

GPU acceleration for the DTCWT motion magnification pipeline, delivering
~5x speedup (25s vs 2min on 301-frame 528x592 video, RTX 4050).

Architecture: two-pass batched pipeline
  Pass 1: Batched DTCWTForward + vectorized phase extraction → CPU
  Filter: Chunked cuFFT temporal filter with reflect-padding
  Pass 2: Re-run DTCWTForward for Yl/amplitudes, reconstruct, DTCWTInverse

New features:
  --gpu flag for GPU acceleration
  --device flag for GPU selection
  --biort/--qshift flags for wavelet filter selection
  Default filters changed to near_sym_b/qshift_b (fewer artifacts)
  FFT-based CPU temporal filter (4x faster for large windows)
  Pre-flight memory estimation
  Dockerfile.gpu, docker-build-gpu.sh, requirements-gpu.txt

Key design decisions:
  - Single file with --gpu flag (not separate file)
  - 3x C=1 sequential channels (C=3 only 1.2x faster, not worth complexity)
  - Float32 everywhere on GPU (verified negligible cumsum error)
  - Chunked cuFFT with reflect-padding (matches CPU boundary handling)
  - Re-run forward DTCWT in Pass 2 (deterministic, saves 718 MB RAM)
  - Auto-tuned batch/chunk sizes from available VRAM

Tests: 46 total (32 CPU + 14 GPU, GPU tests skip on CPU-only)

Fixes #12 #13 #14 #15 #16 #17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slice 1: Switch default wavelet filters + add --biort/--qshift flags

1 participant