Upload folder using huggingface_hub
Browse files- __pycache__/predict.cpython-311.pyc +0 -0
- predict.py +8 -4
__pycache__/predict.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/predict.cpython-311.pyc and b/__pycache__/predict.cpython-311.pyc differ
|
|
|
predict.py
CHANGED
|
@@ -204,7 +204,7 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
|
|
| 204 |
|
| 205 |
# Multi-run AR with noise diversity
|
| 206 |
all_ar_runs = []
|
| 207 |
-
for noise_std in [0.0,
|
| 208 |
ar_preds_run = []
|
| 209 |
ctx = context_tensor.clone()
|
| 210 |
ctx_flip = context_flipped.clone()
|
|
@@ -230,11 +230,15 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
|
|
| 230 |
|
| 231 |
ar_pred = sum(all_ar_runs) / len(all_ar_runs)
|
| 232 |
|
|
|
|
| 233 |
predicted = torch.zeros_like(direct_pred)
|
|
|
|
|
|
|
| 234 |
for step in range(PRED_FRAMES):
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
|
|
|
| 238 |
|
| 239 |
predicted_np = predicted[0].cpu().numpy()
|
| 240 |
ens.direct_cache = []
|
|
|
|
| 204 |
|
| 205 |
# Multi-run AR with noise diversity
|
| 206 |
all_ar_runs = []
|
| 207 |
+
for noise_std in [0.0, 1.0/255.0, 2.0/255.0]:
|
| 208 |
ar_preds_run = []
|
| 209 |
ctx = context_tensor.clone()
|
| 210 |
ctx_flip = context_flipped.clone()
|
|
|
|
| 230 |
|
| 231 |
ar_pred = sum(all_ar_runs) / len(all_ar_runs)
|
| 232 |
|
| 233 |
+
# Agreement-based blending: trust AR where models agree
|
| 234 |
predicted = torch.zeros_like(direct_pred)
|
| 235 |
+
low_thresh = 10.0 / 255.0
|
| 236 |
+
high_thresh = 50.0 / 255.0
|
| 237 |
for step in range(PRED_FRAMES):
|
| 238 |
+
disagreement = torch.abs(ar_pred[:, step] - direct_pred[:, step])
|
| 239 |
+
# Where agree: AR weight=1.0, where disagree strongly: AR weight=0.5
|
| 240 |
+
ar_w = 1.0 - 0.5 * torch.clamp((disagreement - low_thresh) / (high_thresh - low_thresh), 0, 1)
|
| 241 |
+
predicted[:, step] = ar_w * ar_pred[:, step] + (1.0 - ar_w) * direct_pred[:, step]
|
| 242 |
|
| 243 |
predicted_np = predicted[0].cpu().numpy()
|
| 244 |
ens.direct_cache = []
|