Model training method, oil stealing hole identification method, device, equipment and storage medium
By training the oil theft hole recognition model with the YOLO11 model, the problems of low efficiency and poor accuracy in oil theft hole recognition in the existing technology are solved, and efficient and accurate oil theft hole recognition and automatic alarm are achieved, which can meet the recognition needs under various conditions.
Patent Information
- Application Number
- CN202510888153.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
AI Technical Summary
In the existing technology, the identification of oil theft holes relies on manual analysis, which has the problems of low identification efficiency and poor accuracy.
The YOLO11 model is used to train the oil pore recognition model. By acquiring and preprocessing image samples containing oil pores, a training set is constructed. The YOLO11 model is then used for model training, including cropping, scaling, and normalization. The model parameters are optimized in combination with the loss function.
It improves the efficiency and accuracy of oil theft hole identification, realizes real-time identification and automatic alarm, reduces the false detection rate and missed detection rate, and adapts to the identification needs under different pipe diameters and conditions.
Smart Images

Figure CN120808066A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of oil pipeline monitoring, in particular to a model training method, a stolen oil hole identification method, a device, equipment and a storage medium. BACKGROUND
[0002] Oil and gas pipelines are the fastest, safest and most economical way to transport oil and natural gas, and have become the main transportation channel for global oil and gas resources, which is of great significance to energy supply and economic development. However, in recent years, the frequency of stolen oil hole events has increased, which seriously threatens pipeline safety. Such behavior not only damages the integrity of the pipeline, but also may cause major accidents such as leaks and explosions, resulting in economic losses, environmental pollution and public safety crises.
[0003] The existing identification of stolen oil holes mainly relies on manual analysis of monitoring data, and due to the subjective judgment of manual analysis, there are problems of low identification efficiency and poor accuracy. SUMMARY
[0004] The present application provides a model training method, a stolen oil hole identification method, a device, equipment and a storage medium to solve the problem of low identification efficiency and poor accuracy in the existing identification of stolen oil holes.
[0005] According to an aspect of the present application, a stolen oil hole identification model training method is provided, comprising:
[0006] Obtaining a training set, wherein the training set includes sample images with labels, the sample images are images containing stolen oil holes, and the labels include the position and type of the stolen oil holes;
[0007] Preprocessing the training set to obtain a target training set;
[0008] Training a stolen oil hole identification model based on the target training set, wherein the stolen oil hole identification model is determined based on a YOLO11 model.
[0009] According to another aspect of the present application, a stolen oil hole identification method is provided, comprising:
[0010] Obtaining an image to be identified;
[0011] Preprocessing the image to be identified to obtain a target image to be identified;
[0012] Inputting the target image to be identified into a target stolen oil hole identification model to obtain an identification result;
[0013] Wherein, the target stolen oil hole identification model is trained based on the stolen oil hole identification model training method according to any embodiment of the present application.
[0014] In some embodiments, the oil theft hole identification model training device comprises:
[0015] The training set acquisition module is configured to acquire a training set, wherein the training set comprises sample images with labels, the sample images are images containing oil theft holes, and the labels comprise positions and types of the oil theft holes.
[0016] The training set preprocessing module is configured to preprocess the training set to obtain a target training set.
[0017] The model training module is configured to train an oil theft hole identification model based on the target training set, wherein the oil theft hole identification model is determined based on a YOLO11 model.
[0018] In some embodiments, the oil theft hole identification device comprises:
[0019] The image acquisition module is configured to acquire an image to be identified.
[0020] The image preprocessing module is configured to preprocess the image to be identified to obtain a target image to be identified.
[0021] The result determination module is configured to input the target image to be identified into a target oil theft hole identification model to obtain an identification result.
[0022] The target oil theft hole identification model is trained based on the oil theft hole identification model training method according to any of the embodiments of the present application.
[0023] In some embodiments, the electronic device comprises:
[0024] at least one processor; and
[0025] a memory communicatively connected to the at least one processor; wherein
[0026] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the oil theft hole identification model training method according to any of the embodiments of the present application, or execute the oil theft hole identification method according to any of the embodiments of the present application.
[0027] In some embodiments, the computer readable storage medium stores computer instructions for enabling a processor to implement the oil theft hole identification model training method according to any of the embodiments of the present application, or implement the oil theft hole identification method according to any of the embodiments of the present application.
[0028] According to another aspect of the present application, a computer program product is provided, which comprises a computer program which, when executed by a processor, implements the oil theft hole identification model training method according to any one of the embodiments of the present application, or implements the oil theft hole identification method according to any one of the embodiments of the present application.
[0029] The technical solution provided by the embodiment of the present application is to obtain a training set, wherein the training set comprises sample images with labels, the sample images are images containing oil theft holes, and the labels comprise positions and types of the oil theft holes; the training set is preprocessed to obtain a target training set; and an oil theft hole identification model is trained based on the target training set, wherein the oil theft hole identification model is determined based on a YOLO11 model. By the above technical solution, the oil theft hole identification model is constructed based on the YOLO11 model, and the oil theft hole identification model is trained by using sample images containing oil theft holes. Compared with the existing oil theft hole identification method relying on manual identification, the technical solution of the embodiment effectively improves the identification efficiency and accuracy of the oil theft hole identification model in identifying oil theft holes.
[0030] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0032] Figure 1 is a flowchart of an oil theft hole identification model training method provided by the first embodiment of the present application;
[0033] Figure 2 is a sample image with labels provided by the first embodiment of the present application;
[0034] Figure 3 is a schematic diagram of a target sample image after normalization processing provided by the present application;
[0035] Figure 4 is a schematic diagram of a gray-scale oil theft hole image and a gray-scale waveform image provided by the present application;
[0036] Figure 5 is a flowchart of an oil theft hole identification method provided by the second embodiment of the present application;
[0037] Figure 6 is a structural schematic diagram of a stolen oil hole identification model training device provided by Embodiment Three of the present application;
[0038] Figure 7 is a structural schematic diagram of a stolen oil hole identification device provided by Embodiment Four of the present application;
[0039] Figure 8 is a structural schematic diagram of an electronic device provided by Embodiment Five of the present application. DETAILED DESCRIPTION
[0040] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0041] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0042] Embodiment One
[0043] Figure 1 is a flowchart of a stolen oil hole identification model training method provided by Embodiment One of the present application. The present embodiment can be applicable to the case of training a stolen oil hole identification model. The method can be executed by a stolen oil hole identification model training device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device. As shown in the figure, the method comprises: Figure 1
[0044] S110, obtaining a training set, wherein the training set comprises sample images with labels, the sample images are images containing stolen oil holes, and the labels comprise positions and types of the stolen oil holes.
[0045] In the embodiment, the sample image is an image containing an oil stealing hole, for example, the sample image can include a gray oil stealing hole image and / or a gray waveform image corresponding to the gray oil stealing hole image.
[0046] Specifically, detection data is acquired by a detection technology; then a part containing an oil stealing hole in the detection data is analyzed and screenshot by a preset analysis device, so that an original image containing an oil stealing hole can be obtained, which can include an original oil stealing hole image and / or an original waveform image corresponding to the original oil stealing hole image. Further, the positions and categories of the oil stealing holes in the images are labeled by using a labeling tool after gray processing of the images; labeled sample images are determined based on the labeled original images, and a training set is constituted. Further, the training set is acquired. The preset analysis device is not limited in the embodiment.
[0047] Exemplarily, Figure 2 is a labeled sample image provided by the embodiment one of the present application, as Figure 2 shown, the sample image 10 includes an oil stealing hole 11 and an oil stealing hole 12, the oil stealing hole 11 and the oil stealing hole 12 are labeled with a frame, so that the positions of the corresponding oil stealing holes are represented by the coordinates of the frame, the category of the oil stealing hole 11 is an oil stealing hole; similarly, the category of the oil stealing hole 12 is an oil stealing hole.
[0048] It is worth noting that, in order to ensure data diversity, the number of sample images in the training set should be no less than a preset image number, and these sample images should have different resolutions and come from pipelines of different diameters. The preset image number is determined according to actual conditions.
[0049] Exemplarily, in order to ensure data diversity, the number of sample images is no less than 1000, the original images corresponding to these sample images are images of different diameters, the diameter range is 200mm to 1000mm, and at the same time, the resolution range is 640x480 to 1920x1080.
[0050] S120, preprocessing the training set to obtain a target training set.
[0051] Specifically, in order to improve the quality of the training set and improve the training efficiency of the model, the training set is preprocessed to obtain a target training set. The preprocessing includes but is not limited to cropping, scaling, normalizing and feature enhancement of each sample image.
[0052] S130, training an oil stealing hole identification model based on the target training set, wherein the oil stealing hole identification model is determined based on a YOLO11 model.
[0053] In this embodiment, the YOLO (you only look once) 11 model is a high-efficiency and multi-functional computer vision model. The core idea is to convert the target detection problem into a regression problem, take the whole image as the input, and divide it into N×N grids (for example, each grid is a 32×32 region to better cover small targets). Each grid is responsible for detecting and locating the objects it contains, predicting the coordinates of the bounding box (relative to the grid unit), the class of the object, and the probability of the object appearing in the grid.
[0054] Specifically, a stolen oil hole recognition model is constructed using the YOLO 11 model; the target training set is input into the stolen oil hole recognition model, and the model outputs the position coordinates and class of the stolen oil hole in each sample image in the image after feature extraction and target detection operations. At the same time, combined with the loss function, the model parameters are continuously adjusted to reduce the difference between the prediction and the true label, thereby effectively training the stolen oil hole recognition model.
[0055] Optionally, when training the stolen oil hole recognition model using the training set, the number of training rounds is set to 300 rounds, the Adam optimizer is used, the initial learning rate is set to 0.001, and the learning rate is decayed to 0.1 of the original every 50 rounds.
[0056] Optionally, during the training process, the stolen oil hole recognition model is verified using the validation set. That is, the hyperparameters of the model, such as the learning rate and the batch size (the batch size is set to 32), are adjusted according to the feedback results of the validation set, the performance of the model is continuously optimized, until the detection accuracy of the model on the validation set reaches more than 95%, and the detection speed meets the real-time monitoring requirements (such as the detection time of each image is less than 0.1 second). After the training is completed, the stolen oil hole recognition model can also be tested using the test set.
[0057] The technical solution provided by the first embodiment of the present application acquires a training set, wherein the training set includes sample images with labels, the sample images are images containing stolen oil holes, and the labels include the positions and types of the stolen oil holes; the training set is preprocessed to obtain a target training set; and a stolen oil hole recognition model is trained based on the target training set, wherein the stolen oil hole recognition model is determined based on the YOLO 11 model. Through the above technical solution, the stolen oil hole recognition model is constructed based on the YOLO 11 model, and the stolen oil hole recognition model is trained using sample images containing stolen oil holes. Compared with the existing method of relying on manual identification of stolen oil holes, the technical solution of the present embodiment effectively improves the identification efficiency and accuracy of the stolen oil hole recognition model in identifying stolen oil holes.
[0058] In some embodiments, the pre-processing of the training set to obtain a target training set comprises: for each sample image in the training set, performing a cropping operation on the current sample image to obtain a first sample image; performing a scaling operation on the first sample image to obtain a second sample image of a target size; performing a normalization operation on the second sample image to obtain a target sample image; and determining the target training set based on each target sample image. Through the cropping, scaling and normalization operations on the training set, the training efficiency and accuracy of the model are effectively improved.
[0059] In the present embodiment, the target size can be understood as an image size that is pre-set according to the input requirements of the oil theft hole identification model. For example, the target size is set to 448x448.
[0060] Specifically, for each sample image in the training set, a preset cropping algorithm is used to perform a cropping operation on the current sample image to obtain a first sample image containing a key attention region; then, a preset scaling algorithm is used to adjust the size of the first sample image to the target size to obtain a second sample image; and then, a preset normalization algorithm is used to map the pixel values in the second sample image to the range of [0, 1] to obtain a target sample image, as shown in Figure 3 The obtained target sample images are collected to form a target training set.
[0061] It is worth noting that the present embodiment does not limit the preset cropping algorithm, the preset scaling algorithm and the preset normalization algorithm. For example, the preset cropping algorithm can include an edge detection-based cropping algorithm and a feature point detection-based cropping algorithm, etc. The preset scaling algorithm can include a bilinear interpolation algorithm and a nearest neighbor interpolation algorithm, etc. The preset normalization algorithm can use a pixel value centering algorithm, or the following algorithm:
[0062]
[0063] wherein x represents a pixel value in the second sample image, x min represents the minimum pixel value in the second sample image, x max represents the maximum pixel value in the second sample image.
[0064] In some embodiments, the cropping operation on the current sample image to obtain the first sample image comprises: determining a preset edge region of the current sample image, wherein the preset edge region is a frame region formed by extending pixel points inward from four edges of the current sample image; traversing the pixel points in the preset edge region, calculating a difference value of pixel values of each pixel point and adjacent pixel points, determining a pixel point as an invalid pixel point if an absolute value of the difference value is less than a preset threshold, and determining a pixel point as a valid pixel point if the absolute value of the difference value is greater than or equal to the preset threshold; determining a valid region based on the valid pixel points, wherein the valid region does not include invalid pixel points; and cropping the current sample image based on the valid region to obtain the first sample image.
[0065] In the present embodiment, the valid region can be understood as a region that needs to be retained. The preset threshold is used to distinguish between valid pixel points and invalid pixel points. The preset threshold can be a fixed threshold set in advance, or a dynamic threshold. The dynamic threshold is determined according to the pixel mean and the pixel variance of the current sample image by the following algorithm:
[0066] threshold = μ + k * σ
[0067] wherein threshold represents the dynamic threshold, μ represents the pixel mean of the current sample image, σ represents the pixel variance of the current sample image, and k represents an adaptive coefficient, the value range of which is [1.5, 2.5].
[0068] Specifically, a certain number of pixel points are extended inward from the upper, lower, left and right four edges of the current sample image, and these pixel points together constitute a rectangular frame region surrounding the image as the preset edge region. For example, the left and right edges are extended inward by 10% of the pixel points in the horizontal direction (width) of the current sample image, and the upper and lower edges are extended inward by 10% of the pixel points in the vertical direction (height) of the current sample image.
[0069] Further, the pixel points in the preset edge region are traversed, and the difference value of the pixel values of each pixel point and the adjacent pixel points is calculated, wherein the adjacent pixel points can include the pixel points adjacent to the upper, lower, left and right of the pixel point; if the absolute value of the difference value of the pixel value of any adjacent pixel point is less than the preset threshold, the pixel point is determined as an invalid pixel point, otherwise, if the absolute value of the difference value of the pixel value of any adjacent pixel point is greater than or equal to the preset threshold, the pixel point is a valid pixel point.
[0070] Further, based on the valid pixel points, a valid region is determined, wherein the valid region does not include any invalid pixel points. The current sample image is cropped based on the valid region to obtain the first sample image.
[0071] Optionally, the width and height of the effective region should be greater than or equal to the width and height of the inscribed rectangular region surrounded by the preset edge region.
[0072] Optionally, if there is no valid pixel point, the inscribed rectangular region surrounded by the preset edge region is taken as the effective region.
[0073] Through the above technical solutions, the invalid information of the image edge can be effectively removed, the effective content in the image is retained, and the purity and relevance of the image are improved. Through accurate identification and cropping, the key region in the image can be focused on, so as to improve the efficiency and accuracy of the oil stealing hole identification, reduce the interference of invalid data, and enhance the learning effect of the model on the target features.
[0074] Illustratively, taking the oil stealing hole in the oil pipeline with a diameter of 508 mm as an example, the training of the oil stealing hole identification model is described:
[0075] 1) Data preparation, including acquisition and data labeling of original images
[0076] Acquisition of original images: through the oil stealing hole detection data analysis software (preset analysis device), the data rendering software API is called by using Python script, or the mouse is clicked to realize the detection data page turning and screenshot triggered once every 1-2 seconds, so as to realize the screenshot of the pipeline inner wall detection data; 1500 original images with a resolution of 1280x720 to 1920x1080 are intercepted, covering the normal pipeline area and the artificial simulated oil stealing hole (diameter 12-20 mm) area of the pipeline with a diameter of 508 mm, the normalization threshold of each original image is adjusted, and each gray image is obtained, which can include a gray oil stealing hole image and / or a gray waveform image corresponding to the gray oil stealing hole image, as shown in Figure 4 The figure includes a gray oil stealing hole image 441 and a gray waveform image 442 corresponding to the gray oil stealing hole image 441. This example takes obtaining each gray oil stealing hole image as an example for description.
[0077] Data labeling: using a labeling tool (such as Make Sense, LabelImg) to label the rectangular frame position and category (such as “oil stealing hole” and “repaired oil stealing hole”) of each gray oil stealing hole image, obtaining each sample image with label, and generating an.xml or.json format annotation file containing coordinates and categories.
[0078] 2) Data preprocessing
[0079] Image cropping: the preset threshold is set to 40, the invalid area in each sample image is removed, and the pipeline inner wall core monitoring area (effective area) in the image is retained, to obtain each first sample image.
[0080] Scaling and normalization: each first sample image is uniformly adjusted to a second sample image with a size of 448x448 using a bilinear interpolation algorithm, and the pixel values of each second sample image are normalized by the formula The pixel values of each second sample image are normalized to map the data range to [0, 1] to obtain each target sample image. Further, based on each target sample image, a target training set is obtained.
[0081] It is worth noting that the preprocessing process uses multi-thread parallel processing of images to realize the cropping, scaling and normalization operations of images, and the processing time of a single image is < 50 ms.
[0082] Dataset management: an SQLite database is established to store labeled sample images, supporting retrieval and management of datasets according to time, pipe diameter, resolution, etc.
[0083] Dataset division: the 1500 preprocessed images are divided into a training set (1050 images), a validation set (300 images) and a test set (150 images) according to a ratio of 7:2:1;
[0084] 3) Training phase, including model training and optimization
[0085] Model construction: an oil theft hole recognition model is developed based on Python programming language and PyTorch framework, and is deployed on a Linux server to interface with existing pipeline detection software API;
[0086] Training parameter setting: number of training rounds (Epoch): 300 rounds; optimizer: Adam, initial learning rate 0.001, decay to 0.1 of the original value every 50 rounds; batch size: 32; hardware configuration: NVIDIA RTX 4090 GPU, 24GB of video memory;
[0087] The training set is used to train the oil theft hole recognition model to adjust the parameters of the model.
[0088] Training process: the model performance is evaluated using the validation set after each round of training to adjust the hyperparameters of the model. The monitoring indicators include: loss value (Box Loss, Class Loss), detection accuracy (mAP@50, mAP@50-95), recall rate (Recall), precision rate (Precision). When the detection accuracy of the validation set is stable at more than 95% and the detection time of a single image is less than 0.1 second, the training is stopped.
[0089] Optionally, the training parameters are configured using a graphical user interface (GUI), supporting breakpoint resume and hyperparameter tuning (such as learning rate, batch size). The training curve (loss value, accuracy, etc.) is displayed in real time, and the optimal model weight file (best_model.pt) is automatically saved.
[0090] 4) Test phase
[0091] The test set is input into the oil theft hole recognition model, and after model calculation, target extraction is performed.
[0092] The oil theft hole recognition model trained in the above manner has the following advantages: 1. High accuracy: based on the YOLO11 model, the oil theft hole recognition model is constructed, the powerful feature extraction and target detection capability of the YOLO11 model is utilized, and the data set is carefully collected and labeled for training, which can accurately identify oil theft holes under different conditions, effectively reduce the false detection rate and the missed detection rate. Through testing in the test set, the false detection rate is less than 5%, and the missed detection rate is less than 3%. 2. High efficiency: an end-to-end processing method is adopted, which can quickly process a large number of images, realize real-time identification of oil theft holes, and greatly improve the detection efficiency compared with traditional methods. In actual application scenarios, more than 10 images per second can be processed, meeting the real-time detection requirements. 3. Strong adaptability: through the collection and training of images of different pipe diameters, different oil theft holes and different resolutions, the actual detection of various pipe diameters and oil theft holes can be adapted, ensuring the stability and reliability of oil theft hole recognition. In different pipe diameters and oil theft hole types, the recognition accuracy fluctuates less than 5%.
[0093] Embodiment two
[0094] Figure 5 is a flowchart of an oil theft hole recognition method provided by the second embodiment of the present application. The present embodiment can be applicable to the identification of oil theft holes. The method can be executed by an oil theft hole recognition device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device. As shown in the figure, the method comprises: Figure 5
[0095] S210, obtaining an image to be identified.
[0096] In the present embodiment, the image to be identified can be understood as an image that needs to be identified for oil theft holes. Optionally, the image to be identified can include a gray-scale image and / or a waveform image corresponding to the gray-scale image.
[0097] S220, pre-processing the image to be identified to obtain a target image to be identified.
[0098] Specifically, the image to be identified is pre-processed to obtain a target image to be identified, wherein the pre-processing operation includes pre-processing including but not limited to image cropping, scaling, normalization, feature enhancement, etc.
[0099] An exemplary method includes cropping the image to be identified to obtain a first image to be identified, performing scaling processing on the first image to be identified to obtain a second image to be identified of a target size, and performing normalization processing on the second image to be identified to obtain a target image to be identified.
[0100] In some embodiments, the identification result includes a location and a category of the oil stealing hole.
[0101] In some embodiments, the target image to be identified is input into a target oil stealing hole identification model, and an identification result is obtained.
[0102] In some embodiments, the identification result includes a location and a category of the oil stealing hole.
[0103] In some embodiments, the target image to be identified is input into a target oil stealing hole identification model, and an identification result is obtained.
[0104] In some embodiments, the identification result includes a location and a category of the oil stealing hole.
[0105] In some embodiments, after the target image to be identified is input into the target oil stealing hole identification model to obtain the identification result, the method further includes marking a location of the oil stealing hole in the image to be identified based on the identification result to obtain a target image, and performing an alarm based on the target image, the location and the category of the oil stealing hole.
[0106] In some embodiments, after the identification result is obtained, the location of the oil stealing hole in the image to be identified is marked to generate a target image, so as to more clearly show the location of the oil stealing hole.
[0107] Further, the position of the oil stealing hole can be mapped to the actual position in the pipeline, and then when the confidence of the category reaches a set threshold, the target image, the actual position of the oil stealing hole, and the category can be sent to the alarm system, so that the alarm system can quickly trigger an alarm after receiving this information, and notify relevant personnel to handle, thereby timely stopping the theft and reducing losses and ensuring the safe operation of the oil pipeline. The confidence can be understood as the probability distribution of the corresponding type.
[0108] Through the above technical solution, the visualization degree of oil stealing hole identification is effectively improved, and through the rapid alarm mechanism, the loss is effectively reduced and the safety is improved.
[0109] For example, 12 oil stealing holes with a diameter range of 12-20 mm set in a pipeline with a diameter of 508 mm are identified.
[0110] The trained target oil stealing hole identification model is exported as a.pt format file and integrated into the pipeline monitoring system server. Real-time acquisition of the original waveform image detected in the pipeline is preprocessed and input into the target oil stealing hole identification model, and the position coordinates (such as x1, y1, x2, y2) and category confidence (such as “oil stealing hole, confidence 98%”) of the oil stealing hole are output.
[0111] Optionally, in the above identification process, TensorRT is used to accelerate inference, and the time consumption of single image detection is <80 ms, meeting the real-time requirement of processing 10 images per second.
[0112] The accuracy of the above identification result is 100% (i.e. all 12 oil stealing holes are correctly identified without missing detection), and the false detection rate is 0%, and at the same time, the processing speed can reach 20 / second, meeting the real-time monitoring requirement.
[0113] When an oil stealing hole is detected (confidence > 90%), the monitoring software marks the position of the oil stealing hole in the image (such as a red rectangular frame), obtains the target image, and maps the coordinates to the physical position (actual position) of the pipeline, and sends the target image, the actual position of the oil stealing hole, the category, and the detection time to the alarm system to notify the operation and maintenance personnel.
[0114] The above identification process does not require human intervention, realizes automatic oil stealing hole monitoring and alarm, provides an intelligent solution for oil safety monitoring, reduces labor costs and monitoring risks. It can be integrated with existing safety monitoring systems to realize automatic alarm function and timely notify relevant personnel to handle the oil stealing event.
[0115] Embodiment Three
[0116] Figure 6is a structural schematic diagram of a stolen oil hole identification model training device provided by embodiment three of the present application. As shown in the figure, the device comprises: Figure 6
[0117] a training set acquisition module 31 configured to acquire a training set, wherein the training set comprises sample images with labels, the sample images are images containing stolen oil holes, and the labels comprise positions and types of the stolen oil holes;
[0118] a training set preprocessing module 32 configured to preprocess the training set to obtain a target training set;
[0119] a model training module 33 configured to train a stolen oil hole identification model based on the target training set, wherein the stolen oil hole identification model is determined based on a YOLO11 model.
[0120] The technical solution provided by embodiment three of the present application effectively improves the identification efficiency and accuracy of the stolen oil hole identification model in identifying stolen oil holes.
[0121] Optionally, the training set preprocessing module 32 comprises:
[0122] an image cropping unit configured to perform a cropping operation on a current sample image for each sample image in the training set to obtain a first sample image;
[0123] an image scaling unit configured to perform scaling processing on the first sample image to obtain a second sample image with a target size;
[0124] an image normalization unit configured to perform a normalization operation on the second sample image to obtain a target sample image;
[0125] a training set determination unit configured to determine a target training set based on each target sample image.
[0126] Optionally, the image cropping unit comprises:
[0127] an edge region determination subunit configured to determine a preset edge region of a current sample image, wherein the preset edge region is a frame region formed by extending pixel points inward from four edges of the current sample image;
[0128] a pixel point determination subunit configured to traverse pixel points in the preset edge region, calculate a difference value between a pixel value of each pixel point and a pixel value of an adjacent pixel point, determine a pixel point with an absolute value of the difference value less than a preset threshold as an invalid pixel point, and determine a pixel point with the absolute value of the difference value greater than or equal to the preset threshold as a valid pixel point;
[0129] An effective region determination sub-unit is configured to determine an effective region based on the effective pixel points, wherein the effective region does not include the invalid pixel points.
[0130] An image cropping sub-unit is configured to crop the current sample image based on the effective region to obtain a first sample image.
[0131] The oil theft hole identification model training device provided in the embodiments of the present application can execute the oil theft hole identification model training method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.
[0132] Embodiment Four
[0133] Figure 7 is a structural schematic diagram of an oil theft hole identification device provided in Embodiment Four of the present application. Figure 7 As shown in the figure, the device comprises:
[0134] An image acquisition module 41 is configured to acquire a to-be-identified image.
[0135] An image preprocessing module 42 is configured to pre-process the to-be-identified image to obtain a target to-be-identified image.
[0136] A result determination module 43 is configured to input the target to-be-identified image into a target oil theft hole identification model to obtain an identification result.
[0137] The target oil theft hole identification model is trained based on the oil theft hole identification model training method described in any of the embodiments of the present application.
[0138] The technical solution provided in Embodiment Four of the present application effectively improves the identification efficiency and accuracy of the oil theft hole identification.
[0139] Optionally, the identification result comprises a location and a category of the oil theft hole.
[0140] Optionally, the oil theft hole identification device further comprises:
[0141] An image marking module is configured to mark the location of the oil theft hole in the to-be-identified image based on the identification result to obtain a target image.
[0142] An alarm module is configured to alarm based on the target image, the location and the category of the oil theft hole.
[0143] The oil theft hole identification device provided in the embodiments of the present application can execute the oil theft hole identification method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.
[0144] Embodiment Five
[0145] Figure 8 FIG. 1 is a block diagram illustrating the architecture of an electronic device according to an embodiment of the present disclosure. The electronic device can be a variety of forms of digital computers, such as a laptop computer, a tablet computer, a workstation, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also be a variety of forms of mobile devices, such as a personal digital assistant, a cellular phone, a smart phone, a wearable device (e.g., a helmet, glasses, a watch, etc.), and other similar computing devices. The components, their connections and relationships, and their functions, as depicted in the figures, are meant only to be examples and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.
[0146] As shown in FIG. 1, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11. The memory stores a computer program executable by the at least one processor 11. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded into the random access memory (RAM) 13 from the storage unit 18. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14. Figure 8
[0147] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0148] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the stolen oil hole identification model training method or the stolen oil hole identification method.
[0149] In some embodiments, the oil theft hole recognition model training method or the oil theft hole recognition method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., storage unit 18. In some embodiments, parts or all of the computer program can be loaded and / or installed onto electronic device 10 via, e.g., ROM 12 and / or communication unit 19. When the computer program is loaded onto RAM 13 and executed by processor 11, one or more steps of the above-described oil theft hole recognition model training method or oil theft hole recognition method can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the oil theft hole recognition model training method or oil theft hole recognition method by any other suitable means, e.g., by means of firmware.
[0150] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0151] Computer programs used to implement the processes of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as part of a separate software package, or entirely on a remote machine or server.
[0152] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0153] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0154] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0155] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. Servers can be cloud servers, also known as cloud computing servers or cloud hosts, which are a host product in the cloud computing service system to solve the defects of large management difficulty and weak business scalability in traditional physical hosts and VPS services.
[0156] It should be understood that the various forms of flow shown above can be reordered, additional or deleted steps. For example, each step described in the present application can be executed in parallel, sequentially or in different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.
[0157] The above detailed description does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
[0158] The embodiment of the present application further provides a computer program product, comprising a computer program and / or instructions, which, when executed by a processor, implements the oil theft hole identification model training method or the oil theft hole identification method provided by any embodiment of the present application.
[0159] The computer program product can be written in one or more programming languages or combinations of languages to implement the computer program code for performing the operations of the present application, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. The program code can be executed entirely on a user computer, partially on a user computer, as a separate software package, partially on a user computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0160] Note that the above merely describes preferred embodiments of the present application and the applied technical principles. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, modifications and substitutions can be made by those skilled in the art without departing from the scope of the present application. Therefore, although the present application has been described in detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A method for training an oil theft hole identification model, characterized in that: include: Acquire a training set, wherein the training set includes sample images with labels, the sample images are images containing oil theft holes, and the labels include the location and type of the oil theft holes; Preprocessing the training set to obtain a target training set; Based on the target training set, an oil theft hole recognition model is trained, wherein the oil theft hole recognition model is determined based on a YOLO11 model.
2. The method according to claim 1, characterized in that The preprocessing of the training set to obtain a target training set includes: For each sample image in the training set, performing a cropping operation on the current sample image to obtain a first sample image; performing scaling processing on the first sample image to obtain a second sample image of a target size; performing a normalization operation on the second sample image to obtain a target sample image; Based on each target sample image, a target training set is determined.
3. The method according to claim 2, characterized in that The step of performing a cropping operation on the current sample image to obtain a first sample image includes: Determining a preset edge region of the current sample image, wherein the preset edge region is a frame region formed by extending pixels inward from four edges of the current sample image; Traversing the pixel points in the preset edge area, calculating the difference between the pixel value of each pixel point and the pixel value of the adjacent pixel point, determining the pixel point whose absolute value of the difference is less than a preset threshold as an invalid pixel point, and determining the pixel point whose difference is greater than or equal to the preset threshold as a valid pixel point; Determining a valid area based on the valid pixels, wherein the valid area does not include invalid pixels; Based on the valid area, the current sample image is cropped to obtain a first sample image.
4. A method for identifying oil theft holes, characterized in that: include: Obtain the image to be recognized; Preprocessing the image to be identified to obtain a target image to be identified; Inputting the target image to be identified into a target oil theft hole identification model to obtain an identification result; The target oil theft hole identification model is obtained by training based on the oil theft hole identification model training method according to any one of claims 1 to 3.
5. The method according to claim 4, characterized in that The identification result includes the location and category of the theft hole; After inputting the target image to be identified into the target oil theft hole identification model and obtaining the identification result, the method further includes: Based on the recognition result, the position of the oil theft hole in the image to be recognized is marked to obtain a target image; An alarm is issued based on the target image, the location and category of the oil theft hole.
6. An oil theft hole identification model training device, characterized in that: include: A training set acquisition module, configured to acquire a training set, wherein the training set includes sample images with labels, the sample images are images containing oil theft holes, and the labels include the location and type of the oil theft holes; A training set preprocessing module, used to preprocess the training set to obtain a target training set; The model training module is used to train the oil theft hole identification model based on the target training set, wherein the oil theft hole identification model is determined based on the YOLO11 model.
7. An oil theft hole identification device, characterized in that: include: An image acquisition module, used to acquire an image to be identified; An image preprocessing module, configured to preprocess the image to be identified to obtain a target image to be identified; A result determination module is used to input the target image to be identified into the target oil theft hole identification model to obtain an identification result; The target oil theft hole identification model is obtained by training based on the oil theft hole identification model training method according to any one of claims 1 to 3.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the oil theft hole identification model training method described in any one of claims 1 to 3, or execute the oil theft hole identification method described in any one of claims 4 to 5.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the oil theft hole identification model training method as described in any one of claims 1 to 3, or to implement the oil theft hole identification method as described in any one of claims 4 to 5 when executed.
10. A computer program product, characterized in that The computer program product includes a computer program, which, when executed by a processor, implements the oil theft hole identification model training method according to any one of claims 1 to 3, or implements the oil theft hole identification method according to any one of claims 4 to 5.