A method and system for reading pressure of a diaphragm pressure gauge based on deep learning
Through deep learning-based methods, the key information of the membrane box pressure gauge is extracted using image segmentation network and algorithms, and a linear relationship between the center point of the pointer and the angle included is established, which solves the slow reading speed and low accuracy of the membrane box pressure gauge in the existing technology. and the problem of being susceptible to environmental interference, achieving fast and accurate pressure reading.
Patent Information
- Application Number
- CN202111483179.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-12-07
AI Technical Summary
In the prior art, the detection and interpretation of circular pointer pressure gauge is slow, the accuracy is low, and it is susceptible to environmental interference, making it difficult to achieve autonomous monitoring and fast and accurate pressure reading of the diaphragm pressure gauge.
Using a deep learning-based method, the model is trained through image segmentation network, the key mask image of the membrane box pressure gauge is obtained, the pointer outline is extracted using the binary method and the Sklansky algorithm, and the minimum external rectangle of the pointer outline is calculated in combination with the rotating calipers algorithm to determine the pointer The reference point and the vertex establish a linear relationship between the center point of the pointer and the angle included, and calculate the pressure value of the membrane box pressure gauge.
It realizes the rapid and accurate acquisition of the pressure value of the diaphragm pressure gauge, solves the problems of slow reading of pointer instrument data in the prior art, low accuracy, and susceptible to environmental interference, and improves the intelligent robot's diaphragm pressure gauge Monitoring and interpretation ability.
Smart Images

