Upload folder using huggingface_hub
Browse files- __pycache__/predict.cpython-311.pyc +0 -0
- predict.py +8 -3
__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,9 +192,14 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
|
|
| 192 |
|
| 193 |
ens.reset_cache()
|
| 194 |
|
| 195 |
-
#
|
| 196 |
-
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
last_ctx_uint8 = (last_frame * 255).clip(0, 255).astype(np.uint8)
|
| 199 |
ens.direct_cache = [last_ctx_uint8.copy() for _ in range(PRED_FRAMES)]
|
| 200 |
result = ens.direct_cache[ens.cache_step]
|
|
|
|
| 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]
|