Large and small model collaborative pipeline pressure automatic detection method and device
Through the automatic detection method and device of pipeline pressure coordinated by the size and model, the problem of low intelligent level of automatic pipeline pressure detection in the existing technology is solved, efficient and accurate identification and recording of pipeline pressure gauge readings is achieved, monitoring efficiency and data accuracy are improved, and the safe and stable operation of the pipeline system is enhanced.
Patent Information
- Application Number
- CN202510012687.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, the intelligent level of automatic pipeline pressure detection is low, which affects production safety and efficiency.
The automatic pipeline pressure detection method and device that collaborates with large and small models is adopted to obtain the image of the pipeline pressure gauge through the camera, and image processing units and large models are used for image preprocessing, feature extraction and reading recognition, and real-time data analysis and abnormal reminders are carried out in combination with small data analysis models.
It realizes efficient and accurate identification and recording of pipeline pressure gauge readings, improves monitoring efficiency and data accuracy, enhances the safe and stable operation of the pipeline system, and improves the intelligent level of operation and maintenance of building electromechanical equipment.
Smart Images

Figure CN119860500A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of building electromechanical operation and maintenance, and in particular to a method and device for automatically detecting pipeline pressure in coordination with large and small models. Background Art
[0002] In the daily operation and maintenance management process of building electromechanical equipment, continuous monitoring of various pipeline pressure gauges is a key link to ensure the safe and stable operation and efficient production of the entire production system. As an important tool that directly reflects the pressure status of the system, the accuracy of the reading of the pressure gauge is directly related to whether the equipment can operate in the best state and whether potential safety hazards can be discovered and prevented in time. Traditionally, the reading of the pointer pressure gauge in the equipment room is mainly achieved by manual inspection, mainly because the pipelines in the equipment room use traditional pointer pressure gauges, the equipment room environment is limited and does not have a network wiring environment, the pipelines in the equipment room are complex and difficult to replace with digital sensor pressure gauges, and the replacement cost is high. This manual inspection method is not only time-consuming and labor-intensive, inefficient, but also greatly affected by human factors, and the accuracy of data recording is difficult to be reliably guaranteed. Especially in the complex and changeable environment of the computer room, manual inspections may also cause reading errors due to harsh environment or improper operation, which in turn affects the scientificity and timeliness of building operation and maintenance decisions.
[0003] With the continuous advancement of information technology, especially the rapid development of large-scale model technology, new solutions have been provided for the monitoring of pipeline pressure gauges in the operation and maintenance of building mechanical and electrical equipment. It has become possible to automatically identify and record pressure gauge readings through the pressure gauge images collected through advanced large-scale model training, which greatly improves the monitoring efficiency and data accuracy. However, although existing technologies such as optical character recognition (OCR) technology have achieved remarkable results in some fields and can recognize and parse text information in images, there are still problems such as low intelligence level and impact on production safety and efficiency when it is directly applied to pressure gauge reading recognition.
[0004] Therefore, it is necessary to provide a pipeline pressure automatic detection method and device that cooperates with large and small models, which can solve the problems of low intelligence level of pipeline pressure automatic detection in the prior art and affect production safety and efficiency. Summary of the invention
[0005] The purpose of the present invention is to provide a method and device for automatic detection of pipeline pressure by cooperating large and small models, which can solve the problems in the prior art of low intelligence level of automatic detection of pipeline pressure and influence on production safety and efficiency.
[0006] In order to achieve the above object, the technical solution of the present invention is:
[0007] A large and small model coordinated pipeline pressure automatic detection device comprises: an image acquisition device, a power module, an image processing device and a monitoring display; the power module is electrically connected to the image acquisition device, the image acquisition device comprises a camera bracket and a camera; the camera is rotatably installed facing a pointer-type pipeline pressure gauge through the camera bracket; the image processing device comprises an image processing unit, a data processing module and an abnormal alarm module, the output end of the camera is wirelessly connected to the input end of the image processing unit through a wireless network module, the output end of the image processing unit is connected to the input end of the data processing module, the output end of the data processing module is connected to the monitoring display and the abnormal alarm module, and the output end of the abnormal alarm module is wirelessly connected to the intelligent terminal device of the manager.
[0008] The camera is provided with a camera dust scraper, which is in sliding contact with the camera lens. The camera is provided with a light compensator, which is located beside the camera lens.
[0009] An automatic detection method for a pipeline pressure automatic detection device with large and small models coordinated, comprising the following steps:
[0010] Step 1: Acquire the image of the pointer-type pipeline pressure gauge to be inspected through a camera to form a pointer-type pipeline pressure gauge image dataset;
[0011] Step 2: Annotate the pointer-type pipeline pressure gauge image dataset with real labels;
[0012] Step 3: Perform image preprocessing on the pointer type pipeline pressure gauge image data set through an image processing unit;
[0013] Step 4: Establish a large dial recognition model for the pointer-type pipeline pressure gauge;
[0014] Step 5: The dial recognition model extracts features from the image preprocessed in step 3;
[0015] Step 6: Use the pointer-type pipeline pressure gauge image dataset that has undergone image preprocessing and feature extraction to fine-tune the dial recognition model to obtain the fine-tuned dial recognition model;
[0016] Step 7: Input the pointer-type pipeline pressure gauge image data set after image preprocessing into the fine-tuned dial recognition model, iteratively optimize and train the dial recognition model, and obtain the trained dial recognition model;
[0017] Step 8: Build a small model for data anomaly analysis;
[0018] Step 9: Data anomaly analysis The small model performs data analysis;
[0019] Step 10: Use the dial recognition large model to issue data abnormality reminders through the abnormal alarm module.
[0020] The step 2 comprises the following sub-steps:
[0021] Step 2.1: manually annotate the images of the pointer-type pipeline pressure gauges to be inspected with real labels, and clarify the specific pointer-type pipeline pressure gauges corresponding to each image, so as to locate and identify the target pointer-type pipeline pressure gauges in the subsequent actual image acquisition process;
[0022] Step 2.2: obtaining a pointer-type pipeline pressure gauge image dataset annotated with real labels, and preprocessing the pointer-type pipeline pressure gauge image dataset annotated with real labels by an image processing unit to obtain a preprocessed pointer-type pipeline pressure gauge image dataset;
[0023] The preprocessing includes image geometric correction processing, which uses formula (1) to map points in the original image to new positions to achieve correction:
[0024] x'=a0+a1.x+a2.y+a3.x2+a4.x.y+a5.y 2
[0025] y′=b0+b1.x+b2.y+b3.x 2 +b4.x.y+b5.y 2 (1)
[0026] Wherein, x and y are the pixel coordinates in the original image acquired by the camera, x′ and y′ are the corrected coordinates; a0, a1, a2, a3, a4, a5, b0, b1, b2, b3, b4, and b5 are the coefficients of the polynomial transformation of the geometric correction algorithm.
[0027] In step 3, the average value of the neighborhood around each pixel in the preprocessed image is calculated, and the pixel value is replaced by the average value to reduce the influence of noise and improve the clarity of the image; the calculation process is shown in formula (2):
[0028]
[0029] Where f(x,y) is the geometrically corrected image, g(x,y) is the denoised image, M is the width of the filter, and N is the height of the filter.
[0030] In the step 4, the image processing unit uses an open source large model as a basic model for dial recognition to establish a large model for dial recognition. The large model for dial recognition includes an image encoder, a prompt encoder and a mask decoder.
[0031] In the step 5, edge detection and contour extraction operations are performed on the image after image preprocessing in step 3 by the image processing unit to extract the pointer of the pointer-type pipeline pressure gauge and the scale line features it points to;
[0032] The process of extracting the dial contour based on the edge detection algorithm is as follows:
[0033] Step A1: Convert image to grayscale: grayscale the image to reduce image noise and highlight edge information;
[0034] Step A2: Apply thresholding: Use edge detection algorithms to find areas in the image where brightness changes significantly;
[0035] In each image, the gradient magnitude of each pixel is calculated. The gradient magnitude G(x,y) is calculated by formula (3):
[0036]
[0037] Among them, Gx and Gy are the gradients of the image in the x-direction and y-direction respectively, and the pixels with gradient amplitudes in the range of 80-150 are set as very significant edges;
[0038] Step A3: Find the edge, i.e. the outline of the dial: Use the outline finding algorithm and apply the findContours function in OpenCV software to identify and extract continuous edges in the image;
[0039] Step A4: Draw a contour using the continuous edges extracted in step A3, which is the contour of the dial;
[0040] The feature recognition process of identifying the position of the pointer and the scale line it points to through the contour extraction algorithm is as follows:
[0041] Step B1: Screen the pointer outline by length screening: the pointer is usually longer than the scale line. A length threshold can be set according to the pointer length of the pointer-type pipeline pressure gauge to screen the pointer and obtain the pointer outline;
[0042] Step B2: Filter the scale line profile by length screening: the scale line is usually shorter than the pointer. A smaller length threshold can be set according to the scale line length of the pointer-type pipeline pressure gauge to filter the scale line and obtain the scale line profile;
[0043] Step B3: Determine the pointer position: After finding the pointer outline, calculate its center point or endpoint position to determine the pointer position;
[0044] Step B4: Determine the scale line position: calculate the angle of each scale line, and further determine the specific scale value pointed by the pointer according to the scale line pointed by the pointer, that is, the reading of the pointer-type pipeline pressure gauge.
[0045] The step 7 comprises the following sub-steps:
[0046] Step 7.1: Input the image in the pointer-type pipeline pressure gauge image dataset after image preprocessing into the image encoder of the fine-tuned dial recognition large model to obtain the image embedding vector, and perform a convolution operation on the image embedding vector and the true mask image to obtain a convolution image;
[0047] Step 7.2: Use the hint encoder of the fine-tuned dial recognition large model to obtain the hint code, input the convolution image obtained in step 7.1 and the hint code into the mask decoder for decoding, and obtain the predicted mask image;
[0048] Step 7.3: Set the total loss function, use the predicted mask image and the true mask image to calculate the total loss function value, and update the parameters of the fine-tuned dial recognition model according to the calculation results;
[0049] Step 7.4: Determine whether the total loss function value of the dial recognition large model is less than a preset threshold. If so, the dial recognition large model optimization training is completed, and the dial recognition large model after optimization training is obtained; otherwise, repeat steps 7.1 to 7.4 until the dial recognition large model optimization training is completed;
[0050] The total loss function Loss represents the sum of all sub-losses during the training of the dial recognition model, specifically:
[0051]
[0052] Among them, Loss i is the i-th sub-loss function; w i is the weight of the i-th sub-loss function, which is used to adjust the contribution of each sub-loss to the total loss. The weight w i It is usually determined by parameter adjustment; h is the number of sub-loss functions;
[0053] Step 7.5: The image of the pointer-type pipeline pressure gauge to be identified is obtained through the camera, and the image of the pipeline pressure gauge to be identified is transmitted to the image processing unit for preprocessing and image preprocessing, and then the processed image is input into the dial recognition large model after optimization training, and the dial recognition large model outputs the reading of the pointer-type pipeline pressure gauge.
[0054] The step 8 comprises the following sub-steps:
[0055] Step 8.1: The data processing unit uses the knowledge distillation technology to establish a small data anomaly analysis model, and trains the small data anomaly analysis model based on the dial recognition large model and the sample data set to obtain the small data anomaly analysis model;
[0056] The sample data set includes the following:
[0057] All images captured by the camera: including original images of pointer-type pipeline pressure gauges of various models, different readings, and different lighting conditions;
[0058] All images after preprocessing and image preprocessing: images after rectification, denoising, contrast enhancement, and edge detection operations on the original images;
[0059] Image to be recognized acquired by the camera: image to be recognized;
[0060] Real mask image: an image used to train the dial recognition model to identify the position of the scale line pointed by the pointer, generated by manual annotation;
[0061] Step 8.2: Enter the initial threshold of the pointer-type pipeline pressure gauge to be tested into the data anomaly analysis model;
[0062] Step 8.3: The small model for data anomaly analysis obtains the reading of the pointer-type pipeline pressure gauge output by the large dial recognition model.
[0063] The step 10 comprises the following sub-steps:
[0064] Step 10.1: The data anomaly analysis small model transmits the data anomaly information to the dial recognition large model;
[0065] Step 10.2: The dial recognition model sends the alarm information to the manager's smart terminal device through the abnormal alarm module;
[0066] Step 10.3: The data anomaly analysis model stores the real-time detected reading data into the database;
[0067] Step 10.4: The dial recognition model transmits the readings to the monitoring display in real time through the wireless network module, displays the readings on the monitoring display and generates reading charts and change curves, and obtains the pressure changes of the pointer-type pipeline pressure gauge during its operation through the visual interface.
[0068] Compared with the prior art, the present invention has the following beneficial effects:
[0069] 1. The present invention is provided with an image acquisition device and an image processing device. The camera bracket is used to rotate the camera so that the pointer-type pipeline pressure gauge to be detected is completely within the shooting range of the camera. The image of the pointer-type pipeline pressure gauge is automatically acquired remotely, and the reading of the pipeline mechanical pressure gauge is efficiently and accurately identified and recorded through the dial recognition large model, thereby avoiding the tediousness and errors of manual meter reading. At the same time, the adaptability of the entire device to different environmental conditions can be significantly enhanced, which is conducive to ensuring the safe and stable operation of the pipeline system, and is of great significance for improving the intelligent level of operation and maintenance of building electromechanical equipment and ensuring production safety and efficiency.
[0070] 2. The present invention is provided with a large dial recognition model and a small data anomaly analysis model. Through the coordinated work of the large and small models, the readings of the pointer-type pipeline pressure gauge are accurately read and an abnormality analysis is performed on the readings, thereby realizing the functions of real-time transmission, storage, analysis and abnormality reminder of the reading data. It combines the strong dial image processing capability of the large dial recognition model and the abnormal data analysis advantage of the small data anomaly analysis model, thereby improving the intelligent management level and work efficiency of the pointer-type pipeline pressure gauge. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present disclosure.
[0072] Figure 1 It is a flow chart of a pipeline pressure automatic detection method with large and small models coordinated according to the present invention;
[0073] Figure 2 It is a structural block diagram of a large and small model coordinated pipeline pressure automatic detection device of the present invention;
[0074] Figure 3 It is a structural schematic diagram of an image acquisition device in an automatic pipeline pressure detection device in which large and small models cooperate with each other in the present invention.
[0075] In the figure, 1 is a camera bracket, 2 is a camera, 3 is a light compensator, 4 is a camera dust scraper, 5 is a power module, 6 is an image processing unit, 7 is a data processing module, 8 is an abnormal alarm module, 9 is a monitoring display, and 10 is a wireless network module. DETAILED DESCRIPTION
[0076] The following is a further detailed description of a large and small model coordinated pipeline pressure automatic detection method and device proposed by the present invention in conjunction with the accompanying drawings and specific embodiments. The advantages and features of the present invention will become clearer according to the following description and claims. It should be noted that the drawings are all in a very simplified form and are not in precise proportions, and are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention.
[0077] Please see attached Figure 2 and attached Figure 3 , a large and small model coordinated pipeline pressure automatic detection device, including an image acquisition device, a power module 5, an image processing device and a monitoring display 9; the power module 5 is electrically connected to the image acquisition device, the image acquisition device includes a camera bracket 1, a camera 2 and a light compensator 3; the camera 2 is rotatably installed facing the pointer-type pipeline pressure gauge through the camera bracket 1, and the light compensator 3 is installed on the camera 2 and is located next to the shooting lens; the image processing device includes an image processing unit 6, a data processing module 7 and an abnormal alarm module 8, the output end of the camera 2 is wirelessly connected to the input end of the image processing unit 6 through a wireless network module 10, the output end of the image processing unit 6 is connected to the input end of the data processing module 7, the output end of the data processing module 7 is connected to the monitoring display 9 and the abnormal alarm module 8, and the output end of the abnormal alarm module 8 is wirelessly connected to the intelligent terminal device of the management personnel.
[0078] Preferably, the camera bracket 1 can adopt a rotating bracket, which is composed of horizontally and vertically arranged bracket rods connected by a rotating shaft to rotate relative to each other, so that the camera 2 can rotate 360° in the horizontal and vertical directions, so that the pointer-type pipeline pressure gauge at different positions can be photographed to obtain the required image. A plurality of images of pointer-type pipeline pressure gauges are pre-set in the image acquisition device. These preset images serve as references to help the camera bracket 1 and the camera 2 quickly locate and identify the target pointer-type pipeline pressure gauge in the subsequent actual acquisition process. When acquiring an image of a specified pointer-type pipeline pressure gauge, the rotating shaft between the bracket rods can be controlled by the rotation of the motor. Based on the preset image, the remote rotation control of each bracket rod is realized by remote control of the motor, so that the camera 2 can shoot the specified pointer-type pipeline pressure gauge.
[0079] Preferably, the camera 2 may be a high-definition camera with high resolution (e.g., at least 1080p resolution) and high frame rate, capable of real-time monitoring and periodically acquiring (e.g., acquiring one image every minute) clear images of the pointer-type pipeline pressure gauge under different lighting conditions. Its shooting lens may have an autofocus function, capable of providing a viewing angle of at least 90°, ensuring that the dial of the pointer-type pipeline pressure gauge appears completely in the image. The camera 2 may acquire the image of at least one pointer-type pipeline pressure gauge at a time.
[0080] Preferably, the light compensator 3 can use an LED light with adjustable brightness to ensure that the image of the pointer pressure gauge obtained in a low-light environment is clear; the light compensator 3 is equipped with a brightness sensor for automatically detecting ambient light and adjusting the brightness of the LED light according to shooting needs to ensure that the clarity of the image of the pointer-type pipeline pressure gauge obtained under any environmental conditions can meet subsequent processing requirements.
[0081] Preferably, the power module 5 may adopt a lithium battery to provide a stable working power supply for the image acquisition device.
[0082] Preferably, the image processing unit 6 may be equipped with algorithms including but not limited to geometric correction, denoising, contrast enhancement, edge detection, etc., and may perform geometric correction, denoising, contrast enhancement, edge detection, etc. on the image captured and wirelessly transmitted by the camera 2 to improve the accuracy of subsequent image recognition. Denoising, contrast enhancement, and edge detection algorithms are conventional algorithms for image processing in the art, and will not be described one by one here.
[0083] At the same time, the image processing unit 6 performs feature recognition and extraction on the preprocessed image by establishing a dial recognition model, and calculates and outputs the reading of the pointer-type pipeline pressure gauge. Specifically, the image processing unit 6 recognizes the pointer position of the pointer-type pipeline pressure gauge in the image and the angle of the scale line it points to, and accurately calculates the reading of the pointer-type pipeline pressure gauge based on the pointer position and the angle of the scale line it points to, with a calculation error of less than 1%.
[0084] Preferably, a small data anomaly analysis model is established in the data processing unit 7, and an initial threshold value of each pointer-type pipeline pressure gauge is preset through a threshold setting module, that is, the pressure range of the pointer-type pipeline pressure gauge when it is working normally. The data processing unit 7 compares and analyzes the readings of the large dial recognition model to determine whether the pointer-type pipeline pressure gauge is in a normal or abnormal state.
[0085] Preferably, the abnormal alarm module 8 can be equipped with a communication module. When the data processing unit 7 determines that the pointer-type pipeline pressure gauge is in an abnormal state, the alarm information is pushed to the manager's mobile phone or other smart terminal devices via text messages, WeChat messages, etc., so that the manager can intervene in time.
[0086] Preferably, the wireless network module 10 can use a transmission module such as Ethernet, WIFI, 4G / 5G, etc. to transmit the image acquired by the camera 2 to the image processing unit 6 through a corresponding communication protocol. The wireless network module 10 has an IP65 protection level and can adapt to industrial field environments.
[0087] Please see attached Figure 2 and attached Figure 3The camera 2 is provided with a camera dust scraper 4, and the camera dust scraper 4 is in sliding contact with the shooting lens of the camera 2.
[0088] Preferably, the camera dust scraper 4 may include a motor, an electrically-controlled telescopic rod and a cleaning blade. The output shaft of the motor is connected to one end of the cleaning blade, so that the cleaning blade can rotate under the drive of the motor, thereby scraping and cleaning the shooting lens. The electrically-controlled telescopic rod is used to control the synchronous movement of the motor and the cleaning blade, so that the cleaning blade can rotate and move to scrape different positions of the shooting lens, effectively ensuring the cleaning effect.
[0089] The telescopic range and installation position of the electric telescopic rod can be adaptively adjusted according to the cleaning requirements of the shooting lens.
[0090] Please see attached Figure 1 To Attachment Figure 3 , a pipeline pressure automatic detection method with large and small models, comprising the following steps:
[0091] Step 1: The image of the pointer-type pipeline pressure gauge to be inspected is acquired through camera 2 to form a pointer-type pipeline pressure gauge image dataset.
[0092] Step 2: Annotate the pointer-type pipeline pressure gauge image dataset with real labels.
[0093] The step 2 comprises the following sub-steps:
[0094] Step 2.1: Manually annotate the images of the pointer-type pipe pressure gauges to be inspected with real labels to clarify the specific pointer-type pipe pressure gauges corresponding to each image, so as to facilitate rapid positioning and identification of the target pointer-type pipe pressure gauges in the subsequent actual image acquisition process.
[0095] Step 2.2: Obtain a pointer-type pipeline pressure gauge image dataset after being annotated with real labels, and preprocess the pointer-type pipeline pressure gauge image dataset after being annotated with real labels through the image processing unit 6 to obtain a preprocessed pointer-type pipeline pressure gauge image dataset.
[0096] The preprocessing includes image geometric correction processing. Aiming at the problem of image geometric distortion that may occur in the transmission process of the original image of the pointer-type pipeline pressure gauge acquired by the camera 2 (hereinafter referred to as the original image), a geometric correction algorithm is used to map the points in the original image to new positions using formula (1) to achieve correction. The pixel coordinates of the original image are used as the input of formula (1), and the corrected coordinates are calculated and output by formula (1).
[0097] x'=a0+a1·x+a2·y+a3·x2+a4·x·y+a5·y 2
[0098] y'=b0+b1·x+b2·y+b3·x 2 +b4·x·y+b5·y 2 (1)
[0099] Among them, x and y are the pixel coordinates in the original image acquired by camera 2, x′ and y′ are the corrected coordinates; a0, a1, a2, a3, a4, a5, b0, b1, b2, b3, b4, and b5 are the coefficients of the polynomial transformation of the geometric correction algorithm.
[0100] Geometric correction processing is a conventional means of processing image geometric distortion, which can be processed using the geometric correction program of the prior art, and its correction process will not be described in detail here.
[0101] Step 3: Perform image preprocessing on the pointer-type pipeline pressure gauge image data set through the image processing unit 6.
[0102] Since the camera 2 may be affected by various noises when acquiring the original image, such as image sensor noise, ambient light noise, etc., which will affect the clarity of the original image, the image preprocessed in step 2 is optimized through a series of processing algorithms and technical means to improve the quality and recognizability of the image, so that the subsequent feature recognition and extraction of the image are more accurate.
[0103] Specifically, the average value of the neighborhood around each pixel in the preprocessed image is calculated, and the pixel value is replaced with the average value to reduce the influence of the above noise, thereby improving the clarity of the image. The calculation process is shown in formula (2):
[0104]
[0105] Where f(x,y) is the geometrically corrected image, g(x,y) is the denoised image, M is the width of the filter, and N is the height of the filter.
[0106] According to the actual image processing requirements, image preprocessing such as image contrast enhancement and scaling can also be performed.
[0107] Step 4: Establish a large dial recognition model for the pointer-type pipeline pressure gauge.
[0108] In the step 4, the image processing unit 6 uses an open source large model as a basic model for dial recognition to establish a large model for dial recognition. The large model for dial recognition includes an image encoder, a prompt encoder and a mask decoder.
[0109] Preferably, the open source large model can adopt the existing technology LLaMA series model, ChatGLM series model, Baichuan, Qwen, etc.
[0110] Step 5: The dial recognition model extracts features from the image preprocessed in step 3.
[0111] In the step 5, the image processing unit 6 performs edge detection, contour extraction and other operations on the image preprocessed in step 3 to extract the pointer of the pointer-type pipeline pressure gauge and the scale line features it points to.
[0112] Feature extraction is to extract information useful for recognition tasks from the image after image preprocessing. Edge detection: For a pointer-type pipeline pressure gauge, the edge is the area in the image where the brightness changes significantly, corresponding to the outline of the object, i.e., the dial of the pointer-type pipeline pressure gauge.
[0113] Based on edge detection, a contour extraction algorithm is used to identify and track continuous edges in the image to form closed contours; these contours can be used to identify the position of the pointer and the scale line it points to.
[0114] Specifically, in each image, the gradient magnitude of each pixel is calculated. The gradient magnitude G(x, y) can be calculated by formula (3):
[0115]
[0116] Among them, Gx and Gy are the gradients of the image in the x direction and y direction respectively. Pixels with gradient amplitudes in the range of 80-150 are set as very significant edges. The range of gradient amplitudes can be adaptively adjusted according to actual usage requirements.
[0117] The process of extracting the dial contour based on the edge detection algorithm is as follows:
[0118] Step A1: Convert the image to grayscale.
[0119] Grayscale the image to reduce image noise and highlight edge information.
[0120] Step A2: Apply threshold.
[0121] Use edge detection algorithms (gradient magnitude) to find areas in the image where brightness changes significantly. Pixels with gradient magnitudes in the range of 80-150 are very significant edges.
[0122] Step A3: Find the edge, which is the outline of the dial.
[0123] Using the contour finding algorithm, the findContours function in OpenCV software is applied to identify and extract continuous edges in the image.
[0124] Step A4: Draw a contour using the continuous edges extracted in step A3, which is the contour of the dial.
[0125] The feature recognition process of identifying the position of the pointer and the scale line it points to through the contour extraction algorithm is as follows:
[0126] Step B1: Filter the pointer contour.
[0127] Use length screening method: The pointer is usually longer than the scale line. A length threshold can be set according to the pointer length of the pointer-type pipeline pressure gauge to screen the pointer and obtain the pointer profile.
[0128] Step B2: Filter the tick mark contours.
[0129] Use length screening method: the scale line is usually shorter than the pointer. A smaller length threshold can be set according to the scale line length of the pointer-type pipeline pressure gauge to screen the scale line and obtain the scale line outline.
[0130] Step B3: Determine the pointer position.
[0131] After finding the pointer contour, its center point or endpoint position is calculated to determine the position of the pointer, which can be done through the geometric moment of the pointer contour.
[0132] Step B4: Determine the scale line position.
[0133] Calculate the angle of each scale line so that the specific scale value pointed by the pointer can be further determined based on the scale line pointed by the pointer, that is, the reading of the pointer-type pipeline pressure gauge.
[0134] Contour extraction algorithm and edge detection algorithm are conventional operation methods for image feature extraction, and their specific processing procedures will not be described here.
[0135] Step 6: Use the pointer-type pipeline pressure gauge image dataset that has undergone image preprocessing and feature extraction to fine-tune the dial recognition model to obtain the fine-tuned dial recognition model.
[0136] The image encoder is used to convert the input image into a feature vector and extract key information such as the pointer position, scale line shape position, etc. The fine-tuning of the image encoder may include but is not limited to learning rate decay, early stopping and other strategies to improve the generalization ability of the dial recognition model.
[0137] Learning rate decay, early stopping and other strategies are common optimization strategies for image encoders in machine learning models. The specific process will not be described here. The optimization strategy of the image encoder can be selected according to the actual application requirements so that the generalization ability of the dial recognition model can meet the application requirements.
[0138] The prompt encoder is used to convert the input text prompt into a feature vector to provide additional information to the mask decoder, such as "read the reading of the pointer-type pipeline pressure gauge". The fine-tuning of the prompt encoder may include but is not limited to strategies such as teacher learning and knowledge distillation to transfer the knowledge of the dial recognition large model to the data anomaly analysis small model to improve the performance of the data anomaly analysis small model.
[0139] The prompt encoder can be used to send a call instruction and the reading of the pointer-type pipeline pressure gauge to the data anomaly analysis small model, so that the data anomaly analysis small model performs its data analysis function based on the reading of the pointer-type pipeline pressure gauge.
[0140] The mask decoder is used to generate a predicted mask image, i.e., the position of the scale line pointed by the pointer, based on the feature vectors output by the image encoder and the hint encoder. The fine-tuning of the mask decoder may include but is not limited to strategies such as multi-scale training and multi-task learning to improve the processing capability of the dial recognition large model for different scales and tasks.
[0141] Multi-scale training and multi-task learning strategies are common optimization strategies for mask decoders in machine learning models. The specific process will not be described here. The optimization strategy of the mask decoder can be selected according to actual application requirements so that the processing capability of the large dial recognition model can meet the application requirements.
[0142] Step 7: Input the pointer-type pipeline pressure gauge image dataset after image preprocessing into the fine-tuned dial recognition model, iteratively optimize and train the dial recognition model, and obtain the trained dial recognition model.
[0143] The step 7 comprises the following sub-steps:
[0144] Step 7.1: Input the image in the pointer-type pipeline pressure gauge image dataset after image preprocessing into the image encoder of the fine-tuned dial recognition large model to obtain the image embedding vector, and convolve the image embedding vector with the true mask image to obtain the convolved image.
[0145] The real mask image refers to the image of the scale line position pointed by the recognition pointer used to train the dial recognition model in the above feature extraction task. The real mask image can be manually annotated by marking the scale line position pointed by the pointer to ensure that the real mask image is completely consistent with the real reading.
[0146] Step 7.2: Use the hint encoder of the fine-tuned dial recognition large model to obtain the hint code, input the convolution image obtained in step 7.1 and the hint code into the mask decoder for decoding, and obtain the predicted mask image.
[0147] Step 7.3: Set the total loss function, use the predicted mask image and the true mask image to calculate the total loss function value, and update the parameters of the fine-tuned dial recognition model based on the calculation results.
[0148] Step 7.4: Determine whether the total loss function value of the dial recognition large model is less than the preset threshold. If so, the optimization training of the dial recognition large model is completed, and the optimized dial recognition large model is obtained; otherwise, repeat steps 7.1 to 7.4 until the optimization training of the dial recognition large model is completed.
[0149] The input of the dial recognition large model after optimization and training is the image of the pointer-type pipeline pressure gauge to be identified obtained by camera 2 after preprocessing and image preprocessing, and the output is the reading of the pointer-type pipeline pressure gauge.
[0150] The total loss function Loss represents the sum of all sub-losses during the training of the dial recognition model, specifically:
[0151]
[0152] Among them, Loss i is the i-th sub-loss function; w i is the weight of the i-th sub-loss function, which is used to adjust the contribution of each sub-loss to the total loss. The weight w i It is usually determined by parameter tuning; h is the number of sub-loss functions.
[0153] Step 7.5: Acquire the image of the pointer-type pipeline pressure gauge to be identified through camera 2, transmit the image of the pipeline pressure gauge to be identified to the image processing unit 6 for preprocessing and image preprocessing, and then input the processed image into the optimized and trained dial recognition large model, and the dial recognition large model outputs the reading of the pointer-type pipeline pressure gauge.
[0154] According to the position of the pointer-type pipeline pressure gauge to be detected, the camera 2 is rotated by the camera bracket 1 so that the pointer-type pipeline pressure gauge is completely within the shooting range of the camera 2, so that the camera 2 can obtain the original image with the best clarity and resolution.
[0155] After the camera bracket 1 rotates into place, the camera 2 automatically shoots, obtains the image of the pointer-type pipeline pressure gauge to be identified, and transmits it to the image processing unit 6 through the wireless network for preprocessing and image preprocessing. The preprocessing and image preprocessing operations and their operation methods here are the same as the preprocessing and image preprocessing operations and their operation methods in the optimization training process of the dial recognition large model, and will not be repeated here. Finally, the processed image is input into the dial recognition large model after optimization training, so that the dial recognition large model calculates and outputs the reading of the pointer-type pipeline pressure gauge.
[0156] Step 8: Build a small model for data anomaly analysis.
[0157] The large dial recognition model is usually a complex model obtained through training with a large amount of data and resources, while the small data anomaly analysis model is a relatively simple model. The small data anomaly analysis model is designed to replicate the performance of the large dial recognition model as much as possible while maintaining a smaller model size.
[0158] The step 8 comprises the following sub-steps:
[0159] Step 8.1: The data processing unit 7 uses knowledge distillation technology to establish a small data anomaly analysis model, and trains the small data anomaly analysis model based on the dial recognition large model and the sample data set to obtain a small data anomaly analysis model that meets the expected convergence constraints.
[0160] The sample data set includes the following:
[0161] All images acquired by camera 2: including original images of pointer-type pipeline pressure gauges of various models, different readings, and different lighting conditions.
[0162] All images after preprocessing and image preprocessing: images after rectification, denoising, contrast enhancement, edge detection and other operations on the original images.
[0163] The image to be recognized acquired by the camera 2: the image to be recognized, for example, the image of the pointer-type pipeline pressure gauge acquired in real time.
[0164] Real mask image: an image used to train the dial recognition model to identify the position of the scale line pointed by the pointer, generated by manual annotation.
[0165] Step 8.2: Enter the initial threshold value of the pointer-type pipeline pressure gauge to be tested into the data anomaly analysis model.
[0166] The initial threshold value of the pointer-type pipeline pressure gauge can be initialized through the threshold value setting module, which is used to set the corresponding normal working pressure range of each pointer-type pipeline pressure gauge.
[0167] Step 8.3: The small model for data anomaly analysis obtains the reading of the pointer-type pipeline pressure gauge output by the large dial recognition model.
[0168] Step 9: Data anomaly analysis The small model performs data analysis.
[0169] After receiving the call instruction from the dial recognition large model, the data anomaly analysis small model automatically executes the data analysis function, compares the reading of the pointer-type pipeline pressure gauge output by the dial recognition large model with the initial threshold value corresponding to the pointer-type pipeline pressure gauge, and if the data is within the initial threshold range, it is judged to be normal; if the reading exceeds the initial threshold value, it is judged to be abnormal, thereby achieving a rapid response to data anomalies.
[0170] For example: if the initial threshold of a pointer-type pipeline pressure gauge is set to 10-20, then 0-10 and above 20 are both data abnormalities. According to the safe working pressure requirements of the pointer-type pipeline pressure gauge, the abnormal data in the range of 0-10 can be set to the orange alarm level, and the abnormal data in the range of 20-25 can be set to the red alarm. Different alarm levels can also be set according to the safe working pressure requirements of the pointer-type pipeline pressure gauge to facilitate the adoption of different levels of response measures.
[0171] Step 10: Use the dial recognition large model to issue a data abnormality reminder through the abnormality alarm module 8.
[0172] The step 10 comprises the following sub-steps:
[0173] Step 10.1: The small data anomaly analysis model transmits the data anomaly information to the large dial recognition model.
[0174] Step 10.2: The dial recognition model sends the alarm information to the manager's smart terminal device via the abnormal alarm module 8 in the form of SMS, WeChat message, etc.
[0175] Step 10.3: The small model for data anomaly analysis stores the real-time detected reading data into the database to facilitate historical data query and analysis.
[0176] Step 10.4: The dial recognition model transmits the readings to the monitoring display 9 in real time through the wireless network module 10, displays the readings on the monitoring display 9 and generates reading charts, change curves, etc., and quickly and intuitively obtains the pressure changes of the pointer-type pipeline pressure gauge during its operation through the visual interface.
[0177] Preferably, encryption technology can be used to encrypt the reading data during transmission to ensure data security during transmission.
[0178] The above description is only a description of the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention. Any changes or modifications made by a person skilled in the art in the field of the present invention based on the above disclosure shall fall within the scope of protection of the claims.
Claims
1. A large and small model coordinated pipeline pressure automatic detection device, characterized in that: include: An image acquisition device, a power module (5), an image processing device and a monitoring display (9); The power module (5) is electrically connected to the image acquisition device, and the image acquisition device comprises a camera bracket (1) and a camera (2); the camera (2) is rotatably installed facing the pointer-type pipeline pressure gauge through the camera bracket (1); the image processing device comprises an image processing unit (6), a data processing module (7) and an abnormal alarm module (8); the output end of the camera (2) is wirelessly connected to the input end of the image processing unit (6) through a wireless network module (10), the output end of the image processing unit (6) is connected to the input end of the data processing module (7), the output end of the data processing module (7) is connected to a monitoring display (9) and the abnormal alarm module (8), and the output end of the abnormal alarm module (8) is wirelessly connected to the intelligent terminal device of the management personnel.
2. The large and small model coordinated pipeline pressure automatic detection device as claimed in claim 1, characterized in that: The camera (2) is provided with a camera dust scraper (4), which is in sliding contact with the shooting lens of the camera (2). The camera (2) is provided with a light compensator (3), which is located beside the shooting lens of the camera (2).
3. An automatic detection method for the large and small model coordinated pipeline pressure automatic detection device as claimed in claim 1, characterized in that: The following steps are involved: Step 1: Acquire an image of a pointer-type pipeline pressure gauge to be inspected through a camera (2) to form a pointer-type pipeline pressure gauge image data set; Step 2: Annotate the pointer-type pipeline pressure gauge image dataset with real labels; Step 3: performing image preprocessing on the pointer-type pipeline pressure gauge image data set through the image processing unit (6); Step 4: Establish a large dial recognition model for the pointer-type pipeline pressure gauge; Step 5: The dial recognition model extracts features from the image preprocessed in step 3; Step 6: Use the pointer-type pipeline pressure gauge image dataset that has undergone image preprocessing and feature extraction to fine-tune the dial recognition model to obtain the fine-tuned dial recognition model; Step 7: Input the pointer-type pipeline pressure gauge image data set after image preprocessing into the fine-tuned dial recognition model, iteratively optimize and train the dial recognition model, and obtain the trained dial recognition model; Step 8: Build a small model for data anomaly analysis; Step 9: Data anomaly analysis The small model performs data analysis; Step 10: Using the dial recognition large model, the abnormal alarm module (8) issues a data abnormality reminder.
4. The automatic detection method according to claim 3, characterized in that: The step 2 comprises the following sub-steps: Step 2.1: manually annotate the images of the pointer-type pipeline pressure gauges to be inspected with real labels, and clarify the specific pointer-type pipeline pressure gauges corresponding to each image, so as to locate and identify the target pointer-type pipeline pressure gauges in the subsequent actual image acquisition process; Step 2.2: obtaining a pointer-type pipeline pressure gauge image dataset after being annotated with real labels, and preprocessing the pointer-type pipeline pressure gauge image dataset after being annotated with real labels by an image processing unit (6) to obtain a preprocessed pointer-type pipeline pressure gauge image dataset; The preprocessing includes image geometric correction processing, which uses formula (1) to map points in the original image to new positions to achieve correction: x’=a0+a1.x+a2.y+a3.x 2 +a4.x.y+a5.y 2 y'=b0+b1.x+b2.y+b3.x 2 +b4.x.y+b5.y 2 (1) Wherein, x and y are the pixel coordinates in the original image acquired by the camera (2), x' and y' are the coordinates after correction; a0, a1, a2, a3, a4, a5, b0, b1, b2, b3, b4, b5 are the coefficients of the polynomial transformation of the geometric correction algorithm.
5. The automatic detection method according to claim 3, characterized in that: In the step 3, the average value of the neighborhood around each pixel in the preprocessed image is calculated, and the pixel value is replaced by the average value to reduce the influence of noise and improve the clarity of the image; The calculation process is shown in formula (2): Where f(x,y) is the geometrically corrected image, g(x,y) is the denoised image, M is the width of the filter, and N is the height of the filter.
6. The automatic detection method according to claim 3, characterized in that: In the step 4, the image processing unit (6) uses an open source large model as a basic model for dial recognition to establish a large model for dial recognition. The large model for dial recognition includes an image encoder, a prompt encoder and a mask decoder.
7. The automatic detection method according to claim 3, characterized in that: In the step 5, edge detection and contour extraction operations are performed on the image after image preprocessing in step 3 by the image processing unit (6), so as to extract the features of the pointer of the pointer-type pipeline pressure gauge and the scale line it points to; The process of extracting the dial contour based on the edge detection algorithm is as follows: Step A1: Convert image to grayscale: grayscale the image to reduce image noise and highlight edge information; Step A2: Apply thresholding: Use edge detection algorithms to find areas in the image where brightness changes significantly; In each image, the gradient magnitude of each pixel is calculated. The gradient magnitude G(x,y) is calculated by formula (3): Among them, Gx and Gy are the gradients of the image in the x-direction and y-direction respectively, and the pixels with gradient amplitudes in the range of 80-150 are set as very significant edges; Step A3: Find the edge, i.e. the outline of the dial: Use the outline finding algorithm and apply the findContours function in OpenCV software to identify and extract continuous edges in the image; Step A4: Draw a contour using the continuous edges extracted in step A3, which is the contour of the dial; The feature recognition process of identifying the position of the pointer and the scale line it points to through the contour extraction algorithm is as follows: Step B1: Screen the pointer contour by length screening: the pointer is usually longer than the scale line. A length threshold can be set according to the pointer length of the pointer-type pipeline pressure gauge to screen the pointer and obtain the pointer contour; Step B2: Filter the scale line profile by length screening: the scale line is usually shorter than the pointer. A smaller length threshold can be set according to the scale line length of the pointer-type pipeline pressure gauge to filter the scale line and obtain the scale line profile; Step B3: Determine the pointer position: After finding the pointer outline, calculate its center point or endpoint position to determine the pointer position; Step B4: Determine the scale line position: calculate the angle of each scale line, and further determine the specific scale value pointed by the pointer according to the scale line pointed by the pointer, that is, the reading of the pointer-type pipeline pressure gauge.
8. The automatic detection method according to claim 3, characterized in that: The step 7 comprises the following sub-steps: Step 7.1: Input the image in the pointer-type pipeline pressure gauge image dataset after image preprocessing into the image encoder of the fine-tuned dial recognition large model to obtain the image embedding vector, and perform a convolution operation on the image embedding vector and the true mask image to obtain a convolution image; Step 7.2: Use the hint encoder of the fine-tuned dial recognition large model to obtain the hint code, input the convolution image obtained in step 7.1 and the hint code into the mask decoder for decoding, and obtain the predicted mask image; Step 7.3: Set the total loss function, use the predicted mask image and the true mask image to calculate the total loss function value, and update the parameters of the fine-tuned dial recognition model according to the calculation results; Step 7.4: Determine whether the total loss function value of the dial recognition large model is less than a preset threshold. If so, the dial recognition large model optimization training is completed, and the dial recognition large model after optimization training is obtained; otherwise, repeat steps 7.1 to 7.4 until the dial recognition large model optimization training is completed; The total loss function Loss represents the sum of all sub-losses during the training of the dial recognition model, specifically: Among them, Loss i is the i-th sub-loss function; w i is the weight of the i-th sub-loss function, which is used to adjust the contribution of each sub-loss to the total loss. The weight w i It is usually determined by parameter adjustment; h is the number of sub-loss functions; Step 7.5: The image of the pointer-type pipeline pressure gauge to be identified is obtained through the camera (2), and the image of the pipeline pressure gauge to be identified is transmitted to the image processing unit (6) for preprocessing and image preprocessing, and then the processed image is input into the dial recognition large model after optimization training, and the dial recognition large model outputs the reading of the pointer-type pipeline pressure gauge.
9. The automatic detection method according to claim 3, characterized in that: The step 8 comprises the following sub-steps: Step 8.1: The data processing unit (7) uses the knowledge distillation technology to establish a small data anomaly analysis model, and trains the small data anomaly analysis model based on the dial recognition large model and the sample data set to obtain the small data anomaly analysis model; The sample data set includes the following: All images acquired by the camera (2): including original images of pointer-type pipeline pressure gauges of various models, different readings, and different lighting conditions; All images after preprocessing and image preprocessing: images after rectification, denoising, contrast enhancement, and edge detection operations on the original images; The image to be identified acquired by the camera (2): the image to be identified; Real mask image: an image used to train the dial recognition model to identify the position of the scale line pointed by the pointer, generated by manual annotation; Step 8.2: Enter the initial threshold of the pointer-type pipeline pressure gauge to be tested into the data anomaly analysis model; Step 8.3: The small model for data anomaly analysis obtains the reading of the pointer-type pipeline pressure gauge output by the large dial recognition model.
10. The automatic detection method according to claim 3, characterized in that: The step 10 comprises the following sub-steps: Step 10.1: The data anomaly analysis small model transmits the data anomaly information to the dial recognition large model; Step 10.2: The dial recognition model sends the alarm information to the manager's smart terminal device through the abnormal alarm module (8); Step 10.3: The data anomaly analysis model stores the real-time detected reading data into the database; Step 10.4: The dial recognition model transmits the readings to the monitoring display (9) in real time through the wireless network module (10), displays the readings through the monitoring display (9) and generates a reading chart and a change curve, and obtains the pressure change of the pointer-type pipeline pressure gauge during operation through the visual interface.