diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..e0db4df --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,82 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "astro-build-check", + "type": "shell", + "command": "npm run build", + "args": [], + "isBackground": false, + "problemMatcher": [ + "$tsc" + ], + "group": "build" + }, + { + "label": "astro-build-check", + "type": "shell", + "command": "npm run build", + "args": [], + "isBackground": false, + "problemMatcher": [ + "$tsc" + ], + "group": "build" + }, + { + "label": "astro-build-check", + "type": "shell", + "command": "npm run build", + "args": [], + "isBackground": false, + "problemMatcher": [ + "$tsc" + ], + "group": "build" + }, + { + "label": "astro-build-check", + "type": "shell", + "command": "npm run build", + "args": [], + "isBackground": false, + "problemMatcher": [ + "$tsc" + ], + "group": "build" + }, + { + "label": "astro-build-check", + "type": "shell", + "command": "npm run build", + "args": [], + "isBackground": false, + "problemMatcher": [ + "$tsc" + ], + "group": "build" + }, + { + "label": "astro-build-check", + "type": "shell", + "command": "npm run build", + "args": [], + "isBackground": false, + "problemMatcher": [ + "$tsc" + ], + "group": "build" + }, + { + "label": "astro-build-check", + "type": "shell", + "command": "npm run build", + "args": [], + "isBackground": false, + "problemMatcher": [ + "$tsc" + ], + "group": "build" + } + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 36c5abc..512fb4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,11 @@ "version": "0.0.1", "dependencies": { "@astrojs/tailwind": "^6.0.2", - "astro": "^5.14.1", + "astro": "^5.14.7", "tailwindcss": "^3.0.0" }, "devDependencies": { - "@astrojs/check": "^0.9.4", + "@astrojs/check": "^0.9.5", "typescript": "^5.0.0" } }, @@ -30,9 +30,9 @@ } }, "node_modules/@astrojs/check": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@astrojs/check/-/check-0.9.4.tgz", - "integrity": "sha512-IOheHwCtpUfvogHHsvu0AbeRZEnjJg3MopdLddkJE70mULItS/Vh37BHcI00mcOJcH1vhD3odbpvWokpxam7xA==", + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@astrojs/check/-/check-0.9.5.tgz", + "integrity": "sha512-88vc8n2eJ1Oua74yXSGo/8ABMeypfQPGEzuoAx2awL9Ju8cE6tZ2Rz9jVx5hIExHK5gKVhpxfZj4WXm7e32g1w==", "dev": true, "license": "MIT", "dependencies": { @@ -85,9 +85,9 @@ "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.7.3.tgz", - "integrity": "sha512-6Pl0bQEIChuW5wqN7jdKrzWfCscW2rG/Cz+fzt4PhSQX2ivBpnhXgFUCs0M3DCYvjYHnPVG2W36X5rmFjZ62sw==", + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.7.4.tgz", + "integrity": "sha512-lDA9MqE8WGi7T/t2BMi+EAXhs4Vcvr94Gqx3q15cFEz8oFZMO4/SFBqYr/UcmNlvW+35alowkVj+w9VhLvs5Cw==", "license": "MIT" }, "node_modules/@astrojs/language-server": { @@ -133,12 +133,12 @@ } }, "node_modules/@astrojs/markdown-remark": { - "version": "6.3.7", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.7.tgz", - "integrity": "sha512-KXGdq6/BC18doBCYXp08alHlWChH0hdD2B1qv9wIyOHbvwI5K6I7FhSta8dq1hBQNdun8YkKPR013D/Hm8xd0g==", + "version": "6.3.8", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.8.tgz", + "integrity": "sha512-uFNyFWadnULWK2cOw4n0hLKeu+xaVWeuECdP10cQ3K2fkybtTlhb7J7TcScdjmS8Yps7oje9S/ehYMfZrhrgCg==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.3", + "@astrojs/internal-helpers": "0.7.4", "@astrojs/prism": "3.3.0", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", @@ -152,7 +152,7 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", - "shiki": "^3.12.2", + "shiki": "^3.13.0", "smol-toml": "^1.4.2", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", @@ -263,14 +263,15 @@ } }, "node_modules/@capsizecss/unpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@capsizecss/unpack/-/unpack-2.4.0.tgz", - "integrity": "sha512-GrSU71meACqcmIUxPYOJvGKF0yryjN/L1aCuE9DViCTJI7bfkjgYDPD1zbNDcINJwSSP6UaBZY9GAbYDO7re0Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@capsizecss/unpack/-/unpack-3.0.0.tgz", + "integrity": "sha512-+ntATQe1AlL7nTOYjwjj6w3299CgRot48wL761TUGYpYgAou3AaONZazp0PKZyCyWhudWsjhq1nvRHOvbMzhTA==", "license": "MIT", "dependencies": { - "blob-to-buffer": "^1.2.8", - "cross-fetch": "^3.0.4", "fontkit": "^2.0.2" + }, + "engines": { + "node": ">=18" } }, "node_modules/@emmetio/abbreviation": { @@ -2064,16 +2065,17 @@ } }, "node_modules/astro": { - "version": "5.14.1", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.14.1.tgz", - "integrity": "sha512-gPa8NY7/lP8j8g81iy8UwANF3+aukKRWS68IlthZQNgykpg80ne6lbHOp6FErYycxQ1TUhgEfkXVDQZAoJx8Bg==", + "version": "5.14.7", + "resolved": "https://registry.npmjs.org/astro/-/astro-5.14.7.tgz", + "integrity": "sha512-vdZmRN2MFf60ZTjFkZNrQQkrmeeZzTI1c6N3ZRQN55rPGHjywM2VplJwJ68q496DfpaoDoAroDBpdm+eTgHUtQ==", "license": "MIT", + "peer": true, "dependencies": { "@astrojs/compiler": "^2.12.2", - "@astrojs/internal-helpers": "0.7.3", - "@astrojs/markdown-remark": "6.3.7", + "@astrojs/internal-helpers": "0.7.4", + "@astrojs/markdown-remark": "6.3.8", "@astrojs/telemetry": "3.3.0", - "@capsizecss/unpack": "^2.4.0", + "@capsizecss/unpack": "^3.0.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.2.0", "acorn": "^8.15.0", @@ -2115,11 +2117,11 @@ "semver": "^7.7.2", "shiki": "^3.12.0", "smol-toml": "^1.4.2", - "tinyexec": "^0.3.2", + "tinyexec": "^1.0.1", "tinyglobby": "^0.2.14", "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", - "unifont": "~0.5.2", + "unifont": "~0.6.0", "unist-util-visit": "^5.0.0", "unstorage": "^1.17.0", "vfile": "^6.0.3", @@ -2257,26 +2259,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/blob-to-buffer": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/blob-to-buffer/-/blob-to-buffer-1.2.9.tgz", - "integrity": "sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/boxen": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", @@ -2348,6 +2330,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.3", "caniuse-lite": "^1.0.30001741", @@ -2676,15 +2659,6 @@ "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", "license": "MIT" }, - "node_modules/cross-fetch": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.2.0.tgz", - "integrity": "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==", - "license": "MIT", - "dependencies": { - "node-fetch": "^2.7.0" - } - }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -3631,6 +3605,7 @@ "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "license": "MIT", + "peer": true, "bin": { "jiti": "bin/jiti.js" } @@ -4666,26 +4641,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/node-fetch-native": { "version": "1.6.7", "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz", @@ -4958,6 +4913,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -5483,6 +5439,7 @@ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.3.tgz", "integrity": "sha512-RIDh866U8agLgiIcdpB+COKnlCreHJLfIhWC3LVflku5YHfpnsIKigRZeFfMfCc4dVcqNVfQQ5gO/afOck064A==", "license": "MIT", + "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -5832,6 +5789,7 @@ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz", "integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==", "license": "MIT", + "peer": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -5904,9 +5862,9 @@ "license": "MIT" }, "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.1.tgz", + "integrity": "sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw==", "license": "MIT" }, "node_modules/tinyglobby": { @@ -5937,12 +5895,6 @@ "node": ">=8.0" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "license": "MIT" - }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", @@ -6019,6 +5971,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -6101,9 +6054,9 @@ } }, "node_modules/unifont": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/unifont/-/unifont-0.5.2.tgz", - "integrity": "sha512-LzR4WUqzH9ILFvjLAUU7dK3Lnou/qd5kD+IakBtBK4S15/+x2y9VX+DcWQv6s551R6W+vzwgVS6tFg3XggGBgg==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/unifont/-/unifont-0.6.0.tgz", + "integrity": "sha512-5Fx50fFQMQL5aeHyWnZX9122sSLckcDvcfFiBf3QYeHa7a1MKJooUy52b67moi2MJYkrfo/TWY+CoLdr/w0tTA==", "license": "MIT", "dependencies": { "css-tree": "^3.0.0", @@ -6441,6 +6394,7 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.6.tgz", "integrity": "sha512-0msEVHJEScQbhkbVTb/4iHZdJ6SXp/AvxL2sjwYQFfBqleHtnCqv1J3sa9zbWz/6kW1m9Tfzn92vW+kZ1WV6QA==", "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", @@ -6794,22 +6748,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -6961,6 +6899,7 @@ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", "license": "ISC", + "peer": true, "bin": { "yaml": "bin.mjs" }, @@ -7185,6 +7124,7 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index b450070..23825da 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,11 @@ }, "dependencies": { "@astrojs/tailwind": "^6.0.2", - "astro": "^5.14.1", + "astro": "^5.14.7", "tailwindcss": "^3.0.0" }, "devDependencies": { - "@astrojs/check": "^0.9.4", + "@astrojs/check": "^0.9.5", "typescript": "^5.0.0" } } diff --git a/src/pages/report/RoRD_Increment_Report/Increment_Report_2025-10-20.md b/src/pages/report/RoRD_Increment_Report/Increment_Report_2025-10-20.md new file mode 100644 index 0000000..8a5c38d --- /dev/null +++ b/src/pages/report/RoRD_Increment_Report/Increment_Report_2025-10-20.md @@ -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 + FPN(GPU);程序合成 ratio≈0.2–0.3,扩散合成 ratio≈0.1 起步;Elastic α=40, σ=6;渲染 DPI 600–900;KLayout 优先。 + +--- + +## 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×512,runs=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/B(CPU,ResNet34,512×512,runs=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 GPU(A100)示例(512×512,runs=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/FPN,CPU,512×512,runs=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 细分(含注意力,A100,512×512,runs=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 600–900;优先 KLayout;必要时回退 GDSTK+SVG。 +- Elastic 参数:α=40, σ=6, α_affine=6, p=0.3;用 H 一致性可视化抽检。 +- 混采比例:程序合成 ratio=0.2–0.3;扩散合成 ratio=0.1 起步,先做结构统计(边方向、连通组件、线宽分布、密度直方图)。 +- 验证策略:验证集仅真实数据,确保评估不被风格差异干扰。 +- 推理策略:GPU 默认 ResNet34 + FPN;CPU 小任务可评估单尺度 + 更紧的 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 +``` diff --git a/src/pages/report/RoRD_Increment_Report/index.astro b/src/pages/report/RoRD_Increment_Report/index.astro new file mode 100644 index 0000000..c6d13f4 --- /dev/null +++ b/src/pages/report/RoRD_Increment_Report/index.astro @@ -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' +}; +--- + + +
+ +
+
+ +
+ + +
+ + +

{reportConfig.title}

+

{reportConfig.subtitle}

+
+ 报告日期:{reportConfig.date} + {reportConfig.type} +
+ +
+
+
+ + + +
+ +
+
    + +
  • 新增三大能力:ElasticTransform(保持 H 一致)、程序化合成与一键管线(GDS→PNG→质检→配置写回)、三源混采训练(真实/程序合成/扩散合成,验证集仅真实)。已为扩散生成打通接入路径(配置节点与脚手架)。
  • +
    + +
  • 基准结果:ResNet34 在 CPU/GPU 下均表现稳定高效;GPU 环境中 FPN 额外开销低(约 +18%,以 A100 示例为参照),注意力对耗时影响小。整体达到 FPN 相对滑窗 ≥30% 提速与 ≥20% 显存节省目标。
  • +
    + +
  • 建议:默认 ResNet34 + FPN(GPU);程序合成 ratio≈0.2–0.3,扩散合成 ratio≈0.1 起步;Elastic α=40, σ=6;渲染 DPI 600–900;KLayout 优先。
  • +
    +
+
+
+
+
+ + + +
+ +
+ + + +
+
+
+
+ + + +
+ +
+
    + +
  • 配置: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.1 CPU 前向(512×512,runs=5)

+
+ + + +
+ +
+ +

3.2 注意力 A/B(CPU,ResNet34,512×512,runs=10)

+
+ + + +
+ +
+ +

3.3 GPU(A100)示例(512×512,runs=5)

+
+ + + + +

说明:完整复现命令与更全面的实验汇总,见 docs/description/Performance_Benchmark.md

+
+
+ + +
+ +

3.4 三维基准(Backbone × Attention × Single/FPN,CPU,512×512,runs=3)

+
+ + + + +

要点:ResNet34 在 CPU 场景下具备稳健的“速度—FPN 额外开销”折中;EfficientNet-B0 单尺度很快但 FPN 代价显著。

+
+
+ + +
+ +

3.5 GPU 细分(含注意力,A100,512×512,runs=5)

+
+ + + + +

要点:GPU 环境下注意力对耗时影响较小;ResNet34 仍是单尺度与 FPN 的最佳选择。

+
+
+ + +
+ +

3.6 对标方法与 JSON 结构(方法论补充)

+
+ +

速度提升(speedup_percent):

+ +
+ +

显存节省(memory_saving_percent):

+ +
+ +

精度保障:匹配数不显著下降(例如 FPN_matches ≥ SW_matches × 0.95)。

+
+ + + +
+ + +
+ +

3.7 复现实验命令(便携)

+
+ + + + + + + + + +
+
+
+
+
+ + + +
+ +
+
    +
  • 渲染配置:DPI 600–900;优先 KLayout;必要时回退 GDSTK+SVG。
  • +
  • Elastic 参数:α=40, σ=6, α_affine=6, p=0.3;用 H 一致性可视化抽检。
  • +
  • 混采比例:程序合成 ratio=0.2–0.3;扩散合成 ratio=0.1 起步,先做结构统计(边方向、连通组件、线宽分布、密度直方图)。
  • +
  • 验证策略:验证集仅真实数据,确保评估不被风格差异干扰。
  • +
  • 推理策略:GPU 默认 ResNet34 + FPN;CPU 小任务可评估单尺度 + 更紧的 NMS。
  • +
+
+
+
+
+ + + +
+ +
+ +
+

训练收敛更稳

+

Elastic + 程序合成;对非刚性扰动更鲁棒,收敛更平稳。

+
+
+ +
+

泛化能力增强

+

风格域与结构多样性扩大,减少过拟合风险。

+
+
+ +
+

工程复现性提升

+

一键管线、配置写回、TB 导出,标准化流程,复现更强。

+
+
+ +
+

推理经济性提升

+

FPN 相对滑窗 ≥30% 提速与 ≥20% 显存节省。

+
+
+
+
+
+
+ + + +
+ +
+
+ +

一键命令(含扩散目录)

+
+ + + +
+
+ +

建议 YAML 片段

+
+ + + +
+
+
+
+
+ +
+
+
+ +