Upload folder using huggingface_hub
Browse files- __pycache__/predict.cpython-311.pyc +0 -0
- predict.py +12 -8
__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
|
@@ -202,10 +202,10 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
|
|
| 202 |
direct_flipped = torch.flip(direct_flipped, dims=[4])
|
| 203 |
direct_pred = (direct_orig + direct_flipped) / 2.0
|
| 204 |
|
| 205 |
-
# Multi-run AR with noise diversity
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
ctx = context_tensor.clone()
|
| 210 |
ctx_flip = context_flipped.clone()
|
| 211 |
last_t = last_tensor.clone()
|
|
@@ -216,8 +216,8 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
|
|
| 216 |
ar_orig = _predict_ar_frame(ens.sonic_ar, ctx_in, last_t)
|
| 217 |
ar_flip = _predict_ar_frame(ens.sonic_ar, ctx_flip_in, last_f)
|
| 218 |
ar_flip_back = torch.flip(ar_flip, dims=[3])
|
| 219 |
-
|
| 220 |
-
|
| 221 |
ctx_frames = ctx.reshape(1, CONTEXT_FRAMES, 3, 64, 64)
|
| 222 |
ctx_frames = torch.cat([ctx_frames[:, 1:], ar_orig.unsqueeze(1)], dim=1)
|
| 223 |
ctx = ctx_frames.reshape(1, -1, 64, 64)
|
|
@@ -226,9 +226,13 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
|
|
| 226 |
ctx_flip_frames = torch.cat([ctx_flip_frames[:, 1:], ar_flip.unsqueeze(1)], dim=1)
|
| 227 |
ctx_flip = ctx_flip_frames.reshape(1, -1, 64, 64)
|
| 228 |
last_f = ar_flip
|
| 229 |
-
all_ar_runs.append(torch.stack(ar_preds_run, dim=1))
|
| 230 |
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
predicted = torch.zeros_like(direct_pred)
|
| 234 |
for step in range(PRED_FRAMES):
|
|
|
|
| 202 |
direct_flipped = torch.flip(direct_flipped, dims=[4])
|
| 203 |
direct_pred = (direct_orig + direct_flipped) / 2.0
|
| 204 |
|
| 205 |
+
# Multi-run AR with noise diversity - collect all 6 predictions per step
|
| 206 |
+
# (3 noise levels x 2 TTA directions) and take per-pixel median
|
| 207 |
+
all_step_preds = [[] for _ in range(PRED_FRAMES)]
|
| 208 |
+
for noise_std in [0.0, 1.0/255.0, 2.0/255.0]:
|
| 209 |
ctx = context_tensor.clone()
|
| 210 |
ctx_flip = context_flipped.clone()
|
| 211 |
last_t = last_tensor.clone()
|
|
|
|
| 216 |
ar_orig = _predict_ar_frame(ens.sonic_ar, ctx_in, last_t)
|
| 217 |
ar_flip = _predict_ar_frame(ens.sonic_ar, ctx_flip_in, last_f)
|
| 218 |
ar_flip_back = torch.flip(ar_flip, dims=[3])
|
| 219 |
+
all_step_preds[step].append(ar_orig)
|
| 220 |
+
all_step_preds[step].append(ar_flip_back)
|
| 221 |
ctx_frames = ctx.reshape(1, CONTEXT_FRAMES, 3, 64, 64)
|
| 222 |
ctx_frames = torch.cat([ctx_frames[:, 1:], ar_orig.unsqueeze(1)], dim=1)
|
| 223 |
ctx = ctx_frames.reshape(1, -1, 64, 64)
|
|
|
|
| 226 |
ctx_flip_frames = torch.cat([ctx_flip_frames[:, 1:], ar_flip.unsqueeze(1)], dim=1)
|
| 227 |
ctx_flip = ctx_flip_frames.reshape(1, -1, 64, 64)
|
| 228 |
last_f = ar_flip
|
|
|
|
| 229 |
|
| 230 |
+
ar_pred_list = []
|
| 231 |
+
for step in range(PRED_FRAMES):
|
| 232 |
+
stacked = torch.stack(all_step_preds[step], dim=0) # [6, 1, 3, 64, 64]
|
| 233 |
+
median_val = torch.median(stacked, dim=0).values
|
| 234 |
+
ar_pred_list.append(median_val)
|
| 235 |
+
ar_pred = torch.stack(ar_pred_list, dim=1) # [1, 8, 3, 64, 64]
|
| 236 |
|
| 237 |
predicted = torch.zeros_like(direct_pred)
|
| 238 |
for step in range(PRED_FRAMES):
|