low-high-reference / benchmarks /edit /traditional_eval_notes.md
Ouzhang's picture
Support source maps for renamed source videos
df8034f verified
|
Raw
History Blame Contribute Delete
24.4 kB
# Traditional / Pretrained Metric Plan for Our 6 Edit Results
目标数据:
- `val20`: `out/edit_model_face_stage1/eval_outputs/{wan_only,ditto_global,full,text,vace_hint,vace_context}/val_XXXX.mp4`
- `val100`: `out/edit_model_face_stage1/eval_outputs_val100/{wan_only,ditto_global,full,text,vace_hint,vace_context}/val_XXXX.mp4`
- sample metadata:
- `out/edit_model_face_stage1/eval_samples/val_20.jsonl`
- `out/edit_model_face_stage1/eval_samples/val_100.jsonl`
## No-Model Metrics: Can Run Immediately
这些不需要下载模型,只需要 Python 包能读视频。脚本会用 `imageio`/`PIL`/`numpy`
| Metric | 对应 benchmark 口径 | 输入 | 分数方向 |
|---|---|---|---|
| `pixel_mse` | FiVE MSE / 结构差异近似 | source video + edited video | 低更好 |
| `pixel_psnr` | FiVE PSNR | source video + edited video | 高更好 |
| `global_ssim` | FiVE/VEditBench SSIM 近似 | source video + edited video | 高更好 |
| `temporal_flicker_score` | IVE Temporal Flickering 近似 | edited video | 高更好;这里按 `(255 - frame_diff_mae) / 255` |
| `edited_frame_diff_mae` | 时间闪烁原始量 | edited video | 低更好 |
| `source_edit_l1` | Structure distance / non-mask preservation 近似 | source video + edited video | 低更好 |
| `num_frames_sampled` | 记录采样帧数 | edited video | 非质量分 |
注意:
- 这些是全图指标,不等同 FiVE 官方 masked background preservation。没有 mask 时,不能说是正式 FiVE background preservation。
- SSIM 这里实现的是全局灰度 SSIM 近似,不依赖 `skimage`;如果要官方/库级 SSIM,可后续换成 `skimage.metrics.structural_similarity`
## Model-Dependent Traditional / Pretrained Metrics
下载目录统一使用:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models
```
### CLIP
用途:
- FiVE `CLIPSIM` / `CLIPS.edit`
- EditBoard `success_rate`, `clip_similarity`, `background_consistency`
- 我们脚本里的 `clip_t`, `clip_frame_consistency`, `clip_source_edit_similarity`
下载:
```bash
hf download openai/clip-vit-large-patch14 \
--local-dir models/openai_clip-vit-large-patch14
```
可选:EditBoard 原代码还会用 OpenAI CLIP `ViT-B/32` / `ViT-L/14`,如果跑官方 EditBoard,需要让 `clip` 包能下载或提前缓存对应权重。
### DINO
用途:
- EditBoard `subject_consistency`
- IVE-Bench `subject_consistency`
优先用 Hugging Face 下载到 `models/`,避免真实机运行时再走 torch hub 联网:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/facebook_dino-vitb16 models/facebook_dino-vits16
hf download facebook/dino-vitb16 \
--local-dir models/facebook_dino-vitb16
hf download facebook/dino-vits16 \
--local-dir models/facebook_dino-vits16
```
如果跑的 benchmark 原代码仍然写死 `torch.hub.load('facebookresearch/dino:main', ...)`,可以额外在有网机器预热 torch hub 缓存,并把缓存目录放到 `models/torch_cache`
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/torch_cache
export TORCH_HOME="$PWD/models/torch_cache"
python3 - <<'PY'
import torch
torch.hub.load('facebookresearch/dino:main', 'dino_vitb16')
torch.hub.load('facebookresearch/dino:main', 'dino_vits16')
PY
```
### LAION Aesthetic Predictor
用途:
- EditBoard `aesthetic_quality`
下载:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/laion_aesthetic
wget -O models/laion_aesthetic/sa_0_4_vit_l_14_linear.pth \
https://github.com/LAION-AI/aesthetic-predictor/raw/main/sa_0_4_vit_l_14_linear.pth
```
### MUSIQ / pyiqa
用途:
- EditBoard `imaging_quality`
安装/缓存。`pyiqa` 的权重通常走 torch cache;用 `TORCH_HOME` 可以把下载内容固定在本仓库 `models/torch_cache` 下:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
python3 -m pip install pyiqa
mkdir -p models/torch_cache models/pyiqa
export TORCH_HOME="$PWD/models/torch_cache"
export XDG_CACHE_HOME="$PWD/models/cache"
python3 - <<'PY'
import pyiqa
metric = pyiqa.create_metric('musiq', device='cpu')
print(type(metric).__name__)
PY
```
NIQE 第一次运行会找这个参数文件:
```text
models/torch_cache/hub/pyiqa/niqe_modelparameters.mat
```
如果真实机无法自动下载,可以手动下载到脚本默认读取的位置:
```bash
cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/low-high-new
mkdir -p models/torch_cache/hub/pyiqa
hf download chaofengc/IQA-PyTorch-Weights \
niqe_modelparameters.mat \
--local-dir models/torch_cache/hub/pyiqa
```
`run_traditional_metrics.py` 默认会设置:
```bash
TORCH_HOME=$PWD/models/torch_cache
HF_HOME=$PWD/models/hf_cache
XDG_CACHE_HOME=$PWD/models/cache
```
因此手动下载到上面的路径后,`--pyiqa-metrics niqe` 会直接从本地读取,不再重新下载。
如果要用 Q-Align/OneAlign 风格的 pyiqa scorer,不建议装进当前训练环境。它需要 `icecream`,并且在 `numpy>=2` 环境里容易触发 torch/动态模块兼容问题。推荐单独建一个 conda 评测环境:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
conda create -n lowhigh-qalign python=3.10 -y
conda activate lowhigh-qalign
# 按机器 CUDA 情况选择 torch 安装方式。A100/CUDA 12.x 可先用 cu121 wheel;
# 如果你的集群有内部 torch 源,也可以替换成集群推荐命令。
python3 -m pip install --upgrade pip
python3 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
python3 -m pip install \
git+https://github.com/chaofengc/IQA-PyTorch.git \
icecream \
"numpy<2" \
"transformers>=4.36.1" \
accelerate \
sentencepiece \
einops \
timm \
pillow
mkdir -p models/torch_cache models/hf_cache
export TORCH_HOME="$PWD/models/torch_cache"
export HF_HOME="$PWD/models/hf_cache"
python3 - <<'PY'
import pyiqa
metric = pyiqa.create_metric('qalign', device='cpu')
print(type(metric).__name__)
PY
```
说明:
- `pyiqa.create_metric('qalign')` 会 import `pyiqa/archs/q_align/...`,需要额外的 `icecream` 包。
- Q-Align/OneAlign 依赖的部分 torch/动态模块在 `numpy>=2` 环境里可能报 `RuntimeError: Numpy is not available`,所以这里明确 pin `numpy<2`
- 不建议在 `base` 或训练环境里降级 numpy;优先使用 `lowhigh-qalign` 单独环境。
### LPIPS
用途:
- FiVE background preservation `LPIPS`
安装:
```bash
python3 -m pip install lpips
```
默认 `--lpips-net alex` 会通过 torchvision 下载 AlexNet backbone:
```text
models/torch_cache/hub/checkpoints/alexnet-owt-7be5be79.pth
```
如果真实机无法自动下载,可以手动放到脚本默认读取的位置:
```bash
cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/low-high-new
mkdir -p models/torch_cache/hub/checkpoints
wget -O models/torch_cache/hub/checkpoints/alexnet-owt-7be5be79.pth \
https://download.pytorch.org/models/alexnet-owt-7be5be79.pth
```
如果用 `--lpips-net vgg``--lpips-net squeeze`,还会分别需要对应 torchvision backbone。当前统一命令默认使用 `alex`
### CoTracker3
用途:
- FiVE `Motion Fidelity Score`
- IVE `Motion Fidelity`
- VEditBench `Motion Similarity`
下载:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/cotracker3
hf download facebook/cotracker3 scaled_offline.pth \
--local-dir models/cotracker3
hf download facebook/cotracker3 baseline_offline.pth \
--local-dir models/cotracker3
```
### VideoCLIP-XL-v2
用途:
- IVE `OSC`, `PSC`, `SF`
下载:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/VideoCLIP-XL-v2
hf download alibaba-pai/VideoCLIP-XL-v2 \
--local-dir models/VideoCLIP-XL-v2
```
### GroundingDINO
用途:
- IVE `Quantity Accuracy`
下载:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/GroundingDINO
wget -O models/GroundingDINO/groundingdino_swinb_cogcoor.pth \
https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha2/groundingdino_swinb_cogcoor.pth
```
还需要 GroundingDINO 代码和 config:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/GroundingDINO
if [ -d models/GroundingDINO/code/.git ]; then
git -C models/GroundingDINO/code pull --ff-only
else
git clone https://github.com/IDEA-Research/GroundingDINO.git \
models/GroundingDINO/code
fi
```
如果 GroundingDINO 的依赖和主训练环境冲突,单独建环境:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
conda create -n lowhigh-groundingdino python=3.10 -y
conda activate lowhigh-groundingdino
python3 -m pip install --upgrade pip
python3 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
python3 -m pip install opencv-python pycocotools matplotlib addict yapf timm
python3 -m pip install -e models/GroundingDINO/code
python3 - <<'PY'
import groundingdino
print("groundingdino ok")
PY
```
### AMT-G
用途:
- IVE / VEditBench `Motion Smoothness`
下载位置按 IVE `metrics/path.yml` 配置到 `amt-g.pth`。可以用 HF repo `lalala125/AMT` 下载到 `models/amt`
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/amt
hf download lalala125/AMT \
--local-dir models/amt
find models/amt -maxdepth 3 -type f | sort
```
下载后把 IVE `metrics/path.yml` 里的 AMT checkpoint 路径指向实际文件,例如:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
find models/amt -name 'amt-g.pth' -o -name '*amt*g*.pth'
```
然后手动编辑 IVE 的 `metrics/path.yml`,把 `motion_smoothness.checkpoint` 改成上面找到的真实路径。注意下面是 YAML 内容,不是 shell 命令,不能直接粘到终端执行:
```yaml
motion_smoothness:
checkpoint: /Users/ouzhang/Desktop/low-high/low-high-new/models/amt/amt-g.pth
```
如果 AMT/IVE 的 motion smoothness 依赖和主训练环境冲突,单独建环境:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
conda create -n lowhigh-amt python=3.10 -y
conda activate lowhigh-amt
python3 -m pip install --upgrade pip
python3 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
python3 -m pip install opencv-python imageio imageio-ffmpeg einops tqdm scipy pillow numpy
# 如果使用 IVEBench 的 motion_smoothness 代码,在该环境里进入 IVEBench metrics 目录运行。
# 确保其 path.yml 指向 models/amt 下实际下载到的 amt-g.pth。
```
### Q-Align
用途:
- VEditBench `Image Quality`, `Image Aesthetic`, `Video Quality`
推荐使用 HF model `q-future/one-align`,直接下载到 `models/q-future_one-align`
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
mkdir -p models/q-future_one-align
hf download q-future/one-align \
--local-dir models/q-future_one-align
```
建议使用上面创建的 `lowhigh-qalign` 环境,避免污染训练环境。如果还没创建,完整命令如下:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
conda create -n lowhigh-qalign python=3.10 -y
conda activate lowhigh-qalign
python3 -m pip install --upgrade pip
python3 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
python3 -m pip install \
"numpy<2" \
"transformers>=4.36.1" \
accelerate \
sentencepiece \
icecream \
einops \
timm \
pillow
```
如果这个新环境里意外装了 CPU 版 `bitsandbytes` 并导致 import 报错,可以直接卸载;OneAlign 推理不依赖它:
```bash
conda activate lowhigh-qalign
python3 -m pip uninstall -y bitsandbytes
```
如果用 Q-Align 官方代码:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
conda activate lowhigh-qalign
mkdir -p models/Q-Align
if [ -d models/Q-Align/code/.git ]; then
git -C models/Q-Align/code pull --ff-only
else
git clone https://github.com/Q-Future/Q-Align.git \
models/Q-Align/code
fi
python3 -m pip install -e models/Q-Align/code
```
快速检查本地 OneAlign 能否加载:
```bash
cd /Users/ouzhang/Desktop/low-high/low-high-new
conda activate lowhigh-qalign
mkdir -p models/hf_cache
export HF_HOME="$PWD/models/hf_cache"
export TRANSFORMERS_CACHE="$PWD/models/hf_cache/transformers"
python3 - <<'PY'
import torch
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
"models/q-future_one-align",
trust_remote_code=True,
torch_dtype=torch.float16,
device_map="auto",
)
print(type(model).__name__)
PY
```
如果这里报:
- `ModuleNotFoundError: No module named 'icecream'`:执行 `python3 -m pip install icecream`
- `RuntimeError: Numpy is not available` 或提示 `A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x`:执行 `python3 -m pip install "numpy<2"`,或者换一个单独的 Q-Align 评测环境。
- `bitsandbytes ... compiled without GPU support`:通常不是 OneAlign 加载的主因;如果它阻断 import,可先卸载 CPU 版 `bitsandbytes` 或在单独环境里重装匹配 CUDA 的版本。
本地 reference 没有完整 VEditBench official eval code。需要另配 Q-Align/OneAlign scorer 后,再接入统一 manifest。
## Run Unified Metrics on val20 / val100
- `build_six_method_manifest.py`: 为 val20/val100 构建统一 manifest。
- `run_traditional_metrics.py`: 默认跑 no-model metrics;按参数额外启用 CLIP、DINO、LAION aesthetic、pyiqa、LPIPS。
如果 manifest 里的 `source_video` 不存在,脚本仍会计算只依赖 edited video 的指标,例如 `clip_t``clip_frame_consistency``edited_frame_diff_mae``temporal_flicker_score``laion_aesthetic``pyiqa_musiq``pyiqa_niqe`。依赖源视频的列会留空,并在 `error` 列记录 `source_load_failed=...`
需要源视频的列:
- `pixel_mse`
- `pixel_psnr`
- `source_edit_l1`
- `global_ssim`
- `clip_source_edit_similarity`
- `lpips_source_edit`
不需要源视频的列:
- `num_frames_sampled`
- `edited_frame_diff_mae`
- `temporal_flicker_score`
- `clip_t`
- `clip_frame_consistency`
- `dino_frame_consistency`
- `laion_aesthetic`
- `pyiqa_musiq`
- `pyiqa_niqe`
- `pyiqa_qalign_quality`
- `pyiqa_qalign_aesthetic`
### 1. 生成 manifest
`edited_video` 固定来自 `out/edit_model_face_stage1/eval_outputs*``source_video` 应该是真实原视频,默认来自 `eval_samples/*.jsonl` 里的 `control_video`;不能用某个 method 的 edited 输出冒充 source,否则 `PSNR/SSIM/LPIPS/source-edit CLIP` 会变成错误比较。
```bash
cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/low-high-new
python3 reference/benchmarks/edit/build_six_method_manifest.py \
--repo-root . \
--output-dir out/edit_model_face_stage1/traditional_eval_manifests
```
如果真实源视频在另一份目录里,给 builder 加 `--source-root`,脚本会按 `control_video` 的文件名递归搜索并重写 manifest:
```bash
python3 reference/benchmarks/edit/build_six_method_manifest.py \
--repo-root . \
--output-dir out/edit_model_face_stage1/traditional_eval_manifests \
--source-root /path/to/source/videos
```
如果当前机器上的源视频已经被重命名成 hash 文件名,需要提供一个 JSONL 映射文件,至少包含 `sample_id` 和当前视频路径:
```jsonl
{"sample_id": "val_0000", "path": "/inspire/hdd/project/.../datas/ditto_face/low/0a1ec4e5fd6d9079ad1be0ea03cbcfed.mp4"}
```
然后生成 manifest:
```bash
python3 reference/benchmarks/edit/build_six_method_manifest.py \
--repo-root . \
--output-dir out/edit_model_face_stage1/traditional_eval_manifests \
--source-map out/edit_model_face_stage1/source_video_map.jsonl
```
`--source-map` 也支持这些字段名:
- 样本键:`sample_id``id`
- 当前视频路径:`path``video``source_video``source_path``control_video`
- 旧路径键:`old_path``old_video``control_video``source_video`
注意:如果只有一个目录里一堆 hash mp4,但没有 `sample_id -> hash mp4``旧文件名 -> hash mp4` 映射,脚本不能安全自动匹配。此时要先从生成数据时的 records/metadata 找回映射。
生成后快速检查路径:
```bash
python3 - <<'PY'
import json
from pathlib import Path
for manifest in [
Path("out/edit_model_face_stage1/traditional_eval_manifests/val20.jsonl"),
Path("out/edit_model_face_stage1/traditional_eval_manifests/val100.jsonl"),
]:
rows = [json.loads(x) for x in manifest.read_text().splitlines() if x.strip()]
missing_sources = sorted({r["source_video"] for r in rows if not Path(r["source_video"]).exists()})
missing_edits = [r["edited_video"] for r in rows if not Path(r["edited_video"]).exists()]
print(manifest, "rows", len(rows), "missing_sources", len(missing_sources), "missing_edits", len(missing_edits))
for path in missing_sources[:10]:
print(" missing source:", path)
PY
```
### 2. 主环境一次性跑 CLIP / DINO / LAION / MUSIQ / NIQE / LPIPS
这些指标可以在主环境跑。如果 `pyiqa``lpips` 没装,先安装:
```bash
python3 -m pip install pyiqa lpips imageio imageio-ffmpeg
```
运行 `val20`
```bash
cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/low-high-new
mkdir -p out/edit_model_face_stage1/traditional_eval_metrics
export TORCH_HOME="$PWD/models/torch_cache"
export HF_HOME="$PWD/models/hf_cache"
export XDG_CACHE_HOME="$PWD/models/cache"
python3 reference/benchmarks/edit/run_traditional_metrics.py \
--manifest out/edit_model_face_stage1/traditional_eval_manifests/val20.jsonl \
--output out/edit_model_face_stage1/traditional_eval_metrics/val20_metrics_full.csv \
--frames-per-video 16 \
--resize 256 \
--device cuda:0 \
--clip-model-dir models/openai_clip-vit-large-patch14 \
--dino-model-dir models/facebook_dino-vitb16 \
--aesthetic-clip-model-dir models/openai_clip-vit-large-patch14 \
--aesthetic-predictor models/laion_aesthetic/sa_0_4_vit_l_14_linear.pth \
--pyiqa-metrics musiq,niqe \
--lpips \
--clip-batch-size 8 \
--dino-batch-size 8 \
--aesthetic-batch-size 8
```
运行 `val100`
```bash
cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/low-high-new
mkdir -p out/edit_model_face_stage1/traditional_eval_metrics
export TORCH_HOME="$PWD/models/torch_cache"
export HF_HOME="$PWD/models/hf_cache"
export XDG_CACHE_HOME="$PWD/models/cache"
python3 reference/benchmarks/edit/run_traditional_metrics.py \
--manifest out/edit_model_face_stage1/traditional_eval_manifests/val100.jsonl \
--output out/edit_model_face_stage1/traditional_eval_metrics/val100_metrics_full.csv \
--frames-per-video 16 \
--resize 256 \
--device cuda:0 \
--clip-model-dir models/openai_clip-vit-large-patch14 \
--dino-model-dir models/facebook_dino-vitb16 \
--aesthetic-clip-model-dir models/openai_clip-vit-large-patch14 \
--aesthetic-predictor models/laion_aesthetic/sa_0_4_vit_l_14_linear.pth \
--pyiqa-metrics musiq,niqe \
--lpips \
--clip-batch-size 8 \
--dino-batch-size 8 \
--aesthetic-batch-size 8
```
输出 CSV 包含:
| Column | 指标来源 / 含义 | 方向 |
|---|---|---|
| `pixel_mse` | FiVE MSE / 全图像素差近似;需要 source + edited | 低更好 |
| `pixel_psnr` | FiVE PSNR 全图近似;需要 source + edited | 高更好 |
| `source_edit_l1` | 源/编辑视频全图 L1 差异;需要 source + edited | 低更好 |
| `global_ssim` | VEditBench / FiVE SSIM 全图近似;需要 source + edited | 高更好 |
| `edited_frame_diff_mae` | IVE temporal flickering 原始帧间差;只需要 edited | 低更好 |
| `temporal_flicker_score` | `(255-frame_diff_mae)/255`;只需要 edited | 高更好 |
| `clip_t` | CLIP edited frame - instruction similarity;只需要 edited + instruction | 高更好 |
| `clip_frame_consistency` | CLIP edited frame cross-frame consistency;只需要 edited | 高更好 |
| `clip_source_edit_similarity` | CLIP source/edit semantic similarity;需要 source + edited | 高更好 |
| `dino_frame_consistency` | DINO edited frame cross-frame consistency;只需要 edited | 高更好 |
| `laion_aesthetic` | LAION aesthetic predictor;只需要 edited | 高更好 |
| `pyiqa_musiq` | MUSIQ image quality, frame average;只需要 edited | 高更好 |
| `pyiqa_niqe` | NIQE no-reference quality, frame average;只需要 edited | 低更好 |
| `lpips_source_edit` | LPIPS source/edit perceptual distance;需要 source + edited | 低更好 |
### 3. 单独环境跑 Q-Align / OneAlign 分数
Q-Align/OneAlign 建议用 `lowhigh-qalign` 环境,避免和主训练环境的 `numpy>=2``bitsandbytes` 冲突。先确保环境已创建并能加载 `qalign`
```bash
cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/low-high-new
conda activate lowhigh-qalign
python3 -m pip install imageio imageio-ffmpeg pyiqa
python3 -m pip uninstall -y bitsandbytes || true
export TORCH_HOME="$PWD/models/torch_cache"
export HF_HOME="$PWD/models/hf_cache"
export XDG_CACHE_HOME="$PWD/models/cache"
python3 reference/benchmarks/edit/run_traditional_metrics.py \
--manifest out/edit_model_face_stage1/traditional_eval_manifests/val20.jsonl \
--output out/edit_model_face_stage1/traditional_eval_metrics/val20_metrics_qalign.csv \
--frames-per-video 16 \
--resize 256 \
--device cuda:0 \
--pyiqa-metrics qalign_quality,qalign_aesthetic
python3 reference/benchmarks/edit/run_traditional_metrics.py \
--manifest out/edit_model_face_stage1/traditional_eval_manifests/val100.jsonl \
--output out/edit_model_face_stage1/traditional_eval_metrics/val100_metrics_qalign.csv \
--frames-per-video 16 \
--resize 256 \
--device cuda:0 \
--pyiqa-metrics qalign_quality,qalign_aesthetic
```
Q-Align 输出列:
| Column | 含义 | 方向 |
|---|---|---|
| `pyiqa_qalign_quality` | Q-Align / OneAlign image quality scorer | 高更好 |
| `pyiqa_qalign_aesthetic` | Q-Align / OneAlign aesthetic scorer | 高更好 |
### 4. 汇总每个 method 的均值
```bash
cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/low-high-new
python3 - <<'PY'
import csv
from collections import defaultdict
from pathlib import Path
paths = [
Path("out/edit_model_face_stage1/traditional_eval_metrics/val20_metrics_full.csv"),
Path("out/edit_model_face_stage1/traditional_eval_metrics/val100_metrics_full.csv"),
Path("out/edit_model_face_stage1/traditional_eval_metrics/val20_metrics_qalign.csv"),
Path("out/edit_model_face_stage1/traditional_eval_metrics/val100_metrics_qalign.csv"),
]
for path in paths:
if not path.exists():
continue
rows = list(csv.DictReader(path.open()))
by_method = defaultdict(list)
for row in rows:
by_method[row["method"]].append(row)
print("====", path)
print("rows", len(rows), "errors", sum(1 for row in rows if row.get("error")))
fields = [f for f in rows[0].keys() if f not in {"split", "sample_id", "method", "instruction", "source_video", "edited_video", "error"}]
for method in sorted(by_method):
print("--", method, "n", len(by_method[method]))
for field in fields:
values = []
for row in by_method[method]:
value = row.get(field, "")
if value and value not in {"None", "inf"}:
try:
values.append(float(value))
except ValueError:
pass
if values:
print(field, sum(values) / len(values))
PY
```
### 5. 为什么 CoTracker / GroundingDINO 不在统一脚本默认跑
- `CoTracker3` 已下载,但 FiVE/IVE 的 motion fidelity 不是简单逐帧 cosine;需要轨迹采样、遮挡处理和 benchmark 自己的 matching/aggregation 逻辑。可以后续单独接一个 `run_cotracker_metrics.py`,不建议混进当前轻量 CSV 脚本。
- `GroundingDINO` 的 Quantity Accuracy 需要每条样本的 `target_span` 和目标数量。当前 `val20/val100` manifest 只有 `instruction/source_video/edited_video`,没有结构化数量字段,所以不能可靠跑 IVE 的 QA。
- `CLIPS.edit`、FiVE background preservation 的正式版本需要 edit mask。当前 manifest 没有 mask,只能跑全图近似 PSNR/LPIPS/MSE/SSIM。