| --- |
| language: |
| - zh |
| license: other |
| tags: |
| - object-detection |
| - fire-detection |
| - dfine |
| - horizon |
| - rdk-s100p |
| - qat |
| - quantization |
| --- |
| |
| # SPARK 火灾检测模型 |
|
|
| SPARK(**S**mall-target **P**yramid-enhanced **A**daptive **R**ecognition framewor**K**)是面向紧凑空间早期火灾检测的实时目标检测模型,检测小尺度火焰与烟雾(2 类:fire / smoke)。基于 D-FINE / DEIM 架构:**HGNetv2-B5** backbone + **SFPN**(Spatial-Frequency Pyramid Network,空间多核深度卷积 + Haar 小波频率分解)neck + **DFINE-T** decoder(500 queries)。 |
|
|
| 本仓库为 RDK S100P(march = nash-m)部署交付的 3 个模型,覆盖 浮点训练基线 → 结构剪枝 → QAT 量化 的完整链路。 |
|
|
| ## 模型列表 |
|
|
| | 子文件夹 | 模型 | 格式 | 体积 | mAP50:95 (fire-CompactSpace val) | |
| |----------|------|------|------|--------------------------------| |
| | `spark_dfine_float_best/` | Float 训练基线 | PyTorch checkpoint | 1.2 GB | 0.7147 | |
| | `spark_dfine_pruned_x1.5/` | 结构剪枝 x1.5(微调后) | PyTorch checkpoint | 193 MB | 0.6863 | |
| | `spark_fire_prune_x1.5/` | 剪枝 + QAT 量化部署模型 | Horizon BPU 模型 (HBM, nash-m) | 346 MB | 0.6855 | |
|
|
| 每个子文件夹内包含模型文件与说明文档(`README.md`)。 |
|
|
| ## 部署模型(spark_fire_prune_x1.5.hbm) |
| |
| - **平台**:RDK S100P(march = nash-m) |
| - **量化方案**:QAT `int16_act_score16`(decoder 激活 qint16 + 权重 qint8,score 头输出 fp16),校准即用,无需微调 |
| - **精度**:VALIDATION(int16-sim)mAP **0.6855**,相对剪枝模型浮点精度(0.6863)损失 < 0.1% |
| - **静态性能**:FPS 13.7,latency 73.0 ms,min memory 439 MB |
| - **输入**:`images`,[1, 3, 640, 640],FLOAT32(RGB,预处理 /255 → [0,1],无 mean/std) |
| - **输出**:`pred_logits` [1, 500, 2]、`pred_boxes` [1, 500, 4] |
| |
| ## 模型格式说明 |
| |
| | 格式 | 说明 | |
| |------|------| |
| | PyTorch checkpoint | `torch.save` 序列化 dict。float 基线含 `ema.module`/`model` 键 state_dict;剪枝模型含 `prune_model` 键(完整 DFINE 模型对象,50.03M 参数) | |
| | Horizon HBM | `horizon_plugin_pytorch` QAT 导出 + `hbdk4.compiler` convert/compile 生成,可直接部署到 RDK S100P BPU | |
| |
| ## 链路与复现 |
| |
| ```text |
| spark_dfine_float_best.pth (0.7147) |
| │ LAMP 结构剪枝 (74.16M→50.03M params, -36% FLOPs) + 微调恢复 |
| ▼ |
| spark_dfine_pruned_x1.5.pth (0.6863) |
| │ QAT int16_act_score16 校准(10 val 批,calib-only) |
| ▼ |
| spark_fire_prune_x1.5.hbm (0.6855) |
| ``` |
| |
| 复现代码见 [SPARK 仓库](https://github.com/lw-liuwang/SPARK)(`tools/prune/`、`tools/qat/`),文档见 `docs/剪枝指南.md`、`docs/QAT指南.md`。 |
|
|