Reading method and device of pointer type instrument, electronic equipment and storage medium
Through deep learning segmentation algorithms and image processing technology, the problem of poor universality of pointer instrument reading methods in the existing technology has been solved, and accurate readings and robustness improvements for multi-style instruments have been achieved.
Patent Information
- Application Number
- CN202310205806.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-06
- Publication Date
- 2024-09-06
AI Technical Summary
The existing technology is difficult to read accurately in the environment of complex backgrounds, uneven lighting and diverse pointer instruments, and the traditional method has low universality and cannot identify dual-pointer or multi-pointer instruments.
The deep learning segmentation algorithm is used for multi-level feature learning, the inclination of the scale area is corrected, the pointer area is segmented through the connected domain algorithm, and the reading is calculated using an image processing algorithm.
It achieves accurate readings of multi-style pointer instruments, improves robustness and universality, and can accurately identify single-pointer, double-pointer and multi-pointer instruments in complex environments.
Smart Images

Figure CN118608775A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data processing, and in particular relates to a reading method, device, electronic equipment and storage medium of a pointer-type instrument. Background Art
[0002] Pointer instruments have long been widely used in the fields of national power grid, industrial control, automobile and shipbuilding, as well as in our daily life due to their simple structure, easy use, stable performance and low cost. However, for pointer instruments, since there is no data transmission interface, it is difficult to achieve automatic data collection and real-time monitoring to meet the needs of automation. Therefore, it is of great practical significance to identify the readings of pointer instruments through camera technology and image processing technology.
[0003] At present, the main method to solve the problem of pointer instrument reading is image processing technology. However, traditional image processing technology is easily affected by noise, especially in natural environments with complex backgrounds and uneven lighting. It is difficult to perform effective reading recognition. The uneven lighting indoors and outdoors in the instrument use environment and the uneven background of the instrument placement will make it difficult to extract the instrument. In addition, there are many types of pointer instruments in actual use, with various instrument backgrounds, scale styles, and pointer types. There are obvious differences between diversified pointer instruments and single pointer instruments, which will lead to low universality of traditional recognition methods based on fixed thresholds. Therefore, most pointer instrument reading algorithms based on image processing technology have limitations.
[0004] However, the existing related technologies are studied under the conditions that the instrument image is relatively clear and the dial position is relatively ideal. When there is a lot of background interference in the instrument image, the dial position is not centered, the dial is tilted, etc., the instrument scale and pointer cannot be accurately extracted, and the deflection angle of the pointer is inaccurately calculated, resulting in reading errors. Moreover, it is not universally applicable to a wide variety of pointer instruments and complex and changeable usage environments. At the same time, most existing algorithms only support the reading of single-pointer instruments, and cannot normally identify and read dual-pointer instruments or multi-pointer instruments.
[0005] Therefore, there is an urgent need for a method for reading pointer instruments with strong versatility. Summary of the invention
[0006] The embodiments of the present invention provide a pointer instrument reading method, device, electronic device and storage medium to solve the problem of poor versatility of the pointer instrument reading method in the related art.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] According to one aspect of the present invention, a method for reading a pointer instrument comprises: obtaining an original image of the pointer instrument; using a deep learning segmentation algorithm to perform multi-level feature learning on the scale area and pointer area of the pointer instrument in the original image to obtain a segmentation map, wherein the segmentation map comprises a scale area feature map and a pointer area feature map; correcting the inclination of the scale area in the scale area feature map, and segmenting multiple pointers in the pointer area in the pointer area feature map by a connected domain algorithm; and calculating the reading of the pointer instrument based on the corrected scale area and the segmented multiple pointers.
[0009] In an exemplary embodiment, a deep learning segmentation algorithm is implemented by an encoder and a decoder; the deep learning segmentation algorithm is used to perform multi-level feature learning on the scale area and the pointer area of the pointer-type instrument in the original image to obtain a segmentation map, including performing multi-level feature extraction on the original image by the encoder to obtain multiple output feature maps; inputting the multiple output feature maps into the decoder, and performing feature fusion on the multiple output feature maps by the decoder to obtain the segmentation map.
[0010] In an exemplary embodiment, the encoder includes a feature extraction layer and a spatial pyramid pooling layer; the feature extraction layer includes multiple layers of convolution, and the spatial pyramid pooling layer includes a hole convolution module and a global average pooling module; the encoder performs multi-level feature extraction on the original image to obtain multiple output feature maps, including inputting the original image into the feature extraction layer, performing feature extraction through multiple layers of convolution in the feature extraction layer, and obtaining local feature maps; inputting the local feature map into the spatial pyramid pooling layer, performing hole convolution with different expansion rates on the local feature map through the hole convolution module in the spatial pyramid pooling layer, and performing pooling operation on the local feature map through the global average pooling module in the spatial pyramid pooling layer to obtain multiple intermediate feature maps; and using a merged feature map after merging multiple intermediate feature maps and a local feature map obtained in the process of feature extraction through multiple layers of convolution as the output feature map.
[0011] In an exemplary embodiment, the decoder performs feature fusion on the multiple output feature maps to obtain the segmentation map, including performing channel dimensionality reduction on the local feature maps in the output feature maps and upsampling the merged feature maps in the output feature maps through the decoder; obtaining a fused feature map by merging the local feature maps after channel dimensionality reduction and the merged feature maps after upsampling; and restoring the resolution of the fused feature map according to the resolution of the original image to obtain the segmentation map.
[0012] In an exemplary embodiment, correcting the inclination of the scale area in the scale area feature map includes performing ellipse fitting on pixel points in the scale area feature map based on an approximate mean square ellipse fitting algorithm to obtain a fitted scale area; using the major axis endpoint and / or minor axis endpoint of the fitted scale area as a reference point, performing a perspective transformation on the scale area feature map to achieve correction of the scale area.
[0013] In an exemplary embodiment, after performing multi-level feature learning on the scale area and the pointer area of the pointer instrument in the original image to obtain a segmentation map, the method further includes performing a morphological opening operation on the segmentation map to obtain a denoised segmentation map; the morphological opening operation on the segmentation map to obtain a denoised segmentation map includes: traversing the segmentation map through a morphological opening operation, taking the traversed structural element area as the current structural element area; the traversal includes taking the minimum value of pixels in the current structural area as the value of each pixel point in the current structural area; and / or taking the maximum value of pixels in the current structural area as the value of each pixel point in the current structural area; until all structural element areas are traversed to obtain a denoised segmentation map.
[0014] In an exemplary embodiment, after acquiring the original image of the pointer instrument, the method further includes performing image enhancement processing on the original image, so that the enhanced original image is used for multi-level feature learning using a deep learning segmentation algorithm.
[0015] According to one aspect of the present invention, a reading device for a pointer instrument comprises: an original image acquisition module, used to acquire the original image of the pointer instrument; an image segmentation module, used to perform multi-level feature learning on the scale area and pointer area of the pointer instrument in the original image using a deep learning segmentation algorithm to obtain a segmentation map, wherein the segmentation map includes a scale area feature map and a pointer area feature map; an image adjustment module, used to correct the inclination of the scale area in the scale area feature map, and segment multiple pointers in the pointer area in the pointer area feature map using a connected domain algorithm; and an instrument reading module, used to calculate the reading of the pointer instrument based on the corrected scale area and the segmented multiple pointers.
[0016] According to one aspect of the present invention, an electronic device includes a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the method for reading a pointer instrument as described above is implemented.
[0017] According to one aspect of the present invention, a storage medium stores a computer program thereon, and when the computer program is executed by a processor, the method for reading a pointer instrument as described above is implemented.
[0018] According to one aspect of the present invention, a computer program product includes a computer program, the computer program is stored in a storage medium, a processor of a computer device reads the computer program from the storage medium, and the processor executes the computer program, so that when the computer device executes the computer program, the method for reading a pointer instrument as described above is implemented.
[0019] In the above technical solution, the present invention realizes the reading of pointer-type instruments with strong versatility.
[0020] Specifically, the present invention first obtains an original image of a pointer instrument, and then uses a deep learning segmentation algorithm to perform multi-level feature learning on the scale area and pointer area of the pointer instrument in the original image to obtain a segmentation map, which includes a scale area feature map and a pointer area feature map, and then corrects the inclination of the scale area in the scale area feature map, and uses a connected domain algorithm to segment multiple pointers in the pointer area in the pointer area feature map. Based on the corrected scale area and the segmented multiple pointers, the reading of the pointer instrument is calculated. That is, the deep learning segmentation algorithm and the image processing algorithm are combined to read the pointer instrument, and the deep learning segmentation algorithm is used to extract the characteristic mode of the dial from the instrument image, and then the scale area information and the pointer area information are fitted from the characteristic mode of the dial through the image processing algorithm, so as to achieve the adjustment of the scale area inclination and the segmentation of multiple pointers in the pointer area, so as to effectively support the reading tasks of various types of pointer instruments and improve the versatility and robustness of pointer instrument readings.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0023] Figure 1 It is a comparative schematic diagram of a single-style instrument and a multi-style instrument involved in this application;
[0024] Figure 2 It is a schematic diagram of the implementation environment involved in this application;
[0025] Figure 3 is a flow chart of a method for reading a pointer instrument according to an exemplary embodiment;
[0026] Figure 3a yes Figure 3 A schematic diagram of the automatic identification of readings by the angle method involved in the corresponding embodiment;
[0027] Figure 4 is a schematic diagram of the structure of a deep learning segmentation model according to an exemplary embodiment;
[0028] Figure 5a yes Figure 3 A flowchart of a feature extraction process in step 130 in a corresponding embodiment;
[0029] Figure 5b yes Figure 3 A flowchart of a feature fusion process in step 130 in a corresponding embodiment;
[0030] Figure 6 yes Figure 3 A flowchart of an embodiment corresponding to step 150 in an embodiment;
[0031] Figure 7 is a schematic diagram showing the effect of data enhancement according to an exemplary embodiment;
[0032] Figure 8 is a schematic diagram of a reading result of a pointer-type instrument according to an exemplary embodiment;
[0033] Fig. 9 is a block diagram of a reading device of a pointer instrument according to an exemplary embodiment;
[0034] Fig.10 is a hardware structure diagram of an electronic device according to an exemplary embodiment;
[0035] Fig.11 It is a block diagram of an electronic device according to an exemplary embodiment.
[0036] The above-mentioned drawings have shown clear embodiments of the present invention, which will be described in more detail hereinafter. These drawings and textual descriptions are not intended to limit the scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0037] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.
[0038] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0039] Deep learning is an algorithm that learns multiple abstract data representations through multi-layer networks. It is a branch of machine learning and is currently the most popular branch. Deep learning has demonstrated powerful learning capabilities in many fields. Deep learning has pushed many AI technologies to various practical application scenarios. This is mainly due to the feature learning capabilities of deep learning from large amounts of data. The automatic feature extraction of deep learning has gradually replaced traditional manual feature extraction.
[0040] However, most of the existing algorithms are studied when the instrument image is relatively clear and the dial position is relatively ideal. For situations where the instrument image has a lot of background interference, the dial position is not centered, the dial is tilted, etc., the algorithm cannot accurately extract the instrument scale and pointer, resulting in inaccurate calculation of the pointer deflection angle causing reading errors. Most algorithms have high accuracy in identifying and reading specific instruments, but are not applicable to other types of instruments. This is not universal for a wide variety of pointer instruments and complex and changeable usage environments. In addition, most of the existing algorithms only support the reading of single-pointer instruments, but cannot normally identify and read dual-pointer and multi-pointer instruments.
[0041] like Figure 1 As shown, most algorithms only support the simple single-style instruments in the first column of the figure, and do not support the multi-style instruments in the second column.
[0042] As can be seen from the above, the related technology does not support automatic reading of various types of pointer instruments and has the defect of poor versatility.
[0043] To this end, the reading method of the pointer instrument provided in the present application first obtains the original image of the pointer instrument, and then uses the deep learning segmentation algorithm to perform multi-level feature learning on the scale area and the pointer area of the pointer instrument in the original image to obtain a segmentation map, which includes a scale area feature map and a pointer area feature map, and then corrects the inclination of the scale area in the scale area feature map, and segments the multiple pointers in the pointer area in the pointer area feature map through a connected domain algorithm, and calculates the reading of the pointer instrument based on the corrected scale area and the segmented multiple pointers, that is, combines the deep learning algorithm and the image processing algorithm, and uses the deep learning algorithm The characteristic mode of the dial is extracted from the instrument image, and then the scale area information and the pointer area information are fitted from the characteristic mode of the dial through an image processing algorithm, so as to achieve the adjustment of the inclination of the scale area and the segmentation of multiple pointers in the pointer area, thereby being able to effectively support the reading tasks of various types of pointer instruments and improve the versatility and robustness of pointer instrument readings. Accordingly, the reading method of the pointer instrument is suitable for a reading device of the pointer instrument, and the reading device of the pointer instrument can be deployed in an electronic device, for example, the electronic device can be a computer device deployed with a von Neumann architecture, and the computer device can be a desktop computer, a laptop computer, a server, and the like.
[0044] Figure 2 The schematic diagram of the implementation environment of a pointer instrument reading method includes a collection end 110 and a server end 130 .
[0045] Specifically, the acquisition end 110 acquires the image of the pointer instrument. The acquisition end 110 may be an electronic device such as a smart phone, a tablet computer, a laptop computer, a desktop computer, or other devices with image acquisition functions (such as a smart camera), which is not limited here.
[0046] The acquisition terminal 110 and the server terminal 130 may be connected to each other by wired or wireless communication to achieve data transmission between the two. For example, the transmitted data may be a pointer instrument image or the like.
[0047] The server end 130 may also be considered as a cloud, a cloud platform, a platform end, a service end, etc. The server end 130 may be a server, a server cluster consisting of multiple servers, or a cloud computing center consisting of multiple servers, so as to better provide background services to the mass data collection end 110. For example, the background service includes a pointer meter reading service.
[0048] With the interaction between the acquisition end 110 and the server end 130, in an application scenario, taking the server end 130 providing a pointer meter reading service as an example, after the acquisition end 110 obtains the pointer meter image, it sends the pointer meter image to the server end 130, so that the server end 130 can receive the pointer meter image sent by the acquisition end 110, and then provide the pointer meter reading service based on the pointer meter image. Specifically, after the server end 130 obtains the pointer meter image, it can use the deep learning segmentation algorithm to perform multi-level feature learning on the scale area and pointer area of the pointer meter in the pointer meter image to obtain a segmentation map, which includes a scale area feature map and a pointer area feature map, and then correct the inclination of the scale area in the scale area feature map, and segment the multiple pointers in the pointer area feature map through the connected domain algorithm, and then calculate the reading of the pointer meter based on the corrected scale area and the segmented multiple pointers.
[0049] Of course, in another application scenario, the acquisition end 110 can also realize the acquisition of pointer instrument images and the reading of pointer instrument simultaneously, which is not limited here.
[0050] See also Figure 3 The embodiment of the present application provides a method for reading a pointer instrument, which is applicable to electronic devices, for example, the electronic device can be a desktop computer, a laptop computer, a server, etc., and can also be a mobile device such as a smart phone and a tablet computer.
[0051] In the following method embodiments, for ease of description, the execution subject of each step of the method is taken as an electronic device as an example for illustration, but this does not constitute a specific limitation.
[0052] like Figure 3 As shown, the method may include the following steps:
[0053] Step 110, obtaining the original image of the pointer instrument.
[0054] The original image of the pointer instrument can be obtained by shooting and collecting through the acquisition end. The acquisition end can be an electronic device with an image acquisition function, such as a camera, a smart phone equipped with a camera, etc. It can be understood that the shooting can be a single shot to obtain a photo, or multiple shots to obtain a video, that is, the original image of the pointer instrument can be any frame in the video, or a photo.
[0055] Regarding the acquisition of the original image of the pointer instrument, the original image of the pointer instrument can come from the original image of the pointer instrument captured and collected in real time by the acquisition end, or it can be the original image of the pointer instrument captured and collected by the acquisition end in a historical time period pre-stored in the electronic device. Then, for the electronic device, after the acquisition end captures and collects the original image of the pointer instrument, the original image of the pointer instrument can be processed in real time, or it can be pre-stored and processed, for example, the original image of the pointer instrument can be processed when the CPU of the electronic device is low, or the original image of the pointer instrument can be processed according to the instructions of the staff. Therefore, the reading of the pointer instrument in this embodiment can be for the original image of the pointer instrument acquired in real time, or for the original image of the pointer instrument acquired in a historical time period, which is not specifically limited here.
[0056] Step 130, using a deep learning segmentation algorithm, multi-level feature learning is performed on the scale area and pointer area of the pointer instrument in the original image to obtain a segmentation map.
[0057] The segmentation map includes a scale region feature map and a pointer region feature map. The scale region feature map is used to describe the local features of the scale region of the pointer instrument; the pointer region feature map is used to describe the local features of at least one pointer in the pointer region of the pointer instrument.
[0058] That is to say, the embodiment of the present invention can learn the feature modes of the dial in the instrument image through multi-level feature learning of the deep learning segmentation algorithm, including not only low-level feature modes but also high-level feature modes, thereby improving the accuracy of feature extraction of different types of pointer instruments, and laying a solid foundation for subsequent automatic reading.
[0059] Step 150, correcting the inclination of the scale area in the scale area feature map, and segmenting the multiple pointers in the pointer area in the pointer area feature map by using a connected domain algorithm.
[0060] The inventors realize that different camera shooting angles will cause the original image of the pointer instrument to tilt. Therefore, before automatically identifying the reading of the pointer instrument, the scale area and / or the pointer area need to be corrected. In one possible implementation, the tilt correction is achieved through a curve fitting algorithm + perspective transformation, so as to avoid the situation where the dial position is not centered, the dial is tilted, etc., which causes errors in the reading, thereby greatly improving the robustness of the automatic reading to the environment.
[0061] In one possible implementation, multiple pointers in the segmented pointer area are implemented through a connected domain algorithm, so that automatic reading is applicable not only to single-pointer instruments but also to multi-pointer instruments. Specifically, the feature map of the pointer area is binarized to obtain a binary image related to the scale area, and the foreground pixels in the binary image are marked with connected domains to obtain multiple connected areas. The pointers in each connected area are segmented, and finally the multiple pointers in the pointer area of the pointer instrument are segmented. It is explained here that, taking the binary image as a black and white image, the foreground pixels are distinguished from the background pixels, and the foreground pixels refer to white pixels, and the background pixels refer to black pixels.
[0062] Step 170, based on the calibrated scale area and the multiple segmented pointers, calculate and obtain the reading of the pointer instrument.
[0063] The inventors realize that, regardless of whether the pointer instrument is a single-style pointer instrument or a multi-style pointer instrument, in terms of the construction principle of the pointer instrument, there is a linear relationship between the two ends of the scale and the angle of rotation of the pointer. Based on this, in a possible implementation method, the angle method is used to automatically identify the reading of the pointer instrument. Specifically, the angle between the pointer and the scale lines with different scale values, and the angle between the scale lines with different scale values, is used to automatically identify the reading of the pointer instrument.
[0064] Specifically, Figure 3a As shown in the figure, a and b are the minimum and maximum endpoints of the scale on the dial after the ellipse fitting, respectively, the rotation center is O, L represents the straight line where the pointer is located after the ellipse fitting, α represents the angle between the pointer and the minimum scale line, and θ represents the angle of the entire scale area.
[0065] The meter reading is calculated as follows:
[0066]
[0067] Among them, R a Indicates the minimum scale value, R b Indicates the maximum scale value.
[0068] Through the above process, the pointer instrument is read by combining the deep learning segmentation algorithm and the image processing algorithm. The characteristic mode of the dial is extracted from the instrument image using the deep learning segmentation algorithm, and then the scale area information and the pointer area information are fitted from the characteristic mode of the dial through the image processing algorithm. In this way, the adjustment of the inclination of the scale area and the segmentation of multiple pointers in the pointer area can be achieved, thereby effectively supporting the reading tasks of various styles of pointer instruments and improving the versatility and robustness of pointer instrument readings.
[0069] In an exemplary embodiment, the deep learning segmentation algorithm in the embodiment of the present invention is obtained through a deep learning segmentation model. Figure 4 A schematic diagram of the structure of a deep learning segmentation model in an embodiment is shown, and the deep learning segmentation model includes an encoder for performing multi-level feature extraction on an original image and a decoder for performing feature fusion of output feature maps output by multiple encoders. Specifically, the encoder in the deep learning segmentation model includes a feature extraction layer and a spatial pyramid pooling layer, wherein the feature extraction layer includes a multi-layer convolution, and the spatial pyramid pooling layer includes a dilated convolution module and a global average pooling module.
[0070] Combine the following Figure 4 The structure of the deep learning segmentation model describes the feature extraction process in detail as follows:
[0071] like Figure 5a As shown, in an exemplary embodiment, performing multi-level feature extraction on the original image by an encoder to obtain multiple output feature maps may include the following steps:
[0072] Step 131, input the original image into the feature extraction layer, perform feature extraction through multi-layer convolution in the feature extraction layer, and obtain a local feature map.
[0073] Please refer to Figure 4 The encoder mainly includes two parts: the feature extraction layer DCNN and the spatial pyramid pooling layer ASPP. The local feature map calculated from the multi-layer convolution of the feature extraction layer DCNN is divided into two parts. One part is the local feature map output by the middle convolution layers of the feature extraction layer DCNN, which is input into the decoder. The other part is the local feature map output by the last convolution layer of the feature extraction layer DCNN, which is sent to the spatial pyramid pooling layer ASPP module. It should be noted that the local feature maps extracted by different layers of convolution are different. It should be understood that as the level goes deeper, the local feature maps obtained have higher-level feature modes. That is to say, the local feature maps output by the middle convolution layers represent lower-level feature modes, and the local feature maps output by the last convolution layer represent higher-level feature modes.
[0074] Step 132, input the local feature map into the spatial pyramid pooling layer, perform dilated convolutions with different dilation rates on the local feature map through the dilated convolution module in the spatial pyramid pooling layer, and perform pooling operations on the local feature map through the global average pooling module in the spatial pyramid pooling layer to obtain multiple intermediate feature maps.
[0075] Continue reading Figure 4The spatial pyramid pooling layer ASPP module takes the local feature map output by the last convolution layer of the feature extraction layer DCNN as input, uses four hole convolution modules with different expansion rates (the module includes convolution, batch normalization layer, and activation layer) to perform hole convolution on the local feature map, and uses a global average pooling module (the module includes pooling, convolution, batch normalization layer, and activation layer) to perform pooling operation on the local feature map, thereby obtaining a total of five intermediate feature maps.
[0076] Step 133, taking the merged feature map obtained by merging the multiple intermediate feature maps and the local feature map obtained in the feature extraction process through multi-layer convolution as the output feature map.
[0077] Continue reading Figure 4 , after merging the five intermediate feature maps obtained by the spatial pyramid pooling layer ASPP module, a 1×1 convolution module (the module includes convolution, BN, activation, and dropout layers) is obtained to obtain the merged feature map input to the decoder.
[0078] That is to say, the merged feature map output by the ASPP module of the spatial pyramid pooling layer and the local feature map Low-Level Features output by several convolution layers in the feature extraction layer DCNN will be input into the decoder as the output feature map.
[0079] Next, continue to combine Figure 4 The structure of the deep learning segmentation model describes the feature fusion process in detail as follows:
[0080] like Figure 5b As shown, in an exemplary embodiment, multiple output feature maps are input into a decoder, and feature fusion is performed on the multiple output feature maps by the decoder in the deep learning segmentation model to obtain a segmentation map, which may include the following steps:
[0081] Step 134, through the decoder, channel dimension reduction is performed on the local feature map in the output feature map, and the merged feature map in the output feature map is upsampled.
[0082] In one possible implementation, upsampling may be achieved by linear interpolation.
[0083] Step 135, obtaining a fused feature map by merging the local feature map after channel dimensionality reduction and the merged feature map after upsampling.
[0084] Step 136, restore the resolution of the fused feature map according to the resolution of the original image to obtain a segmentation map.
[0085] For more details, see Figure 4The decoder receives the local feature map Low-Level Features output from several layers of convolution in the feature extraction layer DCNN and the merged feature map output from the spatial pyramid pooling layer ASPP module as input. First, the output feature map from the feature extraction layer DCNN is subjected to channel dimension reduction using a 1×1 convolution module to reduce the output feature map from 256 dimensions to 48 dimensions. Then, the output feature map from the spatial pyramid pooling layer ASPP module is upsampled by 4 times linear interpolation to obtain a feature map with the same size as the output feature map after channel dimension reduction. Then, the feature map after channel dimension reduction and the output feature map obtained after upsampling are merged together and sent to a 3×3 convolution module for calculation. Finally, 4 times linear interpolation is used for upsampling again to obtain a segmentation map with the same size as the original image, i.e., the same resolution.
[0086] Under the influence of the above-mentioned embodiments, the embodiments of the present invention extract the characteristic modes of the dial from various types of instrument images through a deep learning algorithm, thereby improving the accuracy of feature extraction of different types of pointer instruments, thereby laying a solid foundation for subsequent reading calculations.
[0087] See also Figure 6 In an exemplary embodiment, the step 150 of correcting the inclination of the scale area in the scale area feature map may include the following steps:
[0088] Step 151, performing ellipse fitting on the pixel points in the scale region feature map based on an approximate mean square ellipse fitting algorithm to obtain a fitted scale region.
[0089] Specifically, the scale area feature map is binarized to obtain a binary image related to the scale area. The pixel points in the binary image are taken as a set, and the minimum ellipse parameter vector is solved according to the distance evaluation function. The ellipse curve corresponding to the ellipse parameter vector is the best ellipse fitting of the scale area feature map, which is also considered to be the fitted scale area.
[0090] The distance evaluation function δ(C(a),x) is used to measure the distance between the pixel point x and the elliptic curve C(a). Based on this, the ellipse fitting problem can be transformed into a solution to make the error function ∈ 2 (a) The ellipse parameter vector a with the smallest value is calculated as follows:
[0091]
[0092] Among them, x and y are the pixels in the binary image, α is the ellipse parameter vector corresponding to the elliptic curve C(a), and the matrix D x and D y It is the partial derivative of matrix D with respect to different pixel points x and y.
[0093] Step 153, using the major axis endpoint and / or minor axis endpoint of the fitted scale region as reference points, performing perspective transformation on the scale region feature map to achieve calibration of the scale region.
[0094] With the help of the above-mentioned embodiments, it is possible to avoid errors in readings caused by the dial being not centered or the dial being tilted, thereby improving the quality of the original image and further facilitating improving the accuracy and efficiency of automatic recognition of readings.
[0095] Since all the scales in the scale area of the pointer instrument have very obvious morphological features, this embodiment uses a morphologically based image processing algorithm to perform a morphological opening operation on the scale area feature map and the pointer area feature map in the segmentation map to filter out noise points in the segmentation map.
[0096] In an exemplary embodiment, before step 150, the method may further include the following steps:
[0097] Perform morphological opening operation on the segmentation map to obtain the denoised segmentation map.
[0098] Specifically, the segmentation map is traversed by the morphological opening operation, the traversed structure element region is taken as the current structure element region, and the morphological opening operation is performed on each pixel in the current structure element region.
[0099] The traversal includes:
[0100] The first step is shape erosion, which is to use the minimum value of pixels in the current structural area as the value of each pixel in the current structural area.
[0101] The specific calculation process of the morphological expansion operation is as follows:
[0102]
[0103] Among them, element represents the structural element, that is, the filter, x and y represent the horizontal and vertical coordinate pixel values of the original image, and x' and y' represent the horizontal and vertical coordinate pixel values in the structural element area centered on the pixel point of the original image.
[0104] The second step is morphological expansion, which is to use the maximum value of pixels in the current structural area as the value of each pixel point in the current structural area.
[0105] The specific calculation process of the morphological erosion operation is as follows:
[0106]
[0107] Among them, element represents the structural element, that is, the filter, x and y represent the horizontal and vertical coordinate pixel values of the original image, and x' and y' represent the horizontal and vertical coordinate pixel values in the structural element area centered on the pixel point of the original image.
[0108] Once all structural element regions have completed the morphological opening operation, the denoised segmentation map can be obtained.
[0109] Through the above process, the present invention reduces the scope of the target area through morphological erosion operation, causing the boundary of the image to shrink, eliminating small and meaningless targets, and then expands the scope of the target area through morphological expansion operation, merging the background in contact with the target area into the target object, so that the boundary of the target area expands outward, fills some holes in the target area and eliminates small particle noise contained in the target area. The quality of the segmentation map is improved by performing morphological opening operation denoising on the segmentation map, thereby improving the accuracy of the reading of the pointer instrument.
[0110] In an exemplary embodiment, after step 110, the method may further include the following steps:
[0111] The original image is enhanced so that the enhanced original image is used for multi-level feature learning using the deep learning segmentation algorithm.
[0112] The inventors consider that deep learning algorithms are data-driven. In actual reading tasks, due to the complexity of data collection, there are only a few hundred pieces of valid data. However, currently popular deep learning algorithms require tens of thousands of picture data. Moreover, in real scenes, a batch of data sets in limited scenes will be collected, but the target application exists under different scene conditions, such as different directions, positions, scaling, brightness, etc. Therefore, data enhancement is performed on limited original pictures. On the one hand, the amount of training data can be increased, and on the other hand, the scene modalities contained in the training data can be increased. Therefore, the embodiment of the present invention performs image enhancement processing on the pointer instrument image after obtaining it.
[0113] In a possible implementation, the image enhancement process includes at least one of the following: flipping, rotation, scaling, random Gaussian noise, perspective transformation, brightness transformation, sharpening and blurring, contrast transformation, etc., which are not limited here.
[0114] Figure 7 The effect of a pointer instrument image after flipping, scaling, random Gaussian noise, perspective transformation and other data enhancements in one embodiment is shown. It can be clearly observed that the scale and pointer of the pointer instrument image after image enhancement processing are more obvious, which is more conducive to the automatic recognition of the pointer instrument reading, and thus helps to improve the accuracy and efficiency of the automatic recognition reading.
[0115] Figure 8 A schematic diagram of the reading effect of a pointer instrument shown in an exemplary embodiment is shown. Figure 8 It can be seen that through the relevant processing of various types of pointer instruments by the present invention, clear and accurate scale areas and pointer areas can be obtained, thereby achieving high-quality pointer instrument readings.
[0116] The following is an embodiment of the device of the present application, which can be used to execute the method for reading a pointer instrument involved in the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the method embodiment of the method for reading a pointer instrument involved in the present application.
[0117] See also Fig. 9 In an exemplary embodiment, a reading device 900 for a pointer instrument is provided.
[0118] The device 900 includes but is not limited to: an original image acquisition module 910 , an image segmentation module 930 , an image adjustment module 950 and an instrument reading module 970 .
[0119] The original image acquisition module 910 is used to acquire the original image of the pointer instrument.
[0120] The image segmentation module 930 is used to use a deep learning segmentation algorithm to perform multi-level feature learning on the scale area and pointer area of the pointer-type instrument in the original image to obtain a segmentation map, where the segmentation map includes a scale area feature map and a pointer area feature map.
[0121] The image adjustment module 950 is used to correct the inclination of the scale area in the scale area feature map, and segment multiple pointers in the pointer area in the pointer area feature map by using a connected domain algorithm.
[0122] The instrument reading module 970 is used to calculate the reading of the pointer instrument based on the calibrated scale area and the divided multiple pointers.
[0123] It should be noted that the reading device of the pointer instrument provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when reading the pointer instrument. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the reading device of the pointer instrument will be divided into different functional modules to complete all or part of the functions described above.
[0124] In addition, the embodiments of the pointer instrument reading device and the pointer instrument reading method provided in the above embodiments belong to the same concept, and the specific manner in which each module performs the operation has been described in detail in the method embodiment and will not be repeated here.
[0125] Fig.10A schematic diagram of the structure of a server is shown according to an exemplary embodiment. The server is suitable for Figure 2 The server side 130 in an implementation environment is shown.
[0126] It should be noted that the server is only an example adapted to the present application and cannot be considered to provide any limitation on the scope of use of the present application. The server cannot be interpreted as requiring dependence on or having Fig.10 One or more components of the exemplary server 2000 shown.
[0127] The hardware structure of the server 2000 may vary greatly due to different configurations or performances, such as Fig.10 As shown, the server 2000 includes: a power supply 210 , an interface 230 , at least one memory 250 , and at least one central processing unit (CPU) 270 .
[0128] Specifically, the power supply 210 is used to provide operating voltage for each hardware device on the server 2000 .
[0129] The interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Figure 2 The illustrated embodiment shows the interaction between the server end 130 and the collection end 110 in the implementation environment.
[0130] Of course, in other examples adapted by the present application, the interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input-output interface 235, and at least one USB interface 237, etc. Fig.10 As shown, this is not intended to be a specific limitation.
[0131] The memory 250 is a carrier for storing resources, which may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 251, an application 253 and data 255, etc. The storage method may be temporary storage or permanent storage.
[0132] Among them, the operating system 251 is used to manage and control the hardware devices and application programs 253 on the server 2000 to enable the central processor 270 to calculate and process the massive data 255 in the memory 250. It can be WindowsServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0133] The application program 253 is a computer program that performs at least one specific task based on the operating system 251, and may include at least one module ( Fig.10Each module may include a computer program for the server 2000. For example, a reading device of a pointer instrument may be regarded as an application program 253 deployed on the server 2000.
[0134] The data 255 may be photos, pictures, etc. stored in a disk, or may be original pictures of input pointer instruments, etc., stored in the memory 250 .
[0135] The central processor 270 may include one or more processors and is configured to communicate with the memory 250 through at least one communication bus to read the computer program stored in the memory 250, thereby realizing the operation and processing of the mass data 255 in the memory 250. For example, the reading method of the pointer instrument is completed by the central processor 270 reading a series of computer programs stored in the memory 250.
[0136] In addition, the present application can also be implemented through hardware circuits or hardware circuits combined with software. Therefore, the implementation of the present application is not limited to any specific hardware circuits, software, or a combination of the two.
[0137] See also Fig.11 In an embodiment of the present application, an electronic device 4000 is provided, and the electronic device 400 may include: a desktop computer, a laptop computer, a server, etc.
[0138] exist Fig.11 In the embodiment, the electronic device 4000 includes at least one processor 4001, at least one communication bus 4002 and at least one memory 4003.
[0139] The processor 4001 and the memory 4003 are connected, such as through a communication bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0140] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0141] The communication bus 4002 may include a path to transmit information between the above components. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0142] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.
[0143] The memory 4003 stores a computer program, and the processor 4001 reads the computer program stored in the memory 4003 through the communication bus 4002 .
[0144] When the computer program is executed by the processor 4001, the reading method of the pointer instrument in the above-mentioned embodiments is implemented.
[0145] In addition, a storage medium is provided in an embodiment of the present application, on which a computer program is stored. When the computer program is executed by a processor, the reading method of the pointer instrument in the above-mentioned embodiments is implemented.
[0146] In an embodiment of the present application, a computer program product is provided, the computer program product includes a computer program, the computer program is stored in a storage medium. A processor of a computer device reads the computer program from the storage medium, and the processor executes the computer program, so that the computer device executes the reading method of the pointer instrument in the above embodiments.
[0147] Compared with the related art, the present invention has the following beneficial effects:
[0148] 1. The present invention proposes a method for reading a pointer instrument, which obtains an original image of the pointer instrument, and then uses a deep learning segmentation algorithm to perform multi-level feature learning on the scale area and pointer area of the pointer instrument in the original image to obtain a segmentation map, which includes a scale area feature map and a pointer area feature map, and then corrects the inclination of the scale area in the scale area feature map, and uses a connected domain algorithm to segment multiple pointers in the pointer area feature map. Based on the corrected scale area and the segmented multiple pointers, the reading of the pointer instrument is calculated, that is, a deep learning algorithm and an image processing algorithm are combined, and the characteristic mode of the dial is extracted from the instrument image using the deep learning algorithm, and then the scale and pointer information are fitted from the dial features through the image processing algorithm, and a morphological opening operation is performed on the characteristic morphological characteristics of the pointer. The pointer information of a variety of pointer instruments is obtained through the connected domain features of the pointer, thereby effectively supporting the reading task of a variety of pointer instruments and improving the robustness of the algorithm to a variety of pointer instruments.
[0149] 2. The present invention combines image processing technology with deep learning algorithms to read pointer instruments from a new angle. Compared with existing instrument reading algorithms, the present invention greatly improves the robustness to the environment, the robustness to instrument types, and the robustness to various types of pointer instruments.
[0150] 3. The present invention can still accurately extract the scale and pointer of the instrument even when there is a lot of background interference on the instrument image, the dial is not centered, the dial is tilted, etc. The deflection angle of the pointer is accurately calculated to avoid reading errors. It is universally applicable to a wide variety of pointer instruments and complex and changeable usage environments.
[0151] 4. The present invention is based on a deep learning segmentation algorithm and uses a variety of data enhancement methods to solve problems such as instrument non-centering, background interference, tilt, blur, and camera angle offset, greatly improving the algorithm's robustness to the environment. By using a deep learning segmentation algorithm to extract the scale and pointer feature maps in the instrument image, combined with the image processing algorithm, the task of reading pointer instruments of various different categories is completed, effectively improving the robustness for different types of instruments.
[0152] 5. The present invention proposes to perform multiple data enhancement operations on the original pointer instrument image data, increase the scene mode and state mode of the data, and improve the robustness of the algorithm to the environment. The image processing algorithm based on connected domain segmentation overcomes the defect that the prior art only supports single-style instrument readings and cannot normally identify and read dual-pointer instruments.
[0153] 6. The present invention can be run in a camera and has the characteristics of high robustness and high accuracy. It can help the power department to quickly and accurately identify meter readings and obtain a higher recognition rate under the influence of harsh environments to achieve real-time monitoring of meter values.
[0154] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0155] The above contents are only preferred exemplary embodiments of the present invention and are not intended to limit the implementation scheme of the present invention. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope required by the claims.
Claims
1. A method for reading a pointer instrument. It is characterized in that The method comprises: Get the original image of the pointer instrument; Using a deep learning segmentation algorithm, multi-level feature learning is performed on the scale area and the pointer area of the pointer-type instrument in the original image to obtain a segmentation map, wherein the segmentation map includes a scale area feature map and a pointer area feature map; Correcting the inclination of the scale area in the scale area feature map, and segmenting multiple pointers in the pointer area in the pointer area feature map by a connected domain algorithm; Based on the corrected scale area and the divided multiple pointers, the reading of the pointer instrument is calculated.
2. The method according to claim 1, It is characterized in that The deep learning segmentation algorithm is implemented by an encoder and a decoder; The deep learning segmentation algorithm is used to perform multi-level feature learning on the scale area and the pointer area of the pointer instrument in the original image to obtain a segmentation map, including: Performing multi-level feature extraction on the original image by the encoder to obtain multiple output feature maps; The plurality of output feature maps are input into the decoder, and the decoder performs feature fusion on the plurality of output feature maps to obtain the segmentation map.
3. The method according to claim 2, It is characterized in that The encoder includes a feature extraction layer and a spatial pyramid pooling layer; the feature extraction layer includes multi-layer convolution, and the spatial pyramid pooling layer includes a hole convolution module and a global average pooling module; The encoder performs multi-level feature extraction on the original image to obtain multiple output feature maps, including: Inputting the original image into a feature extraction layer, performing feature extraction through multi-layer convolution in the feature extraction layer, and obtaining a local feature map; Inputting the local feature map into the spatial pyramid pooling layer, performing dilated convolutions with different dilation rates on the local feature map through a dilated convolution module in the spatial pyramid pooling layer, and performing a pooling operation on the local feature map through a global average pooling module in the spatial pyramid pooling layer to obtain a plurality of intermediate feature maps; The merged feature map obtained by merging multiple intermediate feature maps and the local feature map obtained in the feature extraction process through multi-layer convolution are used as the output feature map.
4. The method according to claim 3, It is characterized in that The step of fusing the plurality of output feature maps by the decoder to obtain the segmentation map comprises: By means of the decoder, channel dimension reduction is performed on the local feature map in the output feature map, and upsampling is performed on the merged feature map in the output feature map; The fused feature map is obtained by merging the local feature map after channel dimension reduction and the merged feature map after upsampling; The resolution of the fused feature map is restored according to the resolution of the original image to obtain the segmentation map.
5. The method according to claim 1, It is characterized in that The correcting the inclination of the scale area in the scale area feature map comprises: Performing ellipse fitting on the pixel points in the scale region feature map based on an approximate mean square ellipse fitting algorithm to obtain a fitted scale region; The major axis endpoint and / or the minor axis endpoint of the fitted scale region are used as reference points, and the scale region feature map is perspective transformed to achieve calibration of the scale region.
6. The method according to any one of claims 1 to 5, It is characterized in that After performing multi-level feature learning on the scale area and the pointer area of the pointer-type instrument in the original image to obtain a segmentation map, the method further includes: Performing a morphological opening operation on the segmentation map to obtain a denoised segmentation map; The step of performing a morphological opening operation on the segmentation map to obtain a denoised segmentation map includes: The segmentation graph is traversed by a morphological opening operation, and the traversed structural element region is used as a current structural element region; the traversal includes: Taking the minimum pixel value in the current structural area as the value of each pixel point in the current structural area; and / or taking the maximum pixel value in the current structural area as the value of each pixel point in the current structural area; Until all structural element areas are traversed, the denoised segmentation map is obtained.
7. The method according to any one of claims 1 to 5, It is characterized in that After obtaining the original image of the pointer instrument, the method further includes: The original image is subjected to image enhancement processing so that the original image subjected to multi-level feature learning using a deep learning segmentation algorithm is the enhanced original image.
8. A reading device for a pointer instrument, It is characterized in that The device comprises: An original image acquisition module is used to acquire the original image of the pointer instrument; An image segmentation module is used to use a deep learning segmentation algorithm to perform multi-level feature learning on the scale area and pointer area of the pointer-type instrument in the original image to obtain a segmentation map, wherein the segmentation map includes a scale area feature map and a pointer area feature map; An image adjustment module is used to correct the inclination of the scale area in the scale area feature map and segment multiple pointers in the pointer area in the pointer area feature map by a connected domain algorithm; The instrument reading module is used to calculate the reading of the pointer instrument based on the calibrated scale area and the divided multiple pointers.
9. An electronic device, It is characterized in that include: at least one processor, at least one memory, and at least one communication bus, wherein: The memory stores a computer program, and the processor reads the computer program in the memory through the communication bus; When the computer program is executed by the processor, the method for reading a pointer instrument according to any one of claims 1 to 7 is implemented.
10. A storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method for reading a pointer instrument according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Building crack detection method and device, computer equipment and storage medium
CN110163842A
Double-pointer instrument reading method based on deep learning
CN111931776A
Pointer type instrument reading identification method and device, computer equipment and storage medium
CN112115895A
Method for detecting complex topographic features on surface of small celestial body
CN114187529A
Substation pointer instrument detection method based on deep learning
CN114463558A
