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

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. __pycache__/predict.cpython-311.pyc +0 -0
  2. predict.py +9 -11
__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
@@ -230,27 +230,25 @@ 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
- 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 = []
241
- last_ctx_uint8 = (last_frame * 255).clip(0, 255).astype(np.uint8)
242
- catastrophic = False
243
  for i in range(PRED_FRAMES):
244
  frame = np.transpose(predicted_np[i], (1, 2, 0))
245
  frame = (frame * 255).clip(0, 255).astype(np.uint8)
246
- diff = np.abs(frame.astype(np.float32) - last_ctx_uint8.astype(np.float32)).mean()
247
- if diff > 100:
248
- catastrophic = True
249
  ens.direct_cache.append(frame)
250
 
251
- if catastrophic:
252
- ens.direct_cache = [last_ctx_uint8.copy() for _ in range(PRED_FRAMES)]
253
-
254
  result = ens.direct_cache[ens.cache_step]
255
  ens.cache_step += 1
256
  return result
 
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 = []
 
 
247
  for i in range(PRED_FRAMES):
248
  frame = np.transpose(predicted_np[i], (1, 2, 0))
249
  frame = (frame * 255).clip(0, 255).astype(np.uint8)
 
 
 
250
  ens.direct_cache.append(frame)
251
 
 
 
 
252
  result = ens.direct_cache[ens.cache_step]
253
  ens.cache_step += 1
254
  return result