面向煤矿安全监测边缘计算的YOLOv5s剪枝方法

YOLOv5s pruning method for edge computing of coal mine safety monitoring

  • 摘要: 目前,边缘计算与机器视觉相结合具有较好的煤矿安全监测应用前景,但边缘端存储空间和计算资源有限,高精度的复杂视觉模型难以部署。针对上述问题,提出了一种面向煤矿安全监测边缘端的基于间接和直接重要性评价空间融合(IDESF)的YOLOv5s剪枝方法,实现对YOLOv5s网络的轻量化。首先对YOLOv5s网络中各模块的卷积层进行结构分析,确定自由剪枝层和条件剪枝层,为后续分配剪枝率及计算卷积核剪枝数奠定基础。其次,根据基于卷积核权重幅值和层相对计算复杂度的卷积核权重重要性得分为可剪枝层分配剪枝率,有效降低剪枝后网络的计算复杂度。然后,基于卷积核直接重要性评价准则,将卷积层的间接输出重要性以缩放因子的形式引入直接重要性空间中,更新卷积核位置分布,构建包含卷积核输出信息和幅值信息的融合重要性评价空间,提高卷积核重要性评价的全面性。最后,借鉴topk投票的思想对中值滤波筛选冗余卷积核的流程进行优化,并用有向图的邻接矩阵中节点的入度来量化卷积核的冗余程度,提高了冗余卷积核筛选过程的可解释性和通用性。实验结果表明:① 从平衡模型精度和轻量化程度的角度出发,剪枝率为50%的YOLOV5s_IDESF是最优的轻量级YOLOv5s。在VOC数据集上,YOLOv5s_IDESF的mAP@.5和mAP@0.5∶0.95均达到最高,分别为0.72和0.44,参数量降至最低2.65×106,计算量降低至1.16×109,综合复杂度也降至最低,图像处理帧率达到31.15 帧/s。② 在煤矿数据集上,YOLOv5s_IDESF的mAP@.5和mAP@0.5∶0.95均达到最高,分别为0.94和0.52,参数量降至最低3.12×106,计算量降低至1.24×109,综合复杂度也降至最低,图像处理帧率达到31.55 帧/s。

     

    Abstract: At present, the combination of edge computing and machine vision has a good application prospect for coal mine safety monitoring. But the storage space and computing resources at the edge are limited, and high-precision complex visual models are difficult to deploy on it. In order to solve the above problems, a YOLOv5s pruning method based on indirect and direct evaluation space fusion (IDESF) is proposed for the edge end of coal mine safety monitoring, aiming to achieve lightweight YOLOv5s network. Firstly, a structural analysis is conducted on the convolutional layers of each module in the YOLOv5s network to determine the free pruning layer and conditional pruning layer. It lays the foundation for subsequent allocation of pruning rates and calculation of the number of pruning kernels. Secondly, the pruning rate is assigned to the prunable layers according to the convolutional kernel weight importance score based on the convolutional kernel weight magnitude and the relative computational complexity of the layers, which effectively reduces the computational complexity of the network after pruning. Thirdly, based on the direct importance evaluation criterion of convolutional kernels, the indirect output importance of convolutional layers is introduced into the direct importance space in the form of scaling factors. The position distribution of convolutional kernels is updated to construct a fused importance evaluation space that includes the output information and amplitude information of convolutional kernels. It thereby improves the comprehensiveness of convolutional kernel importance evaluation. Finally, drawing on the idea of topk voting, the process of median filtering for screening redundant convolution kernels is optimized. The method quantifies the degree of redundancy of a convolutional kernel in terms of the incidence of nodes in the adjacency matrix of a directed graph, which improves the interpretability and generality of the redundant convolutional kernel screening process. The experimental results show the following points. ① From the perspective of balancing model precision and lightweighting, YOLOV5s_IDESF with a pruning rate of 50% is the optimal lightweight YOLOv5s. On the VOC dataset, YOLOv5s_IDESF mAP@.5 and mAP@0.5 is the highest, reaching 0.72 and 0.44 respectively. The parameter count is reduced to a minimum of 2.65×106, the computational complexity is reduced to 1.16×109, and the overall complexity is also reduced to the lowest. The image processing frame rate reaches 31.15 frames per second. ② On the coal mine dataset, YOLOv5s_IDESF mAP@.5 and mAP@0.5∶0.95 achieve the highest values of 0.94 and 0.52, respectively. The parameter count is reduced to a minimum of 3.12×106, the computational complexity is reduced to 1.24×109, and the overall complexity is also minimized. The image processing frame rate reaches 31.55 frames per second.

     

/

返回文章
返回