PEEK: Picking Essential frames via Efficient Knowledge distillation
是 Moments Lab 提出的 query-free 视频帧选择器:在低预算视频字幕场景下,仅依据视频帧
(不计 prompt/caption/text) 为每一帧预测相关性分数,再按 stratified-argmax 策略选出
预算 k 帧。发布权重 peek_base 为 2 层 Transformer (~1.7M 参数,4 头,hidden 256),
冻结输入为 MobileCLIP2-S0 的 512 维逐帧特征。
PeekScorer 为 非 LLM 帧打分网络(TransformerEncoder scorer),
不适用 vLLM-Ascend,直接使用 torch_npu 加载推理。peek/ 包,
去掉 open_clip/huggingface_hub 强依赖,state_dict 键名一致 strict 加载。peek/
├── inference.py # 推理/服务脚本(CLI + FastAPI 服务化)
├── README.md # 本说明(含 NPU 标签)
├── requirements.txt # 环境依赖
└── assets/ # 截图素材(agent_workflow.png / npu_device_call.png / model_result.png)# 昇腾 910 平台,已具备
# torch 2.9.0 + torch_npu 2.9.0.post1 + CANN 8.5.1
pip install safetensors fastapi uvicorn -i https://mirrors.aliyun.com/pypi/simple/权重 peek/safetensors 与 repo 文件对应关系见下表:
| 仓库文件 | 权重文件 |
|---|---|
peek/model.py | peek_base.safetensors |
python inference.py --checkpoint /path/to/peek_base.safetensors --frames 30 --k 4 --device npu:0使用随机/线性 512-d 逐帧特征跑通 scorer,打印每帧分数与选定帧索引。
python inference.py --checkpoint /path/to/peek_base.safetensors --serve --host 0.0.0.0 --port 8000 --device npu:0健康检查:
curl -s http://127.0.0.1:8000/health打分接口(请求体为逐帧 512-d 特征,{"embeddings": [[...]*512, ...], "k": 4}):
curl -s -X POST http://127.0.0.1:8000/score \
-H 'Content-Type: application/json' \
-d '{"embeddings": [[0.1,0.2, ..., 0.5]], "k": 4}' 响应含逐帧 scores 与 selected_indices(stratified-argmax)。
程序在 --verify 模式下固定同一组 512-d 特征,依次在 CPU 与 NPU 推理并输出余弦相似度:
cosine(CPU,NPU) = 1.000000
max_abs_diff = 1.06e-05assets/agent_workflow.png — 适配/部署流程截图assets/npu_device_call.png — NPU 设备与算子调用截图assets/model_result.png — 模型输出结果截图@inproceedings{steunou2026peek,
title={{PEEK}: Picking Essential frames via Efficient Knowledge distillation},
author={Steunou, Killian and Filali Razzouki, Anas and Guetari, Khalil and El-Yacoubi, Moun\^im A. and Tevissen, Yannis},
year={2026},
url={https://arxiv.org/abs/2605.31029}
}