Views
No views yet
MBDModule to aggregate multi-dilation contextersvr/models/*.py are available locally.1import torch, sys
2from huggingface_hub import hf_hub_download
3
4# If you cloned the model repo contents locally:
5# sys.path.append(".")
6
7from ersvr.models.ersvr import ERSVR
8import numpy as np
9
10# Download weights
11ckpt_path = hf_hub_download(
12 repo_id="Abhinavexists/SeeSharp",
13 filename="weights/ersvr_best.pth"
14)
15
16device = "cuda" if torch.cuda.is_available() else "cpu"
17model = ERSVR(scale_factor=4).to(device)
18
19state = torch.load(ckpt_path, map_location=device)
20if isinstance(state, dict) and "model_state_dict" in state:
21 state = state["model_state_dict"]
22model.load_state_dict(state)
23model.eval()
24
25# Prepare a triplet: (3, H, W, 3) with values in [0,1]
26img = np.random.rand(128, 128, 3).astype("float32")
27triplet = np.stack([img, img, img], axis=0) # demo: same frame
28tensor = torch.from_numpy(triplet).permute(3,0,1,2).unsqueeze(0).to(device) # (1,3,3,H,W)
29
30with torch.no_grad():
31 out = model(tensor).clamp(0,1) # (1,3,4H,4W)img.astype(np.float32)/255.0weights/ersvr_best.pth (recommended)weights/ersvr_epoch_10.pth, weights/ersvr_epoch_20.pth, weights/ersvr_epoch_30.pth (training checkpoints)ersvr/train.py for metric computation helpers.