-
卷积神经网络(Convo Neural Networks, CNN)是一类包含卷积计算且具有深度结构的前馈神经网络,文中通过构建CNN网络结构,用于进行电网运行图像数据的压缩。压缩的本质是基于电网时序运行图像数据之间的关联信息和冗余度,通过CNN的训练与拟合,将时序运行图像数据中的冗余信息进行去除,从而使实现对电网运行图像数据的高效压缩。
-
对于电网的时序运行数据而言,连续采集的运行图像数据之间存在着一定的关联性,即相同位置、邻近时刻的像素之间存在一定的相关性,如图1所示。
此外,图像数据中位置相近的像素之间也存在相符感性,假设采样图像数据的灰度函数为g(x, y),则其中各行各列像素的自相关公式为:
$$ {R_x}(k,0) = \dfrac{{\displaystyle\sum\limits_{x = 1}^M {\displaystyle\sum\limits_{y = 1}^N {[g(x,y) - {u_g}][g(x + k,y) - {u_g}]} } }}{{\displaystyle\sum\limits_{x = 1}^M {\displaystyle\sum\limits_{y = 1}^N {{{[g(x,y) - {u_g}]}^2}} } }} $$ (1) $$ {R_y}(0,l) = \dfrac{{\displaystyle\sum\limits_{x = 1}^M {\displaystyle\sum\limits_{y = 1}^N {[g(x,y) - {u_g}][g(x,y + l) - {u_g}]} } }}{{\displaystyle\sum\limits_{x = 1}^M {\displaystyle\sum\limits_{y = 1}^N {{{[g(x,y) - {u_g}]}^2}} } }} $$ (2) 式中:M,N分别为行列数;ug为图像数据的灰度平均值。在相邻时刻,图像数据之间的互相关函数可以通过下式进行计算:
$$ h(k,l) = \displaystyle\int {\displaystyle\int {({g_i}(x + l,y + k) - {u_i})({g_i}(x,y) - {u_i})} } {\text{d}}x{\text{d}}y $$ (3) 通过计算图像数据自身的自相关函数和图像数据之间的相关性函数,可以对图像数据中像素的关联特征进行提取,对具有相同特征的像素进行去除处理,从而实现图像数据压缩的目的。
-
图2展示了CNN模型的整体结构,在CNN模型中,共包括卷积层、池化层、全连接层和Softmax层。卷积、池化层用于数据的特征分析;而全连接、Softmax层则用于数据的特征分类。
在卷积中,卷积核按固定步长对数据遍历运算。每次运算时,卷积核与相应数据进行相乘、求和,并得到logits值,然后卷积核移动一个步长,继续执行运算并遍历整个数据,卷积的运算操作如下:
$$ y_j^l = \sum\limits_{i = 1}^M {x_i^l} * k_{ij}^l + b_j^l $$ (4) 式中:ylj为l层第j个运算后的logits值;M为输入特征图个数;xli为l层i个输入特征图;*为卷积运算符;klij为l层与第i个输入特征图卷积的第j个卷积核;bli为l层的第j个偏置。
卷积运算后,通过Sigmoid激活函数对每个logits值进行非线性变换。之后进一步进行池化以减少网络内部的参数和计算量。文中采用最大值池化,以局部接受域的最大值作为输出。其计算公式为:
$$ p_j^l = \mathop {\max }\limits_r \left\{ {a_j^{l - 1}} \right\} $$ (5) 式中:plj为l层第j个池化结果;r为池化域;al−1j为l层第j个输出特征图。
在对数据进行卷积和池化后,进一步通过全连接层和Softmax层实现数据的分类。全连接层将池化层的输出处理为多维特征向量;Softmax层则用于特征的分类,其公式可表示为:
$$ p(y = k|x;\theta ){\text{ = }}\frac{{\exp (\theta _k^{\rm{T}}x)}}{{\displaystyle\sum {_{j = 1}^K\exp (\theta _k^{\rm{T}}x)} }} $$ (6) 式中:y为类别标签,y∈{1,2,···,K};p(y=k|x;θ)为x属于类别k的概率;θ为训练参数。
损失函数用于衡量模型的输出和期望之间的差距,文中采用交叉熵损失函数,其数学表达式如下:
$$ L(\theta ) = - \frac{1}{m}\left[\sum\limits_{i = 1}^m {\sum\limits_{k = 1}^K {I\{ {y_i} = k\} \log \frac{{\exp (\theta _k^{\rm{T}}x)}}{{\displaystyle\sum {_j^K\exp (\theta _k^{\rm{T}}x)} }}} } \right]$$ (7) 式中:m为样本个数;I{·}为指标函数,其值为真时,函数值为1,否则为0。
为了保证模型精准,就要减少模型的损失函数,文中通过反向传播算法实现优化,其公式如下:
$$ {\theta ^*} = \arg \min L(f(x;\theta ),y) $$ (8) 式中:θ*为最优参数;L(·)为损失函数;f(·)为模型输出值;y为模型目标值。
-
在基于CNN的电网运行数据压缩模型中,其本质是通过计算图像数据中自身像素之间的相似性和时序图像数据之间像素的相似性,通过设置相应阈值,对像素进行保留和去除,从而实现图像数据的压缩。首先,获取时序运行图像数据及其灰度函数作为初始样本。然后将样本分为训练集,验证集和测试集。其中训练集用于模型训练,验证集用于调整网络参数,测试集用于验证效果。基于CNN的电网运行数据压缩的整体流程如图3所示。
在模型训练过程中,首先根据初始的超参数构建神经网络模型,然后通过网络的前向传播计算网络误差,并判断网络误差是否能够满足设置的精度要求,若不满足则通过反向传播对网络参数进行更新,重新构建网络模型并继续进行精度和迭代次数的判断,当满足要求后通过验证集的样本进行精度确定,如果精度达到要求则完成最优模型的构建,反之则重新配置网络,重复操作直至满足要求。在进行网络测试时,将测试集数据输入到已训练好的CNN中,就可以直接输出数据压缩的结果。
-
为了验证所提基于CNN数据压缩模型的有效性和优越性,以某区域电网部署的图像采集设备在24 h内采集的连续图像数据为样本,按照8∶1∶1的比例分割为训练集,验证集和测试集,进行模型的构建及数据压缩测试。所用的深度学习模型基于Python中的Keras深度学习框架,硬件设备为处理器为AMD Ryzen 7 4800 H,2.9 GHz,内存16 G,固态硬盘256 G的个人笔记本电脑。
-
构建深度学习模型时,选择合适的超参数对模型的性能至关重要。如网络的卷积层数、卷积层的卷积核数目及大小等,因此需要对CNN模型的超参数进行实验,选择能够使模型的性能相对较优的参数值,文中最终选取的最优超参数结果如表1所示。
-
根据表1所确定的最优网络超参数进行CNN的模型搭建,通过训练集,对搭建好的模型进行训练,并使用验证集进行验证。值得注意的是,像素的去除阈值N会对所提模型的压缩精度产生影响,去除阈值N越高,像素越容易被保留,表2展示了不同阈值N情况下,对各项数据进行压缩后的平均精度及压缩比例,其中,平均精度采用峰值信噪比指标进行计算[15]。
表 1 CNN的优化超参数结果
Table 1. Optimized hyperparameters results of CNN
Parameter type Value Optimizer Adam Batch size 64 Number of convolutional layers 3 Number of convolution kernels (32, 64, 64) Learning rate 0.4 表 2 数据压缩精度情况
Table 2. Data compression accuracy
N=0.3 N=0.4 N=0.5 N=0.6 N=0.7 N=0.8 Compression ratio 87.38% 84.22% 80.34% 77.45% 60.23% 55.31% Average precision 66.33% 68.62 74.16% 90.35% 91.73% 93.56% 从表2的结果可看出,N=0.6于CNN的电网时序运行数据压缩模型既能保证较好的数据压缩效果,又能保持较高的压缩比例。图4展示了一组经过文中所提方法处理后的图像数据压缩结果。
图 4 基于CNN处理前后的电网图像数据压缩结果
Figure 4. Results of image compression in power grid before and after processing based on CNN
此外,为了验证CNN在处理时序数据压缩方面与其他模型的优势,选择人工神经网络(Artificial Neural Network, ANN),深度置信网络(Deep Belief Network, DBN)进行对比,对上述采集的样本数据分别进行压缩处理,分析各方法的效率和精度,如表3所示。由此可以看出,文中所采用的CNN算法具有更高的准确度,与ANN相比提升了9.41%,与DBN相比提升了4.02%。这得益于CNN强大的特征提取能力。此外,CNN的训练效率相较于两种对比方法也有一定的提升,与ANN相比缩短了411 s,与DBN相比缩短了262 s,这是因为CNN在图像数据处理中能够更好地对数据特征进行挖掘和处理,因此具有更好的训练表现。
表 3 不同模型的对比结果
Table 3. Comparison results of different models
Index ANN DBN CNN Average precision 82.32% 87.71% 91.73% Training time/s 1682 1533 1271
Image data compression technology of smart grid operation based on deep learning
-
摘要: 随着智能电网的快速发展,用于监视电网运行状况的测量设备大规模投入,其产生的海量运行图像等监视数据由于规模大、维度高、数据冗余等问题难以得到有效利用。为了进一步提高电力大数据的分析应用能力,文中提出一种基于深度学习的电网运行图像数据压缩方法,考虑电网图像监视数据在时序上的耦合关联,通过卷积神经网络对电网运行图像数据进行压缩,有效减少了电网运行图像数据的冗余度。与其他方法相比,基于卷积神经网络的图像数据压缩模型不依赖于人工的数据特征提取和工程经验,可以直接以电网中采集到的原始图像数据的灰度函数作为模型的输入,将数据的特征提取和分类合二为一,实现电网运行图像数据的高效、便捷压缩。通过仿真进行了文中所提方法有效性的验证,结果表明,与其他神经网络相比,所提方法在电网图像压缩效率及压缩精度中具有较强优势。Abstract: With the rapid development of smart grids, large-scale investment in measurement equipment for monitoring the operation of power grids, the monitoring data such as massive operation images generated by them is difficult to be effectively utilized due to problems such as large scale, high dimension and data redundancy. In order to further improve the analysis and application ability of power big data, this paper proposes a power grid operation image data compression method based on deep learning. Considering the coupling correlation of power grid image monitoring data in time series, the power grid operation image data is compressed through convolutional neural network, effectively reducing the redundancy of power grid operation image data. Compared with other methods, the image data compression model based on convolutional neural network does not rely on manual data feature extraction and engineering experience, and can directly use the grayscale function of the original image data collected from the power grid as the input of the model, and the data The feature extraction and classification are combined into one, to achieve efficient and convenient compression of power grid operation image data. The effectiveness of the method proposed in this paper is verified by simulation. The results show that the proposed method has strong advantages in power grid image compression efficiency and compression accuracy compared with other neural networks.
-
Key words:
- smart grid /
- deep learning /
- data-driven /
- convolutional neural network /
- image compression
-
表 1 CNN的优化超参数结果
Table 1. Optimized hyperparameters results of CNN
Parameter type Value Optimizer Adam Batch size 64 Number of convolutional layers 3 Number of convolution kernels (32, 64, 64) Learning rate 0.4 表 2 数据压缩精度情况
Table 2. Data compression accuracy
N=0.3 N=0.4 N=0.5 N=0.6 N=0.7 N=0.8 Compression ratio 87.38% 84.22% 80.34% 77.45% 60.23% 55.31% Average precision 66.33% 68.62 74.16% 90.35% 91.73% 93.56% 表 3 不同模型的对比结果
Table 3. Comparison results of different models
Index ANN DBN CNN Average precision 82.32% 87.71% 91.73% Training time/s 1682 1533 1271 -
[1] Chen W J, Zhao G L. Key technologies and equipment of new power system with new energy as the main body [J]. Global Energy Internet, 2022, 5(1): 1. (in Chinese) [2] 贾玉强. 基于深度学习的序列和空间数据压缩技术研究[D]. 哈尔滨工业大学, 2021. Jia Y Q. Research on sequence and spatial data compression technology based on deep learning[D]. Harbin: Harbin Institute of Technology, 2021. (in Chinese) [3] Chen S W, Gao C Y, Hu C. Adaptive waveform data compression based on similarity segmentation and resampling [J]. Journal of Electronic Measurement and Instrumentation, 2019, 33(4): 178-185. (in Chinese) [4] Wang Y Z, Sun L Q. Application of data compression technology in ship power monitoring system [J]. Journal of Shanghai Institute of Ship Transportation Science, 2020, 43(1): 55-60. (in Chinese) doi: 10.3969/j.issn.1674-5949.2020.01.010 [5] Unterweger A, Engel D. Resumable load data compression in smart grids [J]. IEEE Transactions on Smart Grid, 2015, 6(2): 919-929. doi: 10.1109/TSG.2014.2364686 [6] Chen Y, Wang Y L. Lossless data compression scheme of intelligent distribution network monitoring system [J]. Guangdong Electric Power, 2021, 34(5): 90-98. (in Chinese) [7] Zhao H S, Feng J H, Ma L B. Data compression of distribution network infrared image monitoring based on tensor Tucker decomposition [J]. Power System Technology, 2021, 45(4): 1632-1639. (in Chinese) [8] 叶佳翔. 基于压缩感知的电力系统图像采集与重建研究[D]. 湖北工业大学, 2020. Ye J X. Research on image acquisition and reconstruction of power system based on compressed sensing[D]. Wuhan: Hubei University of Technology, 2020. (in Chinese) [9] 赵洪山, 刘秉聪, 王龄婕, 等. 基于压缩感知的电力设备红外图像盲超分辨率方法[J/OL]. 电网技术: 1-12 Zhao H S, Liu B C, Wang L J, et al. Blind super resolution method for infrared images of power equipment based on compressed sensing[J/OL]. Power System Technology, (2022-01-12) [2022-01-24]. (in Chinese) [10] Zhao H H, Jiang Y, Lin R, et al. Research on acceleration and compression of transmission line inspection image detection model [J]. Guangdong Electric Power, 2020, 33(9): 123-128. (in Chinese) [11] 王正辉. 深度学习框架下电气设备图像压缩感知与重建研究[D]. 湖北工业大学, 2021. Wang Z H. Research on compressed sensing and reconstruction of electrical equipment images under the framework of deep learning[D]. Wuhan: Hubei University of Technology, 2021. (in Chinese) [12] Peng J S, Sun L X, Wang L, et al. ED-YOLO electric power inspection UAV obstacle avoidance target detection algorithm based on model compression [J]. Journal of Instrumentation, 2021, 42(10): 161-170. (in Chinese) [13] Tang N Y, Cai L, Zhu T, et al. Construction of image recognition model for power equipment based on deep learning [J]. Automation and Instrumentation, 2020(12): 54-57. (in Chinese) [14] 吴毓峰, 李富盛, 余涛, 等. 基于残差双重注意机制网络的电力数据压缩与高精度重建[J/OL]. 电网技术: 1-15[2022-01-24] Wu Y F, Li F S, Yu T, et al. Power data compression and high-precision reconstruction based on residual dual attention mechanism network[J/OL]. Power System Technology, (2022-1-15)[2022-01-24]. (in Chinese) [15] Zhang S Q, Yang F B, Wang X X. Ghost imaging optimization method based on autoencoding neural network [J]. Electronic Measurement Technology, 2021, 44(21): 77-83. (in Chinese)