Upload folder using huggingface_hub
Browse files- __pycache__/predict.cpython-311.pyc +0 -0
- predict.py +19 -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
|
@@ -202,17 +202,32 @@ 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 brightness diversity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
all_ar_runs = []
|
| 207 |
-
for
|
| 208 |
ar_preds_run = []
|
| 209 |
ctx = context_tensor.clone()
|
| 210 |
ctx_flip = context_flipped.clone()
|
| 211 |
last_t = last_tensor.clone()
|
| 212 |
last_f = last_flipped.clone()
|
| 213 |
for step in range(PRED_FRAMES):
|
| 214 |
-
ctx_in =
|
| 215 |
-
ctx_flip_in =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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])
|
|
|
|
| 202 |
direct_flipped = torch.flip(direct_flipped, dims=[4])
|
| 203 |
direct_pred = (direct_orig + direct_flipped) / 2.0
|
| 204 |
|
| 205 |
+
# Multi-run AR with combined noise+brightness diversity (6 runs)
|
| 206 |
+
# (noise_std, brightness_mult)
|
| 207 |
+
perturbations = [
|
| 208 |
+
(0.0, 1.0), # normal
|
| 209 |
+
(1.0/255.0, 1.0), # noise only
|
| 210 |
+
(2.0/255.0, 1.0), # more noise
|
| 211 |
+
(0.0, 1.02), # brighter
|
| 212 |
+
(0.0, 0.98), # darker
|
| 213 |
+
(1.0/255.0, 1.01), # noise + slight bright
|
| 214 |
+
]
|
| 215 |
all_ar_runs = []
|
| 216 |
+
for noise_std, bright in perturbations:
|
| 217 |
ar_preds_run = []
|
| 218 |
ctx = context_tensor.clone()
|
| 219 |
ctx_flip = context_flipped.clone()
|
| 220 |
last_t = last_tensor.clone()
|
| 221 |
last_f = last_flipped.clone()
|
| 222 |
for step in range(PRED_FRAMES):
|
| 223 |
+
ctx_in = ctx
|
| 224 |
+
ctx_flip_in = ctx_flip
|
| 225 |
+
if noise_std > 0:
|
| 226 |
+
ctx_in = torch.clamp(ctx_in + torch.randn_like(ctx_in) * noise_std, 0, 1)
|
| 227 |
+
ctx_flip_in = torch.clamp(ctx_flip_in + torch.randn_like(ctx_flip_in) * noise_std, 0, 1)
|
| 228 |
+
if bright != 1.0:
|
| 229 |
+
ctx_in = torch.clamp(ctx_in * bright, 0, 1)
|
| 230 |
+
ctx_flip_in = torch.clamp(ctx_flip_in * bright, 0, 1)
|
| 231 |
ar_orig = _predict_ar_frame(ens.sonic_ar, ctx_in, last_t)
|
| 232 |
ar_flip = _predict_ar_frame(ens.sonic_ar, ctx_flip_in, last_f)
|
| 233 |
ar_flip_back = torch.flip(ar_flip, dims=[3])
|