ojaffe commited on
Commit
5e7fdcb
·
verified ·
1 Parent(s): 89d0208

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
@@ -192,14 +192,13 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
192
 
193
  ens.reset_cache()
194
 
195
- # Strict static detection: ALL 7 consecutive pairs must have diff < 1/255
196
- all_static = True
197
- for i in range(len(frames) - 1):
198
- diff = np.abs(frames[i].astype(np.float32) - frames[i + 1].astype(np.float32)).mean()
199
- if diff >= 1.0 / 255.0:
200
- all_static = False
201
- break
202
- if all_static:
203
  last_ctx_uint8 = (last_frame * 255).clip(0, 255).astype(np.uint8)
204
  ens.direct_cache = [last_ctx_uint8.copy() for _ in range(PRED_FRAMES)]
205
  result = ens.direct_cache[ens.cache_step]
 
192
 
193
  ens.reset_cache()
194
 
195
+ # Medium static detection: all frames vs first frame, max diff < 2/255
196
+ max_diff = 0
197
+ first_frame = frames[0]
198
+ for i in range(1, len(frames)):
199
+ diff = np.abs(frames[i].astype(np.float32) - first_frame.astype(np.float32)).mean()
200
+ max_diff = max(max_diff, diff)
201
+ if max_diff < 2.0 / 255.0:
 
202
  last_ctx_uint8 = (last_frame * 255).clip(0, 255).astype(np.uint8)
203
  ens.direct_cache = [last_ctx_uint8.copy() for _ in range(PRED_FRAMES)]
204
  result = ens.direct_cache[ens.cache_step]