CN117036665A - Knob switch state identification method based on twin neural network - Google Patents
Knob switch state identification method based on twin neural network Download PDFInfo
- Publication number
- CN117036665A CN117036665A CN202311137629.6A CN202311137629A CN117036665A CN 117036665 A CN117036665 A CN 117036665A CN 202311137629 A CN202311137629 A CN 202311137629A CN 117036665 A CN117036665 A CN 117036665A
- Authority
- CN
- China
- Prior art keywords
- image
- knob
- knob switch
- preset
- feature
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/24—Aligning, centring, orientation detection or correction of the image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/761—Proximity, similarity or dissimilarity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Molecular Biology (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Image Analysis (AREA)
Abstract
本申请公开了一种基于孪生神经网络的旋钮开关状态识别方法,涉及电力技术领域,该方法首先对获取到的原始预置位图像进行图像预处理,提取待识别状态的旋钮开关经过图像校正后的正角度图像,以降低复杂背景和光照以及多变的拍摄角度带来的影响,然后利用基于孪生神经网络的相似度计算模型学习和表达旋钮开关的状态特征以及各个档位状态之间的差异性,确定待识别图像与各个旋钮开关标准图像之间的图像相似度来实现状态识别,具有较好的识别准确性和鲁棒性,非常适用于自动化控制、智能变电站等领域,有利于提高设备监控和管理的效率和安全性。
This application discloses a method for identifying the state of a knob switch based on a twin neural network, which relates to the field of electric power technology. The method first performs image preprocessing on the acquired original preset image, and extracts the knob switch in the state to be identified after image correction. Positive-angle images to reduce the impact of complex backgrounds and lighting as well as changing shooting angles, and then use a similarity calculation model based on twin neural networks to learn and express the status characteristics of the knob switch and the differences between each gear status It determines the image similarity between the image to be recognized and the standard image of each knob switch to achieve state recognition. It has good recognition accuracy and robustness. It is very suitable for automation control, smart substations and other fields, and is conducive to improving equipment. Monitoring and management efficiency and security.
Description
技术领域Technical field
本申请涉及电力技术领域,尤其是一种基于孪生神经网络的旋钮开关状态识别方法。This application relates to the field of electric power technology, in particular to a method for identifying the status of a knob switch based on twin neural networks.
背景技术Background technique
变电站是电力系统中电网线路的连接点,起着维持电力系统平稳运行和人类正常生产生活的关键作用,保障变电站的正常运作具有至关重要的意义。旋钮开关作为变电站不可缺少的器件,广泛应用于各种设备和机器中,旋钮开关通过接通和切断电路来实现电能的分配和调度,而当电路发生故障时,旋钮开关又能及时切断电力供应,防止故障扩大,确保电路的稳定和安全运行。因此旋钮开关在变电站的运维中起着重要的作用,确定旋钮开关的状态对保障变电站的正常运作非常关键。The substation is the connection point of the power grid lines in the power system. It plays a key role in maintaining the smooth operation of the power system and normal human production and life. It is of vital significance to ensure the normal operation of the substation. As an indispensable component of the substation, the rotary switch is widely used in various equipment and machines. The rotary switch realizes the distribution and dispatch of electric energy by turning on and off the circuit. When the circuit fails, the rotary switch can cut off the power supply in time. , to prevent fault expansion and ensure the stable and safe operation of the circuit. Therefore, the rotary switch plays an important role in the operation and maintenance of the substation. Determining the status of the rotary switch is very critical to ensure the normal operation of the substation.
传统的做法是通过人工巡检的方式对变电站中各种设备进行巡检,特定的人员每天负责检查指定区域内的旋钮开关及其他设备的状态,并加以记录。但是人工巡检的方法自动化程度和效率都较低,而且受人为因素影响,准确度也难以保证。The traditional approach is to conduct manual inspections of various equipment in the substation. Specific personnel are responsible for checking the status of knob switches and other equipment in designated areas every day and recording them. However, manual inspection methods have low automation and efficiency, and are affected by human factors, making it difficult to guarantee accuracy.
随着视觉识别技术的发展,也有一些做法会引入图像处理技术来自动识别旋钮开关的状态,但是需要预先针对每一种旋钮开关独有的特征来人工设置判别标准,所以随着旋钮开关的数量和种类的不断增加,难以全面地应对大数据流的实时性要求,且传统的图像处理技术也存在识别准确性低、对环境变化敏感等问题。With the development of visual recognition technology, there are also some practices that will introduce image processing technology to automatically identify the status of knob switches. However, it is necessary to manually set the discrimination criteria in advance according to the unique characteristics of each knob switch. Therefore, as the number of knob switches increases, With the continuous increase of data and types, it is difficult to comprehensively cope with the real-time requirements of big data streams, and traditional image processing technology also has problems such as low recognition accuracy and sensitivity to environmental changes.
所以进一步的,基于深度学习的方法逐步被引入到旋钮开关的状态识别问题中,目前主流的方法有两种:一种做法是利用诸如VGG16、MobileNetV3、ResNet之类的分类网络对只包含旋钮开关的图像进行状态分别识别。另一种做法是利用诸如YOLO系列、R-CNN系列之类的目标检测模型直接在包含大量背景的图像中找到旋钮开关并识别其状态。但是变电站的环境因素复杂,因此上述两种做法的识别效果都不稳定,且抗干扰能力不足,存在较大概率的误检情况,比如目标检测模型在旋钮开关在包含背景的图像中占比非常小的情况难以检测到旋钮开关,更无法识别状态,而分类网络对差别较小的状态(比如旋钮开关的档位旋转角度较小或档位旋转180°)容易误分类。Therefore, further, deep learning-based methods are gradually introduced into the problem of state identification of knob switches. There are currently two mainstream methods: one method is to use classification networks such as VGG16, MobileNetV3, and ResNet to only include knob switches. The images are used for state recognition respectively. Another approach is to use target detection models such as YOLO series and R-CNN series to directly find the knob switch and identify its state in images containing a large amount of background. However, the environmental factors of the substation are complex, so the recognition effects of the above two methods are unstable, and the anti-interference ability is insufficient, and there is a high probability of false detection. For example, in the target detection model, the knob switch accounts for a very large proportion in the image containing the background. It is difficult to detect the knob switch in small situations, let alone identify the state. The classification network is prone to misclassification of states with small differences (such as the rotation angle of the knob switch is small or the gear is rotated 180°).
发明内容Contents of the invention
本申请针对上述问题及技术需求,提出了一种基于孪生神经网络的旋钮开关状态识别方法,本申请的技术方案如下:In response to the above problems and technical needs, this application proposes a knob switch state identification method based on twin neural networks. The technical solution of this application is as follows:
一种基于孪生神经网络的旋钮开关状态识别方法,该旋钮开关状态识别方法包括:A method for identifying the status of a knob switch based on twin neural networks. The method for identifying the status of a knob switch includes:
获取原始预置位图像,原始预置位图像中包含待识别状态的旋钮开关所在区域的旋钮图像及背景图像;Obtain the original preset image, which contains the knob image and background image of the area where the knob switch in the to-be-identified state is located;
对原始预置位图像进行图像预处理,提取得到原始预置位图像中经过图像校正后的旋钮图像作为待识别图像,待识别图像是待识别状态的旋钮开关经过图像校正后的正角度图像;Perform image preprocessing on the original preset position image, and extract the image-corrected knob image in the original preset position image as the image to be identified. The image to be identified is the positive angle image of the knob switch in the to-be-identified state after image correction;
依次遍历旋钮开关标准库中的各个旋钮开关标准图像,将遍历到的每一个旋钮开关标准图像和待识别图像同时输入预先训练得到的相似度计算模型,得到旋钮开关标准图像和待识别图像之间的图像相似度;其中,旋钮开关标准库中包括各个种类的旋钮开关在各种不同档位状态下的旋钮开关标准图像,且每个旋钮开关标准图像是以正对旋钮开关的拍摄角度获取到的旋钮开关所在区域的正角度图像;相似度计算模型预先基于孪生神经网络构建并训练得到;Traverse each knob switch standard image in the knob switch standard library in sequence, input each knob switch standard image traversed and the image to be recognized into the pre-trained similarity calculation model at the same time, and obtain the difference between the knob switch standard image and the image to be recognized. Image similarity; among them, the rotary switch standard library includes rotary switch standard images of various types of rotary switches in various gear states, and each rotary switch standard image is obtained from the shooting angle facing the rotary switch. Positive angle image of the area where the knob switch is located; the similarity calculation model is built and trained in advance based on the twin neural network;
根据待识别图像与不同档位状态的旋钮开关标准图像之间的图像相似度,得到待识别状态的旋钮开关的档位状态。According to the image similarity between the image to be recognized and the standard image of the knob switch in different gear states, the gear state of the knob switch in the state to be recognized is obtained.
其进一步的技术方案为,旋钮开关状态识别方法还包括:Its further technical solution is that the knob switch state identification method also includes:
从各个不同的拍摄角度分别拍摄各个种类的旋钮开关在各种不同档位状态下的原始样本图像,从每个原始样本图像提取旋钮开关所在区域的图像并标注对应的旋钮开关的档位状态作为训练样本,构建得到训练数据集;Take original sample images of various types of rotary switches in various gear states from different shooting angles. Extract the image of the area where the rotary switch is located from each original sample image and mark the gear state of the corresponding rotary switch as Training samples are used to construct a training data set;
构建相似度计算模型的网络框架包括孪生神经网络、全连接层和Softmax层,孪生神经网络包括两个连接在一起且共享网络参数的特征提取模块,每个特征提取模块以ResNet50为基础网络结构并引入CBAM模块进行注意力机制的学习;The network framework for constructing the similarity calculation model includes twin neural networks, fully connected layers and softmax layers. The twin neural network includes two feature extraction modules that are connected together and share network parameters. Each feature extraction module uses ResNet50 as the basic network structure and Introducing the CBAM module to learn the attention mechanism;
利用训练数据集基于相似度计算模型的网络框架进行模型训练,得到训练后的相似度计算模型,相似度计算模型中的两个特征提取模块分别独立获取输入的一个图像并输出特征图,孪生神经网络将两个特征提取模块输出的特征图连接在一起形成最终特征表示并依次经过全连接层和Softmax层后计算欧式距离得到两个图像之间的图像相似度。The network framework based on the similarity calculation model of the training data set is used for model training, and the trained similarity calculation model is obtained. The two feature extraction modules in the similarity calculation model independently obtain an input image and output a feature map. The twin neural network The network connects the feature maps output by the two feature extraction modules together to form the final feature representation, and then passes through the fully connected layer and the Softmax layer in sequence to calculate the Euclidean distance to obtain the image similarity between the two images.
其进一步的技术方案为,得到待识别状态的旋钮开关的档位状态包括:The further technical solution is to obtain the gear position state of the knob switch in the state to be identified, including:
在分别得到每一个旋钮开关标准图像与待识别图像的图像相似度之后,计算具有相同档位状态的旋钮开关标准图像与待识别图像的图像相似度的平均值,作为档位状态对应的档位相似度;After obtaining the image similarity between the standard image of each knob switch and the image to be identified, the average value of the image similarity between the standard image of the knob switch and the image to be identified with the same gear status is calculated as the gear corresponding to the gear status. similarity;
以对应的档位相似度最高的档位状态作为待识别状态的旋钮开关的档位状态。The gear state with the highest corresponding gear similarity is used as the gear state of the rotary switch in the state to be identified.
其进一步的技术方案为,提取得到原始预置位图像中经过图像校正后的旋钮图像作为待识别图像包括:The further technical solution is to extract the image-corrected knob image from the original preset image as the image to be recognized, including:
确定拍摄原始预置位图像的预置拍摄位所对应的预置位图像模板,不同的预置拍摄位具有不同的预置位图像模板,每个预置拍摄位对应的预置位图像模板指示在预置拍摄位处拍摄的图像中的旋钮开关所在区域;Determine the preset image template corresponding to the preset shooting position for capturing the original preset position image. Different preset shooting positions have different preset position image templates. The preset position image template corresponding to each preset shooting position indicates The area where the knob switch is located in the image taken at the preset shooting position;
利用确定得到的预置位图像模板对原始预置位图像进行图像预处理,提取得到待识别图像。Use the determined preset image template to perform image preprocessing on the original preset image, and extract the image to be recognized.
其进一步的技术方案为,利用确定得到的预置位图像模板对原始预置位图像进行图像预处理包括:The further technical solution is to use the determined preset image template to perform image preprocessing on the original preset image, including:
利用卷积神经网络分别对预置位图像模板和原始预置位图像进行特征提取得到各自的特征图;Use the convolutional neural network to extract features from the preset image template and the original preset image to obtain respective feature maps;
对两个特征图进行特征匹配以实现原始预置位图像与预置位图像模板的图像对齐,并结合预置位图像模板中的旋钮开关所在区域提取得到原始预置位图像中待识别状态的旋钮开关所在区域的旋钮图像;Perform feature matching on the two feature maps to achieve image alignment between the original preset position image and the preset position image template, and combine the area where the knob switch in the preset position image template is extracted to obtain the state to be recognized in the original preset position image. The image of the knob in the area where the knob switch is located;
对提取得到的旋钮图像进行图像校正,提取得到待识别图像。Perform image correction on the extracted knob image, and extract the image to be recognized.
其进一步的技术方案为,提取得到原始预置位图像中待识别状态的旋钮开关所在区域的旋钮图像包括:The further technical solution is to extract the knob image in the area where the knob switch in the to-be-identified state is located in the original preset image, including:
基于预置位图像模板的特征图检测预置位图像模板的图像特征点,基于原始预置位图像的特征图检测原始预置位图像的图像特征点;Detect the image feature points of the preset image template based on the feature map of the preset image template, and detect the image feature points of the original preset image based on the feature map of the original preset image;
利用随机采样一致性算法对预置位图像模板的图像特征点和原始预置位图像的的图像特征点进行过滤,筛选得到最佳匹配的四对图像特征点,每对图像特征点包括预置位图像模板中的一个图像特征点及其匹配的原始预置位图像中的一个图像特征点;The random sampling consistency algorithm is used to filter the image feature points of the preset image template and the original preset image, and the four pairs of image feature points that best match are obtained. Each pair of image feature points includes the preset An image feature point in the bit image template and an image feature point in the matching original preset bit image;
按照根据四对图像特征点的坐标求解得到变换矩阵T1,(x11,y11)和(x21,y21)是一对图像特征点的坐标,(x12,y12)和(x22,y22)是一对图像特征点的坐标,(x13,y13)和(x23,y23)是一对图像特征点的坐标,(x14,y14)和(x24,y24)是一对图像特征点的坐标,且(x11,y11)、(x12,y12)、(x13,y13)和(x14,y14)均是原始预置位图像中的图像特征点,(x21,y21)、(x22,y22)、(x23,y23)、(x24,y24)均是预置位图像模板中的图像特征点;according to The transformation matrix T 1 is obtained by solving the coordinates of four pairs of image feature points. (x 11 , y 11 ) and (x 21 , y 21 ) are the coordinates of a pair of image feature points, (x 12 , y 12 ) and (x 22 , y 22 ) are the coordinates of a pair of image feature points, (x 13 , y 13 ) and (x 23 , y 23 ) are the coordinates of a pair of image feature points, (x 14 , y 14 ) and (x 24 , y 24 ) are the coordinates of a pair of image feature points, and (x 11 , y 11 ), (x 12 , y 12 ), (x 13 , y 13 ) and (x 14 , y 14 ) are all original preset images The image feature points in (x 21 , y 21 ), (x 22 , y 22 ), (x 23 , y 23 ), (x 24 , y 24 ) are all image feature points in the preset image template;
利用变换矩阵T1对预置位图像模板中的旋钮开关所在区域的位置坐标进行坐标变换,得到原始预置位图像中待识别状态的旋钮开关所在区域的位置坐标并提取得到旋钮图像。The transformation matrix T 1 is used to perform coordinate transformation on the position coordinates of the area where the knob switch is located in the preset position image template, and the position coordinates of the area where the knob switch is to be identified in the original preset position image are obtained and the knob image is extracted.
其进一步的技术方案为,对提取得到的旋钮图像进行图像校正包括:The further technical solution is to perform image correction on the extracted knob image including:
确定原始预置位图像中的旋钮图像的四个顶点的坐标A(X1,Y1)、B(X2,Y2)、C(X3,Y3)和D(X4,Y4);Determine the coordinates A(X 1 , Y 1 ), B(X 2 , Y 2 ), C(X 3 , Y 3 ) and D(X 4 , Y 4 ) of the four vertices of the knob image in the original preset image );
根据四个顶点的坐标计算得到顶点A和顶点B之间的欧式距离Wa、顶点C和顶点D之间的欧式距离Wb、顶点A和顶点C之间的欧式距离Ha、顶点B和顶点D之间的欧式距离Hb;According to the coordinates of the four vertices, the Euclidean distance W a between vertex A and vertex B, the Euclidean distance Wb between vertex C and vertex D, the Euclidean distance Ha between vertex A and vertex C, vertex B and vertex D are calculated. The Euclidean distance Hb between;
确定变换后的图像的四个顶点的坐标分别为A′(0,0)、B′(W,0)、C′(0,H)和D′(W,H),其中,W是Wa和Wb中的最大值,H是Ha和Hb中的最大值;Determine the coordinates of the four vertices of the transformed image as A′(0,0), B′(W,0), C′(0,H) and D′(W,H), where W is Wa The maximum value among and Wb, H is the maximum value among Ha and Hb;
按照求解得到变换矩阵T2,并利用变换矩阵T2对原始预置位图像中的旋钮图像进行图像变换得到待识别图像。according to The transformation matrix T 2 is obtained by solving, and the transformation matrix T 2 is used to perform image transformation on the knob image in the original preset image to obtain the image to be recognized.
其进一步的技术方案为,利用变换矩阵T2对原始预置位图像中的旋钮图像进行图像变换得到待识别图像包括:The further technical solution is to use the transformation matrix T 2 to perform image transformation on the knob image in the original preset image to obtain the image to be recognized, including:
利用变换矩阵T2对原始预置位图像中的旋钮图像进行图像变换得到输出图像,输出图像是待识别状态的旋钮开关的正角度图像;Use the transformation matrix T 2 to perform image transformation on the knob image in the original preset image to obtain an output image. The output image is the positive angle image of the knob switch in the state to be recognized;
计算输出图像中的各个像素点的灰度直方图,并计算灰度直方图中各个灰度级别的累积分布函数,任意灰度级别g的累积分布函数Sk(g)等于灰度级别在[0,g]范围内的像素点的数量之和,min≤g≤G,min是灰度级别的最小值,G是灰度级别的最大值;Calculate the grayscale histogram of each pixel in the output image, and calculate the cumulative distribution function of each grayscale level in the grayscale histogram. The cumulative distribution function Sk(g) of any grayscale level g is equal to the grayscale level in [0 , g] The sum of the number of pixels within the range, min≤g≤G, min is the minimum value of the gray level, G is the maximum value of the gray level;
按照将输出图像中任意灰度级别为g的像素点的灰度级别转换为g′,N是输出图像中包含的像素点的总数量,表示对/>进行四舍五入取整。according to Convert the gray level of any pixel with gray level g in the output image to g′, N is the total number of pixels contained in the output image, Expresses yes/> Perform rounding.
其进一步的技术方案为,检测预置位图像模板的图像特征点和检测原始预置位图像的图像特征点包括对于预置位图像模板和原始预置位图像中的任意一个输入图像:The further technical solution is that detecting the image feature points of the preset position image template and detecting the image feature points of the original preset position image include inputting any one of the preset position image template and the original preset position image:
提取输入图像的特征图中的各个关键像素点及各个关键像素点的描述符,每个关键像素点既在预定局部邻域范围内具有最大的空间特征值、也在通道方向上具有最大的通道特征值;每个关键像素点的描述符是关键像素点所在位置的通道方向向量;Extract each key pixel point and the descriptor of each key pixel point in the feature map of the input image. Each key pixel point not only has the largest spatial feature value within the predetermined local neighborhood range, but also has the largest channel value in the channel direction. Feature value; the descriptor of each key pixel is the channel direction vector of the location of the key pixel;
根据提取得到各个关键像素点及各个关键像素点的描述符,通过双线性插值将各个关键像素点恢复至输入图像的图像尺寸,提取得到输入图像的图像特征点。According to the extracted key pixel points and the descriptors of each key pixel point, each key pixel point is restored to the image size of the input image through bilinear interpolation, and the image feature points of the input image are extracted.
其进一步的技术方案为,利用卷积神经网络分别对预置位图像模板和原始预置位图像进行特征提取得到各自的特征图,包括对于预置位图像模板和原始预置位图像中的任意一个输入图像:A further technical solution is to use a convolutional neural network to extract features from the preset image template and the original preset image to obtain respective feature maps, including for any of the preset image template and the original preset image. An input image:
对输入图像进行两次卷积和最大池化组合下采样,得到输入图像的深层特征图,深层特征图的图像尺寸是输入图像的图像尺寸的1/4;Perform two convolutions and maximum pooling combined downsampling on the input image to obtain the deep feature map of the input image. The image size of the deep feature map is 1/4 of the image size of the input image;
对深层特征图再次执行卷积、平均池化和空洞卷积的操作,融合提取得到输入图像的特征图。Convolution, average pooling and atrous convolution are performed on the deep feature map again, and the feature map of the input image is obtained by fusion extraction.
本申请的有益技术效果是:The beneficial technical effects of this application are:
本申请公开了一种基于孪生神经网络的旋钮开关状态识别方法,该方法利用基于孪生神经网络的相似度计算模型学习和表达旋钮开关的状态特征以及各个档位状态之间的差异性,且对原始预置位图像的图像预处理过程可以有效降低复杂背景和光照以及多变的拍摄角度带来的影响,提取得到待识别图像后,通过确定旋钮开关标准图像和待识别图像之间的图像相似度来实现状态识别,具有较好的识别准确性和鲁棒性,非常适用于自动化控制、智能变电站等领域,有利于提高设备监控和管理的效率和安全性。This application discloses a method for identifying the state of a knob switch based on a twin neural network. This method uses a similarity calculation model based on a twin neural network to learn and express the state characteristics of the knob switch and the differences between the states of each gear, and it also The image preprocessing process of the original preset image can effectively reduce the impact of complex background and lighting as well as changing shooting angles. After extracting the image to be identified, the image similarity between the knob switch standard image and the image to be identified is determined. It has good recognition accuracy and robustness. It is very suitable for automation control, smart substations and other fields, and is conducive to improving the efficiency and safety of equipment monitoring and management.
本申请使用的相似度计算模型在构建孪生神经网络时,以ResNet50为基础网络结构并增加CBAM注意力机制,使得使深度卷积神经网络能专注于旋钮特征的提取,具有更好的特征提取效果。When constructing the twin neural network, the similarity calculation model used in this application uses ResNet50 as the basic network structure and adds the CBAM attention mechanism, so that the deep convolutional neural network can focus on the extraction of knob features and have better feature extraction effects. .
附图说明Description of the drawings
图1是本申请一个实施例的旋钮开关状态识别方法的方法流程图。Figure 1 is a method flow chart of a knob switch state identification method according to an embodiment of the present application.
图2是本申请一个实施例中训练相似度计算模型的方法流程图。Figure 2 is a flow chart of a method for training a similarity calculation model in one embodiment of the present application.
图3是本申请一个实施例中对原始预置位图像进行图像预处理提取得到待识别图像的方法流程图。Figure 3 is a flowchart of a method for performing image preprocessing and extraction on an original preset image to obtain an image to be recognized in one embodiment of the present application.
图4是本申请一个实施例中对原始预置位图像中的旋钮图像变换后得到输出图像的变换示意图。Figure 4 is a schematic diagram of the transformation of the output image obtained after transforming the knob image in the original preset image in one embodiment of the present application.
具体实施方式Detailed ways
下面结合附图对本申请的具体实施方式做进一步说明。The specific embodiments of the present application will be further described below in conjunction with the accompanying drawings.
本申请公开了一种基于孪生神经网络的旋钮开关状态识别方法,请参考图1所示的流程图,该旋钮开关状态识别方法包括如下步骤:This application discloses a method for identifying the status of a knob switch based on a twin neural network. Please refer to the flow chart shown in Figure 1. The method for identifying the status of a knob switch includes the following steps:
步骤1,获取原始预置位图像。Step 1: Obtain the original preset image.
在变电站的应用场景中,变电站的多个不同位置固定有若干个相机,每个相机可以旋转到若干个不同的目标角度进行拍摄视场范围内的图像,每个相机在每个目标角度处的拍摄位即为一个预置拍摄位,由相机在一个预置拍摄位处获取到的图像即为本申请中的原始预置位图像。由于各个相机的固定位置是预先确定的,而每个相机可旋转的各个目标角度也是预先确定的,因此整个变电站中存在的所有预置拍摄位都是可以确定的,本申请中获取到的每个原始预置位图像是变电站中其中一个预置拍摄位处拍摄到的,且可以具体确定是在哪个预置拍摄位处拍摄到的。In the application scenario of the substation, there are several cameras fixed at multiple different locations in the substation. Each camera can be rotated to several different target angles to capture images within the field of view. Each camera at each target angle The shooting position is a preset shooting position, and the image obtained by the camera at a preset shooting position is the original preset position image in this application. Since the fixed positions of each camera are predetermined, and the target angles at which each camera can rotate are also predetermined, all preset shooting positions in the entire substation can be determined. Every image obtained in this application can be determined. The original preset position images were captured at one of the preset shooting positions in the substation, and the preset shooting position at which the images were captured can be specifically determined.
而由于变电站环境复杂,因此在每个预置拍摄位处拍摄到的原始预置位图像除了包含旋钮开关之外,往往还包括变电站内其他设备,所以获取到的每个原始预置位图像中除了包含待识别状态的旋钮开关所在区域的旋钮图像之外,还包括背景图像。Due to the complex substation environment, the original preset image captured at each preset shooting position often includes not only the knob switch, but also other equipment in the substation, so each original preset image captured In addition to the knob image of the area containing the knob switch in the state to be recognized, a background image is also included.
步骤2,对原始预置位图像进行图像预处理,提取得到原始预置位图像中经过图像校正后的旋钮图像作为待识别图像。Step 2: Perform image preprocessing on the original preset image, and extract the image-corrected knob image from the original preset image as the image to be recognized.
由于变电站中包含的旋钮开关的种类和数量较多,所以一般不可能针对每个旋钮开关都分别布设一个相机正对其进行拍摄,所以获取到的原始预置位图像往往不是正对待识别状态的旋钮开关进行拍摄得到的图像,而是从各种不统一的倾斜角度拍摄的图像,且还会受到其他环境因素的影响。Since there are many types and quantities of knob switches in a substation, it is generally impossible to set up a camera for each knob switch to take pictures of it. Therefore, the original preset image obtained is often not in the state to be identified. Images captured using a knob switch are captured from various non-uniform tilt angles and are also affected by other environmental factors.
所以在获取原始预置位图像后首先进行图像预处理,弥补拍摄角度和拍摄环境带来的干扰,提取得到的待识别图像是待识别状态的旋钮开关经过图像校正后的正角度图像。Therefore, after obtaining the original preset image, image preprocessing is first performed to compensate for the interference caused by the shooting angle and shooting environment. The extracted image to be recognized is the positive angle image of the knob switch in the state to be recognized after image correction.
步骤3,依次遍历旋钮开关标准库中的各个旋钮开关标准图像,将遍历到的每一个旋钮开关标准图像和待识别图像同时输入预先训练得到的相似度计算模型,得到旋钮开关标准图像和待识别图像之间的图像相似度。Step 3: Traverse each knob switch standard image in the knob switch standard library in sequence, and input each knob switch standard image and the image to be recognized simultaneously into the pre-trained similarity calculation model to obtain the knob switch standard image and the image to be recognized. Image similarity between images.
这里使用到的旋钮开关标准库是预先构建的,旋钮开关标准库中包括各个种类的旋钮开关在各种不同档位状态下的旋钮开关标准图像,且每个旋钮开关标准图像是以正对旋钮开关的拍摄角度获取到的旋钮开关所在区域的正角度图像。每个旋钮开关根据档位旋转角度不同而具有多种不同的档位状态,每个档位状态覆盖旋钮开关的一个档位旋转角度范围,预先根据实际情况划分,比如从0°开始按照每30°的档位旋转角度范围进行划分得到多个档位状态,实际可以自定义划分确定。在构建旋钮开关标准库时,对于变电站中每个种类的旋钮开关,分别调节旋钮开关至不同的档位状态,并在每个档位状态下利用相机正对该旋钮开关拍摄得到一个旋钮开关标准图像,切换档位状态再次拍摄,得到该旋钮开关在所有档位状态下的旋钮开关标准图像后,对其他种类的旋钮开关同样操作,从而得到包含变电站中所有种类的旋钮开关在所有档位状态下的旋钮开关标准图像。The rotary switch standard library used here is pre-built. The rotary switch standard library includes rotary switch standard images of various types of rotary switches in various gear states, and each rotary switch standard image is facing the knob. The positive angle image of the area where the knob switch is located is obtained from the shooting angle of the switch. Each knob switch has a variety of different gear states according to different gear rotation angles. Each gear state covers a gear rotation angle range of the knob switch and is divided in advance according to the actual situation. For example, starting from 0°, every 30 degrees °The gear rotation angle range is divided to obtain multiple gear states, which can actually be customized and determined. When constructing the rotary switch standard library, for each type of rotary switch in the substation, adjust the rotary switch to different gear states, and use the camera to photograph the rotary switch in each gear state to obtain a rotary switch standard. Image, switch the gear state and shoot again. After obtaining the standard image of the rotary switch in all gear states of the rotary switch, do the same for other types of rotary switches, so as to obtain all types of rotary switches in the substation in all gear states. Knob switch standard image below.
该步骤还需要使用到相似度计算模型,该相似度计算模型预先基于孪生神经网络构建并训练得到,后续会介绍其训练方法。This step also requires the use of a similarity calculation model, which is pre-constructed and trained based on the twin neural network. Its training method will be introduced later.
步骤4,根据待识别图像与不同档位状态的旋钮开关标准图像之间的图像相似度,得到待识别状态的旋钮开关的档位状态。Step 4: According to the image similarity between the image to be recognized and the standard image of the knob switch in different gear states, the gear state of the knob switch in the state to be recognized is obtained.
在一个实施例中,将与待识别图像之间的图像相似度最高的旋钮开关标准图像的档位状态作为待识别状态的旋钮开关的档位状态。In one embodiment, the gear position state of the standard image of the knob switch that has the highest image similarity to the image to be recognized is used as the gear position state of the knob switch in the state to be recognized.
但是为了提高识别准确度,在另一个实施例中,在分别得到每一个旋钮开关标准图像与待识别图像的图像相似度之后,计算具有相同档位状态的多个旋钮开关标准图像各自与待识别图像的图像相似度的平均值,作为该档位状态对应的档位相似度。分别得到各个档位状态的档位相似度后,以对应的档位相似度最高的档位状态作为待识别状态的旋钮开关的档位状态。However, in order to improve the recognition accuracy, in another embodiment, after obtaining the image similarity between the standard image of each knob switch and the image to be recognized, calculate the similarity between the standard images of multiple knob switches with the same gear status and the image to be recognized. The average image similarity of the image is used as the gear similarity corresponding to the gear state. After obtaining the gear similarity of each gear state, the gear state with the highest corresponding gear similarity is used as the gear state of the knob switch in the state to be identified.
上述步骤3在应用时,需要使用到相似度计算模型,因此该方法还包括预先训练相似度计算模型的方法,包括如下步骤,请参考图2所示的流程图:When applying step 3 above, a similarity calculation model needs to be used. Therefore, this method also includes a method of pre-training the similarity calculation model, including the following steps. Please refer to the flow chart shown in Figure 2:
1、从各个不同的拍摄角度分别拍摄各个种类的旋钮开关在各种不同档位状态下的原始样本图像,从每个原始样本图像提取旋钮开关所在区域的图像并标注对应的旋钮开关的档位状态作为训练样本,构建得到训练数据集。1. Take original sample images of various types of rotary switches in various gear states from different shooting angles, extract the image of the area where the rotary switch is located from each original sample image, and mark the corresponding gear position of the rotary switch. The status is used as a training sample to construct a training data set.
构建得到训练数据集的方法与上述构建旋钮开关标准库的方法类似,且实际应用时,构建得到的训练数据集中包含旋钮开关标准库中的各个旋钮开关标准图像,因此这两部分共用一个过程完成即可,在构建得到训练数据集的同时,也可以构建得到旋钮开关标准库。The method of constructing the training data set is similar to the method of constructing the rotary switch standard library mentioned above, and in actual application, the constructed training data set contains each rotary switch standard image in the rotary switch standard library, so the two parts share the same process. That is, while building the training data set, you can also build the knob switch standard library.
与构建旋钮开关标准库的区别在于,对于变电站中每个种类的旋钮开关,在将该旋钮开关调节至每个档位状态的情况下,除了利用相机正对该旋钮开关拍摄之外,还利用相机在其他多个不同的拍摄角度拍摄该旋钮开关。The difference from building a rotary switch standard library is that for each type of rotary switch in the substation, when the rotary switch is adjusted to each gear state, in addition to using the camera to shoot the rotary switch, it also uses The camera captures the knob switch at several other different angles.
以旋钮开关建立空间三维虚拟坐标系,该空间三维虚拟坐标系的x0y平面平行于水平面,z轴方向垂直于水平面向上,y轴方向朝向旋钮开关的前方,x轴方向垂直于y轴方向。则多个不同的拍摄角度拍摄包括相对于旋钮开关具有不同的x轴方向的水平拍摄角度,以及相对于旋钮开关具有不同的z轴方向的垂直拍摄角度,以及相对于旋钮开关具有不同的沿着y轴方向的前后距离。在一个实施例中,对于每个种类的旋钮开关在处于每个档位状态的情况下,利用球机摄像头在与x轴正方向夹角30°至150°的范围内沿着x轴方向依次步进移动并拍摄旋钮开关,每次步进30°。以及,利用球机摄像头在z轴正方向夹角30°至150°的范围内沿着z轴方向依次步进移动并拍摄旋钮开关,每次步进30°。以及,利用球机摄像头在与旋钮开关的前后距离在0.5m至2m的范围内沿着y轴方向依次步进移动并拍摄旋钮开关,步进长度为0.5m。A three-dimensional spatial virtual coordinate system is established with the rotary switch. The x0y plane of the spatial three-dimensional virtual coordinate system is parallel to the horizontal plane, the z-axis direction is perpendicular to the horizontal plane and upward, the y-axis direction is toward the front of the rotary switch, and the x-axis direction is perpendicular to the y-axis direction. Then multiple different shooting angles include horizontal shooting angles with different x-axis directions relative to the knob switch, vertical shooting angles with different z-axis directions relative to the knob switch, and different along-axis shooting angles relative to the knob switch. The front-to-back distance in the y-axis direction. In one embodiment, for each type of rotary switch in each gear state, the dome camera is used to sequentially move along the x-axis direction within the range of an angle of 30° to 150° with the positive x-axis direction. Move and shoot the knob switch in steps of 30° each time. And, use the dome camera to sequentially move and photograph the knob switch along the z-axis direction within the angle range of 30° to 150° in the positive direction of the z-axis, with each step of 30°. And, use the dome camera to move the dome camera sequentially along the y-axis direction within a range of 0.5m to 2m from the front and back of the knob switch and photograph the knob switch, with a step length of 0.5m.
拍摄得到各个原始样本图像后,从原始样本图像中提取出旋钮开关所在区域的图像并去除背景图像,然后标注相应的档位状态。After each original sample image is captured, the image of the area where the knob switch is located is extracted from the original sample image and the background image is removed, and then the corresponding gear status is marked.
2、构建相似度计算模型的网络框架包括孪生神经网络、全连接层和Softmax层,孪生神经网络包括两个连接在一起且共享网络参数的特征提取模块,两个特征提取模块共享网络参数可以增加网络效率并减少参数量。每个特征提取模块以ResNet50为基础网络结构并引入CBAM模块进行注意力机制的学习。2. The network framework for constructing the similarity calculation model includes twin neural networks, fully connected layers and softmax layers. The twin neural network includes two feature extraction modules that are connected together and share network parameters. The shared network parameters of the two feature extraction modules can be increased. network efficiency and reduce the number of parameters. Each feature extraction module uses ResNet50 as the basic network structure and introduces the CBAM module to learn the attention mechanism.
3、利用训练数据集基于相似度计算模型的网络框架进行模型训练,得到训练后的相似度计算模型。3. Use the network framework of the training data set based on the similarity calculation model to conduct model training, and obtain the trained similarity calculation model.
相似度计算模型中的两个特征提取模块分别独立获取输入的一个图像并输出特征图,孪生神经网络将两个特征提取模块输出的特征图连接在一起形成最终特征表示并依次经过全连接层和Softmax层后计算欧式距离得到两个图像之间的图像相似度。The two feature extraction modules in the similarity calculation model independently obtain an input image and output a feature map. The twin neural network connects the feature maps output by the two feature extraction modules together to form the final feature representation, which is sequentially passed through the fully connected layer and After the Softmax layer, the Euclidean distance is calculated to obtain the image similarity between the two images.
利用训练数据集中不同种类的旋钮开关在不同档位状态和不同拍摄角度下的训练样本对相似度计算模型进行交叉匹配训练,可以让相似度计算模型具有更强的特征提取能力和鲁棒性。Cross-matching training of the similarity calculation model using training samples of different types of knob switches in different gear states and different shooting angles in the training data set can make the similarity calculation model have stronger feature extraction capabilities and robustness.
上述步骤3中相似度计算模型在获取到旋钮开关标准图像和待识别图像后,首先将旋钮开关标准图像和待识别图像进行标准化处理为相同的图像形状和图像尺寸,然后将两张图像送入特征提取模块中进行前向传播,两张图像将分别通过孪生神经网络的共享层和独立层,从而得到各自的特征图,这一阶段的特征向量是图像的高级表示,用于刻画图像的特征和结构。最后将两个图像的特征图连接在一起形成孪生神经网络的最终特征表示,并通过全连接层、Softmax层等后续处理模块后进行欧氏距离计算,得到旋钮开关标准图像和待识别图像的图像相似度。After the similarity calculation model in step 3 above obtains the standard image of the knob switch and the image to be recognized, it first standardizes the standard image of the knob switch and the image to be recognized into the same image shape and image size, and then sends the two images into Forward propagation is performed in the feature extraction module. The two images will pass through the shared layer and independent layer of the twin neural network respectively to obtain their respective feature maps. The feature vector at this stage is a high-level representation of the image and is used to describe the characteristics of the image. and structure. Finally, the feature maps of the two images are connected together to form the final feature representation of the twin neural network, and the Euclidean distance is calculated through subsequent processing modules such as the fully connected layer and Softmax layer to obtain the standard image of the knob switch and the image of the image to be recognized. Similarity.
在一个实施例中,上述步骤2对原始预置位图像进行图像预处理时,首先确定拍摄该原始预置位图像的预置拍摄位所对应的预置位图像模板,然后利用确定得到的预置位图像模板对原始预置位图像进行图像预处理,提取得到待识别图像。不同的预置拍摄位具有不同的预置位图像模板,每个预置拍摄位对应的预置位图像模板指示在预置拍摄位处拍摄的图像中的旋钮开关所在区域,各个预置拍摄位对应的预置位图像模板是预先确定好的。In one embodiment, when performing image preprocessing on the original preset position image in step 2 above, first determine the preset position image template corresponding to the preset shooting position of the original preset position image, and then use the determined preset position image template. The positioning image template performs image preprocessing on the original pre-positioning image and extracts the image to be recognized. Different preset shooting positions have different preset position image templates. The preset position image template corresponding to each preset shooting position indicates the area where the knob switch is located in the image taken at the preset shooting position. Each preset shooting position The corresponding preset image template is predetermined.
利用确定得到的预置位图像模板对原始预置位图像进行图像预处理包括如下步骤,请参考图3所示的流程图:Using the determined preset image template to perform image preprocessing on the original preset image includes the following steps, please refer to the flow chart shown in Figure 3:
1、利用卷积神经网络分别对预置位图像模板和原始预置位图像进行特征提取得到各自的特征图。1. Use the convolutional neural network to extract features from the preset image template and the original preset image to obtain respective feature maps.
为了捕捉图像中的关键信息,对于预置位图像模板和原始预置位图像中的任意一个输入图像,在提取该输入图像的特征图包括:(1)对输入图像进行两次卷积和最大池化组合下采样,得到输入图像的深层特征图,深层特征图的图像尺寸是输入图像的图像尺寸的1/4。这样做可以防止在卷积特征提取过程中丢失过多的空间特征。(2)对深层特征图再次执行卷积、平均池化和空洞卷积的操作,以融合提取得到稀疏特征并获得较大的感受野,从而提取得到输入图像的特征图,这样可以同时获取更全局的图像信息和更具辨识度的特征。In order to capture the key information in the image, for any input image in the preset image template and the original preset image, extracting the feature map of the input image includes: (1) Convolving the input image twice and maximizing Pooling is combined with downsampling to obtain a deep feature map of the input image. The image size of the deep feature map is 1/4 of the image size of the input image. Doing so prevents excessive spatial features from being lost during the convolutional feature extraction process. (2) Perform convolution, average pooling and atrous convolution operations again on the deep feature map to fuse and extract sparse features and obtain a larger receptive field, thereby extracting the feature map of the input image, so that more information can be obtained at the same time. Global image information and more identifiable features.
2、对两个特征图进行特征匹配以实现原始预置位图像与预置位图像模板的图像对齐,并结合预置位图像模板中的旋钮开关所在区域提取得到原始预置位图像中待识别状态的旋钮开关所在区域的旋钮图像。包括:2. Perform feature matching on the two feature maps to achieve image alignment between the original preset image and the preset image template, and extract the area to be identified in the original preset image based on the area of the knob switch in the preset image template. The image of the knob in the area where the status knob switch is located. include:
(1)基于预置位图像模板的特征图检测预置位图像模板的图像特征点,基于原始预置位图像的特征图检测原始预置位图像的图像特征点。(1) Detect the image feature points of the preset image template based on the feature map of the preset image template, and detect the image feature points of the original preset image based on the feature map of the original preset image.
在一个实施例中,对于预置位图像模板和原始预置位图像中的任意一个输入图像,基于输入图像的特征图检测输入图像的图像特征点包括:In one embodiment, for any input image in the preset image template and the original preset image, detecting the image feature points of the input image based on the feature map of the input image includes:
提取输入图像的特征图中的各个关键像素点及各个关键像素点的描述符,每个关键像素点既在预定局部邻域范围内具有最大的空间特征值、也在通道方向上具有最大的通道特征值。每个关键像素点的描述符是关键像素点所在位置的通道方向向量,这些描述符具有更丰富和全面的信息,相较于传统的特征点提取算法,能够更好地抵抗尺度、旋转、照明、视角以及非刚性变换等干扰。Extract each key pixel point and the descriptor of each key pixel point in the feature map of the input image. Each key pixel point not only has the largest spatial feature value within the predetermined local neighborhood range, but also has the largest channel value in the channel direction. Eigenvalues. The descriptor of each key pixel is the channel direction vector of the location of the key pixel. These descriptors have richer and more comprehensive information. Compared with traditional feature point extraction algorithms, they can better resist scale, rotation, and lighting. , perspective and non-rigid transformation and other interferences.
提取得到的关键像素点keypoints可以表示为keypoints=space∩channel,其中,space={max(fp(i;j;:)(i,j)∈Nb)}表示特征图中任意像素点(i,j)的预定局部邻域范围Nb内的空间特征值的最大值对应的像素点的集合,预定局部邻域范围Nb可以自定义设置,比如常见的设定为3*3邻域,fp(i;j;:)表示输出特征图fp在(i,j)位置的所有像素点。channel={max(fp(:;:;k))}表示特征图中在特征通道索引k的通道方向的通道特征值的最大值对应的像素点的集合,fp(:;:;k)表示输出特征图fp在特征通道索引k的通道方向上的所有像素点。其中符号:表示参量缺省。The extracted key pixels keypoints can be expressed as keypoints=space∩channel, where space={max(fp(i;j;:) (i,j)∈Nb )} represents any pixel point (i, The set of pixels corresponding to the maximum value of the spatial feature value within the predetermined local neighborhood range Nb of j). The predetermined local neighborhood range Nb can be customized. For example, the common setting is 3*3 neighborhood, fp(i ;j;:) represents all the pixels of the output feature map fp at the (i, j) position. channel={max(fp(:;:;k))} represents the set of pixels corresponding to the maximum value of the channel feature value in the channel direction of the feature channel index k in the feature map, fp(:;:;k) represents Output all pixels of the feature map fp in the channel direction of the feature channel index k. The symbol: indicates parameter default.
然后根据提取得到各个关键像素点及各个关键像素点的描述符,通过双线性插值将各个关键像素点恢复至输入图像的图像尺寸,提取得到输入图像的图像特征点。Then, based on the extraction of each key pixel point and the descriptor of each key pixel point, each key pixel point is restored to the image size of the input image through bilinear interpolation, and the image feature points of the input image are extracted.
(2)利用随机采样一致性算法对预置位图像模板的图像特征点和原始预置位图像的图像特征点进行过滤,筛选得到最佳匹配的四对图像特征点,每对图像特征点包括预置位图像模板中的一个图像特征点及其匹配的原始预置位图像中的一个图像特征点。(2) Use the random sampling consistency algorithm to filter the image feature points of the preset image template and the original preset image, and screen out the best matching four pairs of image feature points. Each pair of image feature points includes An image feature point in the preset image template and an image feature point in the original preset image that it matches.
(3)按照根据四对图像特征点的坐标求解得到变换矩阵T1,变换矩阵T1是一个3*3的矩阵。(3)According to The transformation matrix T 1 is obtained by solving the coordinates of the four pairs of image feature points. The transformation matrix T 1 is a 3*3 matrix.
其中,(x11,y11)和(x21,y21)是一对图像特征点的坐标,(x12,y12)和(x22,y22)是一对图像特征点的坐标,(x13,y11)和(x23,y23)是一对图像特征点的坐标,(x14,y14)和(x24,y24)是一对图像特征点的坐标,且(x11,y11)、(x12,y12)、(x13,y13)和(x14,y14)均是原始预置位图像中的图像特征点,(x21,y21)、(x22,y22)、(x23,y23)、(x24,y24)均是预置位图像模板中的图像特征点。Among them, (x 11 , y 11 ) and (x 21 , y 21 ) are the coordinates of a pair of image feature points, (x 12 , y 12 ) and (x 22 , y 22 ) are the coordinates of a pair of image feature points, (x 13 , y 11 ) and (x 23 , y 23 ) are the coordinates of a pair of image feature points, (x 14 , y 14 ) and (x 24 , y 24 ) are the coordinates of a pair of image feature points, and ( x 11 , y 11 ), (x 12 , y 12 ), (x 13 , y 13 ) and (x 14 , y 14 ) are all image feature points in the original preset image, (x 21 , y 21 ) , (x 22 , y 22 ), (x 23 , y 23 ), (x 24 , y 24 ) are all image feature points in the preset image template.
(4)利用变换矩阵T1对预置位图像模板中的旋钮开关所在区域的位置坐标进行坐标变换完成原始预置位图像与预置位图像模板的图像对齐。(4) Use the transformation matrix T 1 to perform coordinate transformation on the position coordinates of the area where the knob switch is located in the preset image template to complete the image alignment between the original preset image and the preset image template.
在完成原始预置位图像与预置位图像模板的图像对齐后,由于预置位图像模板中旋钮开关所在区域是已知的,因此可以对应得到原始预置位图像中待识别状态的旋钮开关所在区域的位置坐标并提取得到旋钮图像。After completing the image alignment between the original preset position image and the preset position image template, since the area of the knob switch in the preset position image template is known, the knob switch in the state to be identified in the original preset position image can be correspondingly obtained The position coordinates of the area are extracted and the knob image is obtained.
比较常见的做法是,预置位图像模板中旋钮开关所在的矩形区域的四个顶点的坐标是已知的,利用变换矩阵T1对这四个顶点坐标进行坐标变换可以得到原始预置位图像中待识别状态的旋钮开关所在区域的四个顶点的坐标,然后依次连接四个顶点的坐标即可确定待识别状态的旋钮开关所在区域,截取该区域内的图像即为旋钮图像。A common approach is that the coordinates of the four vertices of the rectangular area where the knob switch is located in the preset image template are known, and the original preset image can be obtained by performing coordinate transformation on these four vertex coordinates using the transformation matrix T 1 The coordinates of the four vertices in the area where the rotary switch in the state to be identified are located, and then the coordinates of the four vertices are connected in sequence to determine the area where the rotary switch in the state to be identified is located. The image intercepted in this area is the knob image.
3、对提取得到的旋钮图像进行图像校正,提取得到待识别图像。3. Perform image correction on the extracted knob image, and extract the image to be recognized.
当正对待识别状态的旋钮开关拍摄得到原始预置位图像时,这里提取得到的旋钮图像的边界构成矩形结构,但是由于拍摄角度的问题,这里提取得到的旋钮图像的边界往往不是矩形,通常是一个不规则的四边形,在进行图像校正时,首先需要将旋钮图像不规则的边界变换为矩形,从而尽可能将旋钮图像还原成正角度拍摄下的形态,降低拍摄角度对识别的影响。包括如下步骤:When the original preset image is captured from the knob switch in the state to be recognized, the boundary of the knob image extracted here forms a rectangular structure. However, due to the shooting angle, the boundary of the knob image extracted here is often not a rectangle. It is usually For an irregular quadrilateral, when performing image correction, it is first necessary to transform the irregular boundary of the knob image into a rectangle, so as to restore the knob image to the form taken at a positive angle as much as possible and reduce the impact of the shooting angle on recognition. Includes the following steps:
(1)确定原始预置位图像中的旋钮图像的四个顶点的坐标A(X1,Y1)、B(X2,Y2)、C(X3,Y3)和D(X4,Y4)。如图4所示,旋钮图像的四个顶点构成的四边形通常是不规则的。然后即可根据四个顶点的坐标计算得到顶点A和顶点B之间的欧式距离Wa、顶点C和顶点D之间的欧式距离Wb、顶点A和顶点C之间的欧式距离Ha、顶点B和顶点D之间的欧式距离Hb。(1) Determine the coordinates A (X 1 , Y 1 ), B (X 2 , Y 2 ), C (X 3 , Y 3 ) and D (X 4 ) of the four vertices of the knob image in the original preset image. , Y 4 ). As shown in Figure 4, the quadrilateral formed by the four vertices of the knob image is usually irregular. Then the Euclidean distance Wa between vertex A and vertex B, the Euclidean distance Wb between vertex C and vertex D, the Euclidean distance Ha between vertex A and vertex C, vertex B and The Euclidean distance Hb between vertices D.
(2)根据旋钮图像的相邻两个顶点之间的欧式距离确定变换后的图像的四个顶点的坐标分别为A′(0,0)、B′(W,0)、C′(0,H)和D′(W,H),其中,W是Wa和Wb中的最大值,H是Ha和Hb中的最大值。(2) Based on the Euclidean distance between two adjacent vertices of the knob image, determine the coordinates of the four vertices of the transformed image as A′(0,0), B′(W,0), C′(0 , H) and D'(W, H), where W is the maximum value among Wa and Wb, and H is the maximum value among Ha and Hb.
(3)按照求解得到变换矩阵T2,变换矩阵T2是一个3*3的矩阵,且变换矩阵T2中每个元素的取值范围为[1,3]。(3)According to The transformation matrix T 2 is obtained by solving. The transformation matrix T 2 is a 3*3 matrix, and the value range of each element in the transformation matrix T 2 is [1, 3].
(4)利用变换矩阵T2对原始预置位图像中的旋钮图像进行图像变换得到待识别图像。该步骤利用OpenCV库函数warpPerspective()即可完成。(4) Use the transformation matrix T 2 to perform image transformation on the knob image in the original preset image to obtain the image to be recognized. This step can be completed using the OpenCV library function warpPerspective().
在该步骤(4)中,利用变换矩阵T2对原始预置位图像中的旋钮图像进行图像变换得到的输出图像已经是待识别状态的旋钮开关的正角度图像,也即已经尽可能将原始旋钮图像还原成正角度下拍摄的形态,从而有效降低拍摄角度对状态识别的影响,但是考虑到变电站复杂的环境还往往存在光照不均的问题,因此进一步的为了降低光照不均对状态识别的影响,在一个实施例中,并不直接将输出图像作为待识别图像,而是还包括对待识别图像的重映射过程,包括:In this step (4), the output image obtained by using the transformation matrix T 2 to transform the knob image in the original preset image is already a positive angle image of the knob switch in the state to be identified, that is, the original image has been transformed as much as possible. The knob image is restored to the form taken at a positive angle, thereby effectively reducing the impact of the shooting angle on status recognition. However, considering that the complex environment of the substation often has the problem of uneven illumination, further efforts are made to reduce the impact of uneven illumination on status recognition. , in one embodiment, the output image is not directly used as the image to be recognized, but also includes a remapping process of the image to be recognized, including:
(5)计算输出图像中的各个像素点的灰度直方图,并计算灰度直方图中各个灰度级别的累积分布函数,任意灰度级别g的累积分布函数Sk(g)等于灰度级别在[0,g]范围内的像素点的数量之和,min≤g≤G,min是灰度级别的最小值,G是灰度级别的最大值。(5) Calculate the grayscale histogram of each pixel in the output image, and calculate the cumulative distribution function of each grayscale level in the grayscale histogram. The cumulative distribution function Sk(g) of any grayscale level g is equal to the grayscale level The sum of the number of pixels in the range [0, g], min≤g≤G, min is the minimum value of the gray level, and G is the maximum value of the gray level.
(5)按照将输出图像中任意灰度级别为g的像素点的灰度级别转换为g′,N是输出图像中包含的像素点的总数量,表示对/>进行四舍五入取整。(5)According to Convert the gray level of any pixel with gray level g in the output image to g′, N is the total number of pixels contained in the output image, Expresses yes/> Perform rounding.
由此可以提取得到待识别状态的旋钮开关经过图像校正后的正角度图像,也即得到了降低拍摄角度和光照不均影响的待识别图像。From this, it is possible to extract the corrected positive angle image of the knob switch in the state to be identified, that is, to obtain the image to be identified that reduces the influence of the shooting angle and uneven lighting.
以上所述的仅是本申请的优选实施方式,本申请不限于以上实施例。可以理解,本领域技术人员在不脱离本申请的精神和构思的前提下直接导出或联想到的其他改进和变化,均应认为包含在本申请的保护范围之内。The above are only preferred embodiments of the present application, and the present application is not limited to the above embodiments. It can be understood that other improvements and changes directly derived or thought of by those skilled in the art without departing from the spirit and concept of the present application should be considered to be included in the protection scope of the present application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311137629.6A CN117036665B (en) | 2023-09-04 | 2023-09-04 | Knob switch state identification method based on twin neural network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311137629.6A CN117036665B (en) | 2023-09-04 | 2023-09-04 | Knob switch state identification method based on twin neural network |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117036665A true CN117036665A (en) | 2023-11-10 |
CN117036665B CN117036665B (en) | 2024-03-08 |
Family
ID=88637374
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311137629.6A Active CN117036665B (en) | 2023-09-04 | 2023-09-04 | Knob switch state identification method based on twin neural network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117036665B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118690250A (en) * | 2024-08-22 | 2024-09-24 | 北京尚优力达科技有限公司 | A method for knob switch state recognition based on multimodal model |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080174702A1 (en) * | 2007-01-23 | 2008-07-24 | Pixart Imaging Inc. | Quasi analog knob control method and appartus using the same |
CN109145927A (en) * | 2017-06-16 | 2019-01-04 | 杭州海康威视数字技术股份有限公司 | The target identification method and device of a kind of pair of strain image |
CN112381104A (en) * | 2020-11-16 | 2021-02-19 | 腾讯科技(深圳)有限公司 | Image identification method and device, computer equipment and storage medium |
CN114202731A (en) * | 2022-02-15 | 2022-03-18 | 南京天创电子技术有限公司 | Multi-state knob switch identification method |
CN115861210A (en) * | 2022-11-25 | 2023-03-28 | 国网重庆市电力公司潼南供电分公司 | A method and system for abnormal detection of substation equipment based on twin network |
CN116363573A (en) * | 2023-01-31 | 2023-06-30 | 智洋创新科技股份有限公司 | Transformer substation equipment state anomaly identification method and system |
-
2023
- 2023-09-04 CN CN202311137629.6A patent/CN117036665B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080174702A1 (en) * | 2007-01-23 | 2008-07-24 | Pixart Imaging Inc. | Quasi analog knob control method and appartus using the same |
CN109145927A (en) * | 2017-06-16 | 2019-01-04 | 杭州海康威视数字技术股份有限公司 | The target identification method and device of a kind of pair of strain image |
CN112381104A (en) * | 2020-11-16 | 2021-02-19 | 腾讯科技(深圳)有限公司 | Image identification method and device, computer equipment and storage medium |
CN114202731A (en) * | 2022-02-15 | 2022-03-18 | 南京天创电子技术有限公司 | Multi-state knob switch identification method |
CN115861210A (en) * | 2022-11-25 | 2023-03-28 | 国网重庆市电力公司潼南供电分公司 | A method and system for abnormal detection of substation equipment based on twin network |
CN116363573A (en) * | 2023-01-31 | 2023-06-30 | 智洋创新科技股份有限公司 | Transformer substation equipment state anomaly identification method and system |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118690250A (en) * | 2024-08-22 | 2024-09-24 | 北京尚优力达科技有限公司 | A method for knob switch state recognition based on multimodal model |
Also Published As
Publication number | Publication date |
---|---|
CN117036665B (en) | 2024-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112381075B (en) | Method and system for carrying out face recognition under specific scene of machine room | |
CN108961235A (en) | A kind of disordered insulator recognition methods based on YOLOv3 network and particle filter algorithm | |
CN111986240A (en) | Drowning person detection method and system based on visible light and thermal imaging data fusion | |
CN112950667A (en) | Video annotation method, device, equipment and computer readable storage medium | |
CN112232184A (en) | A multi-angle face recognition method based on deep learning and spatial transformation network | |
CN108520204A (en) | A face recognition method | |
CN108537196B (en) | Human behavior recognition method based on spatiotemporal distribution map generated from motion history point cloud | |
CN115331172A (en) | Workshop dangerous behavior recognition alarm method and system based on monitoring video | |
CN114494427A (en) | Method, system and terminal for detecting illegal behavior of person standing under suspension arm | |
WO2019223763A1 (en) | Method, device, and equipment for image detection, medium, patterning control system and method | |
Wang et al. | Zoom to perceive better: No-reference point cloud quality assessment via exploring effective multiscale feature | |
CN111861866A (en) | A panorama reconstruction method of substation equipment inspection image | |
CN113869122B (en) | Reinforced management and control method for distribution network engineering | |
CN115908356A (en) | A PCB defect detection method based on LDLFModel | |
CN113505808A (en) | Detection and identification algorithm for power distribution facility switch based on deep learning | |
WO2022222036A1 (en) | Method and apparatus for determining parking space | |
Xiong et al. | Speal: Skeletal prior embedded attention learning for cross-source point cloud registration | |
CN117036665A (en) | Knob switch state identification method based on twin neural network | |
CN114612798B (en) | Satellite image tampering detection method based on Flow model | |
CN116109849A (en) | SURF feature matching-based high-voltage isolating switch positioning and state identification method | |
CN115690770A (en) | License Plate Recognition Method in Unconstrained Scenes Based on Spatial Attention Features | |
CN110544249A (en) | A Convolutional Neural Network Quality Discrimination Method for Visual Inspection of Chassis Assembly at Any Angle | |
CN114882537A (en) | Finger new visual angle image generation method based on nerve radiation field | |
CN116524160B (en) | Product Consistency Auxiliary Verification System and Method Based on AR Recognition | |
CN116912173A (en) | Product apparent defect detection method based on unsupervised anomaly detection |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |