基于ONNX与测算一体的端侧轻量化洪水预报
ONNX-Based Lightweight On-Device Flood Forecasting with Integrated Measurement and Computation
DOI: 10.12677/jwrr.2026.153034, PDF,   
作者: 程 帅, 朱一松*, 郑晓燕, 刘维高, 项伍林:武汉大水云科技有限公司,湖北 武汉;张佳宁:山东省水文中心,山东 济南;王增凯:烟台市水文中心,山东 烟台
关键词: 测算一体洪水预报ONNXLSTMIntegrated Measurement and Computation Flood Forecasting ONNX LSTM
摘要: 洪涝灾害频发且破坏性强,对洪水预报的时效性、经济性与场景适应性提出更高要求。针对传统洪水预报模型计算量大、云端部署存在传输延迟高、运维成本高、偏远地区适配性差等问题,本研究提出一种基于开放神经网络交换(ONNX)的端侧轻量化LSTM测算一体的洪水预报方法。以山东省内6个AiFlow视觉测流监测站点的流量数据为研究基础,通过Yeo Johnson转换将偏态分布的流量数据转换为近似正态分布,结合Z-score标准差标准化构建时序训练样本;采用双层堆叠LSTM模型捕捉水文数据的时序依赖关系,基于ONNX对模型开展计算图优化、算子融合与量化处理,实现模型的端侧轻量化部署与河道流量实时滚动预报。实验结果表明,该方法在6个监测站点均表现出可靠的预报精度,1、3步滚动预报纳什系数(NSE)均高于0.91,平均绝对百分比误差(MAPE)均小于10%,满足短期洪水预报需求;经ONNX轻量化处理后,较原始PyTorch格式模型,模型文件体积减少了67%,可执行文件体积减少了69%,端侧推理冷启动耗时降低超99%,6个站点的平均推理耗时降低7%~31%,模型预报NSE无变化;模型加载内存增量从111.97 MB降低至0.54 MB,完全适配端侧设备的资源约束。本方法实现了“数据采集、本地推理、预报输出”的全流程闭环,显著降低了洪水预报的运维成本和预报延迟,为中小河流、偏远地区的测算一体化洪水预报提供了低成本、轻量化的技术方案。
Abstract: Frequent and highly destructive flood disasters have imposed increasingly stringent requirements on the timeliness, cost-effectiveness, and scenario adaptability of flood forecasting. To address the key limitations of traditional flood forecasting models (namely excessive computational overhead) and the inherent drawbacks of cloud-based deployment (including high transmission latency, elevated operation and maintenance (O&M) costs, and poor adaptability to remote areas), this study proposes a lightweight on-device LSTM (Long Short-Term Memory) flood forecasting method with integrated measurement and computation based on the Open Neural Network Exchange (ONNX). Taking the discharge data from 6 AiFlow visual flow measurement monitoring stations in Shandong Province as the research basis, the skewed discharge data are transformed into an approximately normal distribution via the Yeo-Johnson transformation, and time-series training samples are constructed in conjunction with Z-score standardization. A two-layer stacked LSTM model is built to capture the temporal dependencies of hydrological series, and ONNX-based computation graph optimization, operator fusion, and quantization processing are implemented on the trained model, enabling lightweight on-device deployment of the model and real-time rolling forecasting of river channel discharge. The experimental results demonstrate that the proposed method achieves reliable forecasting performance across all 6 monitoring stations. For 1-step and 3-step ahead rolling forecasting, the Nash-Sutcliffe Efficiency (NSE) values are all above 0.91, and the Mean Absolute Percentage Error (MAPE) values are all below 10%, fully satisfying the operational requirements of short-term flood forecasting. After ONNX-enabled lightweight processing, the model code is reduced by 67%, the executable file size is reduced by 69%. The cold start latency of on-device inference is cut by over 99%, and the average inference time across the 6 stations is reduced by 7% to 31%, with no degradation in forecasting NSE. The memory increment required for model loading is reduced from 111.97 MB to 0.54 MB, which fully complies with the resource constraints of on-device edge terminals. The proposed method establishes a full-process closed loop covering “data acquisition, local inference, and forecasting output”, thus significantly lowers the O&M costs and forecasting latency of flood forecasting, and provides a low-cost, lightweight technical solution for integrated measurement-computation flood forecasting in medium and small rivers and remote areas.
文章引用:程帅, 张佳宁, 朱一松, 王增凯, 郑晓燕, 刘维高, 项伍林. 基于ONNX与测算一体的端侧轻量化洪水预报[J]. 水资源研究, 2026, 15(3): 306-325. https://doi.org/10.12677/jwrr.2026.153034

