ojaffe commited on
Commit
7cae137
·
verified ·
1 Parent(s): cd75c12

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. __pycache__/predict.cpython-311.pyc +0 -0
  2. predict.py +7 -13
__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,17 @@ 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
  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()
211
  last_t = last_tensor.clone()
212
  last_f = last_flipped.clone()
213
  for step in range(PRED_FRAMES):
214
- ctx_in = ctx if noise_std == 0 else torch.clamp(ctx + torch.randn_like(ctx) * noise_std, 0, 1)
215
- ctx_flip_in = ctx_flip if noise_std == 0 else torch.clamp(ctx_flip + torch.randn_like(ctx_flip) * noise_std, 0, 1)
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])
@@ -230,17 +230,11 @@ 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
- # Channel-specific AR/direct blend: blue gets more direct weight
234
- # ar_start, ar_end per channel: R(0.65,0.35), G(0.60,0.30), B(0.50,0.20)
235
- ch_ar_start = [0.65, 0.60, 0.50]
236
- ch_ar_end = [0.35, 0.30, 0.20]
237
  predicted = torch.zeros_like(direct_pred)
238
  for step in range(PRED_FRAMES):
239
- t = step / (PRED_FRAMES - 1)
240
- for c in range(3):
241
- ar_w = ch_ar_start[c] - t * (ch_ar_start[c] - ch_ar_end[c])
242
- di_w = 1.0 - ar_w
243
- predicted[:, step, c] = ar_w * ar_pred[:, step, c] + di_w * direct_pred[:, step, c]
244
 
245
  predicted_np = predicted[0].cpu().numpy()
246
  ens.direct_cache = []
 
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 brightness in [1.0, 1.02, 0.98]:
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 = torch.clamp(ctx * brightness, 0, 1) if brightness != 1.0 else ctx
215
+ ctx_flip_in = torch.clamp(ctx_flip * brightness, 0, 1) if brightness != 1.0 else ctx_flip
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])
 
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
+ ar_weight = 0.65 - (step / (PRED_FRAMES - 1)) * 0.3
236
+ direct_weight = 1.0 - ar_weight
237
+ predicted[:, step] = ar_weight * ar_pred[:, step] + direct_weight * direct_pred[:, step]
 
 
238
 
239
  predicted_np = predicted[0].cpu().numpy()
240
  ens.direct_cache = []