Real-time detection of infrared ammonia leakage through lightweighted shuffling self-attention
-
摘要:
氨气是重要的基础工业原材料,实现其非接触探测对于及时发现氨气泄漏避免重大安全事故发生具有重要意义。针对常规氨气泄漏检测装置需氨气扩散到一定范围并与传感器接触时才能响应的不足,提出一种混洗自注意力网络(SSANet)模型实现氨气泄漏红外非接触检测。因红外热像仪获取的氨气泄漏图像含噪高、对比度低,通过非局部均值去噪、限制对比度的自适应直方图均衡化预处理建立氨气泄漏红外检测数据集。SSANet模型在YOLOv5s基础上通过K-means算法聚类分析出适用于氨气泄漏红外检测的候选框以预置模型参数;采用轻量级ShuffleNetv2网络,将其Shuffle Block中的3×3的深度可分离卷积核替换为5×5,采用含有新卷积模块的SK5 Block对特征提取网络进行重构,使模型大小、计算量和参数量实现轻量化的同时提高检测精度;采用Transformer模块代替原网络瓶颈模块中的C3模块实现泄漏区域多头注意力自底向上融合,实现检测精度的再次提升。实验结果表明,SSANet模型较YOLOv5s基础模型大小和参数量分别减少76.40%、78.30%,降为3.40 M、1.53 M;单张图像平均检测速度提升1.10%,达到3.20 ms;平均检测精度提升3.50%,达到96.30%。本文为开发氨气泄漏非接触探测装置以保障涉氨企业的安全生产和稳定运行提供了一种有效的检测算法。
-
关键词:
- 氨气泄漏检测 /
- 红外图像 /
- 聚类分析 /
- 轻量化结构 /
- Transformer模块
Abstract:Ammonia gas is an important basic industrial raw material, and realizing its non-contact detection is of great significance for the timely detection of ammonia gas leaks to avoid major safety incidents. Aiming at the shortcoming of conventional ammonia leak detection devices that can only respond when ammonia diffuses to a certain range and makes contact with a sensor, a shuffling self-attention network (SSANet) model is proposed to realize the infrared non-contact detection of ammonia leaks. Due to the high noise and low contrast of ammonia leakage images obtained by infrared cameras, an infrared detection dataset of ammonia leakage was established through non-local mean denoising and contrast-limited adaptive histogram equalization preprocessing. On the basis of YOLOv5s, the SSANet model uses the K-means algorithm to cluster and analyze the candidate frame suitable for the infrared detection of ammonia gas leakage to preset the model’s parameters. Using the lightweight ShuffleNetv2 network, the depth of 3×3 in the Shuffle Block can be adjusted. The separate convolution kernel is replaced with a 5×5 depth, and the feature extraction network is reconstructed with an SK5 Block containing a new convolution module, which makes the model size, calculation and parameters non-intensive while improving the detection accuracy. The Transformer module is used instead of its original version. The C3 module in the network bottleneck module realizes the bottom-up fusion of multi-head attention in the leake area, and further improves the detection accuracy. The experimental results show that the size and parameter requirements of the SSANet model are reduced by 76.40% and 78.30%, respectively, to 3.40 M and 1.53 M compared with the basic model of YOLOv5s; the average detection speed of a single image is increased by 1.10% to 3.20 ms; and the average detection accuracy is increased by 3.50% , reaching 96.30%. This paper provides an effective detection algorithm for the development of a non-contact detection device for ammonia leakage to ensure the safe production and stable operation of ammonia-related enterprises.
-
Key words:
- ammonia leak detection /
- infrared image /
- cluster analysis /
- lightweight structure /
- transformer module
-
表 1 聚类前后三个检测层初始候选框尺寸情况
Table 1. Initial candidate frame size of the three detection layers before and after clustering
检测层 聚类前 聚类后 检测层1 (10,13)、(16,30)、(33,23) (11,10)、(29,12)、(34,29) 检测层2 (30,61)、(62,45)、(59,119) (52,61)、(62,18)、(64,38) 检测层3 (116,90)、(156,198)、(373,326) (91,38)、(115,22)、(201,45) 表 2 超参数配置
Table 2. Hyperparameter configuration
超参数名称 超参数值 批大小(Batch Size) 16 初始学习率(Learn Rate) 0.01 迭代次数(Epoch) 400 动量(Momentum) 0.937 学习率衰减策略(Policy) 余弦退火策略 权重衰减(Weight Decay) 0.0005 表 3 图像预处理的定量评价指标
Table 3. Objective evaluation indicators of images
图像 PSNR/dB AG IE 原图像 23.40 1.90 7.06 预处理图像 2.17 7.53 表 4 图像预处理前后网络性能对比
Table 4. Comparison of network performance before and after image preprocessing
模型 Params
/MModel size/M Speed
/msmAP
/%YOLOv5s 7.05 14.40 3.60 92.80 Prep-YOLOv5s 7.05 14.40 3.60 93.80 表 5 聚类前后网络性能对比
Table 5. Comparison of network performance before and after clustering
模型 Params
/MModel
size/MSpeed/ms mAP
/%YOLOv5s 7.05 14.40 3.60 92.80 Kms-YOLOv5s 7.05 14.40 3.60 93.70 Kms-Prep-YOLOv5s 7.05 14.40 3.60 94.30 表 6 不同特征提取网络评估指标对比
Table 6. Comparison of evaluation indicators for different backbone networks
模型 GFLOPs Model
size/MParams
/MSpeed
/msmAP
/%GhostNet
-YOLOv5s10.60 10.50 5.08 3.00 93.90 MobileNetv3
-YOLOv5s6.30 7.40 3.54 2.80 93.50 ShuffleNetv2
-YOLOv5s4.60 3.40 1.53 2.70 93.80 SK5-YOLOv5s 4.80 3.40 1.57 2.70 94.40 表 7 不同BottleNeck结构网络性能对比
Table 7. Comparison of network performance of different BottleNeck structures
模型 Model
size/MParams
/MSpeed
/msmAP
/%SK5-YOLOv5s 3.40 1.57 2.70 94.40 SK5-YOLOv5s-CSPBottleNeck 3.40 1.54 2.70 93.70 SK5-YOLOv5s-GhostBottleNeck 3.30 1.50 2.60 94.20 SK5-YOLOv5s-CbamBottleNeck 3.20 1.47 2.50 92.90 SSANet 3.40 1.54 3.20 96.30 表 8 不同模型精度对比
Table 8. Accuracy comparison of different models
Model GFLOPs Params
/MModel
size/MSpeed
/msmAP
/%YOLOv3 154.7 61.50 123.40 11.70 92.70 YOLOv3-tiny 12.90 8.70 17.40 3.40 37.40 YOLOv5s 16.30 7.05 14.40 3.40 92.80 YOLOx 26.64 8.94 71.90 8.43 89.78 SSANet 4.60 1.54 3.40 3.20 96.30 -
[1] 潘旭海, 蒋军成. 重(特)大泄漏事故统计分析及事故模式研究[J]. 化学工业与工程,2002,19(3):248-252,264. doi: 10.3969/j.issn.1004-9533.2002.03.008PAN X H, JIANG J CH. Analysis on important release accidents and modes studying[J]. Chemical Industry and Engineering, 2002, 19(3): 248-252,264. (in Chinese) doi: 10.3969/j.issn.1004-9533.2002.03.008 [2] 胡继粗, 陈明鹏, 荣茜, 等. 氨气传感材料及器件的研究进展[J]. 功能材料,2019,50(4):4030-4037,4048. doi: 10.3969/j.issn.1001-9731.2019.04.006HU J C, CHEN M P, RONG Q, et al. Research progress on ammonia gas sensing materials and devices[J]. Journal of Functional Materials, 2019, 50(4): 4030-4037,4048. (in Chinese) doi: 10.3969/j.issn.1001-9731.2019.04.006 [3] 克迪里亚·吾麦尔, 姑丽各娜·买买提依明, 买买提艾沙·苏莱曼, 等. 高灵敏复合光波导硫化氢气体传感器的研究[J]. 光学学报,2020,40(24):2428001.WUMAIER K, MAMTIMIN G, SULAIMAN M, et al. Highly-sensitive hydrogen-sulfide gas sensor based on composite optical waveguide[J]. Acta Optica Sinica, 2020, 40(24): 2428001. (in Chinese) [4] 赵鹏鹏, 李庶中, 李迅, 等. 融合视觉显著性和局部熵的红外弱小目标检测[J]. 中国光学,2022,15(2):267-275. doi: 10.37188/CO.2021-0170ZHAO P P, LI SH ZH, LI X, et al. Infrared dim small target detection based on visual saliency and local entropy[J]. Chinese Optics, 2022, 15(2): 267-275. (in Chinese) doi: 10.37188/CO.2021-0170 [5] 张旭, 金伟其, 李力, 等. 天然气泄漏被动式红外成像检测技术及系统性能评价研究进展[J]. 红外与激光工程,2019,48(S2):S204001.ZHANG X, JIN W Q, LI L, et al. Research progress on passive infrared imaging detection technology and system performance evaluation of natural gas leakage[J]. Infrared and Laser Engineering, 2019, 48(S2): S204001. (in Chinese) [6] 王涛, 覃鹤宏, 赵苓, 等. 基于模糊核聚类图像分割的气体泄漏定位研究[J]. 北京理工大学学报,2013,33(3):280-284. doi: 10.3969/j.issn.1001-0645.2013.03.014WANG T, QIN H H, ZHAO L, et al. Localization of air leak based on fuzzy clustering of infrared image[J]. Transactions of Beijing Institute of Technology, 2013, 33(3): 280-284. (in Chinese) doi: 10.3969/j.issn.1001-0645.2013.03.014 [7] 王建平, 李俊山, 杨亚威, 等. 基于红外成像的乙烯气体泄漏检测[J]. 液晶与显示,2014,29(4):623-628. doi: 10.3788/YJYXS20142904.0623WANG J P, LI J SH, YANG Y W, et al. Ethylenegas leaking detection based on infrared imaging[J]. Chinese Journal of Liquid Crystals and Displays, 2014, 29(4): 623-628. (in Chinese) doi: 10.3788/YJYXS20142904.0623 [8] 隋中山, 李俊山, 张姣, 等. 基于张量低秩分解和稀疏表示的红外微小气体泄漏检测[J]. 光学 精密工程,2016,24(11):2855-2862. doi: 10.3788/OPE.20162411.2855SUI ZH SH, LI J SH, ZHANG J, et al. Micro gas leakage detection based on tensor low rank decomposition and sparse representation from infrared images[J]. Optics and Precision Engineering, 2016, 24(11): 2855-2862. (in Chinese) doi: 10.3788/OPE.20162411.2855 [9] 林云. 基于深度学习的有害气体红外图像处理研究[D]. 杭州: 浙江工商大学, 2018.LIN Y. Research on infrared image processing of toxic gases based on deep learning algorithm[D]. Hangzhou: Zhejiang Gongshang University, 2018. (in Chinese) [10] SANO T, TAKEHANA T, SEKINE K. Improvement of LP-gas leak detecting system by means of infrared difference absorption[J]. Journal of High Pressure Institute of Japan, 2005, 43(1): 15-21. [11] KASTEK M, PIATKOWSKI T, TRZASKAWKA P. Infrared imaging fourier transform spectrometer as the stand-off gas detection system[J]. Metrology and Measurement Systems, 2011, 18(4): 607-620. doi: 10.2478/v10178-011-0058-4 [12] BARBER R, RODRIGUEZ-CONEJO M A, MELENDEZ J, et al. Design of an infrared imaging system for robotic inspection of gas leaks in industrial environments[J]. International Journal of Advanced Robotic Systems, 2015, 12(3): 23. doi: 10.5772/60058 [13] REDMON J, FARHADI A. YOLO9000: better, faster, stronger[C]. 2017 IEEE Conference on Computer Vision and Pattern Recognition, IEEE, 2017: 6517-6525. [14] REDMON J, FARHADI A. YOLOv3: an incremental improvement[J]. arXiv preprint arXiv: , 1804, 02767: 2018. [15] BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detection[J]. arXiv preprint arXiv: , 2004, 10934: 2020. [16] JUBAYER F, SOEB J A, MOJUMDER A N, et al. Detection of mold on the food surface using YOLOv5[J]. Current Research in Food Science, 2021, 4: 724-728. doi: 10.1016/j.crfs.2021.10.003 [17] LU Y H, ZHANG L W, XIE W. YOLO-compact: an efficient YOLO network for single category real-time object detection[C]. 2020 Chinese Control and Decision Conference (CCDC), IEEE, 2020: 1931-1936. [18] KANUNGO T, MOUNT D M, NETANYAHU N S, et al. An efficient k-means clustering algorithm: analysis and implementation[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2002, 24(7): 881-892. doi: 10.1109/TPAMI.2002.1017616 [19] DOSOVITSKIY A, BEYER L, KOLESNIKOV A, et al. . An image is worth 16x16 words: transformers for image recognition at scale[C]. 9th International Conference on Learning Representations, ICLR, 2020. [20] MA N N, ZHANG X Y, ZHENG H T, et al. . ShuffleNet V2: practical guidelines for efficient CNN architecture design[C]. Proceedings of the 15th European Conference on Computer Vision, Springer, 2018: 122-138. [21] VOITA E, TALBOT D, MOISEEV F, et al. . Analyzing multi-head self-attention: specialized heads do the heavy lifting, the rest can be pruned[C]. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Association for Computational Linguistics, 2019: 5797-5808. [22] XIONG R B, YANG Y C, HE D, et al. . On layer normalization in the transformer architecture[C]. Proceedings of the 37th International Conference on Machine Learning, JMLR. org, 2020: 10524-10533. [23] BUADES A, COLL B, MOREL J M. A non-local algorithm for image denoising[C]. 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, IEEE, 2005: 60-65. [24] REZA A M. Realization of the contrast limited adaptive histogram equalization (CLAHE) for real-time image enhancement[J]. Journal of VLSI Signal Processing Systems for Signal,Image and Video Technology, 2004, 38(1): 35-44. doi: 10.1023/B:VLSI.0000028532.53893.82 [25] 江泽涛, 钱艺, 伍旭, 等. 一种基于ARD-GAN的低照度图像增强方法[J]. 电子学报,2021,49(11):2160-2165. doi: 10.12263/DZXB.20200822JIANG Z T, QIAN Y, WU X, et al. Low-light image enhancement method based on ARD-GAN[J]. Acta Electronica Sinica, 2021, 49(11): 2160-2165. (in Chinese) doi: 10.12263/DZXB.20200822 [26] 刘柯, 李旭健. 水下和微光图像的去雾及增强方法[J]. 光学学报,2020,40(19):1910003. doi: 10.3788/AOS202040.1910003LIU K, LI X J. De-hazing and enhancement methods for underwater and low-light images[J]. Acta Optica Sinica, 2020, 40(19): 1910003. (in Chinese) doi: 10.3788/AOS202040.1910003 [27] 江巨浪, 刘国明, 朱柱, 等. 基于快速模糊聚类的动态多直方图均衡化算法[J]. 电子学报,2022,50(1):167-176. doi: 10.12263/DZXB.20201040JIANG J L, LIU G M, ZHU ZH, et al. Dynamic multi-histogram equalization based on fast fuzzy clustering[J]. Acta Electronica Sinica, 2022, 50(1): 167-176. (in Chinese) doi: 10.12263/DZXB.20201040 [28] HAN K, WANG Y H, TIAN Q, et al. . GhostNet: more features from cheap operations[C]. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), IEEE, 2020: 1577-1586. [29] HOWARD A, SANDLER M, CHEN B, et al. . Searching for MobileNetV3[C]. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), IEEE, 2020: 1314-1324. [30] GE ZH, LIU S T, WANG F, et al. YOLOX: exceeding YOLO series in 2021[J]. arXiv preprint arXiv: , 2107, 08430: 2021. -