Instructions to use dvdface/next-frame-predict with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use dvdface/next-frame-predict with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy), and from_pretrained_keras was removed in huggingface_hub 1.0. # See https://github.com/keras-team/tf-keras for more details. # !pip install "huggingface_hub<1.0" tf_keras from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("dvdface/next-frame-predict") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from dvdface/next-frame-predict: direct link, hf CLI and curl.
- Browser
- Download file 2.16 kB
-
https://huggingface.co/dvdface/next-frame-predict/resolve/main/README.md
- Command line
-
hf download hf://dvdface/next-frame-predict/README.md
-
curl -L -o README.md https://huggingface.co/dvdface/next-frame-predict/resolve/main/README.md
2.16 kB
| ## PredNet denoising (black-box SavedModel) | |
| This repository packages a TensorFlow **SavedModel** for video-frame prediction/denoising **without publishing any model architecture source code**. Inference calls the SavedModel signature as a black box and produces predicted frames. | |
| ### Files | |
| - `savedmodel/`: TensorFlow SavedModel directory (weights + graph) | |
| - `infer/`: minimal inference helpers (black-box loader + IO) | |
| - `predict.py`: CLI that outputs prediction images | |
| - `anomaly.py`: CLI that outputs per-frame anomaly scores (ahat_error + 1-SSIM vectors) | |
| ### Install | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ### Run (from a directory of frames) | |
| `frames_dir` should contain ordered image frames (e.g. `0001.png`, `0002.png`, ...). | |
| ```bash | |
| python predict.py --model_dir savedmodel --frames_dir /path/to/frames --out_dir outputs --save_sequence_grid | |
| ``` | |
| Outputs: | |
| - `outputs/pred_last.png` | |
| - `outputs/pred_sequence_grid.png` (optional) | |
| ### Run (from npy/npz) | |
| Accepts `frames` stored as `[T,H,W,C]` or `[B,T,H,W,C]`. | |
| ```bash | |
| python predict.py --array frames.npy --out_dir outputs | |
| ``` | |
| ### Anomaly scores (4-frame window) | |
| For each window of 4 frames ending at time `t`, this computes two vectors of length 4: | |
| - `ahat_error[1..4]`: mean absolute error between `pred_frame_k` and `GT_frame_4` | |
| - `dissim_1mssim[1..4]`: `1 - SSIM(pred_frame_k, GT_frame_4)` | |
| ```bash | |
| python anomaly.py --model_dir savedmodel --frames_dir /path/to/frames --out_json anomaly.json --out_csv anomaly.csv | |
| ``` | |
| ### Hugging Face Hub usage | |
| After you upload this repo to the Hub, users can download it via `huggingface_hub` and point `--model_dir` at the downloaded `savedmodel/` directory. | |
| ### HuggingFace Pipeline Usage | |
| ```python | |
| from transformers import pipeline | |
| import numpy as np | |
| pipe = pipeline( | |
| "video-frame-prediction", | |
| model="dvdface/denoising-prednet", | |
| trust_remote_code=True, | |
| ) | |
| # frames: [T, H, W, C] numpy array, uint8 (0-255) or float (0-1) | |
| frames = np.random.randint(0, 255, (4, 128, 128, 3), dtype=np.uint8) | |
| result = pipe(frames) | |
| print(result["sequence"].shape) # (4, 128, 128, 3) | |
| print(result["last_frame"].shape) # (128, 128, 3) | |
| ``` | |