Views
No views yet
| Student | Teacher | |
|---|---|---|
| File | drunet_student.pth | drunet_teacher.pth |
| Parameters | 1.06M | 32.6M |
| Architecture | nc=[16,32,64,128] nb=2 | nc=[64,128,256,512] nb=4 |
| Quality (PSNR) | 49.98 dB | 53.27 dB |
| Sharpness | ~100% of original | 107% of original |
| Speed (RTX 3060) | 57 fps C++ pipeline / 63 fps TRT FP16 / 64 fps TRT INT8 | ~5 fps |
| VRAM | ~500 MB | ~2 GB |
| Checkpoint size | 4 MB | 125 MB |
| Use case | Deployment / real-time | Quality reference / training |
drunet_student.onnx -- ONNX export with dynamic spatial dimensions for TensorRT engine building.1import torch
2import sys
3sys.path.insert(0, "/path/to/KAIR") # github.com/cszn/KAIR
4from models.network_unet import UNetRes
5
6# Student model (fast, deployment)
7model = UNetRes(in_nc=3, out_nc=3, nc=[16, 32, 64, 128], nb=2,
8 act_mode='R', bias=False)
9ckpt = torch.load("drunet_student.pth", map_location="cpu", weights_only=True)
10model.load_state_dict(ckpt["params"])
11model.eval().half().cuda()
12
13# Inference: input is [0, 1] float tensor, NCHW
14with torch.no_grad(), torch.cuda.amp.autocast():
15 output = model(input_tensor)
16output = output.clamp(0, 1)1# Same architecture, larger config
2model = UNetRes(in_nc=3, out_nc=3, nc=[64, 128, 256, 512], nb=4,
3 act_mode='R', bias=False)
4ckpt = torch.load("drunet_teacher.pth", map_location="cpu", weights_only=True)
5model.load_state_dict(ckpt["params"])1# Build TensorRT FP16 engine from ONNX (one-time, ~2 min)
2trtexec --onnx=drunet_student.onnx \
3 --shapes=input:1x3x1080x1920 --fp16 --useCudaGraph \
4 --saveEngine=drunet_student_1080p_fp16.engine
5
6# INT8 quantization (requires calibration data)
7trtexec --onnx=drunet_student.onnx \
8 --shapes=input:1x3x1080x1920 --int8 --fp16 --useCudaGraph \
9 --calib=calibration_data.bin \
10 --saveEngine=drunet_student_1080p_int8.engine1import vapoursynth as vs
2core = vs.core
3clip = core.bs.VideoSource("input.mkv")
4clip = core.resize.Bicubic(clip, format=vs.RGBS, matrix_in_s="709")
5clip = core.ort.Model(clip, network_path="drunet_student.onnx",
6 backend=core.ort.Backend.TRT(fp16=True))
7clip = core.resize.Bicubic(clip, format=vs.YUV420P10, matrix_s="709")
8clip.set_output().pth files use the format {"params": state_dict}. Load with:state_dict = torch.load("model.pth", map_location="cpu", weights_only=True)["params"]UNetRes architecture definition@misc{remaster-drunet,
title={Remaster DRUNet: Real-Time Video Enhancement via Teacher-Student Distillation},
url={https://github.com/seantempesta/remaster},
year={2026}
}