Upload folder using huggingface_hub
Browse files- __pycache__/predict.cpython-311.pyc +0 -0
- predict.py +7 -8
__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 |
-
#
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 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]
|