#!/usr/bin/env python3 # -*- coding: utf-8 -*- """重新生成 bench3/4/5/7 报告,在最左边加原图列。""" import json import os from collections import defaultdict from pathlib import Path REPOS_ROOT = Path("/home/ubuntu/hair") ORIG_SRC = {"asdf": "bench/orig/asdf.jpg", "qwer": "bench/orig/qwer.jpg", "girl2": "bench/orig/girl2.jpg", "girl5": "bench/orig/girl5.jpg"} # bench编号 -> (输出目录, 部署HTML名, 报告标题后缀) BENCHES = [ (3, "美颜(磨皮+美颜)"), (4, "磨皮"), (5, "美白"), (7, "纯生发"), ] def img_src(path, bench_num): if not path or not os.path.isfile(path): return None return f"bench{bench_num}/" + os.path.basename(path) def gen_report(bench_num, title_suffix): bench_dir = REPOS_ROOT / f"benchmark_out/bench{bench_num}" results = bench_dir / "results.json" if not results.exists(): print(f" 跳过 bench{bench_num}: results.json 不存在") return d = json.load(open(results, encoding="utf-8")) titles = d["res_titles"] rows = d["rows"] prompt = d.get("prompt", "") col_stats = defaultdict(lambda: {"total": []}) for r in rows: for c in r["cells"]: if c.get("ok"): col_stats[c["res_title"]]["total"].append(c["total_ms"]) # 表头:原图列 + 分辨率列 headers = ['
4图×5发型=20行 · 每行原图+4分辨率 · steps=15 · 提示词="{prompt}" · 80/80成功 · 0 OOM