Figure CN114119980B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and system for reading the pressure of a diaphragm pressure gauge based on deep learning. Background Art
[0002] With the continuous development of artificial intelligence and automation technology, robots have been widely used in the industrial field. Usually, intelligent robots need to autonomously monitor and read the data of pointer instruments in the factory and make corresponding decisions. Therefore, the detection and interpretation of circular pointer instruments have become the key to the decision-making of intelligent robots.
[0003] However, the existing technologies for detecting the dial area of the pressure gauge include pre-calibration, region growing algorithm, neural network, support vector machine and feature point matching. Among them, the region growing algorithm requires setting seeds, the neural network and support vector machine require pre-training of the training set, and the feature point matching method requires pre-production of templates. The Hough transform is the most commonly used method for identifying pointers, and compared with other straight line detection algorithms, the Hough transform is slower. At present, various algorithms rely on simple edge or straight line knowledge in the aspects of dial area positioning and instrument interpretation, which are easily affected by environmental interference, resulting in a decrease in their intelligence level.
[0004] In view of this, there is an urgent need to provide a method for reading the pressure of a diaphragm pressure gauge that can realize autonomous monitoring and is accurate and fast. Summary of the invention
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is to provide a method for reading the pressure of a diaphragm pressure gauge based on deep learning, comprising the following steps:
[0006] Based on the historical diaphragm pressure gauge image, the initial image segmentation model is trained to obtain the image segmentation model; the diaphragm pressure gauge image to be segmented is input into the image segmentation model to obtain the key mask image; the key mask image is processed by the binary method to extract the pointer contour in the key mask image; the Sklansky algorithm is then used to determine the convex hull of the pointer contour, and the rotating calipers algorithm is used to calculate the minimum circumscribed rectangle of the convex hull of the pointer contour; the pointer reference point, pointer center point and pointer vertex of the diaphragm pressure gauge in the image are determined; with the pointer center point as the vertex, the angle A formed by the pointer center point to the pointer reference point and the pointer center point to the pointer vertex are determined respectively, and the linear relationship between the pressure value of the diaphragm pressure gauge and the angle A is established, and the pressure value of the diaphragm pressure gauge is calculated and determined.
[0007] The present invention also provides a diaphragm pressure gauge pressure reading system based on deep learning, comprising:
[0008] Image acquisition unit: used to acquire historical diaphragm pressure gauge images and real-time diaphragm pressure gauge images;
[0009] Image segmentation model training unit: used to train the initial image segmentation model and obtain the image segmentation model;
[0010] An image key mask extraction unit is used to segment and extract a key mask of a diaphragm pressure gauge to be read using the image segmentation model trained by the image segmentation model training unit;
[0011] Pointer contour extraction unit: The key mask image is processed by using a binary method, and the pointer contour in the key mask image is extracted; the convex hull of the pointer contour is determined by using the Sklansky algorithm, and the minimum circumscribed rectangle of the convex hull of the pointer contour is calculated by using the rotating calipers algorithm;
[0012] Diaphragm pressure gauge pressure value calculation unit: used to determine the pointer reference point, pointer center point and pointer vertex of the diaphragm pressure gauge in the image, with the pointer center point as the vertex, to determine the angle A formed by the pointer center point to the pointer reference point and the pointer center point to the pointer vertex, to establish a linear relationship between the pressure value of the diaphragm pressure gauge and the angle A, and to calculate and determine the pressure value of the diaphragm pressure gauge.
[0013] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the diaphragm pressure gauge pressure reading method based on deep learning as described above when executing the computer program.
[0014] The present invention also provides a computer-readable storage medium, which stores a computer program, and is characterized in that when the computer program is executed by a processor, it implements the diaphragm pressure gauge pressure reading method based on deep learning as described above.
[0015] The method of the present invention uses an image segmentation network to quickly and accurately obtain the key mask of the diaphragm pressure gauge, and then obtains key information in the segmented image, such as the pointer reference point, the pointer position, etc., by binarizing the image; then, by extracting the contour and fitting the line with the minimum multiplication method, the key points of the three calculated angles are obtained, and the piecewise linear relationship between the diaphragm pressure gauge reading and the angle is established by calculating the angle between the key points, and the diaphragm pressure gauge reading is output. The method realizes intelligent acquisition and reading of the diaphragm pressure gauge vertically, and solves the problems of slow speed, low precision, and susceptibility to environmental interference in reading pointer-type instrument data in the prior art.
[0016] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A schematic diagram of the method provided by the present invention;
[0019] Figure 2 The image of the diaphragm pressure gauge captured by the camera provided by the present invention;
[0020] Figure 3 A key mask image generated by the image segmentation network provided by the present invention;
[0021] Figure 4 A schematic diagram of three key points in the key mask image and a straight line fitting of the pointer contour provided by the present invention;
[0022] Figure 5 A block diagram of the system structure provided by the present invention;
[0023] Figure 6 This is a structural block diagram of the computer device provided by the present invention. DETAILED DESCRIPTION
[0024] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0026] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined. In addition, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0027] The present invention is described in detail below in conjunction with specific implementation methods and the accompanying drawings.
[0028] Method Embodiment
[0029] According to an embodiment of the present invention, a method for reading pressure of a diaphragm pressure gauge based on deep learning is provided. Figure 1 As shown, a method for reading pressure of a diaphragm pressure gauge based on deep learning according to an embodiment of the present invention comprises the following steps:
[0030] Step S1, training an initial image segmentation model based on historical diaphragm pressure gauge images to obtain an image segmentation model;
[0031] Step S2, inputting the membrane box pressure gauge image to be segmented into the image segmentation model to obtain a key mask image;
[0032] Step S3, using a binary method to process the key mask image and extract the pointer outline in the key mask image;
[0033] Step S4, using the Sklansky algorithm to determine the convex hull of the pointer contour, and using the rotating calipers algorithm to calculate the minimum circumscribed rectangle of the convex hull of the pointer contour;
[0034] Step S5, determining the pointer reference point P1, the pointer center point P2 and the pointer vertex P3 of the diaphragm pressure gauge in the image;
[0035] Step S6, taking the pointer center point P2 as the vertex, respectively determine the angle A formed by the pointer center point P2 to the pointer reference point P1 and the pointer center point P2 to the pointer vertex P3, establish a linear relationship between the pressure value of the diaphragm pressure gauge and the angle A, and calculate and determine the pressure value of the diaphragm pressure gauge.
[0036] The method for determining the pointer reference point P1, the pointer center point P2 and the pointer vertex P3 is as follows:
[0037] 1) Obtain the pointer reference point P1; compare the center point coordinates of the minimum circumscribed rectangle of each extracted contour convex hull, and the point with the smallest center point horizontal coordinate value is the pointer reference point P1; in this embodiment, the pointer reference point P1 is the coordinate point where the pointer is located when the diaphragm pressure gauge is not working.
[0038] 2) Obtain the pointer center point P2; Based on the pointer contour in step S3, the inner contour of the pointer center is obtained through the RETR_TREE tree structure extraction mode, and the rotating calipers algorithm is used to determine the coordinates of the center point of the minimum circumscribed rectangle of the inner contour of the pointer center, which is the pointer center point P2.
[0039] 3) Obtain the pointer vertex P3; based on the pointer contour in step S3, use the least squares method to perform straight line fitting to obtain the pointer symmetry axis L1; determine the four vertex coordinates of the minimum circumscribed rectangle of the pointer contour convex hull, the intersection points of the symmetry axis L1 and the two wide sides of the minimum circumscribed rectangle of the pointer contour convex hull are pt1 and pt2 respectively, calculate and compare the distances l2 and l3 between pt1 and pt2 and the pointer center point P2 respectively, if l2>l3, pt1 is the pointer vertex P3, otherwise pt2 is the pointer vertex P3.
[0040] The following is combined with Figure 2-4 , the above technical method of the embodiment of the present invention is described in detail.
[0041] In this embodiment, it is necessary to first obtain historical diaphragm pressure gauge images. An industrial camera can be used to collect images of the diaphragm pressure gauge to form a data set. The data set is divided into a training set D train and the test set D test ; Among them, the training set D train For each image x i (i≤N) corresponds to a label, which is used to train the initial image segmentation model; the test set D test The images in the training set D are not labeled. train and the test set D testImages can be overlapped and used by using the training set D train and the test set D test Train the initial image segmentation model to obtain the key mask x that can segment the pressure gauge imask Image segmentation model.
[0042] During the work, the industrial camera will also be used to collect images of the diaphragm pressure gauge, and the trained image segmentation model will be used to extract the key mask x of the pressure gauge to be read. imask .
[0043] In this embodiment, based on the extracted key mask x imask , reading the value of the diaphragm pressure gauge includes the following steps:
[0044] The basic idea of this embodiment is to determine the angle between the pointer offset position and the pointer initial reference line, establish a linear relationship between the pressure gauge pressure and the angle, and thus determine and calculate the pressure value of the capsule pressure gauge in the image. The specific implementation steps are:
[0045] Firstly, the key mask image is processed by binarization to extract the pointer outline in the key mask image;
[0046] Extracting the pointer outline in the key mask image is as follows:
[0047] Then, the RETR_TREE tree structure extraction mode and the CHAIN_APPROX_SIMPLE simplest adjacent chain approximation algorithm are used to compress the elements in the horizontal, vertical, and diagonal directions, retain the key coordinates in the three directions, and extract the key mask x imask Pointer outline.
[0048] The Sklansky algorithm is then used to find the convex hull of the pointer contour, and the rotating calipers algorithm is used to calculate the minimum circumscribed rectangle of the convex hull of the pointer contour.
[0049] Determine the pointer reference point P1, the pointer center point P2 and the pointer vertex P3, the pointer reference point P1, the pointer center point P2 and the pointer vertex P3;
[0050] The pointer reference point P1 is obtained by comparing the center point coordinates of each extracted minimum circumscribed rectangle of the contour, and the point with the smallest horizontal coordinate value of the center point is the pointer reference point P1; in this embodiment, the pointer reference point P1 is the coordinate point where the pointer is located when the diaphragm pressure gauge is not working.
[0051] The specific steps of obtaining the pointer center point P2 are as follows: based on the obtained pointer outline, the inner contour of the pointer center is obtained through the RETR_TREE tree structure extraction mode, and the rotating calipers algorithm is used to determine the coordinates of the center point of the minimum circumscribed rectangle of the inner contour of the pointer center, which is the pointer center point P2.
[0052] The specific steps of obtaining the pointer vertex P3 are as follows: based on the obtained pointer contour, the least squares method is used for straight line fitting to obtain the pointer symmetry axis L1; the four vertex coordinates of the minimum circumscribed rectangle of the pointer contour convex hull are determined, and the intersection points of the two wide sides of the minimum circumscribed rectangle of the pointer contour convex hull and the symmetry axis L1 are pt1 and pt2 respectively. The distances l2 and l3 between pt1 and pt2 and the pointer center point P2 are calculated and compared respectively. If l2>l3, pt1 is the pointer vertex P3, otherwise pt2 is the pointer vertex P3.
[0053] Determine the coordinates of the pointer reference point P1, the pointer center point P2 and the pointer vertex P3 as (x1, y1), (x2, y2), (x3, y3) respectively. The cosine value calculation formula of the angle A with the pointer center point P2 as the vertex is:
[0054]
[0055] Where a, b, and c are the side lengths of the triangle with the pointer reference point P1, the pointer center point P2, and the pointer vertex P3 as vertices.
[0056]
[0057] Finally, according to the coordinates of the pointer reference point P1, the pointer center point P2 and the pointer vertex P3, a linear relationship between the angle and the pressure gauge reading is established, specifically:
[0058] First, calculate the angle A according to the coordinates of the pointer reference point P1, the pointer center point P2 and the pointer vertex P3. Then, according to the relative position of the pressure gauge scale and the pointer angle, establish a linear relationship between the angle and the pressure gauge reading Pvalue. The formula is:
[0059]
[0060] In the formula, k1, k2, k3, b1, b2, b3 are fitting coefficients, and m1-m4 is the angle range. That is to say, when the angle A is between m1 and m2, a linear relationship is used for fitting. After k1 and b1 are converted, P is obtained. value When the angle A is between m2 and m3, a linear relationship is used for fitting. After k2 and b2 conversion, P is obtained. value When the angle A is between m3 and m4, a linear relationship is used for fitting. After k3 and b3 conversion, P is obtained.value value.
[0061] Beneficial effects of the method of this embodiment:
[0062] The method of this embodiment uses an image segmentation network to quickly and accurately obtain the key mask of the diaphragm pressure gauge, and then obtains the key information in the segmented image, such as the pointer reference point, the pointer position, etc., by binarizing the image; then, by extracting the contour and fitting the line with the minimum multiplication method, the key points of the three calculated angles are obtained, and the piecewise linear relationship between the diaphragm pressure gauge reading and the angle is established by calculating the angle between the key points, and the diaphragm pressure gauge reading is output. This method realizes the intelligent acquisition and reading of the diaphragm pressure gauge vertically, and solves the problems of slow speed, low accuracy, and susceptibility to environmental interference in reading pointer-type instrument data in the prior art.
[0063] The method of this embodiment is further described below through specific cases combined with the accompanying drawings.
[0064] Step 1: Create the data set required for training the initial image segmentation model. In this case, the initial image segmentation model uses the Unet segmentation network.
[0065] The dataset includes D train , D test . Where D train There are 20 images of historical diaphragm pressure gauges. An industrial camera is used to collect images facing the pressure gauge. Each image is x i (i≤20) corresponds to a label and is used for training the Unet segmentation network. test Contains 100 images of pressure gauges to be read, without labels. train and D test The data samples can overlap. Figure 2 As shown, it is the pressure gauge image captured by the camera.
[0066] Step 2: Use the trained segmentation network to segment the diaphragm pressure gauge image to obtain the key mask x of the pressure gauge to be read. imask As shown in the figure, Figure 3 It is the key mask image after segmentation by the segmentation network U-net.
[0067] Step 33.1) Use the above method to extract the minimum circumscribed rectangle of the pointer contour and the convex hull of the pointer contour respectively.
[0068] 3.2) Use the above method to obtain the pointer reference point P1, pointer center point P2 and pointer vertex P3 respectively.
[0069] like Figure 4As shown in the figure, the pointer reference point P1, pointer center point P2 and pointer vertex P3 extracted in this case and the pointer contour fitting straight line graph, where the coordinates of P1 are (1424, 728), the coordinates of P2 are (2026, 1120), and the coordinates of P3 are (1277, 1551). The angle A with P2 as the vertex and P1P2 as the side, according to the cosine calculation formula provided above, the cosine value of angle A is 0.8693, and according to the inverse trigonometric function calculation formula, the value of angle A is 62.31°.
[0070] The calculation formula for the relationship between the pressure and angle reading of the diaphragm pressure gauge is as follows:
[0071]
[0072] Substituting A = 62.31° into the above formula, we can get P value =11.5kPa.
[0073] System Example
[0074] According to an embodiment of the present invention, a diaphragm pressure gauge pressure reading system based on deep learning is provided. Figure 5 As shown, a diaphragm pressure gauge pressure reading system based on deep learning according to an embodiment of the present invention includes:
[0075] Image acquisition unit: used to acquire historical diaphragm pressure gauge images and real-time diaphragm pressure gauge images; specifically, an industrial camera can be used to acquire images of the diaphragm pressure gauge to form a data set.
[0076] Image segmentation model training unit: used to train the initial image segmentation model and obtain the image segmentation model;
[0077] The specific implementation content of this unit is: according to the data set obtained by the image acquisition unit, the data set is divided into a training set D train and the test set D test ; Among them, the training set D train For each image x i (i≤N) corresponds to a label, which is used to train the initial image segmentation model; the test set D test The images in the training set D are not labeled. train and the test set D test Images can be overlapped and used by using the training set D train and the test set D test Train the initial image segmentation model to obtain the key mask x that can segment the pressure gauge imask Image segmentation model.
[0078] An image key mask extraction unit is used to segment and extract the key mask of the diaphragm pressure gauge to be read using the image segmentation model trained by the image segmentation model training unit.
[0079] Pointer contour extraction unit: The key mask image is processed by using a binary method, and the pointer contour in the key mask image is extracted; the convex hull of the pointer contour is determined by using the Sklansky algorithm, and the minimum circumscribed rectangle of the convex hull of the pointer contour is calculated by using the rotating calipers algorithm;
[0080] The pointer contour extraction unit extracts the pointer contour in the key mask image as follows:
[0081] Adopt RETR_TREE tree structure extraction mode and CHAIN_APPROX_SIMPLE simplest adjacent chain approximation algorithm to compress the elements in the horizontal, vertical and diagonal directions, retain the key coordinates in the three directions, and extract the key mask x imask Pointer outline.
[0082] Diaphragm pressure gauge pressure value calculation unit: used to determine the pointer reference point P1, pointer center point P2 and pointer vertex P3 of the diaphragm pressure gauge in the image, take the pointer center point P2 as the vertex, determine the angle A formed by the pointer center point P2 to the pointer reference point P1 and the pointer center point P2 to the pointer vertex P3 respectively, establish a linear relationship between the pressure value of the diaphragm pressure gauge and the angle A, and calculate and determine the pressure value of the diaphragm pressure gauge.
[0083] Wherein, the pressure value calculation unit of the diaphragm pressure gauge includes:
[0084] Pointer reference point P1 acquisition module: compare the center point coordinates of the minimum circumscribed rectangle of each extracted contour convex hull, and the point with the smallest horizontal coordinate value of the center point is the pointer reference point P1;
[0085] Pointer center point P2 acquisition module: Based on the pointer contour extracted by the pointer contour extraction unit, the inner contour of the pointer center is obtained through the RETR_TREE tree structure extraction mode, and the rotating calipers algorithm is used to determine the coordinates of the center point of the minimum circumscribed rectangle of the inner contour of the pointer center, which is the pointer center point P2.
[0086] Pointer vertex P3 acquisition module: Based on the pointer contour extracted by the pointer contour extraction unit, the least squares method is used to perform straight line fitting to obtain the pointer symmetry axis L1; determine the four vertex coordinates of the minimum circumscribed rectangle of the pointer contour convex hull, the intersection points of the symmetry axis L1 and the two wide sides of the minimum circumscribed rectangle of the pointer contour convex hull are pt1 and pt2 respectively, and calculate and compare the distances l2 and l3 between pt1 and pt2 and the pointer center point P2 respectively. If l2>l3, pt1 is the pointer vertex P3, otherwise pt2 is the pointer vertex P3.
[0087] Diaphragm pressure gauge pressure value calculation module: With the pointer center point P2 as the vertex, determine the angle A formed by the pointer center point P2 to the pointer reference point P1 and the pointer center point P2 to the pointer vertex P3, establish a linear relationship between the diaphragm pressure gauge pressure value and the angle A, and calculate and determine the diaphragm pressure gauge pressure value.
[0088] The specific calculation module of the diaphragm pressure gauge pressure value is calculated as follows:
[0089] Determine the coordinates of the pointer reference point P1, the pointer center point P2 and the pointer vertex P3 as (x1, y1), (x2, y2), (x3, y3) respectively. The cosine value calculation formula of the angle A with the pointer center point P2 as the vertex is:
[0090]
[0091] Where a, b, and c are the side lengths of the triangle with the pointer reference point P1, the pointer center point P2, and the pointer vertex P3 as vertices.
[0092]
[0093] Finally, according to the coordinates of the pointer reference point P1, the pointer center point P2 and the pointer vertex P3, a linear relationship between the angle and the pressure gauge reading is established, specifically:
[0094] First, calculate the angle A according to the coordinates of the pointer reference point P1, the pointer center point P2 and the pointer vertex P3, and then establish the angle and the pressure gauge reading P according to the relative position of the pressure gauge scale and the pointer angle. value The linear relationship is:
[0095]
[0096] After that, the calculated angle A is substituted into the linear relationship to obtain the final P value value.
[0097] like Figure 6As shown, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the diaphragm pressure gauge pressure reading method based on deep learning in the above-mentioned embodiment, or, when executed by a processor, implements the diaphragm pressure gauge pressure reading method based on deep learning in the above-mentioned embodiment.
[0098] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0099] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0100] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0101] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for reading pressure of a diaphragm pressure gauge based on deep learning, characterized in that: The following steps are involved: Based on the historical diaphragm pressure gauge image, the initial image segmentation model is trained to obtain the image segmentation model; Input the membrane box pressure gauge image to be segmented into the image segmentation model to obtain the key mask image; The key mask image is processed by binary method to extract the pointer contour in the key mask image; the convex hull of the pointer contour is determined by Sklansky algorithm, and the minimum circumscribed rectangle of the convex hull of the pointer contour is calculated by rotating calipers algorithm; the pointer reference point, pointer center point and pointer vertex of the diaphragm pressure gauge in the image are determined; with the pointer center point as the vertex, the angle A formed by the pointer center point to the pointer reference point and the pointer center point to the pointer vertex is determined respectively, and the linear relationship between the pressure value of the diaphragm pressure gauge and the angle A is established, and the pressure value of the diaphragm pressure gauge is calculated and determined, where The pointer reference point, pointer center point and pointer vertex are determined as follows: Compare the center point coordinates of the minimum circumscribed rectangle of each extracted contour convex hull, and the point with the smallest horizontal coordinate value of the center point is the pointer reference point; Based on the pointer contour, the inner contour of the pointer center is obtained through the RETR_TREE tree structure extraction mode, and the rotating calipers algorithm is used to determine the coordinates of the center point of the minimum circumscribed rectangle of the inner contour of the pointer center, which is the center point of the pointer. Based on the pointer contour, the least squares method is used for straight line fitting to obtain the pointer symmetry axis L1; determine the coordinates of the four vertices of the minimum circumscribed rectangle of the pointer contour convex hull, the intersection points of the symmetry axis L1 and the two wide sides of the minimum circumscribed rectangle of the pointer contour convex hull are pt1 and pt2 respectively, and calculate and compare the distances l2 and l3 between pt1 and pt2 and the center point of the pointer respectively. If l2>l3, pt1 is the pointer vertex, otherwise pt2 is the pointer vertex.
2. The method for reading the pressure of a diaphragm pressure gauge according to claim 1, characterized in that: The historical diaphragm pressure gauge image is collected by an industrial camera facing the diaphragm pressure gauge to form a data set; The dataset is divided into a training set and a test set. Each image in the training set corresponds to a label, which is used to train the initial image segmentation model. The images in the test set do not contain labels.
3. The method for reading the pressure of a diaphragm pressure gauge according to claim 1, characterized in that: The method of extracting the pointer outline in the key mask image is as follows: For the binary key mask image, the RETR_TREE tree structure extraction mode and the CHAIN_APPROX_SIMPLE simplest adjacent chain approximation algorithm are used to compress the elements in the horizontal, vertical and diagonal directions, retain the key coordinates in this direction, and extract the pointer contour of the key mask.
4. The method for reading the pressure of a diaphragm pressure gauge according to claim 1, characterized in that: The calculation to determine the pressure value of the diaphragm pressure gauge is as follows: Determine the coordinates of the pointer reference point, the pointer center point and the pointer vertex points are (x1, y1), (x2, y2), (x3, y3), and the cosine value calculation formula of the angle A with the pointer center point as the vertex is: Among them, a, b, and c are the side lengths of the triangle with the pointer base point, the pointer center point, and the pointer vertex as vertices, respectively. According to the coordinates of the pointer reference point, the pointer center point and the pointer vertex, and the calculated angle A, and according to the relative position of the pressure gauge scale and the pointer angle, a linear relationship between the angle and the pressure gauge reading Pvalue is established, and the formula is: In the formula, k1, k2, k3, b1, b2, b3 are fitting coefficients, and m1-m4 is the angle range.
5. A diaphragm pressure gauge pressure reading system based on deep learning, characterized in that: include Image acquisition unit: used to acquire historical diaphragm pressure gauge images and real-time acquisition of diaphragm pressure gauge images; Image segmentation model training unit: used to train the initial image segmentation model and obtain the image segmentation model; An image key mask extraction unit is used to segment and extract a key mask of a diaphragm pressure gauge to be read using the image segmentation model trained by the image segmentation model training unit; Pointer contour extraction unit: The key mask image is processed by using a binary method, and the pointer contour in the key mask image is extracted; the convex hull of the pointer contour is determined by using the Sklansky algorithm, and the minimum circumscribed rectangle of the convex hull of the pointer contour is calculated by using the rotating calipers algorithm; The pressure value calculation unit of the diaphragm pressure gauge is used to determine the pointer reference point, pointer center point and pointer vertex of the diaphragm pressure gauge in the image, and take the pointer center point as the vertex to respectively determine the angle A formed by the pointer center point to the pointer reference point and the pointer center point to the pointer vertex, establish a linear relationship between the pressure value of the diaphragm pressure gauge and the angle A, and calculate and determine the pressure value of the diaphragm pressure gauge, including Pointer reference point acquisition module: compare the center point coordinates of the minimum circumscribed rectangle of each extracted contour convex hull, and the point with the smallest horizontal coordinate value of the center point is the pointer reference point; Pointer center point acquisition module: Based on the pointer contour extracted by the pointer contour extraction unit, the inner contour of the pointer center is obtained through the RETR_TREE tree structure extraction mode, and the rotating calipers algorithm is used to determine the coordinates of the center point of the minimum circumscribed rectangle of the inner contour of the pointer center, which is the pointer center point; Pointer vertex acquisition module: Based on the pointer contour extracted by the pointer contour extraction unit, the least squares method is used to perform straight line fitting to obtain the pointer symmetry axis L1; the four vertex coordinates of the minimum circumscribed rectangle of the pointer contour convex hull are determined, and the intersection points of the symmetry axis L1 and the two wide sides of the minimum circumscribed rectangle of the pointer contour convex hull are pt1 and pt2 respectively. The distances l2 and l3 between pt1 and pt2 and the pointer center point are calculated and compared respectively. If l2>l3, pt1 is the pointer vertex, otherwise pt2 is the pointer vertex.
6. The diaphragm pressure gauge pressure reading system according to claim 5, characterized in that: The image segmentation model training unit divides the data set into a training set and a test set according to the data set acquired by the image acquisition unit; wherein each image in the training set corresponds to a label for training the initial image segmentation model; the images in the test set do not contain labels; by using the training set and the test set to train the initial image segmentation model, an image segmentation model that can segment out the key mask of the pressure gauge is obtained.
7. The diaphragm pressure gauge pressure reading system according to claim 5, characterized in that: The pointer contour extraction unit extracts the pointer contour in the key mask image specifically as follows: The RETR_TREE tree structure extraction mode and the CHAIN_APPROX_SIMPLE simplest adjacent chain approximation algorithm are used to compress the elements in the horizontal, vertical, and diagonal directions, retain the key coordinates in this direction, and extract the pointer contour of the key mask.
8. The diaphragm pressure gauge pressure reading system according to claim 5, characterized in that: The diaphragm pressure gauge pressure value calculation unit calculates as follows: Determine the coordinates of the pointer reference point, the pointer center point and the pointer vertex points are (x1, y1), (x2, y2), (x3, y3), and the cosine value calculation formula of the angle A with the pointer center point as the vertex is: Among them, a, b, and c are the side lengths of the triangle with the pointer base point, the pointer center point, and the pointer vertex as vertices, respectively. Then calculate the angle A according to the coordinates of the pointer reference point, the pointer center point and the pointer vertex; establish the angle and the pressure gauge reading P according to the relative position of the pressure gauge scale and the pointer angle. value The linear relationship is: Then bring the calculated angle A into the linear relationship to get the final P value Values, where k1, k2, k3, b1, b2, b3 are fitting coefficients and m1-m4 is the angle range.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the deep learning-based pressure reading method of the diaphragm pressure gauge as described in any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the deep learning-based pressure reading method of a diaphragm pressure gauge as described in any one of claims 1 to 4 is implemented.
