GPU-accelerated motion magnification - #18
Merged
Merged
Conversation
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
This was referenced Mar 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--gpuflag for GPU-accelerated motion magnification viapytorch_wavelets+ cuFFT (~5x speedup)near_sym_b/qshift_b(fewer block artifacts)--biort/--qshiftflags for wavelet filter selectionDockerfile.gpu,docker-build-gpu.sh,requirements-gpu.txtTest plan
Fixes #12 #13 #14 #15 #16 #17
🤖 Generated with Claude Code