lavad-mps 是在原项目 lavad
的基础上进行修改的版本,主要适配了 macOS (Apple Silicon / MPS 加速)
平台,同时保留了原始功能与结构,方便在不同硬件和操作系统上复现。
The lavad-mps project is a modified version of the original
lavad repository, adapted for
macOS (Apple Silicon / MPS acceleration), while retaining the
original functionality and structure for easier reproduction across
various hardware and OS environments.
- 将原始的 CUDA 专用代码 修改为 MPS(Metal Performance Shaders) 兼容版本,用于 MacBook (Apple Silicon)。
- 调整了部分 shell 脚本,以保证在 macOS 上路径格式 (
/而非\) 正确。 - 删除了 Windows 和 Linux 平台下不兼容的部分依赖。
- 更新了 README 文档,提供了中英文复现说明。
- macOS 13+
- Apple Silicon 芯片(M1 / M2 / M3)
- Python 3.10+
- Anaconda 或 Miniconda
- CUDA 11.8+ (Linux / Windows)
- NVIDIA GPU (6GB+ VRAM 建议)
- Python 3.10+
git clone https://github.com/emo-naxia/lavad-mps.git
cd lavad-mpsconda create -n lavad_mps python=3.10 -y
conda activate lavad_mpsmacOS (MPS)
pip install -r requirements.txtLinux / Windows (CUDA)
pip install -r requirements_cuda.txt- 提取视频帧 / Extract frames
./scripts/00_extract_frames.sh <VIDEO_NAME>- 生成字幕 / Generate captions
./scripts/01_caption.sh <VIDEO_NAME>- 创建索引 / Create index
./scripts/02_create_index.sh <VIDEO_NAME>- 清洗字幕 / Clean captions
./scripts/03_clean_captions.sh <VIDEO_NAME>- 调用 LLM 进行异常打分 / Query LLM for anomaly scores
./scripts/04_query_llm.sh <VIDEO_NAME>- 生成摘要索引 / Create summary index
./scripts/05_create_summary_index.sh <VIDEO_NAME>- 优化异常分数 / Refine anomaly scores
./scripts/06_refine_anomaly_scores.sh <VIDEO_NAME>- 评估结果 / Evaluate results
./scripts/07_eval.sh <VIDEO_NAME>- 本项目已适配 macOS MPS,但在 CUDA 环境下依然可运行。
- 某些路径依赖于
datasets目录的结构,请严格按照原始数据组织方式。 - 原项目作者的 CUDA 版 README 依然适用,只需将设备参数改为
mps即可。
原始项目作者:lavad by
lucazanella
This repository is a modified version of the original lavad repository
by lucazanella.