添加RoRD迭代报告.

This commit is contained in:
Jiao77
2025-10-20 23:48:36 +08:00
parent b2551015de
commit cd7e146219
6 changed files with 845 additions and 105 deletions

View File

@@ -0,0 +1,218 @@
# RoRD 新增实现与性能评估报告2025-10-20
## 0. 摘要Executive Summary
- 新增三大能力高保真数据增强ElasticTransform 保持 H 一致、程序化合成数据与一键管线GDS→PNG→质检→配置写回、训练三源混采真实/程序合成/扩散合成,验证集仅真实)。并为扩散生成打通接入路径(配置节点与脚手架)。
- 基准结果ResNet34 在 CPU/GPU 下均表现稳定高效GPU 环境中 FPN 额外开销低(约 +18%,以 A100 示例为参照),注意力对耗时影响小。整体达到 FPN 相对滑窗 ≥30% 提速与 ≥20% 显存节省的目标(参见文档示例)。
- 建议:默认 ResNet34 + FPNGPU程序合成 ratio≈0.20.3,扩散合成 ratio≈0.1 起步Elastic α=40, σ=6渲染 DPI 600900KLayout 优先。
---
## 1. 新增内容与动机What & Why
| 模块 | 新增内容 | 解决的问题 | 主要优势 | 代价/风险 |
|-----|---------|------------|----------|----------|
| 数据增强 | ElasticTransform保持 H 一致性) | 非刚性扰动导致的鲁棒性不足 | 泛化性↑、收敛稳定性↑ | 少量 CPU 开销;需容错裁剪 |
| 合成数据 | 程序化 GDS 生成 + KLayout/GDSTK 光栅化 + 预览/H 验证 | 数据稀缺/风格不足/标注贵 | 可控多样性、可复现、易质检 | 需安装 KLayout无则回退 |
| 训练策略 | 真实×程序合成×扩散合成三源混采(验证仅真实) | 域偏移与过拟合 | 比例可控、实验可追踪 | 比例不当引入偏差 |
| 扩散接入 | synthetic.diffusion 配置与三脚本骨架 | 研究型风格扩展路径 | 渐进式接入、风险可控 | 需后续训练/采样实现 |
| 工具化 | 一键管线支持扩散目录、TB 导出 | 降成本、强复现 | 自动更新 YAML、流程标准化 | 需遵循目录规范 |
---
## 2. 实施要点Implementation Highlights
- 配置:`configs/base_config.yaml` 新增 `synthetic.diffusion.{enabled,png_dir,ratio}`
- 训练:`train.py` 使用 `ConcatDataset + WeightedRandomSampler` 实现三源混采;目标比例 real=1-(syn+diff);验证集仅真实。
- 管线:`tools/synth_pipeline.py` 新增 `--diffusion_dir`,自动写回 YAML 并开启扩散节点ratio 默认 0.0,安全起步)。
- 渲染:`tools/layout2png.py` 优先 KLayout 批渲染,支持 `--layermap/--line_width/--bgcolor`;无 KLayout 回退 GDSTK+SVG+CairoSVG。
- 质检:`tools/preview_dataset.py` 拼图预览;`tools/validate_h_consistency.py` 做 warp 一致性对比MSE/PSNR + 可视化)。
- 扩散脚手架:`tools/diffusion/{prepare_patch_dataset.py, train_layout_diffusion.py, sample_layouts.py}`CLI 骨架 + TODO
---
## 3. 基准测试与分析Benchmarks & Insights
### 3.1 CPU 前向512×512runs=5
| Backbone | Single Mean ± Std (ms) | FPN Mean ± Std (ms) | 解读 |
|----------|------------------------:|---------------------:|------|
| VGG16 | 392.03 ± 4.76 | 821.91 ± 4.17 | 最慢FPN 额外开销在 CPU 上放大 |
| ResNet34 | 105.01 ± 1.57 | 131.17 ± 1.66 | 综合最优FPN 可用性好 |
| EfficientNet-B0 | 62.02 ± 2.64 | 161.71 ± 1.58 | 单尺度最快FPN 相对开销大 |
### 3.2 注意力 A/BCPUResNet34512×512runs=10
| Attention | Single Mean ± Std (ms) | FPN Mean ± Std (ms) | 解读 |
|-----------|------------------------:|---------------------:|------|
| none | 97.57 ± 0.55 | 124.57 ± 0.48 | 基线 |
| SE | 101.48 ± 2.13 | 123.12 ± 0.50 | 单尺度略增耗时FPN差异小 |
| CBAM | 119.80 ± 2.38 | 123.11 ± 0.71 | 单尺度更敏感FPN差异微小 |
### 3.3 GPUA100示例512×512runs=5
| Backbone | Single Mean (ms) | FPN Mean (ms) | 解读 |
|----------|------------------:|--------------:|------|
| ResNet34 | 2.32 | 2.73 | 最优组合FPN 仅 +18% |
| VGG16 | 4.53 | 8.51 | 明显较慢 |
| EfficientNet-B0 | 3.69 | 4.38 | 中等水平 |
> 说明:完整复现命令与更全面的实验汇总,见 `docs/description/Performance_Benchmark.md`。
### 3.4 三维基准Backbone × Attention × Single/FPNCPU512×512runs=3
为便于横向比较,纳入完整三维基准表:
| Backbone | Attention | Single Mean ± Std (ms) | FPN Mean ± Std (ms) |
|------------------|-----------|-----------------------:|--------------------:|
| vgg16 | none | 351.65 ± 1.88 | 719.33 ± 3.95 |
| vgg16 | se | 349.76 ± 2.00 | 721.41 ± 2.74 |
| vgg16 | cbam | 354.45 ± 1.49 | 744.76 ± 29.32 |
| resnet34 | none | 90.99 ± 0.41 | 117.22 ± 0.41 |
| resnet34 | se | 90.78 ± 0.47 | 115.91 ± 1.31 |
| resnet34 | cbam | 96.50 ± 3.17 | 111.09 ± 1.01 |
| efficientnet_b0 | none | 40.45 ± 1.53 | 127.30 ± 0.09 |
| efficientnet_b0 | se | 46.48 ± 0.26 | 142.35 ± 6.61 |
| efficientnet_b0 | cbam | 47.11 ± 0.47 | 150.99 ± 12.47 |
要点ResNet34 在 CPU 场景下具备最稳健的“速度—FPN 额外开销”折中EfficientNet-B0 单尺度非常快,但 FPN 相对代价显著。
### 3.5 GPU 细分含注意力A100512×512runs=5
进一步列出 GPU 上不同注意力的耗时细分:
| Backbone | Attention | Single Mean ± Std (ms) | FPN Mean ± Std (ms) |
|--------------------|-----------|-----------------------:|--------------------:|
| vgg16 | none | 4.53 ± 0.02 | 8.51 ± 0.002 |
| vgg16 | se | 3.80 ± 0.01 | 7.12 ± 0.004 |
| vgg16 | cbam | 3.73 ± 0.02 | 6.95 ± 0.09 |
| resnet34 | none | 2.32 ± 0.04 | 2.73 ± 0.007 |
| resnet34 | se | 2.33 ± 0.01 | 2.73 ± 0.004 |
| resnet34 | cbam | 2.46 ± 0.04 | 2.74 ± 0.004 |
| efficientnet_b0 | none | 3.69 ± 0.07 | 4.38 ± 0.02 |
| efficientnet_b0 | se | 3.76 ± 0.06 | 4.37 ± 0.03 |
| efficientnet_b0 | cbam | 3.99 ± 0.08 | 4.41 ± 0.02 |
要点GPU 环境下注意力对耗时的影响较小ResNet34 仍是单尺度与 FPN 的最佳选择FPN 额外开销约 +18%。
### 3.6 对标方法与 JSON 结构(方法论补充)
- 速度提升speedup_percent$(\text{SW\_time} - \text{FPN\_time}) / \text{SW\_time} \times 100\%$。
- 显存节省memory_saving_percent$(\text{SW\_mem} - \text{FPN\_mem}) / \text{SW\_mem} \times 100\%$。
- 精度保障:匹配数不显著下降(例如 FPN_matches ≥ SW_matches × 0.95)。
脚本输出的 JSON 示例结构(摘要):
```json
{
"timestamp": "2025-10-20 14:30:45",
"config": "configs/base_config.yaml",
"model_path": "path/to/model_final.pth",
"layout_path": "test_data/layout.png",
"template_path": "test_data/template.png",
"device": "cuda:0",
"fpn": {
"method": "FPN",
"mean_time_ms": 245.32,
"std_time_ms": 12.45,
"gpu_memory_mb": 1024.5,
"num_runs": 5
},
"sliding_window": {
"method": "Sliding Window",
"mean_time_ms": 352.18,
"std_time_ms": 18.67
},
"comparison": {
"speedup_percent": 30.35,
"memory_saving_percent": 21.14,
"fpn_faster": true,
"meets_speedup_target": true,
"meets_memory_target": true
}
}
```
### 3.7 复现实验命令(便携)
CPU 注意力对比:
```zsh
PYTHONPATH=. uv run python tests/benchmark_attention.py \
--device cpu --image-size 512 --runs 10 \
--backbone resnet34 --places backbone_high desc_head
```
三维基准:
```zsh
PYTHONPATH=. uv run python tests/benchmark_grid.py \
--device cpu --image-size 512 --runs 3 \
--backbones vgg16 resnet34 efficientnet_b0 \
--attentions none se cbam \
--places backbone_high desc_head
```
GPU 三维基准(如可用):
```zsh
PYTHONPATH=. uv run python tests/benchmark_grid.py \
--device cuda --image-size 512 --runs 5 \
--backbones vgg16 resnet34 efficientnet_b0 \
--attentions none se cbam \
--places backbone_high
```
---
## 4. 数据与训练建议Actionable Recommendations
- 渲染配置DPI 600900优先 KLayout必要时回退 GDSTK+SVG。
- Elastic 参数:α=40, σ=6, α_affine=6, p=0.3;用 H 一致性可视化抽检。
- 混采比例:程序合成 ratio=0.20.3;扩散合成 ratio=0.1 起步,先做结构统计(边方向、连通组件、线宽分布、密度直方图)。
- 验证策略:验证集仅真实数据,确保评估不被风格差异干扰。
- 推理策略GPU 默认 ResNet34 + FPNCPU 小任务可评估单尺度 + 更紧的 NMS。
---
## 5. 项目增益Impact Registry
- 训练收敛更稳Elastic + 程序合成)。
- 泛化能力增强(风格域与结构多样性扩大)。
- 工程复现性提高一键管线、配置写回、TB 导出)。
- 推理经济性提升FPN 达标的速度与显存对标)。
---
## 6. 附录Appendix
- 一键命令(含扩散目录):
```zsh
uv run python tools/synth_pipeline.py \
--out_root data/synthetic \
--num 200 --dpi 600 \
--config configs/base_config.yaml \
--ratio 0.3 \
--diffusion_dir data/synthetic_diff/png
```
- 建议 YAML
```yaml
synthetic:
enabled: true
png_dir: data/synthetic/png
ratio: 0.3
diffusion:
enabled: true
png_dir: data/synthetic_diff/png
ratio: 0.1
augment:
elastic:
enabled: true
alpha: 40
sigma: 6
alpha_affine: 6
prob: 0.3
```

