How sunwj/car works
CAR-pytorch accepts high-resolution images, predicts content-adaptive sampling kernels and offsets, downsamples the images, then uses EDSR to reconstruct them and reports image-quality metrics. The README documents pretrained 2×/4× models and benchmark-image workflows. The graph follows the sampled inference orchestration and sampler bindings; CUDA kernel internals and utility implementations were not sampled, so their detailed behavior is not expanded.
Main entry points: run.py Inference runner · edsr.py EDSR upscaler · gridsampler.py Adaptive downsampler · adaptive_gridsampler_cuda.cpp CUDA binding
Components 14
Inference workflow
- Inference runner
run.py - Image loading and saving
run.py - Quality metrics
utils.py
Image models
- Kernel and offset predictor
modules.py - EDSR upscaler
EDSR/edsr.py - EDSR layers
EDSR/common.py
Adaptive sampler
- Adaptive downsampler
adaptive_gridsampler/gridsampler.py - CUDA binding
adaptive_gridsampler/adaptive_gridsampler_cuda.cpp - CUDA kernel
adaptive_gridsampler/adaptive_gridsampler_kernel.cu - Kernel declarations
adaptive_gridsampler/adaptive_gridsampler_kernel.cuh - CUDA helpers
adaptive_gridsampler/helper_cuda.h - String helpers
adaptive_gridsampler/helper_string.h
Other components
- Image user
- Images and scores
Connections 11
- Image user → Inference runner: provides images
README.md - Inference runner → Image loading and saving: loads and saves
run.py - Inference runner → Kernel and offset predictor: predicts kernels
run.py - Inference runner → Adaptive downsampler: downscales image
run.py - Inference runner → EDSR upscaler: reconstructs image
run.py - Inference runner → Quality metrics: calculates scores
run.py - Inference runner → Images and scores: writes results
run.py - Adaptive downsampler → CUDA binding: calls forward
adaptive_gridsampler/gridsampler.py - CUDA binding → Kernel declarations: invokes kernel
adaptive_gridsampler/adaptive_gridsampler_cuda.cpp - EDSR upscaler → EDSR layers: uses layers
EDSR/edsr.py - CUDA helpers → String helpers: references
adaptive_gridsampler/helper_cuda.h