Files
hair/OFFLINE_ASSETS.md
T
xsl 66a2c84168 chore: 预下载离线模型权重+字体,补充内网部署清单
- 下载 BiSeNet(79999_iter.pth 53MB) + resnet18骨干(45MB) + Noto Sans CJK SC字体(16MB)
  到 face_analysis/weights 与 fonts(大文件 .gitignore 不入库,靠文件拷贝带入内网)
- 新增 OFFLINE_ASSETS.md:文件清单+sha256校验+resnet18骨干离线放置说明+来源URL
- 字体由 SourceHanSansSC 改为 NotoSansCJKsc(同一套字体),同步更新两份文档引用
- 文档补充内网/离线注意事项(resnet18联网下载坑、权重已预置)
2026-06-14 00:23:10 +08:00

67 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 离线资产清单(内网部署用)
开发/部署机在内网无法联网,以下模型权重与字体**已预先下载**放在仓库对应目录。
这些文件**不进 git**(见 `.gitignore`),通过文件拷贝(U盘/内网共享)随项目一起带到内网机即可。
> 拷贝到内网机后,用本文件末尾的 sha256 校验完整性,确认未损坏。
## 文件清单
| 文件 | 路径 | 大小 | 用途 |
|------|------|------|------|
| BiSeNet 主权重 | `face_analysis/weights/79999_iter.pth` | 53,289,463 B (~53MB) | 人脸解析分割(方案 B,取真实发际线/头顶) |
| resnet18 骨干 | `face_analysis/weights/resnet18-5c106cde.pth` | 46,827,520 B (~45MB) | BiSeNet 的骨干网络,**内网必需**(见下) |
| 中文字体 | `face_analysis/fonts/NotoSansCJKsc-Regular.otf` | 16,437,364 B (~16MB) | 标注图中文渲染(= 思源黑体,同一套字体) |
## sha256 校验
```
468e13ca13a9b43cc0881a9f99083a430e9c0a38abd935431d1c28ee94b26567 face_analysis/weights/79999_iter.pth
5c106cde386e87d4033832f2996f5493238eda96ccf559d1d62760c4de0613f8 face_analysis/weights/resnet18-5c106cde.pth
2c76254f6fc379fddfce0a7e84fb5385bb135d3e399294f6eeb6680d0365b74b face_analysis/fonts/NotoSansCJKsc-Regular.otf
```
校验命令:
```bash
# Linux/macOS
sha256sum -c <<'EOF'
468e13ca13a9b43cc0881a9f99083a430e9c0a38abd935431d1c28ee94b26567 face_analysis/weights/79999_iter.pth
5c106cde386e87d4033832f2996f5493238eda96ccf559d1d62760c4de0613f8 face_analysis/weights/resnet18-5c106cde.pth
2c76254f6fc379fddfce0a7e84fb5385bb135d3e399294f6eeb6680d0365b74b face_analysis/fonts/NotoSansCJKsc-Regular.otf
EOF
```
```powershell
# Windows PowerShell
Get-FileHash face_analysis\weights\79999_iter.pth -Algorithm SHA256
```
> resnet18 文件名内嵌的 `5c106cde` 即其官方 sha256 前 8 位(torchvision 命名惯例),与上表一致 = 官方权重无误。
## ⚠️ resnet18 骨干的离线处理(重要)
BiSeNet 初始化时会调用 `torch.utils.model_zoo` / `torchvision` **联网下载** resnet18 骨干,内网会失败报错。两种解法任选其一:
1. **放进 torch 缓存目录**(推荐,零改代码):
```bash
mkdir -p ~/.cache/torch/hub/checkpoints/
cp face_analysis/weights/resnet18-5c106cde.pth ~/.cache/torch/hub/checkpoints/
```
Windows 路径:`%USERPROFILE%\.cache\torch\hub\checkpoints\`
2. **改 BiSeNet 代码**,把骨干加载改成从 `face_analysis/weights/resnet18-5c106cde.pth` 本地读取(`load_state_dict(torch.load(本地路径))`,并去掉联网下载分支)。
## 下载来源(联网环境重建用)
```
79999_iter.pth https://huggingface.co/ManyOtherFunctions/face-parse-bisent/resolve/main/79999_iter.pth
resnet18-5c106cde.pth https://download.pytorch.org/models/resnet18-5c106cde.pth
NotoSansCJKsc-Regular.otf https://github.com/notofonts/noto-cjk/raw/main/Sans/OTF/SimplifiedChinese/NotoSansCJKsc-Regular.otf
```
## 还差什么(pip 依赖)
模型已就位,但**内网机还需要 Python 依赖的离线 wheel 包**`mediapipe`/`opencv-python`/`torch` CPU 版等),否则 `pip install` 在内网无法联网安装。这部分**与目标机的操作系统和 Python 版本强相关**,需确认后单独打包:见仓库提交说明或联系下载方补充 `wheels/` 目录。
---
> 创建日期:2026-06-14 | 配套:技术方案 v2.0 / 任务书 v1.3