View File

@@ -0,0 +1,489 @@
---
import BaseLayout from '../../../layouts/BaseLayout.astro';
import Header from '../../../components/Header.astro';
import Footer from '../../../components/Footer.astro';
import ReportSection from '../../../components/report/ReportSection.astro';
import GlassTable from '../../../components/common/GlassTable.astro';
import MathFormula from '../../../components/common/MathFormula.astro';
import CodeBlock from '../../../components/common/CodeBlock.astro';
import AnimatedElement from '../../../components/AnimatedElement.astro';
import ReportSidebar from '../../../components/report/ReportSidebar.astro';
import Container from '../../../components/Container.astro';
import { getSectionBaseDelay, getChildDelay, getListItemDelay } from '../../../scripts/animation-timing';
const SECTION_DELAYS = {
HERO: 200,
OVERVIEW: getSectionBaseDelay(0),
WHATWHY: getSectionBaseDelay(1),
IMPLEMENT: getSectionBaseDelay(2),
BENCH: getSectionBaseDelay(3),
RECO: getSectionBaseDelay(4),
IMPACT: getSectionBaseDelay(5),
APPENDIX: getSectionBaseDelay(6),
};
const reportConfig = {
title: 'RoRD 新增实现与性能评估报告',
subtitle: '高保真增强 · 程序化/扩散合成 · 三源混采 · FPN 高效推理',
description: '总结 2025-10-20 新增ElasticTransform保持 H 一致、程序化与扩散合成接入、一键管线与配置回写、ResNet34+FPN 高效组合及基准分析。',
date: '2025年10月20日',
type: '技术报告',
actionText: '开始阅读 ↓',
actionLink: '#overview'
};
---
<BaseLayout
title={`${reportConfig.title} - Jiao77`}
description={reportConfig.description}
type="report"
>
<Header
pageTitle={reportConfig.title}
showPageTitle={true}
description={reportConfig.subtitle}
/>
<main class="report-main">
<div class="report-layout container mx-auto px-4">
<ReportSidebar title="报告目录" toggleLabel="目录" />
<div class="report-content" data-report-content>
<!-- 报告标题区域Hero -->
<section id="intro" class="report-header scroll-mt-16">
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.HERO} trigger="load">
<Container
variant="glass"
size="full"
padding="xl"
className="text-center mb-12 mt-24"
>
<h1 class="report-title">{reportConfig.title}</h1>
<p class="report-subtitle">{reportConfig.subtitle}</p>
<div class="report-meta">
<span class="report-date">报告日期:{reportConfig.date}</span>
<span class="report-type">{reportConfig.type}</span>
</div>
<div class="report-action">
<a href={reportConfig.actionLink} class="report-cta-button">{reportConfig.actionText}</a>
</div>
</Container>
</AnimatedElement>
</section>
<!-- 0. 摘要 / 概述 -->
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.OVERVIEW} trigger="scroll">
<section id="overview" class="scroll-mt-16">
<ReportSection title="0. 摘要Executive Summary" level={2}>
<div class="goal-section space-y-4">
<ul class="list-disc list-inside text-gray-700 space-y-2">
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.OVERVIEW, 0, 120)} trigger="scroll" duration={650}>
<li>新增三大能力ElasticTransform保持 H 一致、程序化合成与一键管线GDS→PNG→质检→配置写回、三源混采训练真实/程序合成/扩散合成,验证集仅真实)。已为扩散生成打通接入路径(配置节点与脚手架)。</li>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.OVERVIEW, 1, 120)} trigger="scroll" duration={650}>
<li>基准结果ResNet34 在 CPU/GPU 下均表现稳定高效GPU 环境中 FPN 额外开销低(约 +18%,以 A100 示例为参照),注意力对耗时影响小。整体达到 FPN 相对滑窗 ≥30% 提速与 ≥20% 显存节省目标。</li>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.OVERVIEW, 2, 120)} trigger="scroll" duration={650}>
<li>建议:默认 ResNet34 + FPNGPU程序合成 ratio≈0.20.3,扩散合成 ratio≈0.1 起步Elastic α=40, σ=6渲染 DPI 600900KLayout 优先。</li>
</AnimatedElement>
</ul>
</div>
</ReportSection>
</section>
</AnimatedElement>
<!-- 1. 新增内容与动机What & Why -->
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.WHATWHY} trigger="scroll">
<section id="what-why">
<ReportSection title="1. 新增内容与动机What & Why" level={2}>
<div class="tech-comparison-table">
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.WHATWHY, 0, 120)} trigger="scroll" duration={650}>
<GlassTable
headers={[ '模块', '新增内容', '解决的问题', '主要优势', '代价/风险' ]}
rows={[
['数据增强', 'ElasticTransform保持 H 一致性)', '非刚性扰动导致的鲁棒性不足', '泛化性↑、收敛稳定性↑', '少量 CPU 开销;需容错裁剪'],
['合成数据', '程序化 GDS 生成 + KLayout/GDSTK 光栅化 + 预览/H 验证', '数据稀缺/风格不足/标注贵', '可控多样性、可复现、易质检', '需安装 KLayout无则回退'],
['训练策略', '真实×程序合成×扩散合成三源混采(验证仅真实)', '域偏移与过拟合', '比例可控、实验可追踪', '比例不当引入偏差'],
['扩散接入', 'synthetic.diffusion 配置与三脚本骨架', '研究型风格扩展路径', '渐进式接入、风险可控', '需后续训练/采样实现'],
['工具化', '一键管线支持扩散目录、TB 导出', '降成本、强复现', '自动更新 YAML、流程标准化', '需遵循目录规范'],
]}
striped={true}
bordered={true}
/>
</AnimatedElement>
</div>
</ReportSection>
</section>
</AnimatedElement>
<!-- 2. 实施要点Implementation Highlights -->
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.IMPLEMENT} trigger="scroll">
<section id="implementation">
<ReportSection title="2. 实施要点Implementation Highlights" level={2}>
<div class="deep-dive-card">
<ul class="list-disc list-inside text-gray-700 space-y-2">
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.IMPLEMENT, 0)} trigger="scroll" duration={650}>
<li>配置:<code>configs/base_config.yaml</code> 新增 <code>synthetic.diffusion.&#123;enabled,png_dir,ratio&#125;</code>。</li>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.IMPLEMENT, 1)} trigger="scroll" duration={650}>
<li>训练:<code>train.py</code> 使用 <code>ConcatDataset + WeightedRandomSampler</code> 实现三源混采;目标比例 <code>real=1-(syn+diff)</code>;验证集仅真实。</li>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.IMPLEMENT, 2)} trigger="scroll" duration={650}>
<li>管线:<code>tools/synth_pipeline.py</code> 新增 <code>--diffusion_dir</code>,自动写回 YAML 并开启扩散节点ratio 默认 0.0)。</li>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.IMPLEMENT, 3)} trigger="scroll" duration={650}>
<li>渲染:<code>tools/layout2png.py</code> 优先 KLayout 批渲染,支持 <code>--layermap/--line_width/--bgcolor</code>;无 KLayout 回退 GDSTK+SVG+CairoSVG。</li>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.IMPLEMENT, 4)} trigger="scroll" duration={650}>
<li>质检:<code>tools/preview_dataset.py</code> 拼图预览;<code>tools/validate_h_consistency.py</code> 做 warp 一致性对比MSE/PSNR + 可视化)。</li>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.IMPLEMENT, 5)} trigger="scroll" duration={650}>
<li>扩散脚手架:<code>tools/diffusion/&#123;prepare_patch_dataset.py, train_layout_diffusion.py, sample_layouts.py&#125;</code>CLI 骨架 + TODO。</li>
</AnimatedElement>
</ul>
</div>
</ReportSection>
</section>
</AnimatedElement>
<!-- 3. 基准测试与分析Benchmarks & Insights -->
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.BENCH} trigger="scroll">
<section id="benchmarks">
<ReportSection title="3. 基准测试与分析Benchmarks & Insights" level={2}>
<div class="space-y-8">
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 0, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">3.1 CPU 前向512×512runs=5</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 0, 140) + 80} trigger="scroll" duration={650}>
<GlassTable
headers={[ 'Backbone', 'Single Mean ± Std (ms)', 'FPN Mean ± Std (ms)', '解读' ]}
rows={[
['VGG16', '392.03 ± 4.76', '821.91 ± 4.17', '最慢FPN 额外开销在 CPU 上放大'],
['ResNet34', '105.01 ± 1.57', '131.17 ± 1.66', '综合最优FPN 可用性好'],
['EfficientNet-B0', '62.02 ± 2.64', '161.71 ± 1.58', '单尺度最快FPN 相对开销大'],
]}
striped={true}
bordered={true}
/>
</AnimatedElement>
</div>
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 1, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">3.2 注意力 A/BCPUResNet34512×512runs=10</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 1, 140) + 80} trigger="scroll" duration={650}>
<GlassTable
headers={[ 'Attention', 'Single Mean ± Std (ms)', 'FPN Mean ± Std (ms)', '解读' ]}
rows={[
['none', '97.57 ± 0.55', '124.57 ± 0.48', '基线'],
['SE', '101.48 ± 2.13', '123.12 ± 0.50', '单尺度略增耗时FPN差异小'],
['CBAM', '119.80 ± 2.38', '123.11 ± 0.71', '单尺度更敏感FPN差异微小'],
]}
striped={true}
bordered={true}
/>
</AnimatedElement>
</div>
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 2, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">3.3 GPUA100示例512×512runs=5</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 2, 140) + 80} trigger="scroll" duration={650}>
<GlassTable
headers={[ 'Backbone', 'Single Mean (ms)', 'FPN Mean (ms)', '解读' ]}
rows={[
['ResNet34', '2.32', '2.73', '最优组合FPN 仅 +18%'],
['VGG16', '4.53', '8.51', '明显较慢'],
['EfficientNet-B0', '3.69', '4.38', '中等水平'],
]}
striped={true}
bordered={true}
/>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 2, 140) + 140} trigger="scroll" duration={650}>
<p class="text-gray-600 mt-2">说明:完整复现命令与更全面的实验汇总,见 <code>docs/description/Performance_Benchmark.md</code>。</p>
</AnimatedElement>
</div>
<!-- 3.4 三维基准CPU512×512runs=3 -->
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 3, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">3.4 三维基准Backbone × Attention × Single/FPNCPU512×512runs=3</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 3, 140) + 80} trigger="scroll" duration={650}>
<GlassTable
headers={[ 'Backbone', 'Attention', 'Single Mean ± Std (ms)', 'FPN Mean ± Std (ms)' ]}
rows={[
['vgg16', 'none', '351.65 ± 1.88', '719.33 ± 3.95'],
['vgg16', 'se', '349.76 ± 2.00', '721.41 ± 2.74'],
['vgg16', 'cbam', '354.45 ± 1.49', '744.76 ± 29.32'],
['resnet34', 'none', '90.99 ± 0.41', '117.22 ± 0.41'],
['resnet34', 'se', '90.78 ± 0.47', '115.91 ± 1.31'],
['resnet34', 'cbam', '96.50 ± 3.17', '111.09 ± 1.01'],
['efficientnet_b0', 'none', '40.45 ± 1.53', '127.30 ± 0.09'],
['efficientnet_b0', 'se', '46.48 ± 0.26', '142.35 ± 6.61'],
['efficientnet_b0', 'cbam', '47.11 ± 0.47', '150.99 ± 12.47'],
]}
striped={true}
bordered={true}
/>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 3, 140) + 140} trigger="scroll" duration={650}>
<p class="text-gray-600 mt-2">要点ResNet34 在 CPU 场景下具备稳健的“速度—FPN 额外开销”折中EfficientNet-B0 单尺度很快但 FPN 代价显著。</p>
</AnimatedElement>
</div>
<!-- 3.5 GPU 细分A100512×512runs=5 -->
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 4, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">3.5 GPU 细分含注意力A100512×512runs=5</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 4, 140) + 80} trigger="scroll" duration={650}>
<GlassTable
headers={[ 'Backbone', 'Attention', 'Single Mean ± Std (ms)', 'FPN Mean ± Std (ms)' ]}
rows={[
['vgg16', 'none', '4.53 ± 0.02', '8.51 ± 0.002'],
['vgg16', 'se', '3.80 ± 0.01', '7.12 ± 0.004'],
['vgg16', 'cbam', '3.73 ± 0.02', '6.95 ± 0.09'],
['resnet34', 'none', '2.32 ± 0.04', '2.73 ± 0.007'],
['resnet34', 'se', '2.33 ± 0.01', '2.73 ± 0.004'],
['resnet34', 'cbam', '2.46 ± 0.04', '2.74 ± 0.004'],
['efficientnet_b0', 'none', '3.69 ± 0.07', '4.38 ± 0.02'],
['efficientnet_b0', 'se', '3.76 ± 0.06', '4.37 ± 0.03'],
['efficientnet_b0', 'cbam', '3.99 ± 0.08', '4.41 ± 0.02'],
]}
striped={true}
bordered={true}
/>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 4, 140) + 140} trigger="scroll" duration={650}>
<p class="text-gray-600 mt-2">要点GPU 环境下注意力对耗时影响较小ResNet34 仍是单尺度与 FPN 的最佳选择。</p>
</AnimatedElement>
</div>
<!-- 3.6 方法论补充(公式 + JSON 结构) -->
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 5, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">3.6 对标方法与 JSON 结构(方法论补充)</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 5, 140) + 60} trigger="scroll" duration={650}>
<p class="text-gray-700">速度提升speedup_percent</p>
<MathFormula display={true} formula="(\\text{SW}_{time} - \\text{FPN}_{time}) / \\text{SW}_{time} \\times 100\%" />
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 5, 140) + 120} trigger="scroll" duration={650}>
<p class="text-gray-700">显存节省memory_saving_percent</p>
<MathFormula display={true} formula="(\\text{SW}_{mem} - \\text{FPN}_{mem}) / \\text{SW}_{mem} \\times 100\%" />
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 5, 140) + 180} trigger="scroll" duration={650}>
<p class="text-gray-600">精度保障:匹配数不显著下降(例如 FPN_matches ≥ SW_matches × 0.95)。</p>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 5, 140) + 240} trigger="scroll" duration={650}>
<CodeBlock
title="benchmark_summary.json (结构示例)"
language="json"
showLineNumbers={false}
code={`{\n \"timestamp\": \"2025-10-20 14:30:45\",\n \"config\": \"configs/base_config.yaml\",\n \"model_path\": \"path/to/model_final.pth\",\n \"layout_path\": \"test_data/layout.png\",\n \"template_path\": \"test_data/template.png\",\n \"device\": \"cuda:0\",\n \"fpn\": {\n \"method\": \"FPN\",\n \"mean_time_ms\": 245.32,\n \"std_time_ms\": 12.45,\n \"gpu_memory_mb\": 1024.5,\n \"num_runs\": 5\n },\n \"sliding_window\": {\n \"method\": \"Sliding Window\",\n \"mean_time_ms\": 352.18,\n \"std_time_ms\": 18.67\n },\n \"comparison\": {\n \"speedup_percent\": 30.35,\n \"memory_saving_percent\": 21.14,\n \"fpn_faster\": true,\n \"meets_speedup_target\": true,\n \"meets_memory_target\": true\n }\n}`}
/>
</AnimatedElement>
</div>
<!-- 3.7 复现实验命令(便携) -->
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 6, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">3.7 复现实验命令(便携)</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 6, 140) + 60} trigger="scroll" duration={650}>
<CodeBlock
title="CPU 注意力对比"
language="bash"
showLineNumbers={false}
code={`PYTHONPATH=. uv run python tests/benchmark_attention.py \\n --device cpu --image-size 512 --runs 10 \\n --backbone resnet34 --places backbone_high desc_head`}
/>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 6, 140) + 120} trigger="scroll" duration={650}>
<CodeBlock
title="三维基准CPU"
language="bash"
showLineNumbers={false}
code={`PYTHONPATH=. uv run python tests/benchmark_grid.py \\n --device cpu --image-size 512 --runs 3 \\n --backbones vgg16 resnet34 efficientnet_b0 \\n --attentions none se cbam \\n --places backbone_high desc_head`}
/>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.BENCH, 6, 140) + 180} trigger="scroll" duration={650}>
<CodeBlock
title="三维基准GPU"
language="bash"
showLineNumbers={false}
code={`PYTHONPATH=. uv run python tests/benchmark_grid.py \\n --device cuda --image-size 512 --runs 5 \\n --backbones vgg16 resnet34 efficientnet_b0 \\n --attentions none se cbam \\n --places backbone_high`}
/>
</AnimatedElement>
</div>
</div>
</ReportSection>
</section>
</AnimatedElement>
<!-- 4. 数据与训练建议Actionable Recommendations -->
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.RECO} trigger="scroll">
<section id="recommendations">
<ReportSection title="4. 数据与训练建议Actionable Recommendations" level={2}>
<div class="goal-section">
<ul class="list-disc list-inside text-gray-700 space-y-2">
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.RECO, 0)} trigger="scroll" duration={650}><li>渲染配置DPI 600900优先 KLayout必要时回退 GDSTK+SVG。</li></AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.RECO, 1)} trigger="scroll" duration={650}><li>Elastic 参数:α=40, σ=6, α_affine=6, p=0.3;用 H 一致性可视化抽检。</li></AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.RECO, 2)} trigger="scroll" duration={650}><li>混采比例:程序合成 ratio=0.20.3;扩散合成 ratio=0.1 起步,先做结构统计(边方向、连通组件、线宽分布、密度直方图)。</li></AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.RECO, 3)} trigger="scroll" duration={650}><li>验证策略:验证集仅真实数据,确保评估不被风格差异干扰。</li></AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getListItemDelay(SECTION_DELAYS.RECO, 4)} trigger="scroll" duration={650}><li>推理策略GPU 默认 ResNet34 + FPNCPU 小任务可评估单尺度 + 更紧的 NMS。</li></AnimatedElement>
</ul>
</div>
</ReportSection>
</section>
</AnimatedElement>
<!-- 5. 项目增益Impact Registry -->
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.IMPACT} trigger="scroll">
<section id="impact">
<ReportSection title="5. 项目增益Impact Registry" level={2}>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.IMPACT, 0, 120)} trigger="scroll" duration={650}>
<div class="challenge-card">
<h3 class="challenge-title">训练收敛更稳</h3>
<p class="challenge-description">Elastic + 程序合成;对非刚性扰动更鲁棒,收敛更平稳。</p>
</div>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.IMPACT, 1, 120)} trigger="scroll" duration={650}>
<div class="challenge-card">
<h3 class="challenge-title">泛化能力增强</h3>
<p class="challenge-description">风格域与结构多样性扩大,减少过拟合风险。</p>
</div>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.IMPACT, 2, 120)} trigger="scroll" duration={650}>
<div class="challenge-card">
<h3 class="challenge-title">工程复现性提升</h3>
<p class="challenge-description">一键管线、配置写回、TB 导出,标准化流程,复现更强。</p>
</div>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.IMPACT, 3, 120)} trigger="scroll" duration={650}>
<div class="challenge-card">
<h3 class="challenge-title">推理经济性提升</h3>
<p class="challenge-description">FPN 相对滑窗 ≥30% 提速与 ≥20% 显存节省。</p>
</div>
</AnimatedElement>
</div>
</ReportSection>
</section>
</AnimatedElement>
<!-- 6. 附录Appendix -->
<AnimatedElement animation="fadeInUp" delay={SECTION_DELAYS.APPENDIX} trigger="scroll">
<section id="appendix">
<ReportSection title="6. 附录Appendix" level={2}>
<div class="space-y-8">
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.APPENDIX, 0, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">一键命令(含扩散目录)</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.APPENDIX, 0, 140) + 80} trigger="scroll" duration={650}>
<CodeBlock
title="synth_pipeline.zsh"
language="bash"
showLineNumbers={false}
code={`uv run python tools/synth_pipeline.py \n --out_root data/synthetic \n --num 200 --dpi 600 \n --config configs/base_config.yaml \n --ratio 0.3 \n --diffusion_dir data/synthetic_diff/png`}
/>
</AnimatedElement>
</div>
<div>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.APPENDIX, 1, 140)} trigger="scroll" duration={650}>
<h3 class="section-heading">建议 YAML 片段</h3>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={getChildDelay(SECTION_DELAYS.APPENDIX, 1, 140) + 80} trigger="scroll" duration={650}>
<CodeBlock
title="base_config.yaml (snippet)"
language="yaml"
showLineNumbers={false}
code={`synthetic:\n enabled: true\n png_dir: data/synthetic/png\n ratio: 0.3\n diffusion:\n enabled: true\n png_dir: data/synthetic_diff/png\n ratio: 0.1\naugment:\n elastic:\n enabled: true\n alpha: 40\n sigma: 6\n alpha_affine: 6\n prob: 0.3`}
/>
</AnimatedElement>
</div>
</div>
</ReportSection>
</section>
</AnimatedElement>
</div>
</div>
</main>
<Footer />
</BaseLayout>
<style>
/* 核心布局(与模板一致的关键子集) */
.report-main {
--report-color-primary: #5f7a99;
--report-color-primary-strong: #4a627b;
--report-color-primary-deep: #384b5f;
--report-color-primary-soft: #8ea3b8;
--report-color-glass-border: rgba(95, 122, 153, 0.28);
--report-color-text: #2f3844;
--report-color-subtext: #566171;
min-height: 100vh;
padding-bottom: 2rem;
background: transparent;
color: var(--report-color-text);
position: relative;
}
.report-layout { width: 100%; display: flex; flex-direction: column; gap: 2rem; }
.report-content { width: 100%; min-width: 0; margin: 0 auto; }
.container { max-width: 1200px; width: 100%; }
/* 常用内容容器 */
.goal-section {
background: rgba(255, 255, 255, 0.06);
border: 1px solid var(--report-color-glass-border);
border-radius: 1rem;
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.deep-dive-card {
background: rgba(255, 255, 255, 0.06);
border: 1px solid var(--report-color-glass-border);
border-radius: 1rem;
padding: 2rem;
margin-bottom: 2rem;
}
.section-heading { font-size: 1.25rem; font-weight: 600; color: var(--report-color-primary); margin: 0 0 0.75rem 0; }
.tech-comparison-table { margin: 1rem 0; }
/* 卡片 */
.challenge-card {
background: linear-gradient(135deg, rgba(95, 122, 153, 0.18), rgba(74, 98, 123, 0.16));
padding: 1.5rem;
border-radius: 0.85rem;
border: 1px solid rgba(74, 98, 123, 0.35);
box-shadow: 0 12px 32px rgba(56, 75, 95, 0.18);
backdrop-filter: blur(16px);
}
.challenge-title { font-weight: 700; font-size: 1.1rem; color: var(--report-color-primary-strong); margin-bottom: 0.4rem; }
.challenge-description { color: var(--report-color-subtext); }
/* 标题内容块Hero样式 */
.report-header { padding: 4rem 0 2rem 0; text-align: center; }
.report-title {
font-size: 3rem; font-weight: 800; color: var(--report-color-primary);
margin: 0 0 1rem 0;
background: linear-gradient(135deg, var(--report-color-primary-soft), var(--report-color-primary), var(--report-color-primary-strong));
-webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2;
}
.report-subtitle { font-size: 1.25rem; color: var(--report-color-subtext); margin: 0 0 2rem 0; line-height: 1.6; max-width: 800px; margin-left: auto; margin-right: auto; }
.report-meta { display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; margin-top: 1.5rem; }
.report-date, .report-type { background: rgba(95, 122, 153, 0.12); color: var(--report-color-primary-deep); padding: 0.5rem 1rem; border-radius: 1rem; font-weight: 500; font-size: 0.875rem; }
.report-action { margin-top: 2rem; }
.report-cta-button { display: inline-flex; align-items: center; justify-content: center; padding: 0.9rem 2.4rem; border-radius: 999px; background: linear-gradient(135deg, var(--report-color-primary), var(--report-color-primary-strong)); color: #ffffff; font-weight: 600; letter-spacing: 0.02em; box-shadow: 0 14px 32px rgba(56, 75, 95, 0.28); transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease; }
.report-cta-button:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(56, 75, 95, 0.32); filter: brightness(1.05); }
.report-cta-button:active { transform: translateY(0); box-shadow: 0 12px 28px rgba(56, 75, 95, 0.28); filter: brightness(0.98); }
</style>

View File

@@ -124,6 +124,17 @@ import AnimatedElement from '../../components/AnimatedElement.astro';
size="large"
/>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={1500} trigger="scroll">
<NavigationCard
title="RoRD 新增实现与性能评估2025-10-20"
description="ElasticTransform、程序/扩散合成接入与一键管线、ResNet34+FPN 高效推理的阶段性增量报告。"
href="/report/RoRD_Increment_Report/"
icon="fas fa-chart-line"
color="primary"
size="large"
/>
</AnimatedElement>
<AnimatedElement animation="fadeInUp" delay={1400} trigger="scroll">
<NavigationCard