参考文献

[1] 方宏远, 郑飞飞, 狄丹阳, 等. 考虑河道分洪措施与洪涝灾害风险的应急避难选址研究[J]. 人民黄河, 2025, 47(9): 9-14+36.
[2] 童超, 詹晗煜, 崔罡, 刘康, 欧阳磊, 肖宏宇. 融合ResNet-18与水动力模型的洪水演进快速预测[J]. 水资源保护, 2026, 42(1): 129-136.
[3] 罗秋实, 沈洁, 李舒. 郑州市洪涝模拟模型研究[J]. 人民黄河, 2024, 46(7): 42-47+78.
[4] 张倬豪. 基于HEC-RAS二维建模的渗漏屏障有效性分析与洪水预报[J]. 武汉理工大学学报, 2024, 46(1): 97-104.
[5] 杨宇, 王喆, 刘贞鹏, 等. 基于TUFLOW模型的洪水实时预测预报技术研究与实践[J]. 广西水利水电, 2022(5): 94-99.
[6] 程桂芳, 周芸. 黄河三门峡水文站非汛期流量预报研究[J]. 人民黄河, 2025, 47(4): 38-43+57.
[7] 刘浩, 张玲. 基于Transformer模型的洪水预报研究与分析[C]//河海大学, 浙江省水利学会, 上海市水利学会, 江苏省水利学会, 安徽省水利学会. 2025 (第十三届)中国水利信息化技术交流会论文集. 2025: 1329-1339.
[8] 蔡金华. 基于DWT与Informer融合算法的洪水预测模型研究[D]: [硕士学位论文]. 武汉: 武汉纺织大学, 2024.
[9] 段生月, 王长坤, 张柳艳. 基于正则化GRU模型的洪水预报[J]. 计算机系统应用, 2019, 28(5): 196-201.
[10] VASWANI, A., SHAZEER, N., PARMAR, N., et al. Attention is all you need. In: GUYON I., VON LUXBURG U., BENGIO S., et al., Eds., Advances in neural information processing systems 30 (NIPS 2017). Long Beach: Curran Associates, Inc., 2017: 6000-6010.
[11] ZHOU, H., ZHANG, S., PENG, J., et al. Informer: Beyond efficient transformer for long sequence time-series forecasting. 2020.
[12] GRAVES, A. Long short-term memory. In Studies in computational intelligence. Berlin: Springer, 2012: 37-45.[CrossRef
[13] 钱峰, 成建国, 夏润亮, 等. 数字孪生水利“天空地水工”一体化监测感知体系构建与应用初探[J]. 中国水利, 2024(24): 39-47.
[14] 李小静, 肖文. 数字孪生水利工程建设费用测算[J]. 水利技术监督, 2026(2): 35-38+76.
[15] LEE, Y. J., HWANG, J. Y., PARK, J., JUNG, H. G. and SUHR, J. K. Deep neural network-based flood monitoring system fusing rgb and lwir cameras for embedded iot edge devices. Remote Sensing, 2024, 16(13): 2358. [Google Scholar] [CrossRef
[16] THIRUGNANASAMMANDAMOORTHI, P., GHOSH, D., DEWANGAN, R. K., et al. FloodNet-Lite: A lightweight deep learning for flood mapping using remote sensing data with optimized UNet and edge deployment approach in 6G. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 2025, 18: 20294-20314.[CrossRef
[17] SAMIKWA, E., VOIGT, T. and ERIKSSON, J. Flood prediction using IoT and artificial neural networks with edge computing. In 2020 International conferences on internet of things (iThings) and IEEE green computing and communications (GreenCom) and IEEE cyber, physical and social computing (CPSCom) and IEEE smart data (SmartData) and IEEE congress on cybermatics (Cybermatics). Piscataway: IEEE, 2020: 234-240. [Google Scholar] [CrossRef
[18] 赋设备“智慧”一视见“水情”——武汉大学智慧水业研究所所长刘炳义教授谈AiFlow视频测流产品[J]. 中国水利, 2021(12): 114-118.
[19] LE, T. D., BERCEA, G. T., CHEN, T., et al. Compiling ONNX neural network models using MLIR. 2020.
[20] 刘婷利. 视觉测流技术在郴州水文站的应用研究[J]. 人民珠江, 2025, 46(S1): 97-99.
[21] YEO, I. K., JOHNSON, R. A. A new family of power transformations to improve normality or symmetry. Biometrika, 2000, 87(4): 954-959. [Google Scholar] [CrossRef