Industrial instrument pointer reading method and system based on deep learning
Through deep learning technology, combined with YOLOv7, U-Net++ and ECA modules, it solves the problem of inaccurate readings of pointer instruments in industrial environments with traditional image processing methods, achieves efficient and accurate instrument readings, adapts to complex environments and reduces Operational difficulty.
Patent Information
- Application Number
- CN202311515514.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2024-09-10
AI Technical Summary
Traditional image processing methods have high requirements for image quality of pointer instruments in industrial environments, and require a large amount of calculation. They cannot meet the lighting conditions of industrial environments, resulting in inaccurate and stable feature extraction, and it is difficult to fully network in low-resolution images. train.
Using a deep learning-based method, YOLOv7 network, attention series and parallel ELAN modules, U-Net++ model, ECA module and least squares ellipse fitting method are used, combined with sliding angle technology, to optimize the feature layer and attention calculation, to perform instrumentation Image tilt correction and feature extraction to achieve pointer positioning and reading.
It significantly improves the reading accuracy and efficiency of pointer instruments, enables real-time identification and reading in complex environments, enhances the adaptability and robustness of the system, and reduces the difficulty of reading operations.
Smart Images

Figure CN118628883A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine learning, and in particular relates to an industrial instrument pointer reading method and system based on deep learning. Background Art
[0002] The automatic reading of pointer-type meters in cigarette factories often uses traditional image processing techniques when processing images, such as threshold binarization for preprocessing, circular detection and positioning of dials, canny edge detection, Hough transform detection of straight lines, etc., to extract pointer position information. However, these traditional image processing methods often have high requirements on the quality of the captured images, and external environmental factors such as lighting in cigarette factories cannot meet this condition, and the amount of calculation is huge, and the feature extraction of pointer-type meters in cigarette factories cannot achieve accurate and stable results. Today, with the explosive development of artificial intelligence, all aspects of social production and life cannot be separated from the help of computer vision, especially the application of deep learning and convolutional neural networks. In order to improve the drawbacks of pointer-type meters in cigarette factories during automatic reading, the present invention proposes to use a method based on deep learning to achieve automatic reading of pointer-type meters.
[0003] Through the above analysis, the problems and defects of the prior art are as follows:
[0004] (1) Traditional image processing methods often have high requirements on the quality of the captured images, but external environmental factors such as lighting in industrial environments cannot meet this condition. In addition, the amount of calculation is huge, and the feature extraction of pointer instruments in industrial environments cannot achieve accurate and stable results.
[0005] (2) The content in the image shows a certain structure, especially in the image of pointer-type instruments, where the position of the scale lines and the pointer is subject to clear spatial constraints. This structure makes the existing image change patterns easier to understand. Therefore, for the accurate segmentation of instrument images, it is crucial to extract high-level semantic information and underlying image features. Such analysis helps to better understand the intrinsic semantic information of the image and provides strong support for subsequent processing and recognition.
[0006] (3) In an industrial environment, it is not easy to collect a large number of images of pointer instruments. The actual scene images are limited, making it difficult to fully train the network. Low-resolution images can still provide structural features to support object segmentation. Visual recognition of pointer instruments does not require an overly complex network structure to prevent overfitting. Summary of the invention
[0007] In view of the problems existing in the prior art, the present invention provides an industrial instrument pointer reading method and system based on deep learning.
[0008] The present invention is a method for reading an industrial instrument pointer based on deep learning, and the method for reading an industrial instrument pointer based on deep learning comprises:
[0009] Step 1: Based on the YOLOv7 network, the attention series ELAN module and the attention parallel ELAN module are used to optimize the stacking of feature layers and the attention calculation process to realize the smart instrument visual recognition framework.
[0010] Step 2: Based on scale extraction and the ellipse fitting method of the least square method, the scale circle is fitted and the perspective transformation matrix is calculated to complete the tilt correction of the instrument image;
[0011] Step 3: Based on the U-Net++ model, the Attention module is introduced to centrally select and merge the features extracted from different levels on the expansion path;
[0012] Step 4: Introduce the ECA module to model the interdependencies between feature channels;
[0013] Step 5, introducing a sliding angle for addressing and positioning the starting pointer of the pointer instrument panel;
[0014] Step six, take a value in the middle of the scale pixel to determine the start scale, end scale and pointer position of the dial according to the proportional degree.
[0015] Further, the step 1 includes:
[0016] Step 1: In order to improve the accuracy and efficiency of pointer instrument recognition in complex environments, the YOLOv7 network is used to implement the intelligent instrument visual recognition framework.
[0017] Step 101: The original backbone ELAN module in YOLOv7 is mainly composed of convolutional standard activation functions. There are 4 channels in total, which pass through 1, 1, 3, and 5 convolutional standard activation functions respectively. Finally, the feature layers of these 4 channels are stacked and integrated by a convolutional standard activation function.
[0018] Step 102: Attention series ELAN module. Since the feature layers of four channels are finally stacked, the number of feature layers is large, and some feature layers have a large effect while others have a small effect. Therefore, after the stacking layer, the channel attention of the stacked features is calculated through mean pooling, two-dimensional convolution, and sigmoid activation layer, and a weight is calculated for each feature layer. Finally, the weight is multiplied by the stacked feature to obtain the stacked feature after channel attention fusion, and finally the output feature is calculated through Conv2d_BN_SILU.
[0019] Step 103: Attention parallel ELAN module. The above attention series modules will completely ignore the layers with less effect in actual calculation, but these layers cannot be completely ignored, so Conv2d_BN_SILU and attention results are connected in series.
[0020] Step 104: The features of the two parts are fused by adding fusion, so that the layer with a large effect still has a higher weight, and the layer with a small effect is not completely ignored.
[0021] Further, the step 2 includes:
[0022] Step 201: performing data enhancement on the instrument image based on the data enhancement strategy;
[0023] Step 202: According to the characteristics of the instrument dial, a perspective transformation model is selected to eliminate the distortion of the pointer instrument image. The specific transformation process is as follows:
[0024]
[0025]
[0026]
[0027] Among them, f 33 It is usually 1. From equations (2) and (3), we can see that the transformation matrix still has 8 unknowns;
[0028] Step 203: Extract four relatively stable groups of corresponding points based on the ellipse fitting method of the least squares method. First, establish a rectangular coordinate system on the instrument image plane:
[0029] F(A,B,C,D,E)=x 2 +Axy+By 2 +Cx+Dy+E=0 (4)
[0030] According to the least squares principle, if there are n (N ≥ 5) groups of data (x i ,y i )(i=1,2,3,…,N), then the parameters A, B, C, D, E can be determined by finding the minimum value of the objective function (5):
[0031]
[0032] Let the partial derivatives of the function F(A,B,C,D,E) with respect to each of its parameters be zero, then we can get the following set of equations:
[0033]
[0034] Solving this linear equation system can solve A, B, C, D, E, and the common parameters of the ellipse can be obtained from formula (6):
[0035]
[0036] Among them, (x0, y0) is the center of the ellipse, a is the semi-major axis, b is the semi-minor axis, and θ is the major axis deflection. After extracting the scale, the least squares ellipse fitting is performed according to the distal end points of each scale to obtain the ellipse where the scale is located. The perspective transformation matrix can be obtained by using the major and minor axis endpoints of the ellipse and the upper, lower, left and right four points of the set circle of the perspective plane to complete the tilt correction.
[0037] Furthermore, in step three, a nested U-Net is used as the basic network framework, and the encoder and decoder are symmetrically arranged on both sides of the network. The context information extracted by the encoder is propagated to the decoder of the corresponding layer through dense skip connections to extract more effective hierarchical features. After receiving the features of each layer, the decoder restores the features in a bottom-up manner, which specifically includes the following sub-steps:
[0038] Step 301: Define the feature map as follows, using X i,j represents the output of the block, where i is the feature depth in the encoder and j is the depth of the convolutional layer along the skip connection in the nested block, so the extracted convolutional layer feature map can be defined as:
[0039]
[0040] Where Φ[] represents the convolutional block after the concatenation and merging, Up() and Ag() represent upsampling and attention gate selection respectively;
[0041] Step 302: The network extracts features from the encoder and passes them to the decoder through dense skip connections to achieve integration of hierarchical representations. An attention gate mechanism is added between the nested convolutional blocks so that features extracted at different levels can be centrally selected and merged on the expansion path;
[0042] Furthermore, in step 4, the ECA module considers each channel and its k adjacent channels to capture local cross-channel interactions, and consists of three parts: where H, W, and C represent the length, width, and input feature number, respectively, GAP represents global average pooling, σ represents the Sigmoid activation function, and K is the adaptively determined convolution kernel size:
[0043] Step 401: GAP generates a feature map of size 1*1*c;
[0044] Step 402: Calculate the size of the adaptive convolution kernel;
[0045] Step 403: Apply the convolution kernel size to the one-dimensional convolution to obtain the weight of each channel, where the channel dimension C is proportional to the size of the convolution kernel k, and the number of convolution kernels is set to 2 to the power of k, as shown in the following formula:
[0046]
[0047] The formula for convolution kernel size is as follows:
[0048]
[0049] Where |t| odd Represents an odd number close to t, with a value of γ of 2 and a value of b of 1.
[0050] Further, the step five comprises:
[0051] Step 501: Determine the size of the sliding window and set it to 15 degrees;
[0052] Step 502: Move the sliding angle forward a certain distance (5 degrees), and then continue to move the window until the starting scale of the pointer instrument is found.
[0053] Furthermore, the loss function uses Focal Loss as the loss function, introduces a weighting factor α and an adjustment factor (1-p t ) γ , where γ is greater than or equal to 0, the equation is defined as:
[0054] FL(p y )=-α t (1-p t ) γ log(p t )
[0055] Another object of the present invention is to provide an industrial instrument pointer reading system based on deep learning, the industrial instrument pointer reading system based on deep learning comprising:
[0056] Image positioning module, used to identify instruments under complex backgrounds;
[0057] Image processing module, used to perform data enhancement on instrument images and eliminate image distortion;
[0058] Feature extraction module, used to model and extract image features;
[0059] Reading module, used to read the instrument pointer reading.
[0060] Another object of the present invention is to provide a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the industrial instrument pointer reading method based on deep learning.
[0061] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to perform the steps of the industrial instrument pointer reading method based on deep learning.
[0062] Another object of the present invention is to provide an information data processing terminal, which is used to implement the industrial instrument pointer reading system based on deep learning.
[0063] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:
[0064] First, the present invention studies methods for eliminating image distortion such as image registration and perspective transformation, and proposes a least squares ellipse fitting method based on rough scale extraction to eliminate instrument image distortion, targeting the scale features of pointer instruments that are the most stable and least likely to be lost in perspective transformation. This method can effectively process images of pointer instruments that have a large visual tilt.
[0065] The present invention segments the scale and pointer areas in the dashboard based on the improved U-Net++ of the convolutional neural network to eliminate background interference. Before the output of the original U-Net++ model, the ECA module proposed in is added to the four copy and crop structures. In the U-Net++ network jump connection, an attention mechanism module is also introduced in the path to enhance the features of the area to be segmented and suppress the part of the unsegmented area. The network model is trained using a mixed loss function to prevent the imbalance of the segmented area share (such as Fig.10 shown).
[0066] The present invention aims to study the problem that the current reading of the start and end of the dial is to directly obtain the starting position of the dial scale pixel, but the start of the scale has a certain pixel width, resulting in inaccurate reading. It is proposed to take the value in the middle of the pixel in the scale at the start of the scale, solving the problem of pixel width affecting the reading of pointer-type instruments.
[0067] Second, the present invention relates to a pointer reading method for pointer-type industrial instruments based on deep learning, aiming to improve the accuracy and efficiency of pointer-type instrument reading. The following is a description of the technical solution as a whole:
[0068] 1. Intelligent instrument visual recognition framework: To address the problem of instrument recognition in complex environments, this paper adopts the YOLOv7 network. By connecting the Attention modules in series and in parallel, the module structure in the network is optimized, and the expressive power of the feature layer and the accuracy of attention calculation are enhanced.
[0069] 2. Ellipse fitting and perspective transformation: By using the ellipse fitting method of scale extraction and least squares method, the present invention can accurately fit the scale circle of the instrument and perform image tilt correction through perspective transformation. This step ensures that the input of the subsequent deep learning model has a good geometric structure.
[0070] 3. U-Net++ deep learning model: The present invention uses the U-Net++ deep learning model, and by introducing the Attention module and the ECA module, it realizes the centralized selection and merging of features extracted at different levels and the interdependence between modeling feature channels. This enables the model to better understand and capture the semantic information of instrument images.
[0071] 4. Pointer positioning and scale reading: By introducing a sliding angle for pointer positioning and combining it with the value of scale pixels, the present invention can accurately determine the starting scale, ending scale and pointer position of the dial, thereby achieving accurate reading of the instrument.
[0072] Third, the technical effects and advantages brought by the present invention are:
[0073] Improve the accuracy of meter readings: Through multi-step fine processing and the introduction of deep learning models, the present invention can significantly improve the accuracy of meter readings, especially in complex background environments.
[0074] Real-time recognition: The introduction of the YOLOv7 network enables the system to have a faster reasoning speed, realizes real-time recognition and reading of instruments, and meets the needs of real-time monitoring.
[0075] Strong environmental adaptability: Through the introduction of the attention module, the system has better adaptability to instruments in different environments, which improves the versatility and robustness of the system.
[0076] Comprehensive multi-module optimization: The present invention comprehensively optimizes the overall system structure through the series and parallel connection of multiple modules and the fusion of features, so that the effect of each module is effectively improved, forming a set of collaborative technical solutions.
[0077] The technical solution of the present invention effectively solves many problems in the pointer reading of industrial instruments by combining several key steps and a deep learning model, and has significant technical effects and practical advantages.
[0078] Fourth, the expected benefits and commercial value of the technical solution of the present invention after transformation are: through the industrial instrument pointer reading method based on deep learning, the intelligent reading of industrial instruments is realized. This will greatly improve the accuracy and efficiency of instrument reading, reduce the difficulty of reading operation, and have significant production benefits and use value.
[0079] The technical solution of the present invention fills the technical gap in the industry at home and abroad: in the field of industrial instrument pointer reading, especially in the method based on deep learning, there used to be traditional methods for pointer reading, which lacked intelligence and efficiency. The present invention fills the technical gap in this field by introducing deep learning technologies such as U-Net++ model, Attention module, ECA module, etc., making the pointer reading more accurate and intelligent.
[0080] The technical solution of the present invention solves a technical problem that people have always been eager to solve but have never succeeded in solving: through the comprehensive application of deep learning technology, the problem of pointer instrument reading is successfully solved, and more efficient and accurate pointer instrument reading is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 It is a schematic diagram of a flow chart provided by an embodiment of the present invention;
[0082] Figure 2 is a schematic diagram of the perspective transformation of a dial provided by an embodiment of the present invention;
[0083] Figure 3 The embodiment of the present invention provides a U-Net++ network structure diagram based on adding an attention mechanism;
[0084] Figure 4 The embodiment of the present invention provides Figure 3 Added EA U-Net++ network structure diagram of ECA module;
[0085] Figure 5 is the network structure of the ECA module provided by the embodiment of the present invention;
[0086] Figure 6 It is the result of the normal angle and different tilt angles provided by the embodiment of the present invention;
[0087] Figure 7 is a schematic diagram of an original backbone ELAN module provided by an embodiment of the present invention;
[0088] Figure 8 is a schematic diagram of an attention series ELAN module provided by an embodiment of the present invention;
[0089] Fig. 9 is a schematic diagram of an attention parallel ELAN module provided by an embodiment of the present invention;
[0090] Fig.10 is a schematic diagram of pointer and scale segmentation results of different models provided by an embodiment of the present invention;
[0091] Fig.11 is a schematic diagram of the perspective transformation effect of a pointer-type dial provided by an embodiment of the present invention;
[0092] Fig.12 is a schematic diagram of pointer and scale segmentation results of different models provided by an embodiment of the present invention;
[0093] Fig.13 It is a schematic diagram of pointer and scale segmentation effects of different models provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0094] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0095] The present invention provides two specific embodiments and implementation schemes thereof for the deep learning industrial instrument pointer reading method:
[0096] Example 1: Car dashboard readings
[0097] 1) Feature Fusion:
[0098] The instrument cluster image is processed using attention series and parallel ELAN modules to highlight the instrument cluster needles and scales.
[0099] Optimize the attention mechanism to ensure accurate recognition of pointers and scales.
[0100] 2) Image correction:
[0101] A least squares ellipse fitting technique is used to identify the circular edge of the instrument panel.
[0102] Use the perspective transformation matrix to correct the tilt of the instrument panel image to ensure the accuracy of the reading.
[0103] 3) Feature extraction:
[0104] Use the U-Net++ model and Attention module to extract more accurate features of specific areas of the dashboard (such as pointers and scale areas).
[0105] 4) Channel relationship modeling:
[0106] The ECA module is introduced to enhance the correlation between feature channels and improve the model's ability to recognize dashboard details.
[0107] 5) Pointer positioning:
[0108] Use sliding angle technology to accurately locate the starting position of the pointer.
[0109] 6) Reading calculation:
[0110] The value is taken in the middle of the determined scale pixel, the specific position of the pointer on the dashboard is calculated, and converted into readings such as speed and fuel level.
[0111] Example 2: Industrial pressure gauge readings
[0112] 1) Feature fusion and optimization:
[0113] Apply attention series and parallel ELAN modules to the pressure gauge image, focusing on the features of the pointer and scale.
[0114] The stacking efficiency of feature layers and the accuracy of attention calculation are improved through optimization algorithms.
[0115] 2) Image correction:
[0116] Use a least squares ellipse fit to identify the circular scale area of the pressure gauge.
[0117] Apply the perspective transformation matrix to perform image correction to eliminate reading errors caused by angle problems.
[0118] 3) Deep feature extraction:
[0119] Combining the U-Net++ model and the Attention module, deep feature extraction is performed on the key areas of the pressure gauge.
[0120] 4) Feature channel dependency modeling:
[0121] The ECA module is introduced to enhance the interaction and correlation between feature channels when the model processes pressure gauge images.
[0122] 5) Pointer initial positioning:
[0123] Use sliding angle technology to accurately locate the starting position of the pointer.
[0124] 6) Reading conversion:
[0125] The value is taken from the middle of the scale pixel, the position of the pointer is determined, and the actual pressure reading is calculated based on the ratio.
[0126] The two embodiments provided by the present invention are applied to automobile dashboards and industrial pressure gauges, respectively, demonstrating the flexibility and accuracy of this deep learning method in different application scenarios. By combining a variety of advanced image processing and machine learning technologies, these implementations can effectively improve the automation and accuracy of instrument readings.
[0127] like Figure 1 As shown, the industrial instrument pointer reading method based on deep learning provided by an embodiment of the present invention includes the following steps:
[0128] S101, based on the YOLOv7 network, the attention series ELAN module and the attention parallel ELAN module, optimizes the stacking of feature layers and the attention calculation process to realize the intelligent instrument visual recognition framework.
[0129] S102, fitting a scale circle based on scale extraction and an ellipse fitting method of the least square method, and calculating a perspective transformation matrix to complete the tilt correction of the instrument image;
[0130] S103, based on the U-Net++ model, introduces the Attention module to centrally select and merge the features extracted from different levels on the expansion path;
[0131] S104, introduce the ECA module to model the interdependence between feature channels;
[0132] S105, introducing a sliding angle for addressing and positioning the starting pointer of the pointer-type instrument panel;
[0133] S106, taking values in the middle of the scale pixels to determine the start scale, end scale and pointer position of the dial, according to the proportional degree.
[0134] The first step provided in the embodiment of the present invention includes:
[0135] Step 101: The original backbone ELAN module in YOLOv7 is mainly composed of convolutional standard activation functions. There are 4 channels in total, which pass through 1, 1, 3, and 5 convolutional standard activation functions respectively. Finally, the feature layers of these 4 channels are stacked and integrated by a convolutional standard activation function.
[0136] Step 102: Attention series ELAN module. Since the feature layers of four channels are finally stacked, the number of feature layers is large, and some feature layers have a large effect while others have a small effect. Therefore, after the stacking layer, the channel attention of the stacked features is calculated through mean pooling, two-dimensional convolution, and sigmoid activation layer, and a weight is calculated for each feature layer. Finally, the weight is multiplied by the stacked feature to obtain the stacked feature after channel attention fusion, and finally the output feature is calculated through Conv2d_BN_SILU.
[0137] Step 103: Attention parallel ELAN module. The above attention series modules will completely ignore the layers with less effect in actual calculation, but these layers cannot be completely ignored, so Conv2d_BN_SILU and attention results are connected in series.
[0138] Step 104: The features of the two parts are fused by adding fusion, so that the layer with a large effect still has a higher weight, and the layer with a small effect is not completely ignored.
[0139] The second step provided in the embodiment of the present invention includes:
[0140] Step 201: performing data enhancement on the instrument image based on the data enhancement strategy;
[0141] Step 202: According to the characteristics of the instrument dial, a perspective transformation model is selected to eliminate the distortion of the pointer instrument image.
[0142] The specific transformation process is as follows:
[0143]
[0144]
[0145]
[0146] Among them, f 33 It is usually 1. From equations (2) and (3), we can see that the transformation matrix still has 8 unknowns;
[0147] Step 203: Extract four relatively stable groups of corresponding points based on the ellipse fitting method of the least squares method. First, establish a rectangular coordinate system on the instrument image plane:
[0148] F(A,B,C,D,E)=x 2 +Axy+By 2 +Cx+Dy+E=0 (4)
[0149] According to the least squares principle, if there are N (N ≥ 5) groups of data (x i ,y i )(i=1,2,3,…,N), then the parameters A, B, C, D, E can be determined by finding the minimum value of the objective function (5):
[0150]
[0151] Let the partial derivatives of the function F(A,B,C,D,E) with respect to each of its parameters be zero, then we can get the following set of equations:
[0152]
[0153] Solving this linear equation system can solve A, B, C, D, E, and the common parameters of the ellipse can be obtained from formula (6):
[0154]
[0155] Among them, (x0, y0) is the center of the ellipse, a is the semi-major axis, c is the semi-minor axis, and θ is the major axis deflection. After extracting the scale, the least squares ellipse fitting is performed according to the distal end points of each scale to obtain the ellipse where the scale is located. The perspective transformation matrix can be obtained by using the major and minor axis endpoints of the ellipse and the upper, lower, left and right four points of the setting circle of the perspective plane to complete the tilt correction (such as Figure 2 shown).
[0156] Step 2 provided in the embodiment of the present invention uses a nested U-Net as the basic network framework (such as Figure 3 ). The encoder and decoder are symmetrically arranged on both sides of the network. The context information extracted by the encoder is propagated to the decoder of the corresponding layer through dense skip connections, so that more effective hierarchical features can be extracted. After receiving the features of each layer, the decoder restores the features in a bottom-up manner.
[0157] The step 3 includes the following sub-steps:
[0158] Step 301: Define the feature map as follows, using X i,j represents the output of the block, where i is the feature depth in the encoder and j is the depth of the convolutional layer along the skip connection in the nested block, so the extracted convolutional layer feature map can be defined as:
[0159]
[0160] Where Φ[] represents the convolutional block after the concatenation and merging, Up() and Ag() represent upsampling and attention gate selection, respectively.
[0161] Step 302: The network extracts features from the encoder and passes them to the decoder through dense skip connections to achieve the integration of hierarchical representations. An attention gate mechanism is added between the nested convolutional blocks so that features extracted at different levels can be centrally selected and merged on the expansion path.
[0162] Step 4 provided in the embodiment of the present invention introduces an ECA module (such as Figure 4 shown).
[0163] The ECA module considers each channel and its k adjacent channels to capture local cross-channel interactions. Its structure is as follows Figure 5 As shown in the figure, it consists of three parts: H, W, and C represent the length, width, and input feature number, respectively. GAP represents global average pooling, σ represents the Sigmoid activation function, and K is the adaptively determined convolution kernel size.
[0164] 1. GAP generates a feature map of size 1*1*c;
[0165] 2. Calculate the size of the adaptive convolution kernel;
[0166] 3. Apply the kernel size to a 1D convolution to get the weights for each channel.
[0167] Among them, the channel dimension C is proportional to the size of the convolution kernel k, and the number of convolution kernels is set to 2 to the power of k, and the formula is as follows:
[0168]
[0169] The formula for convolution kernel size is as follows:
[0170]
[0171] Where |t| odd represents an odd number close to t. The value of γ is 2, and the value of b is 1. The ECA module involves fewer parameters, avoids the reduction of feature dimension, increases the interaction of information between channels, and effectively improves the performance of the model.
[0172] The angle method commonly used in current detection schemes for calculating indications has certain limitations. When the dial is tilted at a large angle, the initial angle detection fails. Figure 6 (a) Pointer instruments of the standard angle type, in which case the angle method may be used to obtain the indication; Figure 6 (b) and Figure 6 The pointer instrument shown in (c) has large and small tilt angles, and the angle method cannot be used to calculate the reading. For instruments with tilt angles, the pointer instrument reading calculation based on the sliding angle is introduced.
[0173] Step 5 provided in the embodiment of the present invention includes:
[0174] Step 501: First determine the size of the sliding window. The size of the sliding window is first set to 15 degrees.
[0175] Step 502: Move the sliding angle forward a certain distance (5 degrees), and then continue to move the window until the starting scale of the pointer instrument is found.
[0176] In step 6 provided in the embodiment of the present invention, the reading of the start and end of the dial is to directly obtain the start of the dial scale pixel. In fact, the start of the scale has a certain pixel width. Therefore, the value is taken in the middle of the pixel in the scale at the start of the scale to obtain the maximum scale and the minimum scale of the pointer instrument.
[0177] Step 601: Take a value in the middle of the pixel in the scale where the scale starts, and obtain the maximum scale and the minimum scale of the pointer instrument.
[0178] Step 602: Read the pointer meter in proportion to the pixel position of the pointer.
[0179] The embodiment of the present invention adopts Focal Loss as the loss function to solve the problem that the pointer instrument image usually has uneven samples. Focal Loss solves the sampling problem in our collision risk assessment by suppressing the contribution of large and simple classes, and in turn emphasizes improving the minority classification. A weighting factor α and an adjustment factor (1-p t ) γ To solve this problem, where γ is greater than or equal to 0, the former balances the significance between positive and negative examples, and the latter adjusts the weights of easy and difficult examples to make them more differentiable. The equation is defined as:
[0180] FL(p y )=-α t (1-p t ) γ log(p t )
[0181] In a correct class, the cross entropy loss is inversely proportional to the confidence, which is expressed as a binary classification. Assuming an extreme imbalance of classes, when the probability is large p t →1, for well-classified examples, the modulation factor decreases (1-p T ) γ → 0. The loss contribution from the majority class is reduced and effectively down-weighted. When a rare class is misclassified and p t When is very small, the modulation function approaches 1 and the loss is comparable to the loss calculated by cross entropy.
[0182] The industrial instrument pointer reading system based on deep learning provided by the embodiment of the present invention includes:
[0183] Image positioning module, used to identify instruments under complex backgrounds;
[0184] Image processing module, used to perform data enhancement on instrument images and eliminate image distortion;
[0185] Feature extraction module, used to model and extract image features;
[0186] Degree module, used to read the meter pointer readings.
[0187] The system structure and workflow provided by the present invention are as follows:
[0188] Image preprocessing: First, the instrument image is preprocessed by an ellipse fitting method based on scale extraction and least squares method. This includes fitting the scale circle and calculating the perspective transformation matrix to complete the tilt correction of the instrument image.
[0189] Deep learning model: The U-Net++ model is used, and the Attention module and ECA module are introduced into it. These modules focus on selecting and merging the features extracted at different levels, modeling the interdependence between feature channels, thereby improving the accuracy of the instrument pointer.
[0190] Pointer positioning and scale reading: The sliding angle is introduced for the start pointer addressing and positioning of the pointer instrument panel. By taking the value in the middle of the scale pixel, the start scale, end scale and pointer position of the dial are determined, and the reading is performed according to the proportional degree.
[0191] Environmental adaptability: In order to improve the recognition accuracy and efficiency in complex environments, the YOLOv7 network is introduced to implement the intelligent instrument visual recognition framework. Through the attention series ELAN module and the attention parallel ELAN module, the stacking of feature layers and the attention calculation process are optimized to better adapt to the role of different feature layers. Through feature fusion, it is ensured that the layers with large roles still have higher weights, and the layers with small roles are not completely ignored.
[0192] Application effects of the present invention:
[0193] Improved accuracy: Compared with traditional methods, the system significantly improves the accuracy of meter readings in complex environments, especially in cases of uneven lighting and complex backgrounds.
[0194] Real-time and efficiency: The introduction of the YOLOv7 network enables the system to have a faster reasoning speed and realize real-time recognition and reading of instruments.
[0195] Environmental adaptability: Through the introduction of the attention module and the ECA module, the system has better adaptability to instruments in different environments, which improves the versatility and robustness of the system.
[0196] The industrial instrument pointer reading method based on deep learning provided by the application embodiment of the present invention is applied to a computer device, and the computer device includes a memory and a processor, and the memory stores a computer program. When the computer program is executed by the processor, the processor executes the steps of the industrial instrument pointer reading method based on deep learning.
[0197] The industrial instrument pointer reading method based on deep learning provided by the application embodiment of the present invention is applied to an information data processing terminal, and the information data processing terminal is used to implement the industrial instrument pointer reading system based on deep learning.
[0198] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. It can be understood by a person of ordinary skill in the art that the above-mentioned devices and methods can be implemented using computer executable instructions and / or contained in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium. The device and its modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software, such as firmware.
[0199] like Fig.11 As shown, the schematic diagram of the perspective transformation effect of the pointer dial.
[0200] like Fig.12 As shown, schematic diagrams of pointer and scale segmentation results of different models.
[0201] like Fig.13 As shown, it is a schematic diagram of the pointer and scale segmentation effects of different models.
[0202] Model Precision Recall Map 0.5 Map 0.95 Bas Model 0.893 0.806 0.859 0.59 Series Model 0.906 0.85 0.912 0.676 Parallel Model 0.887 0.907 0.94 0.713
[0203] Schematic diagram of experimental results of series-parallel and original models
[0204] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principle of the present invention should be covered by the protection scope of the present invention.
Claims
1. A deep learning method for reading industrial instrument pointers, characterized in that: include: Step 1: Use the attention series ELAN module and the attention parallel ELAN module to fuse the features of the two parts and optimize the stacking of feature layers and the attention calculation process; Step 2: Based on scale extraction and the ellipse fitting method of the least square method, the scale circle is fitted and the perspective transformation matrix is calculated to complete the tilt correction of the instrument image; Step 3: Based on the U-Net++ model, the Attention module is introduced to centrally select and merge the features extracted from different levels on the expansion path; Step 4: Introduce the ECA module to model the interdependencies between feature channels; Step 5, introducing a sliding angle for addressing and positioning the starting pointer of the pointer instrument panel; Step six, take a value in the middle of the scale pixel to determine the start scale, end scale and pointer position of the dial according to the proportional degree.
2. The deep learning industrial instrument pointer reading method according to claim 1 is characterized in that: The step one comprises: Step 1: In order to improve the accuracy and efficiency of pointer instrument recognition in complex environments, the YOLOv7 network is used to implement the intelligent instrument visual recognition framework; Step 101: The original backbone ELAN module in YOLOv7 is shown in Figure 7. It can be seen that it is mainly composed of convolutional standard activation functions. There are 4 channels in total, which pass through 1, 1, 3, and 5 convolutional standard activation functions respectively. Finally, the feature layers of these 4 channels are stacked and integrated by a convolutional standard activation function. Step 102: The attention series ELAN module is shown in Figure 9. Since the feature layers of four channels are finally stacked, the number of feature layers is large, and some feature layers have a large effect while others have a small effect. Therefore, after the stacking layer, the channel attention of the stacked features is calculated through mean pooling, two-dimensional convolution, and sigmoid activation layer. A weight is calculated for each feature layer, and finally the weight is multiplied by the stacked feature to obtain the stacked feature after channel attention fusion. Finally, the output feature is calculated through Conv2d_BN_SILU; Step 103: The attention parallel ELAN module is shown in Figure 10. The above attention series module will completely ignore the layers with smaller effects in actual calculations, but these layers cannot be completely ignored, so Conv2d_BN_SILU and the attention result are connected in series; Step 104: The features of the two parts are fused by adding fusion, so that the layer with a large effect still has a higher weight, and the layer with a small effect is not completely ignored; The second step comprises: Step 201: performing data enhancement on the instrument image based on the data enhancement strategy; Step 202: According to the characteristics of the instrument dial, a perspective transformation model is selected to eliminate the distortion of the pointer instrument image. The specific transformation process is as follows: Among them, f 33 It is usually 1. From equations (2) and (3), we can see that the transformation matrix still has 8 unknowns; Step 203: Extract four relatively stable groups of corresponding points based on the ellipse fitting method of the least squares method. First, establish a rectangular coordinate system on the instrument image plane: F(A,B,C,D,E)x 2 +Axy+By 2 +Cx+Dy+E0 (4) According to the least squares principle, if there are N (N ≥ 5) groups of data (x i ,y i )(i=1,2,3,…,N), then the parameters A, B, C, D, E can be determined by finding the minimum value of the objective function (5): Let the partial derivatives of the function F(A,B,C,D,E) with respect to each of its parameters be zero, then we can get the following set of equations: Solving this linear equation system can solve A, B, C, D, E, and the common parameters of the ellipse can be obtained from formula (6): Among them, (x0, y0) is the center of the ellipse, a is the semi-major axis, b is the semi-minor axis, and θ is the major axis deflection. After extracting the scale, the least squares ellipse fitting is performed according to the distal end points of each scale to obtain the ellipse where the scale is located. The perspective transformation matrix can be obtained by using the major and minor axis endpoints of the ellipse and the upper, lower, left and right four points of the set circle of the perspective plane to complete the tilt correction.
3. The deep learning industrial instrument pointer reading method according to claim 1 is characterized in that: In step 3, a nested U-Net is used as the basic network framework. The encoder and decoder are symmetrically arranged on both sides of the network. The context information extracted by the encoder is propagated to the decoder of the corresponding layer through dense skip connections to extract more effective hierarchical features. After receiving the features of each layer, the decoder restores the features in a bottom-up manner. Specifically, the following sub-steps are included: Step 301: Define the feature map as follows, using X i,j represents the output of the block, where i is the feature depth in the encoder and j is the depth of the convolutional layer along the skip connection in the nested block, so the extracted convolutional layer feature map can be defined as: Where Φ[] represents the convolutional block after the concatenation and merging, Up() and Ag() represent upsampling and attention gate selection respectively; Step 302: The network extracts features from the encoder and passes them to the decoder through dense skip connections to achieve the integration of hierarchical representations. An attention gate mechanism is added between the nested convolutional blocks so that features extracted at different levels can be centrally selected and merged on the expansion path.
4. The deep learning industrial instrument pointer reading method according to claim 1 is characterized in that: In step 4, the ECA module considers each channel and its k adjacent channels to capture local cross-channel interactions, and consists of three parts: where H, W, and C represent the length, width, and input feature number, respectively, GAP represents global average pooling, σ represents the Sigmoid activation function, and K is the size of the convolution kernel determined adaptively: Step 401: GAP generates a feature map of size 1*1*c; Step 402: Calculate the size of the adaptive convolution kernel; Step 403: Apply the convolution kernel size to the one-dimensional convolution to obtain the weight of each channel, where the channel dimension C is proportional to the size of the convolution kernel k, and the number of convolution kernels is set to 2 to the power of k, as shown in the following formula: The formula for convolution kernel size is as follows: Where |t| odd Represents an odd number close to t, with a value of γ of 2 and a value of b of 1.
5. The deep learning industrial instrument pointer reading method according to claim 1 is characterized in that: The step five comprises: Step 501: Determine the size of the sliding window and set it to 15 degrees; Step 502: Move the sliding angle forward a certain distance (5 degrees), and then continue to move the window until the starting scale of the pointer instrument is found.
6. The deep learning industrial instrument pointer reading method according to claim 1 is characterized in that: The loss function uses Focal Loss as the loss function, introduces a weighting factor α and an adjustment factor (1-p t ) γ , where γ is greater than or equal to 0, the equation is defined as: FL(p y )=-a t (1-p t ) γ log(p t )。 7. An industrial instrument pointer reading system based on deep learning according to any one of claims 1 to 7, characterized in that: The industrial instrument pointer reading system based on deep learning includes: Image positioning module, used to identify instruments under complex backgrounds; Image processing module, used to perform data enhancement on instrument images and eliminate image distortion; Feature extraction module, used to model and extract image features; Degree module, used to read the meter pointer readings.
8. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the industrial instrument pointer reading method based on deep learning as described in any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the industrial instrument pointer reading method based on deep learning as described in any one of claims 1 to 7.
10. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the industrial instrument pointer reading system based on deep learning as described in claim 8.
Citation Information
Patent Citations
Round pointer type instrument correction and reading identification method
CN115512343A
Deep learning-based pointer instrument identification and abnormity alarm method
CN116844147A
Deep-learning-based method for automatically reading pointer instrument
WO2022057103A1
Cited By
Instrument panel data determination method and device, storage medium and electronic device
CN119478908A
Remote automatic acquisition system and method for pressure gauge data
CN119942509A
