ojaffe commited on
Commit
8ed02fd
·
verified ·
1 Parent(s): 7051a2c

Upload folder using huggingface_hub

Browse files
__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
@@ -164,11 +164,9 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
164
 
165
  ar_pred = torch.stack(ar_preds, dim=1)
166
 
167
- # U-shaped AR weights: less AR early/late, more in middle
168
- pong_ar_weights = [0.70, 0.70, 0.85, 0.85, 0.85, 0.60, 0.60, 0.60]
169
  predicted = torch.zeros_like(direct_pred)
170
  for step in range(PRED_FRAMES):
171
- ar_weight = pong_ar_weights[step]
172
  direct_weight = 1.0 - ar_weight
173
  predicted[:, step] = ar_weight * ar_pred[:, step] + direct_weight * direct_pred[:, step]
174
 
@@ -238,6 +236,13 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
238
  direct_weight = 1.0 - ar_weight
239
  predicted[:, step] = ar_weight * ar_pred[:, step] + direct_weight * direct_pred[:, step]
240
 
 
 
 
 
 
 
 
241
  predicted_np = predicted[0].cpu().numpy()
242
  ens.direct_cache = []
243
  for i in range(PRED_FRAMES):
 
164
 
165
  ar_pred = torch.stack(ar_preds, dim=1)
166
 
 
 
167
  predicted = torch.zeros_like(direct_pred)
168
  for step in range(PRED_FRAMES):
169
+ ar_weight = 0.85 - (step / (PRED_FRAMES - 1)) * 0.3
170
  direct_weight = 1.0 - ar_weight
171
  predicted[:, step] = ar_weight * ar_pred[:, step] + direct_weight * direct_pred[:, step]
172
 
 
236
  direct_weight = 1.0 - ar_weight
237
  predicted[:, step] = ar_weight * ar_pred[:, step] + direct_weight * direct_pred[:, step]
238
 
239
+ # Motion correction from context
240
+ ctx_reshaped = context_tensor.reshape(1, CONTEXT_FRAMES, 3, 64, 64)
241
+ motion = ctx_reshaped[:, -1] - ctx_reshaped[:, -2] # [1, 3, 64, 64]
242
+ for step in range(PRED_FRAMES):
243
+ alpha = 0.05 * (step + 1)
244
+ predicted[:, step] = torch.clamp(predicted[:, step] + alpha * motion, 0, 1)
245
+
246
  predicted_np = predicted[0].cpu().numpy()
247
  ens.direct_cache = []
248
  for i in range(PRED_FRAMES):