Abnormal state data extraction method for oil pipeline based on image segmentation
By converting sensor data from detection equipment in oil pipelines into images and performing image segmentation processing, the DRLSE model system and level set function are used to identify abnormal areas, solving the problem of abnormal data extraction from massive data and improving data processing efficiency and analysis performance.
Patent Information
- Application Number
- CN202410889508.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-07-04
AI Technical Summary
In the processing and analysis of massive data generated by inspection equipment in oil pipelines, the problem of how to extract valuable information and remove abnormal status data is difficult to process efficiently with existing technology.
Using a method based on image segmentation, the sensor data fluctuation map is formed by reading sensor data, and image processing and preprocessing are performed. The DRLSE model system and level set function are used for image segmentation, and abnormal areas are identified and extracted.
It realizes the rapid extraction of abnormal status data of oil pipelines, improves data processing efficiency, effectively removes abnormal data, and simplifies data analysis and troubleshooting.
Smart Images

Figure CN118429345B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of abnormal state data extraction, and in particular to a method for extracting abnormal state data of a petroleum pipeline based on image segmentation. Background Art
[0002] When using internal inspection equipment to detect internal stress and cracks in oil and gas pipelines, these devices are often equipped with a series of high-precision sensors to ensure that various parameters inside the pipeline can be fully and accurately obtained. These sensors include sensors for measuring stress, which are distributed in different parts of the equipment to capture the stress changes of the pipeline at different locations; posture sensors, which are used to monitor the spatial position and posture of the equipment in real time to ensure the accuracy of data collection; inclination sensors, which can sense the inclination angle of the equipment to determine whether the pipeline is deformed or twisted; mileage sensors, which are responsible for recording the distance the equipment moves inside the pipeline, which helps to build a three-dimensional model of the pipeline.
[0003] Each sensor works at a relatively high sampling frequency, which means they generate a large amount of data in a short period of time. During the operation of the equipment, these sensors continuously collect data and store it in the memory inside the equipment. This rich data provides valuable information for subsequent fault analysis, model building, predictive maintenance and other work.
[0004] However, as time goes by, the amount of data will grow rapidly, bringing huge challenges to subsequent data processing. In addition, in the face of a large amount of data, there is also the problem of how to process and analyze massive amounts of data, extract valuable information, and remove data with abnormal conditions. Summary of the invention
[0005] In order to solve the above-mentioned problem of how to process and analyze a large amount of data, extract valuable information, and remove data with abnormal status, the present application provides a method for extracting abnormal status data of oil pipelines based on image segmentation, comprising the steps of:
[0006] Read sensor data on an internal detection device for detecting an oil pipeline, obtain the rotation angle of the sensor, obtain the sensor degree, obtain the sampling mileage count value of the internal detection device as the sensor position, and the sampling mileage count value is the distance between the sampling point position of the internal detection device and the initial position of the internal detection device;
[0007] Perform a rough detection of abnormal values on the sensor data, and record the sampled mileage count value of the internal detection device that generates the abnormal data ;
[0008] The sensor position sequence is used as the horizontal axis, the sensor degree size is used as the vertical axis, and the sensor data are placed in parallel by multiple sensors to form a sensor data fluctuation graph;
[0009] Correcting the position and inclination of the sensor according to the sensor data, and processing the sensor data fluctuation graph into an image to obtain a grayscale image, and preprocessing the grayscale image;
[0010] The horizontal axis of the grayscale image is the sensor position, the vertical axis represents the multiple sensors on the internal detection device, and the grayscale value of the sensor represents the corresponding sensor degree at the current sensor position;
[0011] Odometer value based on abnormal data , for the mileage count value on the grayscale image The defect segmentation is performed in the neighborhood area of the grayscale image, and the horizontal coordinate area of the grayscale image is extracted And record as image ;
[0012] According to the image Establishing a DRLSE model system, initializing a level set function, and extracting a zero level set of the initialized level set function as an initial contour of the abnormal area;
[0013] Define a level set energy functional, wherein the level set energy functional includes a level set penalty function, a length energy term, and a region energy term;
[0014] Establishing a gradient descent flow equation, and solving the gradient descent flow equation by using a variational method to obtain a solution of the gradient descent flow equation, and updating the level set function according to the solution of the gradient descent flow equation;
[0015] Iterate by looping the previous step so that the level set function evolves to obtain a steady-state solution, at which time the level set energy functional reaches a local minimum;
[0016] The level set function when the steady-state solution is reached is output, and according to the level set function, with 0 as the threshold, the area with a level set function value greater than 0 is determined as a normal area, and the area with a level set function value less than 0 is determined as an abnormal area.
[0017] In a feasible implementation, correcting the position and inclination of the sensor according to the sensor data comprises the steps of:
[0018] The data obtained by the sensor is used express;
[0019] in, is the odometer distance, which indicates the length of the sensor along the oil pipeline. represents the data obtained by the i-th sensor when the odometer distance is x;
[0020] When the internal detection device is placed in the oil pipeline, its inclination angle is 0 degrees in the initial state, which is recorded as:
[0021] ;
[0022] Then we get: ;
[0023] In the formula, Represents the pixel value of the point (x, y) on the grayscale image, The pixel value of a point (x, y) on the grayscale image is determined by the data of the yth sensor when the odometer distance is x;
[0024] When the inclination angle of the internal detection device changes, the detection position will be tilted. By correcting y, the change in the inclination angle of the internal detection device is compensated. At this time, assuming , where i is the sensor number at different locations of the device, modified by the following formula:
[0025] ;
[0026] get: ;
[0027] In the formula, for the internal detection device, is the inclination angle of the sensor closest to the current inclination angle, t is the corrected inclination angle, y' is the yth sensor after correction, and n is the total number of sensors;
[0028] After correction, the pixel value of the point (x, y) on the image is determined by the data of the corrected sensor y when the odometer distance is x.
[0029] In a feasible implementation, the sensor data is subjected to rough detection of abnormal values, and the sampled mileage count value of the internal detection device generating the abnormal data is recorded. Includes steps:
[0030] Initially determine the abnormal area and set:
[0031] ;
[0032] In the formula, represents the data obtained by the i-th sensor when the odometer distance is x, is the average value of all sensor data;
[0033] right After normalization, we get:
[0034] ;
[0035] In the formula, for The normalized value of for The minimum value of for The maximum value of
[0036] Introducing the Heaviside function :
[0037] ;
[0038] ;
[0039] The function is used to convert continuous values into discrete binary output. Yes A further extension of , by introducing a manually set threshold t to adjust the sensitivity of the function;
[0040] Where t is the manually set threshold, ε is the parameter that controls the smoothness of the function, is a variable, which represents the function input value;
[0041] The odometry distance x is taken as The input value of the function is obtained , the normalized function With function Perform convolution operation;
[0042] Get function ;
[0043] Get Function And judged by the following formula:
[0044] ;
[0045] When an abnormality is detected, the corresponding mileage value is recorded. .
[0046] In a feasible implementation, the level set energy functional is defined as follows:
[0047] ;
[0048] In the formula, is the level set function, which is a real-valued function defined in the image space domain Ω. The zero level set of the level set function is =0, corresponding to the boundary of the target in the image; is the level set penalty function, is the constant coefficient of the level set penalty function; is the length energy term, and , is the constant coefficient of the length energy term, is the regional energy term, and , is the constant coefficient of the regional energy term, The edge stop function.
[0049] In a feasible implementation, the edge stop function is defined as follows:
[0050] ;
[0051] In the formula, The standard deviation is Gaussian kernel function; is the gradient operator; is the edge strength of the image; I is the image to be segmented, that is, the grayscale image.
[0052] In a feasible implementation, the level set penalty function is defined as follows:
[0053] ;
[0054] Where: is the level set function The gradient represents the rate of change of the function value in the image space; Ω is the spatial domain of the image, that is, the set of all pixels in the image; is the double-well potential function;
[0055] Wherein, the double-well potential function is defined as:
[0056] ;
[0057] In the formula, is the level set function The absolute value of the gradient modulus, is a constant used to adjust the scale of the potential function; is a function that varies between 0 and 2. When the value is 0, When the value is 1; It is a following A monotonically increasing function that is used to punish Greater than 1.
[0058] In a feasible implementation, the length energy term is defined as follows:
[0059] ;
[0060] In the formula, is the unit pulse function; is the level set function The gradient represents the rate of change of the function value in the image space; Ω is the spatial domain of the image, that is, the set of all pixels in the image; The edge stop function.
[0061] In a feasible implementation, the regional energy term is defined as follows:
[0062] ;
[0063] In the formula, is the Heaviside function; is the level set function, The edge stop function.
[0064] In a feasible implementation, the gradient descent flow equation is defined as follows:
[0065] ;
[0066] In the formula, represents the level set function The regularization width of , used to smooth the function and function .
[0067] In a feasible implementation, the step of solving the gradient descent flow equation using a variational method includes:
[0068] Find the steady-state solution of the gradient descent flow equation through the partial differential equation of the gradient descent flow equation solution;
[0069] The partial differential equation is defined as:
[0070] ;
[0071] Where: E is the energy function, is the level set function, For time;
[0072] After solving by partial differentiation, the gradient descent flow equation about the level set function is obtained as follows:
[0073] ;
[0074] Where: is the divergence operator, is defined as function.
[0075] From the above content, it can be known that the oil pipeline abnormal state data extraction method based on image segmentation of the present application forms a sensor data fluctuation graph by reading the sensor data on the internal detection equipment for detecting the oil pipeline; the sensor data fluctuation graph is image-processed to obtain a grayscale image, and then the grayscale image is pre-processed; at the same time, the sensor data is detected for abnormal data, and the horizontal coordinate area with abnormal data of the grayscale image is extracted according to the detection result and recorded as an image, and the image is processed for image segmentation, and the segmentation result is output, that is, the oil pipeline abnormal state data is extracted. The present application realizes the rapid extraction of valuable information in the face of a large amount of data, removes data with abnormal status, and improves the efficiency of data processing by converting data into images and then performing image segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the implementation of the present invention, and together with the specification are used to explain the principles of the embodiments of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the implementation of the present invention, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0077] Figure 1 It is a flow chart of a method for extracting abnormal state data of oil pipelines by image segmentation provided in an embodiment of the present application;
[0078] Figure 2 It is a fluctuation diagram of oil pipeline data of image segmentation provided by an embodiment of the present application;
[0079] Figure 3 The grayscale image is obtained by processing the oil pipeline data fluctuation image of the image segmentation provided by an embodiment of the present application into an image;
[0080] Figure 4 Another embodiment of the present application provides an image segmentation oil pipeline data fluctuation map, which is processed into an image to obtain a grayscale image;
[0081] Figure 5 It is a schematic diagram of abnormal areas on a grayscale image of oil pipeline data of image segmentation provided by an embodiment of the present application;
[0082] Figure 6 It is a schematic diagram of abnormal areas on a grayscale image of oil pipeline data of image segmentation provided by another embodiment of the present application. DETAILED DESCRIPTION
[0083] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the embodiments of the present invention will be more comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the implementation of the embodiments of the present invention.
[0084] When testing the internal stress and cracks of oil and gas pipelines, internal testing equipment is used. These equipment are often equipped with a series of high-precision sensors to ensure that the various parameters inside the pipeline can be fully and accurately obtained. Each sensor works at a relatively high sampling frequency, which means that they will generate a large amount of data in a short period of time. During the operation of the equipment, these sensors will continuously collect data and store it in the memory inside the equipment. However, as time goes by, the amount of data will grow rapidly, bringing huge challenges to subsequent data processing. In addition, in the face of a large amount of data, there is also the problem of how to process and analyze massive amounts of data, extract valuable information, and remove data with abnormal conditions.
[0085] To solve the above problems, the present application provides a method for extracting abnormal state data of oil pipelines based on image segmentation. Figure 1 As shown, the steps include:
[0086] S100: Read sensor data on an internal detection device for detecting an oil pipeline, obtain the rotation angle of the sensor, obtain the sensor degree, obtain the sampling mileage count value of the internal detection device as the sensor position, and the sampling mileage count value is the distance between the internal detection device at the sampling point position and the initial position of the internal detection device.
[0087] This step mainly reads and analyzes the sensor data of the detection equipment inside the oil pipeline. First, the system reads the sensor data installed on the detection equipment inside the oil pipeline. These data mainly reflect the rotation angle of the sensor, thereby obtaining the specific sensor degree. In addition, the system also obtains the sampling mileage count value of the internal detection equipment. This value represents the distance between the sampling point position and the initial position of the internal detection equipment, providing the specific location information of the equipment in the pipeline for subsequent data processing.
[0088] S200: Perform a rough detection of abnormal values on the sensor data and record the sampled mileage count value of the internal detection device that generates the abnormal data .
[0089] In some embodiments, in the specific operation of the rough detection of abnormal values, a method for preliminarily determining the abnormal area is first set. By calculating the average value of the data of all sensors at the same odometer distance x , a reference benchmark can be obtained. Next, this average value is normalized to convert the data of different ranges into a unified standardized value. , which can better perform subsequent outlier judgment.
[0090] Specifically, the abnormal area is initially determined and set:
[0091] ;
[0092] In the formula, represents the data obtained by the i-th sensor when the odometer distance is x, is the average value of all sensor data.
[0093] Again After normalization, we get:
[0094] ;
[0095] In the formula, for The normalized value of for The minimum value of for The maximum value of .
[0096] Second, introduce the Heaviside function And its extended form These two functions can convert continuous data values into discrete binary outputs in signal processing and data analysis, which are used to clearly identify abnormal points. By adjusting the parameters t and ε in the function, the sensitivity and smoothness of the function can also be controlled to adapt to different data characteristics.
[0097] Specifically, introduce the Heaviside function for:
[0098] ;
[0099] ;
[0100] The function is used to convert continuous values into discrete binary output. Yes A further extension of , by introducing a manually set threshold t to adjust the sensitivity of the function.
[0101] Where t is the manually set threshold, ε is the parameter that controls the smoothness of the function, is a variable, which represents the function input value;
[0102] The odometry distance x is taken as The input value of the function is obtained , the normalized function With function Perform convolution operation.
[0103] In the above formula, the odometer distance x is taken as The input value of the function is obtained, H(x, t), and then it is compared with the normalized function After performing the convolution operation, a new function h(x) is obtained. This function reflects the relationship between the original data and the Heaviside function, which helps to further identify abnormal patterns in the data.
[0104] Specifically, after the convolution operation, we get the function ;
[0105] Get Function And judged by the following formula:
[0106] ;
[0107] The function h(x) is used to determine whether an abnormality exists. If the value of h(x) is greater than the set threshold ε, an abnormality is determined and the mileage count value at that time is recorded. .
[0108] S300: Using the sensor position sequence as the horizontal axis and the sensor degree size as the vertical axis, multiple sensors are placed in parallel to form a sensor data fluctuation graph; this step is mainly to graphically display the sensor data in order to more intuitively analyze and identify abnormal data.
[0109] In this application, it is assumed that the data return value obtained by the inclination sensor on the internal detection device is , is the sensor degree. The raw data of the horizontal axis should be the odometer sampling sequence count (1, 2, ..., N). However, using only the sampling sequence count as the horizontal axis is not intuitive enough, so it needs to be converted into an actual distance value. It can be calculated by combining the movement speed v of the internal detection device and the sampling time interval t. The movement speed v of the device is closely related to the state of the detection pipeline. For example, at the normal estimated speed of 10 kilometers per hour, the sampling time interval t can also be converted according to the sampling frequency. In this way, the sampling sequence count on the horizontal axis can be converted into a relative distance from the initial point of the detection device, thereby more accurately reflecting the position information of the sensor in the pipeline.
[0110] When we graph the fluctuations of sensor data in this way, we can see that a large number of data points form a complex fluctuation pattern. Figure 2 As shown in the figure, the amount of sensor data is huge. After forming a fluctuation graph, after observing a section of data, it can be found that there are invalid data with large deviations, but more similar ripple fluctuations. Therefore, by converting the data into a picture form, the workload of data processing can be greatly reduced. Through image processing, it is easier to identify and extract abnormal areas. This graphical analysis method is particularly effective when processing a large amount of sensor data. It can help quickly locate the problem and provide strong support for subsequent data analysis and troubleshooting.
[0111] S400: Correct the position and inclination of the sensor according to the sensor data, and perform image processing on the sensor data fluctuation graph to obtain a grayscale image, and pre-process the grayscale image. The purpose of this step is to further correct and graphically process the sensor data so as to better extract and analyze abnormal areas in the data. That is, the position and inclination of the sensor need to be corrected to eliminate data errors caused by equipment tilt or position deviation.
[0112] In some embodiments, we use a specific mathematical model when correcting the sensor data. Specifically, we use Represents the data obtained by the i-th sensor at the odometer distance x, where x represents the length of the sensor along the oil pipeline. When the inclination of the internal detection device is 0 degrees in the initial state, the pixel value on the grayscale image can be simply matched with the sensor data. However, when the inclination of the internal detection device changes, the y value needs to be corrected to compensate for the impact of this change in inclination angle on the data. This correction ensures that the sensor data can still be accurately extracted from the image even when the device is tilted. Correcting the position and inclination of the sensor includes the following steps:
[0113] Specifically, the data obtained by the sensor is first used Indicates; among them, is the odometer distance, which indicates the length of the sensor along the oil pipeline. represents the data obtained by the i-th sensor when the odometer distance is x; when the internal detection equipment is placed in the oil pipeline, its inclination is 0 degrees, recorded as: .
[0114] Then we get: ; In the formula, Represents the pixel value of the point (x, y) on the grayscale image, The pixel value of the point (x, y) on the grayscale image is determined by the data of the yth sensor when the odometer distance is x. When the inclination angle of the internal detection device changes, the detection position will tilt. By correcting y, the inclination angle change of the internal detection device is compensated. At this time, it is assumed that , where i is the sensor number at different locations of the device, modified by the following formula:
[0115] ;
[0116] get: ; In the formula, For internal testing equipment, is the sensor inclination angle closest to the current inclination angle, t is the corrected inclination angle, y' is the yth sensor after correction, and n is the total number of sensors; after correction, the pixel value of the point (x, y) on the image is determined by the data of the corrected sensor y when the odometer distance is x.
[0117] After correction, a grayscale image can be obtained, in which the horizontal axis of the grayscale image is the sensor position, the vertical axis represents the multiple sensors on the internal detection device, and the grayscale value of the sensor represents the corresponding sensor degree size at the current sensor position; for details, refer to Figure 3 and Figure 4 As shown in the figure, the horizontal axis is the position information obtained by the odometer sensor, that is, the sensor position, and the vertical axis represents the sensors at different positions on the internal detection device. The sensors at adjacent positions are placed in adjacent rows in order to ensure the smoothness of the obtained image. The grayscale value represents the degree obtained by the sensor at the current position, and the abnormal area can be monitored according to the fluctuation of the image, that is, the degree.
[0118] However, the grayscale image may show undesirable effects due to some external factors, such as device tilt or data noise. In order to solve this problem, the embodiment of the present application further pre-processes the grayscale image. Specifically, the median filter and Gaussian filter methods are used to reduce noise interference and smooth the image. The median filter can effectively remove the noise in the longitudinal data, while the Gaussian filter can further smooth the image and reduce the stripe effect.
[0119] In some embodiments of the present application, due to the characteristics of the data source, the grayscale image finally obtained will show the properties of continuous horizontal grayscale values and discrete vertical grayscale values, resulting in the image having an effect similar to horizontal stripes. In order to reduce the impact of this stripe effect on subsequent work, a method of performing longitudinal median filtering on multiple sensor data at each position is adopted. This method effectively reduces noise interference without affecting the change trend of the stress detector. In order to more accurately process this stripe effect, a Gaussian filtering method is also used. Specifically, a window with a length of 3 is used to process the longitudinal data. During the processing, the standard deviation σ of the Gaussian function is set to 1.5. Based on this σ value, a convolution template with a length of 3 can be calculated and normalized. Finally, the image is convolved using this convolution template to obtain an image with suppressed stripe effects, thereby achieving preprocessing of the grayscale image.
[0120] The expression of Gaussian function is as follows:
[0121] ;
[0122] In the formula, Represents the Gaussian function value at position (x, y); σ is the standard deviation of the Gaussian function, which determines the width and shape of the Gaussian function. In the embodiment of the present application, σ is set to 1.5; d is the distance function, which usually represents the distance from the center point to the current point; e is the base of the natural logarithm.
[0123] The core idea of using Gaussian filtering is to calculate a new pixel value for each pixel in the image based on the distance and weight (given by the Gaussian function) of the surrounding pixels. In this way, the image can be effectively smoothed and noise can be reduced. Specifically, in order to avoid data fluctuations caused by tilt, some embodiments of the present application mark the degree of the stress sensor on the internal detection device, and in different positions, the data is returned according to the tilt sensor at the location, so that the degree of the stress sensor closest to the tilt angle of the internal inspection device is used as the center position of the vertical axis of the image at that position, that is, the horizontal coordinate, thereby avoiding misjudgment of the angle of the abnormal area caused by tilt.
[0124] S500: Odometer value based on abnormal data , for the mileage count value on the grayscale image The defect segmentation is performed in the neighborhood area of the grayscale image, and the horizontal axis area is extracted And record as image .
[0125] This step begins to locate and extract abnormal data. Once the mileage value of the abnormal data is identified through the previous step , the next task is to accurately find the area corresponding to these abnormal data on the grayscale image. To this end, the embodiment of the present application defines a neighborhood area, that is, the mileage count value for each abnormal data , will extract its horizontal coordinate area on the grayscale image The selection of this neighborhood range is based on the estimation of the area that the abnormal data may affect, ensuring that the abnormal data and its surrounding areas that may be affected can be captured. Through this process, a series of images are obtained. , each image They all correspond to a neighborhood area of abnormal data.
[0126] S600: According to the image Establish the DRLSE model system, initialize the level set function, and extract the zero level set of the initialized level set function as the initial contour of the abnormal area. Refine the identification and description of abnormal areas. I used the DRLSE (Distance Regularized Level Set Evolution) model system. DRLSE is an advanced image segmentation technique that uses a level set function to describe and evolve the boundaries of the target area. First, we need to initialize the level set function, which will determine the shape and position of the initial contour. Then, extract the zero level set of the initialized level set function, which is actually a mathematical representation of the initial contour. This initial contour will serve as the starting point for further analysis and processing of abnormal areas.
[0127] S700: Define the level set energy functional, which is a mathematical model that integrates multiple factors and is used to describe and drive the evolution of the target contour in the image. The level set energy functional includes, for example, a level set penalty function, a length energy term, and a region energy term.
[0128] In some embodiments of the present application, the level set energy functional is defined as follows:
[0129] ;
[0130] In the formula, is the level set function, which is a real-valued function defined in the image space domain Ω. The zero level set of the level set function is =0, corresponding to the boundary of the target in the image; is the level set penalty function, is the constant coefficient of the level set penalty function; is the length energy term, and , is the constant coefficient of the length energy term, is the regional energy term, and , is the constant coefficient of the regional energy term, The edge stop function.
[0131] Furthermore, the edge stop function is defined as follows:
[0132] ;
[0133] In the formula, The standard deviation is Gaussian kernel function; is the gradient operator; is the edge strength of the image; I is the image to be segmented, that is, the grayscale image.
[0134] Among them, the level set penalty function It is used to ensure the regularity of the level set function, that is, to make the level set function maintain a certain smoothness and stability during the evolution process. By introducing the double-well potential function, the gradient of the level set function can be penalized to avoid steep or non-smooth changes. This regularization method helps to reduce instability and errors in numerical calculations. The level set penalty function is defined as follows:
[0135] ;
[0136] Where: is the level set function The gradient represents the rate of change of the function value in the image space; Ω is the spatial domain of the image, that is, the set of all pixels in the image; is the double-well potential function.
[0137] The double-well potential function is defined as:
[0138] ;
[0139] In the formula, is the level set function The absolute value of the gradient modulus, is a constant used to adjust the scale of the potential function; is a function that varies between 0 and 2. When the value is 0, When the value is 1; It is a following A monotonically increasing function that is used to punish Greater than 1.
[0140] Furthermore, the length energy term It reflects the length information of the target contour. By introducing the edge stop function , which can stop the contour from evolving at the edge of the image, thus ensuring that the contour can accurately fit the boundary of the target. The design of this length energy term helps to suppress the excessive growth or contraction of the contour and improve the accuracy of segmentation. The definition of the length energy term is as follows:
[0141] ;
[0142] In the formula, is the unit pulse function; is the level set function The gradient represents the rate of change of the function value in the image space; Ω is the spatial domain of the image, that is, the set of all pixels in the image; The edge stop function.
[0143] Furthermore, the regional energy term The regional information of the image is taken into account. By introducing the Heaviside function H, different regions in the image can be distinguished, and the level set function can take into account the differences between these regions during the evolution process. The design of this regional energy term helps to enhance the model's ability to recognize different regions in the image and improve the robustness of segmentation. The definition of the regional energy term is as follows:
[0144] ;
[0145] In the formula, is the Heaviside function; is the level set function, The edge stop function.
[0146] in: is the Heaviside function. x The local Shannon entropy is introduced into the energy functional model. The local Shannon entropy is used to measure the grayscale change characteristics of a local area in the image. Specifically, the local Shannon entropy can reflect the discrete degree of grayscale distribution in the neighborhood of the image, thereby revealing the spatial information between image pixels to a certain extent, ensuring that the processing of grayscale uneven images, especially noisy images, is more reliable. If the grayscale change of the image is relatively strong, the local entropy at this location is small. On the contrary, when the grayscale distribution of the image is relatively uniform, the local entropy of the image is large. The local entropy can reflect the spatial information between image pixels to a certain extent. The local entropy can be used to detect the edges with large grayscale discreteness and mutation in the image. The local entropy information is introduced into the clustering energy to make full use of the local entropy to improve the image grayscale information, improve the accuracy, and improve the noise resistance.
[0147] Local Shannon entropy h xThe specific expression is as follows:
[0148] ;
[0149] In the formula, represents the probability density estimate of gray level y in the m×n neighborhood, where the m×n neighborhood refers to a local area centered on pixel x, with a size of m rows and n columns; is the probability density function Integrate and multiply by The logarithm base here is 2, because information theory usually uses logarithms with base 2 to represent the amount of information. The integral range is from 0 to L, where L represents the maximum value of the grayscale. By performing such an integral operation on the probability density function, the Shannon entropy of the local area can be obtained.
[0150] Local Shannon entropy h x The smaller the value of (p(y)), the stronger the grayscale change of the image in this local area, that is, the more discrete the grayscale distribution; on the contrary, if h x If the value of (p(y)) is large, it means that the grayscale distribution of the image in this area is relatively uniform. Therefore, the local Shannon entropy can reflect the spatial information between image pixels to a certain extent, and then be used in tasks such as image segmentation and edge detection to improve the accuracy and robustness of processing.
[0151] S800: Establish a gradient descent flow equation, and use a variational method to solve the gradient descent flow equation to obtain a solution to the gradient descent flow equation, and update the level set function according to the solution to the gradient descent flow equation. The gradient descent flow equation guides how the level set function evolves according to the change of the energy functional in image processing to achieve accurate extraction of the target contour.
[0152] Energy functional Used to describe the weighted area inside the active contour curve in the image. When the value is 1, the energy functional is simplified to the area of the inner region of the contour, so it is specifically called the regional energy term. This energy term plays a significant role in the evolution of the level set. When the active contour curve is far away from the target edge, the regional energy term can accelerate the movement speed of the zero level set, making it approach the target edge faster. In addition, the weight constant coefficient 𝜐 of the regional energy term determines the movement direction of the zero level set: when When is positive, the zero level set shrinks inward; when When is negative, the zero level set expands outward. This flexible movement allows the level set method to adapt to targets of different shapes and sizes. ,by The influence of positive and negative signs on the energy term when the energy functional is minimized This will drive the zero level set to shrink inwards Or expand outward .
[0153] The specific energy functional Introduce it into the solution process of the gradient descent flow equation. The energy functional includes multiple components such as the level set penalty function, the length energy term and the regional energy term, and together determine the evolution behavior of the level set function. In the solution process, the regularization width is introduced , used for smoothing functions and function , in order to improve the stability and accuracy of numerical calculations. Substituting the above formula into the simplified form, we can obtain the gradient descent flow equation, the energy functional It can be expressed as:
[0154] ;
[0155] In the formula, represents the level set function The regularization width of , used to smooth the function and function .
[0156] Further, through the partial differential equation: ; to define the evolution of the gradient descent flow equation. This partial differential equation describes the level set function How to change with time t to minimize the energy function E. Then, the variational method is used to solve this partial differential equation and obtain the gradient descent flow equation about the level set function. This equation contains the divergence operator and function , which together determine the spatial variation characteristics of the level set function during the evolution process.
[0157] After solving by partial differentiation, the gradient descent flow equation about the level set function is obtained as follows:
[0158] ;
[0159] Where: is the divergence operator, is defined as function.
[0160] S900: Iterate by looping the previous step so that the level set function evolves to obtain a steady-state solution, at which point the level set energy functional reaches a local minimum.
[0161] In each iteration, the level set function is updated according to the solution of the gradient descent flow equation, so that it gradually approaches the target contour. This process continues until the level set energy functional reaches a local minimum, that is, the system reaches a relatively stable state. At this point, the level set function has successfully evolved into a form that can accurately describe the target contour.
[0162] Specifically, the discretization describing the evolution of the level set function over time is expressed as:
[0163] ;
[0164] Where: represents the value of the level set function at time step n; represents the value of the level set function at time step n-1; Δt is the time step, that is, the time interval from n-1 to n; is the level set function The partial derivative with respect to time t represents the rate of change of the level set function over time.
[0165] The significance of this formula is to use discrete time steps Δt to approximate continuous time changes. , thereby gradually updating the level set function through iteration. In each iteration, a new level set function value is calculated based on the level set function value of the previous time step and the current time step. In this way, the evolution process of the level set function in continuous time can be simulated.
[0166] S110: Output the level set function when the steady-state solution is reached, and according to the level set function, with 0 as the threshold, determine the area where the level set function value is greater than 0 as the normal area, and determine the area where the level set function value is less than 0 as the abnormal area.
[0167] Specifically, according to the level set function , with 0 as the threshold, the area with a function value greater than 0 is determined as a normal area, and the area with a function value less than 0 is determined as an abnormal area. This segmentation method is based on the properties of the level set function, where the positive and negative changes in the function value reflect the characteristics of different areas in the image. In the image segmentation process, the normal area may represent normal data, while the abnormal area represents abnormal data.
[0168] The judgment formula is as follows:
[0169] ;
[0170] In the formula, is a binary image, is the level set function, and the two variables i and j represent the pixel coordinates in the image. In a two-dimensional image, each pixel can be uniquely identified by its row coordinate i and column coordinate j.
[0171] The above formula converts the binary image Each pixel point is based on the level set function If the value of the level set function at this point is greater than or equal to 0, then The pixel value at the corresponding position in is set to 0; if the value of the level set function at this point is less than 0, then The pixel value at the corresponding position in is set to 1. In this way, a binary image with normal and abnormal areas marked is obtained.
[0172] Furthermore, in order to retain the sensor data, that is, the grayscale value of the abnormal area of the image, the abnormal area and the stress value of the area can be obtained in the end.
[0173] .
[0174] In the formula, is a binary image, is the original image, is the result image, and the two variables i and j represent the pixel coordinates in the image. In a two-dimensional image, each pixel can be uniquely identified by its row coordinate i and column coordinate j.
[0175] The above formula combines the binary image and the original image To generate the final result image In this formula, if The pixel value in is 1 (i.e. abnormal area), then The pixel value at the corresponding position will be the original image The pixel value at the corresponding position; if The pixel value in is 0 (i.e. normal area), then The pixel value at the corresponding position will be 0 (because any number multiplied by 0 is equal to 0). In this way, we get an image that only retains the grayscale value of the abnormal area, so that we can further analyze the characteristics of these areas or extract relevant information.
[0176] Reference Figure 5 and Figure 6 As shown in Figure 1, the DRLSE model uses the gradient of the image as the conditional information to constrain the active contour curve evolution to stop, so it can effectively segment images with clear target edges. This is why this paper classifies DRLSE as an image segmentation method based on edge level sets. However, it should be noted that the main contribution of the DRLSE method is the introduction of the distance regularization energy term , using its double-well potential function to avoid the problem of the level set function needing to be constantly reinitialized during the level set evolution, improving the segmentation efficiency of the variational level set image segmentation method and greatly promoting the development of image segmentation methods based on level sets.
[0177] From the above content, it can be known that the oil pipeline abnormal state data extraction method based on image segmentation of the present application forms a sensor data fluctuation graph by reading the sensor data on the internal detection equipment for detecting the oil pipeline; the sensor data fluctuation graph is image-processed to obtain a grayscale image, and then the grayscale image is pre-processed; at the same time, the sensor data is detected for abnormal data, and the horizontal coordinate area with abnormal data of the grayscale image is extracted according to the detection result and recorded as an image, and the image is processed for image segmentation, and the segmentation result is output, that is, the oil pipeline abnormal state data is extracted. The present application realizes the rapid extraction of valuable information in the face of a large amount of data, removes data with abnormal status, and improves the efficiency of data processing by converting data into images and then performing image segmentation.
[0178] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
Claims
1. A method for extracting abnormal state data of oil pipelines based on image segmentation, characterized in that: Includes steps: Read sensor data on an internal detection device for detecting an oil pipeline, obtain the rotation angle of the sensor, obtain the sensor degree, obtain the sampling mileage count value of the internal detection device as the sensor position, and the sampling mileage count value is the distance between the sampling point position of the internal detection device and the initial position of the internal detection device; Perform a rough detection of abnormal values on the sensor data, and record the sampled mileage count value of the internal detection device that generates the abnormal data ; The sensor position sequence is used as the horizontal axis, the sensor degree size is used as the vertical axis, and the sensor data are placed in parallel by multiple sensors to form a sensor data fluctuation graph; Correcting the position and inclination of the sensor according to the sensor data, and processing the sensor data fluctuation graph into an image to obtain a grayscale image, and preprocessing the grayscale image; The horizontal axis of the grayscale image is the sensor position, the vertical axis represents the multiple sensors on the internal detection device, and the grayscale value of the sensor represents the corresponding sensor degree at the current sensor position; Odometer value based on abnormal data , for the mileage count value on the grayscale image The defect segmentation is performed in the neighborhood area of the grayscale image, and the horizontal coordinate area of the grayscale image is extracted And record as image ; According to the image Establishing a DRLSE model system, initializing a level set function, and extracting a zero level set of the initialized level set function as an initial contour of the abnormal area; Define a level set energy functional, wherein the level set energy functional includes a level set penalty function, a length energy term, and a region energy term; Establishing a gradient descent flow equation, and solving the gradient descent flow equation by using a variational method to obtain a solution of the gradient descent flow equation, and updating the level set function according to the solution of the gradient descent flow equation; Iterate by looping the previous step so that the level set function evolves to obtain a steady-state solution, at which time the level set energy functional reaches a local minimum; The level set function when the steady-state solution is reached is output, and according to the level set function, with 0 as the threshold, an area with a level set function value greater than 0 is determined as a normal area, and an area with a level set function value less than 0 is determined as the abnormal area.
2. The method for extracting abnormal state data of a petroleum pipeline based on image segmentation according to claim 1 is characterized in that: Correcting the position and inclination of the sensor according to the sensor data comprises the steps of: The data obtained by the sensor is used express; in, is the odometer distance, which indicates the length of the sensor along the oil pipeline. represents the data obtained by the i-th sensor when the odometer distance is x; When the internal detection device is placed in the oil pipeline, its inclination angle is 0 degrees in the initial state, which is recorded as: ; Then we get: ; In the formula, Represents the pixel value of the point (x, y) on the grayscale image, The pixel value of a point (x, y) on the grayscale image is determined by the data of the yth sensor when the odometer distance is x; When the inclination angle of the internal detection device changes, the detection position will be tilted. By correcting y, the change in the inclination angle of the internal detection device is compensated. At this time, assuming , where i is the sensor number at different locations of the device, modified by the following formula: ; get: ; In the formula, for the internal detection device, is the inclination angle of the sensor closest to the current inclination angle, t is the corrected inclination angle, y' is the yth sensor after correction, and n is the total number of sensors; After correction, the pixel value of the point (x, y) on the image is determined by the data of the corrected sensor y when the odometer distance is x.
3. The method for extracting abnormal state data of oil pipeline based on image segmentation according to claim 1 is characterized in that: The sensor data is roughly detected for abnormal values, and the sampling mileage count value of the internal detection device that generates the abnormal data is recorded. Includes steps: Initially determine the abnormal area and set: ; In the formula, represents the data obtained by the i-th sensor when the odometer distance is x, is the average value of all sensor data; right After normalization, we get: ; In the formula, for The normalized value of for The minimum value of for The maximum value of Introducing the Heaviside function : ; ; The function is used to convert continuous values into discrete binary output. Yes A further extension of , by introducing a manually set threshold t to adjust the sensitivity of the function; Where t is the manually set threshold, ε is the parameter that controls the smoothness of the function, is a variable, which represents the function input value; The odometer distance x is Get the input value of the function , the normalized function With function Perform convolution operation; Get function ; Get Function And judged by the following formula: ; When an abnormality is detected, the corresponding mileage value is recorded. .
4. The method for extracting abnormal state data of a petroleum pipeline based on image segmentation according to claim 1, characterized in that: The level set energy functional is defined as follows: ; In the formula, is the level set function, which is a real-valued function defined in the image space domain Ω. The zero level set of the level set function is =0, corresponding to the boundary of the target in the image; is the level set penalty function, is the constant coefficient of the level set penalty function; is the length energy term, and , is the constant coefficient of the length energy term, is the regional energy term, and , is the constant coefficient of the regional energy term, The edge stop function.
5. The method for extracting abnormal state data of oil pipelines based on image segmentation according to claim 4 is characterized in that: The edge stop function is defined as follows: ; In the formula, The standard deviation is Gaussian kernel function; is the gradient operator; is the edge strength of the image; I is the image to be segmented, that is, the grayscale image.
6. The method for extracting abnormal state data of a petroleum pipeline based on image segmentation according to claim 5 is characterized in that: The level set penalty function is defined as follows: ; Where: is the level set function The gradient represents the rate of change of the function value in the image space; Ω is the spatial domain of the image, that is, the set of all pixels in the image; is the double-well potential function; Wherein, the double-well potential function is defined as: ; In the formula, is the level set function The absolute value of the gradient modulus, is a constant used to adjust the scale of the potential function; is a function that varies between 0 and 2. When the value is 0, When the value is 1; It is a following A monotonically increasing function that is used to punish Greater than 1.
7. The method for extracting abnormal state data of a petroleum pipeline based on image segmentation according to claim 6 is characterized in that: The length energy term is defined as follows: ; In the formula, is the unit pulse function; is the level set function The gradient represents the rate of change of the function value in the image space; Ω is the spatial domain of the image, that is, the set of all pixels in the image; The edge stop function.
8. The method for extracting abnormal state data of a petroleum pipeline based on image segmentation according to claim 7 is characterized in that: The definition of the regional energy term is as follows: ; In the formula, is the Heaviside function; is the level set function, The edge stop function.
9. The method for extracting abnormal state data of a petroleum pipeline based on image segmentation according to claim 8, characterized in that: The gradient descent flow equation is defined as follows: ; In the formula, represents the level set function The regularization width of , used to smooth the function and function .
10. The method for extracting abnormal state data of oil pipelines based on image segmentation according to claim 9, characterized in that: The step of solving the gradient descent flow equation by using the variational method comprises: Find the steady-state solution of the gradient descent flow equation through the partial differential equation of the gradient descent flow equation solution; The partial differential equation is defined as: ; Where: E is the energy function, is the level set function, For time; After solving by partial differentiation, the gradient descent flow equation about the level set function is obtained as follows: ; Where: is the divergence operator, is defined as function.
Citation Information
Patent Citations
CT image segmentation method based on novel threshold value formula and self-adaptive double-potential-well function
CN114140476A
Line detection terminal with induction power taking technology
CN114884223A
