Image labeling method for oil and gas station working condition recognition and storage medium
Through the gradient flow minimization process of equivalent set functions and energy functionals, combined with automation and polygon annotation, the problem of efficient image annotation of leakage phenomena in the petrochemical field is solved, efficient and low-cost dataset construction is achieved, and the performance of the recognition model is improved.
Patent Information
- Application Number
- CN202411684911.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-11-22
AI Technical Summary
The existing image annotation methods for leakage phenomena in the petrochemical field consume a lot of labor costs and time costs, and it is difficult to clearly distinguish between the target and the background under insufficient lighting conditions at night, which increases the difficulty of annotation.
The target oil spill area is represented by an equivalued set function. An energy functional and its gradient flow minimization process are designed. Combined with automation and polygon annotation methods, the boundaries of the target oil spill area are automatically located and refined.
It improves the accuracy and efficiency of annotation, reduces labor costs and time consumption, builds a more representative dataset, and enhances the generalization ability and robustness of the recognition model.
Smart Images

Figure CN119600387B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of oil pipeline leakage detection, and in particular to an image annotation method and storage medium for oil and gas station working condition identification. Background Art
[0002] To meet the practical needs of intelligent inspection robots detecting and identifying leaks at oil and gas stations, image recognition algorithms must have high detection accuracy, strong real-time performance, and easy deployment. To ensure that the recognition model meets these requirements, building a high-quality dataset suitable for AI model training is crucial.
[0003] In existing public datasets for detection, tracking, and recognition tasks, common annotation methods include box annotation and contour annotation, both of which aim to clearly indicate the target object and its area or boundary. However, specific datasets for leakage in the petrochemical industry need to cover a variety of environmental conditions, such as scene conditions under daylight and nighttime lights. It should be pointed out that insufficient light in nighttime environments can lead to reduced image contrast, making it difficult to clearly distinguish between the target and the background, increasing the difficulty of data annotation. Among the existing annotation methods, although the use of contour line annotation can more accurately define the specific scope of leakage conditions, its annotation data requires a lot of labor and time costs. Therefore, it is particularly important to explore more efficient data annotation methods. Summary of the Invention
[0004] The present invention provides an image annotation method and storage medium for oil and gas station working condition identification with higher efficiency and accuracy, which can solve at least one of the above technical problems.
[0005] In order to solve the above technical problems, the present invention adopts the following technical solution: an image annotation method for oil and gas station working condition identification, comprising the following steps:
[0006] S1, representing the oil spill target area in the two-dimensional image as a three-dimensional equivalued set function;
[0007] S2. Design a binary step function to initialize the equal value set function and roughly locate the potential target area;
[0008] S3. Design an energy functional with desired variability and define the energy functional as the line integral along the zero contour of the isovalue set function;
[0009] S4, evolving the equivalent set function, solving the gradient flow minimization energy functional, and obtaining the zero equivalent set contour, that is, the boundary of the optimal oil spill target area, as the mask boundary;
[0010] S5. Verify whether the obtained mask boundary meets the requirements. If so, the evolved zero-equal-value set contour is used as the annotation result of the boundary of the oil spill target area in the image. If not, the polygon annotation method is used to refine the mask boundary to obtain the final annotation result.
[0011] Furthermore, in the above S1, the two-dimensional RGB image of the oil pipeline with leakage phenomenon collected by the camera is processed and converted into a grayscale image, and the target area of the oil leakage on the grayscale image is mapped to the grayscale image. Represented as a three-dimensional equivalued set function , the parameters of the isovalue set function include spatial variables and time variables .
[0012] Furthermore, in S2, according to the characteristic that the target area of the oil spill has a low intensity value, a binary step function is designed, and the equivalent set function is initialized according to the following formula:
[0013]
[0014] in, is a constant, is the intensity threshold of the potential target area.
[0015] Furthermore, in S3, an energy functional is designed for the expected difference of a specific area around the oil pipeline leak target, the expected difference term is used as the external energy, and the energy functional is defined as the line integral along the zero isovalue contour of the isovalue set function, further comprising:
[0016] S31. Define the expected difference energy functional :
[0017]
[0018]
[0019]
[0020] in, represents the approximate Heaviside function, represents a very small constant, and Respectively and its fields The expected value of the intensity, the neighborhood Defined as the distance zero contour Less than or equal to The area of pixels;
[0021] S32. Define the expected difference term as the above energy functional Along the equivalued set function The zero contour of The line integral of :
[0022]
[0023] in, represents the approximate Dirac delta function, represents the gradient operator;
[0024] when When located at the border of the oil spill target area, smallest;
[0025] S33. The total energy functional is defined as:
[0026]
[0027] in, is the distance regularization term, is the area energy functional, is a symbolic function, 、 and are all expressed as weight coefficients;
[0028] when Greater than the current maximum value When it takes a positive value, the contour of the zero equal value set Contraction, on the contrary, when Less than the current maximum value When negative, zero equal value set contour expansion.
[0029] Furthermore, in S4, the gradient flow is solved according to the following formula to minimize the energy functional , and obtain the final zero-equal-value set contour , as the target area flooding boundary:
[0030]
[0031] in, Expressed as a divergence operator, Expressed as the correlation function of the double-well potential.
[0032] Furthermore, in S5, the criteria for determining whether the flooding boundary meets the requirements are:
[0033] If the difference between the mask boundary and the true boundary of the target area is less than the set threshold, the requirement is met and the mask boundary is used as the annotation result. Conversely, if the difference between the mask boundary and the true boundary of the target area is greater than or equal to the set threshold, the requirement is not met and the polygon annotation method is used to fine-tune and refine the mask boundary to obtain the annotation result.
[0034] Furthermore, in S5, the polygon annotation method includes the following steps:
[0035] Determine polygon vertices: When the difference between the mask boundary and the true boundary of the target area is greater than or equal to the set threshold, all polygon vertices determined by the automatic annotation method are first revised to ensure that all polygon vertices in the area are correctly marked;
[0036] Draw polygon mask: connect all polygon vertices to generate a new polygon mask.
[0037] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor executes the steps of the image annotation method for identifying oil and gas station working conditions.
[0038] The beneficial effects of the present invention are embodied in:
[0039] 1. This method uses an equivalued set function to represent the target oil leak area and designs an energy functional and its gradient flow minimization process. This allows for more precise definition of the specific scope of leak conditions, particularly in complex nighttime environments with low illumination and image contrast. Compared to traditional box annotation or simple contour annotation, this method captures the boundaries of the leak area in greater detail, improving both accuracy and detail.
[0040] 2. The labeling method based on equivalent sets proposed in the present invention can automatically generate relatively complete contour labels by assisting the labeling process through automated means. Compared with traditional data labeling methods that require a lot of manual participation, are time-consuming and costly, this method can significantly reduce the workload of manual labeling, reduce labor costs and time consumption.
[0041] 3. The method of the present invention can adapt to image annotation under different lighting conditions, making the constructed data set more comprehensive and representative, which helps to improve the generalization ability and robustness of the leakage condition identification model in the petrochemical field. It has the advantages of high efficiency, strong stability and high precision in solving data annotation and constructing training data sets, and can effectively solve the problem of pipeline oil leakage sample annotation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application.
[0043] Figure 1 This is a flow chart of an image annotation method for oil and gas station working condition identification according to an embodiment of the present invention.
[0044] Figure 2 This is a framework diagram of an image annotation method for oil and gas station working condition identification according to an embodiment of the present invention.
[0045] Figure 3 This is a framework diagram of an image polygon annotation method for oil and gas station working condition identification according to an embodiment of the present invention.
[0046] Figure 4 It is a structural block diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. In the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0048] See also Figure 1-Figure 2 The embodiment of the present invention provides an image annotation method for oil and gas station working condition identification, including the following steps S1-S5:
[0049] S1. Represent the oil spill target area in the two-dimensional image as a three-dimensional equivalent set function.
[0050] Specifically, in this step, the two-dimensional RGB image of the oil pipeline with leakage phenomenon captured by the camera is processed and converted into a grayscale image to construct a high-quality data set suitable for model training for detecting and identifying leakage conditions, and the target oil leakage area on the grayscale image is mapped to the grayscale image. Represented as a three-dimensional equivalued set function , the parameters of the isovalue set function include spatial variables and time variables . Then, by evolving the equivalent set function , we can get the zero-valued set contour Target mask edge as oil spill.
[0051] S2. Design a binary step function to initialize the equal value set function and roughly locate the potential target area.
[0052] Specifically, in this step, according to the characteristic that the target area of the oil spill has a low intensity value, a binary step function is designed, and the equivalent set function is initialized according to the following formula:
[0053]
[0054] in, is a constant, here it is taken as 1, is the intensity threshold of the potential target area, which is taken as 40 here.
[0055] S3. Design an energy functional with desired variability and define the energy functional as the line integral along the zero contour of the isovalue set function.
[0056] Specifically, in this step, an energy functional is designed based on the expected difference in a specific area around the oil pipeline leak target, with the expected difference term as the external energy. The energy functional is defined as the line integral along the zero contour of the contour set function, further including:
[0057] S31. Define the expected difference energy functional :
[0058]
[0059]
[0060]
[0061] in, represents the approximate Heaviside function, represents a very small constant, and Respectively and its fields The expected value of the intensity, the neighborhood Defined as the distance zero contour Less than or equal to The area of pixels;
[0062] When calculating the target-level detection index, the error within 5 pixels is still considered as the target area. The present invention takes n=5 to alleviate the background interference at a long distance.
[0063] S32. Define the expected difference term as the above energy functional Along the equivalued set function The zero contour of The line integral of :
[0064]
[0065] in, represents the approximate Dirac delta function, represents the gradient operator;
[0066] when When located at the border of the oil spill target area, smallest;
[0067] S33. The total energy functional is defined as:
[0068]
[0069] in, is the distance regularization term, is the area energy functional, is a symbolic function, 、 and are all expressed as weight coefficients;
[0070] when Greater than the current maximum value When it takes a positive value, the contour of the zero equal value set Contraction, on the contrary, when Less than the current maximum value When negative, zero equal value set contour expansion.
[0071] S4. Evolve the equivalent set function, solve the gradient flow minimization energy functional, and obtain the zero equivalent set contour, that is, the boundary of the optimal oil leakage target area, as the mask boundary.
[0072] Specifically, in this step, the gradient flow is solved according to the following formula to minimize the energy functional , and obtain the final zero-equal-value set contour , as the target area flooding boundary:
[0073]
[0074] in, Expressed as a divergence operator, Expressed as the correlation function of the double-well potential.
[0075] S5. Verify whether the obtained mask boundary meets the requirements. If so, the evolved zero-equal-value set contour is used as the annotation result of the boundary of the oil spill target area in the image. If not, the polygon annotation method is used to refine the mask boundary to obtain the final annotation result.
[0076] Specifically, in this step, the criteria for judging whether the submerged boundary meets the requirements are:
[0077] If the difference between the mask boundary and the true boundary of the target area is less than the set threshold, the requirement is met and the mask boundary is used as the annotation result. Conversely, if the difference between the mask boundary and the true boundary of the target area is greater than or equal to the set threshold, the requirement is not met and the polygon annotation method is used to fine-tune and refine the mask boundary to obtain the annotation result.
[0078] Furthermore, the polygon annotation method includes the following steps:
[0079] Determine polygon vertices: When the difference between the mask boundary and the true boundary of the target area is greater than or equal to the set threshold, all polygon vertices determined by the automatic annotation method are first revised to ensure that all polygon vertices in the area are correctly marked;
[0080] Draw polygon mask: connect all polygon vertices to generate a new polygon mask.
[0081] like Figure 3 As shown in the figure, in an actual case application, the automatic annotation method was used to annotate the leakage phenomenon in the image, but the annotation was still incomplete. The automatic annotation method failed to mark some parts with large background interference. Therefore, based on this, the polygon annotation method was used to correct it. First, all vertices in the annotated area were corrected, and then all vertices were connected to generate a new annotation mask. This can achieve almost complete annotation of the leakage phenomenon in the image, further improving the efficiency and accuracy of image annotation.
[0082] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the above-mentioned image annotation method for oil and gas station working condition identification.
[0083] See also Figure 4 An embodiment of the present invention further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned image annotation method for oil and gas station working condition identification.
[0084] An embodiment of the present invention further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps of the above-mentioned image annotation method for identifying the working conditions of oil and gas stations.
[0085] It is understandable that the system, device and storage medium provided in the embodiments of the present invention correspond to the method provided in the embodiments of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts of the above methods.
[0086] It should be noted that those skilled in the art will appreciate that all or part of the steps implemented in the embodiments of the present invention can be implemented in whole or in part via software, hardware, firmware, or any combination thereof. When implemented using hardware, the steps can be implemented in whole or in part as purchased standard components or modified parts. When implemented using software, the steps can be implemented in whole or in part as a computer program product. The computer program product comprises one or more computer instructions. When loaded and executed on a computer, the steps or functions described in the embodiments of the present application are fully or partially performed. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0087] In summary, the present invention aims to solve the problems that the background of the data set of oil pipeline leakage conditions is complex and there are different lighting conditions, which makes it difficult to clearly distinguish the target and the background. Traditional labeling methods require a lot of labor costs and time costs. An efficient image labeling method for oil and gas station working condition identification is proposed, which adopts a combination of automatic labeling and manual labeling. Specifically, the area where the pipeline is leaking in the image is represented as an equivalued set function. According to the characteristic that the target area of the oil leakage has a low intensity value, a set binary step function is used for initialization to roughly locate the potential target area. Then, an energy functional with the expected difference is designed. The boundary of the optimal oil leakage target area is searched by minimizing the energy functional to obtain a mask. Finally, the mask is fine-tuned using the polygonal labeling method to obtain the final labeling result, thereby realizing efficient labeling of the oil pipeline leakage image sequence. While ensuring the labeling quality, the labor cost and time consumption are significantly reduced, and the labeling efficiency of the oil pipeline leakage samples is improved.
[0088] It should be understood that the examples and implementation methods described herein are for illustrative purposes only and are not intended to limit the present invention. Those skilled in the art may make various modifications or changes based on them. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. An image annotation method for identifying working conditions of oil and gas stations, characterized by: The following steps are involved: S1. Process the two-dimensional RGB image of the oil pipeline with leakage collected by the camera and convert it into a grayscale image. Represented as a three-dimensional equivalued set function , the parameters of the isovalue set function include spatial variables and time variable t; S2. Design a binary step function to initialize the equal value set function and roughly locate the potential target area; S3. Design an energy functional with desired variability and define the energy functional as the line integral along the zero contour of the isovalue set function; S4, evolving the equivalent set function, solving the gradient flow minimization energy functional, and obtaining the zero equivalent set contour, that is, the boundary of the optimal oil spill target area, as the mask boundary; S5. The judgment criteria for whether the submerged boundary meets the requirements are as follows: if the difference between the mask boundary and the true boundary of the target area is less than a set threshold, the requirements are met and the mask boundary is used as the annotation result; conversely, if the difference between the mask boundary and the true boundary of the target area is greater than or equal to the set threshold, the requirements are not met and the polygon annotation method is used to fine-tune and refine the mask boundary to obtain the annotation result; Said S3 further comprises: S31. Define the expected difference energy functional : in, represents the approximate Heaviside function, represents a very small constant, and Respectively and its fields The expected value of the intensity, the neighborhood Defined as the distance zero contour Less than or equal to The area of pixels; S32. Define the expected difference term as the above energy functional Along the equivalued set function The zero contour of The line integral of : in, represents the approximate Dirac delta function, represents the gradient operator; when When located at the border of the oil spill target area, smallest; S33. The total energy functional is defined as: in, is the distance regularization term, is the area energy functional, is a symbolic function, 、 and are all expressed as weight coefficients; when Greater than the current maximum value When it takes a positive value, the contour of the zero equal value set Contraction, on the contrary, when Less than the current maximum value When negative, zero equal value set contour expansion.
2. The image annotation method for oil and gas station working condition identification according to claim 1 is characterized in that: In S2, according to the characteristic of low intensity value of the target area of oil spill, a binary step function is designed, and the equivalent set function is initialized according to the following formula: in, is a constant, is the intensity threshold of the potential target area.
3. The image annotation method for oil and gas station working condition identification according to claim 1 is characterized in that: In S4, the gradient flow is solved to minimize the energy functional according to the following formula: , and obtain the final zero-equal-value set contour , as the target area flooding boundary: in, Expressed as a divergence operator, Expressed as the correlation function of the double-well potential.
4. The image annotation method for oil and gas station operating condition identification according to claim 1 is characterized in that: In S5, the polygon marking method includes the following steps: Determine polygon vertices: When the difference between the mask boundary and the true boundary of the target area is greater than or equal to the set threshold, all polygon vertices determined by the automatic annotation method are first revised to ensure that all polygon vertices in the area are correctly marked; Draw polygon mask: connect all polygon vertices to generate a new polygon mask.
5. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the image annotation method for oil and gas station working condition identification according to any one of claims 1 to 4.
Citation Information
Patent Citations
SAR (storage address register) image changing detection method based on improved C-V model
CN102779346A
Level set image segmentation method and system thereof based on regional information and edge information
CN106056611A