Crude oil leakage detection method and application thereof
By pruning the detection algorithm model layer by layer and globally, combined with network quantitative optimization, the problem of limited hardware conditions in drone crude oil leakage detection is solved, and efficient and accurate detection results are achieved.
Patent Information
- Application Number
- CN202411887895.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-15
AI Technical Summary
In drone inspection missions, the crude oil leakage detection environment is complex and the objects are diverse. The drone platform is limited by computing power and battery life. How to improve the performance of the detection algorithm under limited hardware conditions has become an urgent problem to be solved at present.
By pruning and globally pruning each convolutional layer in the network of the detection algorithm model, and introducing sparse regular terms into the loss function for retraining, the calculation complexity is reduced. At the same time, through network quantization optimization, the weight and activation values in the model are reduced from 32-bit floating point numbers to 8-bit fixed-point numbers, optimizing the overall calculation efficiency.
It significantly reduces the computational complexity, maintains the detection accuracy of the pruning model, optimizes the overall computing efficiency, and improves the efficiency and accuracy of the drone crude oil leakage detection system.
Smart Images

Figure CN119832453A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and in particular to a crude oil leakage detection method, a crude oil leakage detection device, an electronic device, and a non-transitory computer-readable storage medium. Background Art
[0002] With the development of drone technology, drone-based inspection systems have been widely used in monitoring and detection of oil pipelines, oilfield equipment and other areas. Crude oil spills are extremely destructive events, and timely detection and disposal of leaks are of great significance to environmental protection and economic benefits. Traditional manual inspection methods are time-consuming and labor-intensive, and it is difficult to achieve wide-area real-time monitoring. Drones equipped with cameras with built-in detection algorithms can achieve long-term automatic inspections, greatly improving detection efficiency.
[0003] However, due to the complex environment and diverse objects of crude oil leak detection, and the fact that drone platforms are limited by computing power and flight time, how to improve the performance of detection algorithms under limited hardware conditions has become a problem that needs to be solved urgently. Summary of the invention
[0004] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a crude oil leakage detection method and application, which can significantly improve the detection efficiency and accuracy of the embedded platform in the UAV inspection mission.
[0005] On the one hand, an embodiment of the present invention proposes a crude oil leak detection method, including: presetting a detection algorithm model, pruning each convolutional layer in the network of the detection algorithm model layer by layer and retesting the model accuracy to mark the sensitive layer; determining the pruning ratio of each convolutional layer according to the marked sensitive layer, and pruning each convolutional layer again layer by layer according to the pruning ratio; globally pruning the detection algorithm model obtained by the layer-by-layer pruning, and introducing a sparse regularization term in the loss function to retrain the detection algorithm model until the model accuracy before the layer-by-layer pruning is restored.
[0006] In one embodiment of the present invention, the layer-by-layer pruning includes: using the L1 norm to calculate the accuracy contribution of the feature channel of each convolutional layer, and determining the priority of the layer-by-layer pruning according to the size of the accuracy contribution.
[0007] In one embodiment of the present invention, the layer-by-layer pruning further includes: obtaining detection scene information, determining the pruning coefficient α of the corresponding convolution layer according to the detection scene information; and determining the pruning coefficient α of the corresponding convolution layer according to the formula Prune the corresponding convolutional layers layer by layer; wherein, C l is the number of channels, The number of channels retained after pruning.
[0008] In one embodiment of the present invention, the global pruning further includes: acquiring detection scene information, determining a pruning amplitude of the global convolutional layer according to the detection scene information, and completing global pruning of the corresponding detection scene according to the pruning amplitude.
[0009] In one embodiment of the present invention, the crude oil leakage detection method further includes: performing network quantization optimization on the detection algorithm model, reducing the weights and activation values in the model from 32-bit floating point numbers to 8-bit fixed point numbers, and the formula is expressed as: Among them, △ is the quantization step size, which is used to control the accuracy. The quantization range of 8-bit fixed-point numbers is [-128, 127]; the quantization step size △ is defined as: Among them, the maximum and minimum values of floating point numbers are represented by x. max and x min Indicates that b is the number of quantization bits.
[0010] In one embodiment of the present invention, the network quantization optimization also includes: using a relatively small quantization ratio for the high-level convolutional layers in the detection algorithm model, and using a relatively large quantization ratio for the low-level convolutional layers and pooling layers; using a relatively small quantization ratio for the relatively complex oilfield equipment area in the inspection task, and using a relatively large quantization ratio for the relatively simple long-distance oil pipeline; using asymmetric quantization of the activation value for the oilfield equipment area, and using symmetric quantization of the activation value for the long-distance oil pipeline.
[0011] In one embodiment of the present invention, the network quantization optimization also includes: selecting to use a mixed precision quantization strategy according to the environmental climate state, and the mixed precision quantization strategy includes: using relatively high precision 16-bit floating point quantization for high-level convolutional layers, and using relatively low precision 8-bit fixed point quantization for low-level convolutional layers and pooling layers.
[0012] On the other hand, an embodiment of the present invention further proposes a crude oil leakage detection device, comprising: a sensitive layer marking module, used to preset a detection algorithm model, prune each convolutional layer in the network of the detection algorithm model layer by layer, and retest the model accuracy to mark the sensitive layer; a layer-by-layer pruning module, used to determine the pruning ratio of each convolutional layer according to the marked sensitive layer, and prune each convolutional layer again layer by layer according to the pruning ratio; a global pruning and retraining module, used to globally prune the detection algorithm model obtained by the layer-by-layer pruning, and introduce a sparse regularization term in the loss function to retrain the detection algorithm model until the model accuracy before the layer-by-layer pruning is restored.
[0013] On the other hand, an embodiment of the present invention further proposes an electronic device, comprising: a memory and one or more processors connected to the memory, the memory storing a computer program, and the processor being used to execute the computer program to implement the crude oil leakage detection method as described in any one of the above embodiments.
[0014] On the other hand, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the crude oil leakage detection method as described in any one of the above embodiments.
[0015] It can be seen from the above that, compared with the prior art, the above embodiments of the present invention can have at least one or more of the following beneficial effects:
[0016] By pruning each convolutional layer in the detection algorithm model network layer by layer and retesting the model accuracy to mark the sensitive layer, the pruning ratio of each convolutional layer is determined and pruned layer by layer again. The model after layer-by-layer pruning is pruned globally and sparse regularization terms are introduced for retraining until the model accuracy before layer-by-layer pruning is restored. This can significantly reduce the computational complexity in a targeted manner and maintain the detection accuracy of the pruned model, while optimizing the overall computational efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0018] Figure 1 A flow chart of a crude oil leakage detection method provided by an embodiment of the present invention;
[0019] Figure 2 A schematic diagram of specific execution steps of a crude oil leakage detection method provided by an embodiment of the present invention;
[0020] Figure 3 A schematic diagram of the quantitative optimization steps provided by an embodiment of the present invention;
[0021] Figure 4 A system architecture diagram of a crude oil leakage detection method application provided by an embodiment of the present invention;
[0022] Figure 5 A schematic structural diagram of a crude oil leakage detection device provided by an embodiment of the present invention;
[0023] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0024] Figure 7A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0025] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described below with reference to the accompanying drawings and in combination with the embodiments.
[0026] In order to enable ordinary technicians in the field to better understand the technical solution of the present invention, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments, and all should belong to the protection scope of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are applicable to distinguishing similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition. The terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or are proprietary to these processes, methods, products or devices.
[0028] It should also be noted that the division of multiple embodiments in the present invention is only for the convenience of description and should not constitute a special limitation. The features in various embodiments can be combined and referenced to each other without contradiction.
[0029] like Figure 1 As shown, the first embodiment of the present invention proposes a crude oil leakage detection method, for example, including: step S1, presetting a detection algorithm model, pruning each convolution layer in the network of the detection algorithm model layer by layer and retesting the model accuracy to mark the sensitive layer; step S2, determining the pruning ratio of each convolution layer according to the marked sensitive layer, and pruning each convolution layer again layer by layer according to the pruning ratio; step S3, globally pruning the detection algorithm model obtained by the layer-by-layer pruning, and introducing a sparse regularization term in the loss function to retrain the detection algorithm model until the model accuracy before the layer-by-layer pruning is restored.
[0030] Specifically, the crude oil leakage detection method proposed in this embodiment is implemented based on a drone inspection platform equipped with a HiSilicon Hi3519V101 chip, and a preset detection algorithm model (such as a YOLOv8 model) is loaded into the HiSilicon Hi3519V101 chip. The HiSilicon Hi3519 V101 chip has strong computing power, and is particularly suitable for real-time image processing and reasoning tasks. As an advanced target detection algorithm, YOLOv8 can achieve high detection accuracy and speed, but its computational complexity is high. Therefore, this embodiment optimizes the YOLOv8 model by pruning and quantizing, so as to make full use of the computing resources of the chip and improve the efficiency and accuracy of the drone crude oil leakage detection system.
[0031] Network pruning is a technique that reduces the complexity of the model by reducing redundant parameters in convolutional neural networks. Figure 2 As shown, in step S1, the YOLOv8 model is analyzed layer by layer to identify the layers that have a greater impact on the model accuracy, which are called sensitive layers. This analysis can be achieved through layer-by-layer pruning testing: prune some channels of each layer one by one, and retest the model accuracy. If the pruning of a layer causes a significant decrease in accuracy, the layer is marked as a sensitive layer.
[0032] In step S2, the marked sensitive layer is used to determine the pruning ratio according to the application environment, including: (1) Complex environment application: When detecting complex equipment areas (such as drilling platforms or oil pumping stations), these scenes contain a large number of small targets and complex backgrounds. Therefore, the sensitive layer needs to be marked during pruning to reduce the pruning ratio of the sensitive layer, or not prune it at all to ensure the detection accuracy of small targets.
[0033] (2) Simple environment application: In the long-distance oil pipeline scenario, the background is relatively simple and highly repetitive, the sensitive layer is relatively reduced, and the pruning strategy can be more aggressive to prune redundant channels that do not affect the detection of large targets.
[0034] Furthermore, the feature channels of each convolutional layer in the network are expressed as:
[0035]
[0036] in, represents the i-th channel of the l-th layer of convolution, j, k are the indices of the weight matrix.
[0037] For example, the L1-norm or other channel weight importance evaluation methods are used to calculate the contribution of each channel in each convolutional layer. Channels with lower contributions are pruned first, thereby reducing the computational overhead of the network.
[0038] Furthermore, for example, detection scene information is obtained, and the pruning coefficient α of the corresponding convolutional layer is determined according to the detection scene information; according to the formula Prune the corresponding convolutional layers layer by layer; among them, C l is the number of channels, The number of channels retained after pruning. Specifically, in more complex scenes, feature extraction of shallow convolution is particularly important for small targets, so shallow convolution layers will be retained as much as possible during pruning, so the smaller α is; in simpler environments (such as single pipeline detection), more intermediate layers will be pruned to reduce redundant features, so the larger α is.
[0039] Furthermore, by pruning layer by layer, the part with smaller L1 norm in the channel is pruned each time, and a sparsification regularization term is added to the loss function, and the model is retrained to recover the accuracy loss caused by pruning. After pruning, the model can maintain accuracy while greatly reducing the computational complexity. The process is expressed by the formula:
[0040]
[0041] Among them, λ is the sparsification regularization coefficient, which is used to control the degree of sparsification.
[0042] In step S3, pruning is not limited to layer-by-layer operations, for example, global pruning is also performed based on global network optimization. By introducing a global sparse regularization term, the model automatically cuts unimportant weights during training, thereby performing global channel pruning. This method can perform unified pruning between multiple layers and optimize the overall computational efficiency.
[0043] Furthermore, global pruning also obtains detection scene information, determines the global pruning amplitude of the convolution layer according to the detection scene information, and completes global pruning of the corresponding detection scene according to the pruning amplitude. Specifically, for example, in complex equipment areas, the global pruning amplitude is relatively small to maintain the robustness of the overall model; when inspecting long-distance pipelines, the global pruning amplitude is relatively large to reduce more redundant calculations.
[0044] Similarly, after each pruning, the model accuracy may decrease due to the loss of some features of the model. Therefore, the model needs to be retrained after pruning to restore accuracy. Retraining can be fine-tuned based on small batches of data to ensure that the pruned model can refit the data distribution and ensure that the inference efficiency is greatly improved.
[0045] Furthermore, the crude oil leakage detection method also includes network quantization optimization. Network quantization refers to reducing the weights and activation values in the model from 32-bit floating point numbers to 8-bit fixed point numbers to reduce computing overhead and storage requirements. The quantization process is expressed by the formula:
[0046]
[0047] Among them, △ is the quantization step size, which is used to control the accuracy.
[0048] For 8-bit fixed-point quantization, the quantization range is [-128, 127], and the step size △ is defined as:
[0049]
[0050] Among them, the maximum and minimum values of floating point numbers are represented by x. max and x min Indicates that b is the number of quantization bits.
[0051] This embodiment significantly improves the reasoning efficiency of the YOLOv8 model on the embedded platform through network quantization optimization.
[0052] Further, such as Figure 3 As shown in the figure, quantization optimization includes hierarchical quantization: weight quantization is performed for different convolutional layers in the model. Specifically, in high-level convolution (shallow feature extraction), due to the importance of initial feature extraction, a smaller quantization ratio is used during quantization to ensure accuracy, while a more aggressive quantization strategy is used in subsequent convolutional layers and pooling layers to further improve the inference speed. In addition, for application scenario optimization: a more conservative quantization strategy is used for complex oilfield equipment areas in inspection tasks to ensure the accuracy of detecting small targets; a more aggressive quantization strategy is used in long-distance pipeline inspection to minimize the amount of calculation.
[0053] Furthermore, for activation value quantization, symmetric quantization and asymmetric quantization are used for different application scenarios. Specifically, symmetric quantization: that is, x max =-x min Symmetric quantization is to quantize activation values equidistantly in the positive and negative directions, which can simplify the calculation, but is not sensitive to the uneven distribution of certain features; asymmetric quantization: that is, x max and x min Asymmetric: Asymmetric quantization can better handle unevenly distributed activation values, especially for processing multiple details in complex scenes. For example, asymmetric quantization is used in complex equipment areas to handle uneven feature distribution; while symmetric quantization is used in simple pipeline inspections to improve computational efficiency.
[0054] Furthermore, in actual scenarios, some layers have higher requirements for computational accuracy, while some layers can withstand lower precision loss. Therefore, this embodiment, for example, also uses mixed precision quantization technology, combining the advantages of 16-bit floating point numbers and 8-bit fixed point numbers to achieve a balance between performance and accuracy. Specifically, in complex environments, shallow convolutional layers use 16-bit floating point numbers to ensure the accuracy of initial feature extraction, while 8-bit fixed point numbers are used in the middle and subsequent layers to improve overall reasoning efficiency.
[0055] Furthermore, in order to avoid a significant decrease in model accuracy due to direct quantization, this embodiment uses quantization-aware training (QAT) technology to simulate the process of low-precision reasoning during training, allowing the network to gradually adapt to quantization operations during training. By quantizing some convolutional layers and activation values during training, the model can maintain high detection accuracy during the reasoning process after quantization. QAT technology is particularly suitable for use in scenarios with large environmental changes and high detection complexity, such as harsh climatic conditions in oil fields (strong light, wind and sand, rain and fog, etc.), to ensure the stability and accuracy of the quantization model during reasoning on the hardware platform.
[0056] Furthermore, this embodiment combines the hardware acceleration capability of the HiSilicon Hi3519 V101 chip to fully utilize the DSP module in the chip for parallel computing and memory optimization during the model reasoning process to accelerate the reasoning process of YOLOv8. Specifically, the built-in DSP module of the HiSilicon Hi3519 V101 chip can accelerate the convolution operation, and by transferring the convolution operation with large computational complexity in the YOLOv8 model to the DSP module for execution, the computational delay in the reasoning process is significantly reduced, and the response speed of the detection system is improved.
[0057] Furthermore, since the YOLOv8 model needs to frequently access memory for weight loading and feature map calculation during the inference process, especially large-scale convolution operations and multi-layer feature extraction, it relies heavily on efficient memory access. Therefore, this embodiment optimizes the memory access mode of the model to better adapt it to the memory hierarchy of the HiSilicon Hi3519 V101 chip. Specifically, it includes:
[0058] (1) Data preloading strategy: Before model inference begins, a prefetch mechanism is used to load the weights and feature maps that will be needed into the memory in advance, reducing the waiting time of the CPU or DSP during the inference process. This method greatly reduces the dependence on off-chip DDR memory by caching the weights and intermediate feature maps into on-chip memory (such as on-chip SRAM).
[0059] (2) Memory layout optimization: By adjusting the layout of model weights and feature maps in memory, frequently used parameters and feature maps are arranged compactly, reducing jumps during data access and optimizing the continuity of memory access. In pipeline detection scenarios with relatively simple backgrounds, the model can quickly load important weights and feature maps, which can significantly reduce inference time and enable the model to run quickly under low computing power conditions.
[0060] In addition, the HiSilicon Hi3519 V101 chip supports heterogeneous computing and can use the CPU, DSP and GPU to allocate tasks at the same time. By reasonably allocating the computing tasks of the YOLOv8 model, the multi-core advantages of the chip are fully utilized to improve detection efficiency.
[0061] like Figure 4 As shown in the figure, in the actual application system, the drone is equipped with a camera to cruise the oil field drilling and oil pipeline area in real time. The Hi3519 V101 chip is responsible for real-time processing of image data and executing the optimized YOLOv8 model for crude oil leak detection. When a leak is detected, the system automatically marks the location and generates an alarm signal to assist the inspection personnel to quickly respond to the leak. The optimization strategy of pruning and quantization is dynamically adjusted according to the inspection task and environmental changes to ensure the high efficiency and stability of the detection task in a complex environment.
[0062] The following is a detailed description of the crude oil leakage detection process in combination with the system execution process:
[0063] 1. System initialization
[0064] First of all, before the drone takes off, the following system initialization work needs to be done:
[0065] (1) Model loading: Load the pruned and quantized optimized YOLOv8 model into the HiSilicon Hi3519V101 chip.
[0066] (2) Hardware module initialization: Initialize the camera, DSP acceleration module, memory management unit and other hardware devices to ensure that the system can efficiently process the received image data.
[0067] (3) Flight route setting: Set the flight path of the drone inspection area to ensure coverage of oilfield equipment areas and long-distance oil pipelines.
[0068] 2. Drone cruises and collects images
[0069] The drone starts cruising along the preset route, and the system automatically performs the image acquisition process:
[0070] (1) Image acquisition: The camera captures the multispectral image of the inspection area in real time and transmits it to the Hi3519 V101 chip for processing. The image data will be transferred to the memory for storage and processing.
[0071] (2) Memory optimization management: The system uses optimized memory allocation and data access strategies to ensure that high-definition images captured by the camera can quickly enter the processing stage, reduce memory transmission delays, and improve real-time responsiveness.
[0072] 3. Image processing and feature extraction
[0073] Image processing and feature extraction on Hi3519 V101 chip:
[0074] (1) Convolutional layer computing acceleration: Image data is input into the YOLOv8 model for processing, and the convolution operation is accelerated by the DSP module, which reduces the computing time and improves the inference speed of the model.
[0075] (2) Pruned model reasoning: Based on the pruned optimized YOLOv8 model, the system performs corresponding reasoning operations for different scenarios (such as equipment-intensive areas or long oil pipeline areas). In complex scenarios, the pruning ratio of shallow convolutional layers is small to ensure high-precision detection of small targets; in simple background scenes, the pruning ratio is large to improve processing efficiency.
[0076] 4. Crude oil leak detection
[0077] After pruning and quantization optimization, the YOLOv8 model begins to detect crude oil leaks in inspection images:
[0078] (1) Leakage Target Detection: The system analyzes inspection images and identifies potential signs of oil leaks. This process uses the YOLOv8 model with mixed precision quantization to ensure a balance between high accuracy and efficient reasoning.
[0079] (2) Scene Adaptation: The system dynamically adjusts the pruning and quantization strategies according to the scene complexity of the detection area. For example, in complex equipment areas, the system maintains a high model accuracy; in pipeline areas with simple backgrounds, the system prioritizes improving processing speed.
[0080] 5. Abnormal alarm
[0081] When the system detects oil and gas leakage or other abnormal conditions:
[0082] (1) Real-time alarm: The system sends leakage information (such as specific location, image evidence, etc.) to the ground control center in real time through the wireless communication module. This information includes the coordinates of the leakage point, the severity of the leakage and other data, so that the inspection personnel can respond in time.
[0083] In addition, the system uses QAT technology and mixed precision quantification in harsh environments such as wind and rain, enabling the system to adapt to complex background changes caused by light and climate change, and improve the detection stability of crude oil leaks. Specifically, it includes:
[0084] (1) In rainy and foggy weather, the system simulates the reasoning process in extreme scenarios in advance through quantization perception training (QAT) to ensure that the accuracy of reasoning is not affected by quantization;
[0085] (2) In terms of pruning strategy, more feature extraction capabilities of shallow convolutional layers are retained, so that the system can still effectively identify leakage targets in poor lighting conditions;
[0086] (3) The image processing speed is improved through memory optimization, reducing the load of complex computing tasks on the system.
[0087] like Figure 5 As shown, the second embodiment of the present invention further proposes a crude oil leakage detection device, including: a sensitive layer marking module 201, a layer-by-layer pruning module 202 and a global pruning and retraining module 203.
[0088] Among them, the sensitive layer marking module 201 is used to preset the detection algorithm model, prune each convolution layer in the network of the detection algorithm model layer by layer, and retest the model accuracy to mark the sensitive layer; the layer-by-layer pruning module 202 is used to determine the pruning ratio of each convolution layer according to the marked sensitive layer, and prune each convolution layer again layer by layer according to the pruning ratio; the global pruning and retraining module 203 is used to globally prune the detection algorithm model obtained by the layer-by-layer pruning, and introduce a sparse regularization term in the loss function to retrain the detection algorithm model until the model accuracy before the layer-by-layer pruning is restored.
[0089] The crude oil leakage detection method implemented by the crude oil leakage detection device disclosed in the second embodiment of the present invention is as described in the first embodiment, so it will not be described in detail here. Optionally, the various modules and the above-mentioned other operations or functions in the second embodiment are respectively for implementing the method described in the first embodiment, and the beneficial effects of the crude oil leakage detection device provided by this embodiment are the same as the beneficial effects of the crude oil leakage detection method provided by the first embodiment, and for the sake of brevity, they will not be repeated here.
[0090] like Figure 6As shown, the third embodiment of the present invention further proposes an electronic device, for example, comprising: at least one processor, and at least one memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method as described in the first embodiment, and the beneficial effects of the electronic device provided by this embodiment are the same as the beneficial effects of the crude oil leakage detection method provided by the first embodiment.
[0091] like Figure 7 As shown, the fourth embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented, and the beneficial effects of the non-transitory computer-readable storage medium provided by this embodiment are the same as the beneficial effects of the crude oil leakage detection method provided by the first embodiment.
[0092] Among them, computer-readable storage media may include, but are not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0093] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0094] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0095] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0096] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0097] In addition, each functional unit in each embodiment of the present application may be integrated into one processor, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0098] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program code.
[0099] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct the relevant hardware. The program may be stored in a computer-readable memory, and the memory may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0100] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
[0101] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0102] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A crude oil leakage detection method, characterized in that: include: Preset a detection algorithm model, prune each convolutional layer in the network of the detection algorithm model layer by layer, and retest the model accuracy to mark the sensitive layer; Determine a pruning ratio of each of the convolutional layers according to the marked sensitive layer, and prune each of the convolutional layers again layer by layer according to the pruning ratio; The detection algorithm model obtained by the layer-by-layer pruning is globally pruned, and a sparse regularization term is introduced into the loss function to retrain the detection algorithm model until the model accuracy before the layer-by-layer pruning is restored.
2. The crude oil leakage detection method according to claim 1, characterized in that: The layer-by-layer pruning includes: The L1 norm is used to calculate the accuracy contribution of the feature channel of each convolution layer, and the priority of the layer-by-layer pruning is determined according to the order of the accuracy contribution.
3. The crude oil leakage detection method according to claim 1, characterized in that: The layer-by-layer pruning further includes: Acquire detection scene information, and determine the corresponding pruning coefficient α of the convolutional layer according to the detection scene information; According to the formula Pruning the corresponding convolutional layers layer by layer; Among them, C l is the number of channels, The number of channels retained after pruning.
4. The crude oil leakage detection method according to claim 1, characterized in that: The global pruning also includes: Acquire detection scene information, determine the global pruning amplitude of the convolution layer according to the detection scene information, and complete the global pruning of the corresponding detection scene according to the pruning amplitude.
5. The crude oil leakage detection method according to claim 1, characterized in that: Also includes: The detection algorithm model is optimized by network quantization, and the weights and activation values in the model are reduced from 32-bit floating point numbers to 8-bit fixed point numbers. The formula is expressed as follows: Among them, △ is the quantization step size, which is used to control the accuracy. The quantization range of 8-bit fixed-point numbers is [-128, 127]; the quantization step size △ is defined as: Among them, the maximum and minimum values of floating point numbers are represented by x. max and x min Indicates that b is the number of quantization bits.
6. The crude oil leakage detection method according to claim 5, characterized in that: The network quantization optimization also includes: A relatively small quantization ratio is used for the high-level convolutional layers in the detection algorithm model, and a relatively large quantization ratio is used for the low-level convolutional layers and pooling layers; A relatively small quantification ratio is used for relatively complex oilfield equipment areas in the inspection task, and a relatively large quantification ratio is used for relatively simple long-distance oil pipelines; The activation value is quantized asymmetrically for the oilfield equipment area, and quantized symmetrically for the long-distance oil pipeline.
7. The crude oil leakage detection method according to claim 5, characterized in that: The network quantization optimization also includes: A mixed precision quantization strategy is selected according to the environmental climate state, wherein the mixed precision quantization strategy includes: using relatively high precision 16-bit floating point quantization for high-level convolutional layers, and using relatively low precision 8-bit fixed point quantization for low-level convolutional layers and pooling layers.
8. A crude oil leakage detection device, characterized in that: include: A sensitive layer marking module is used to preset a detection algorithm model, prune each convolutional layer in the network of the detection algorithm model layer by layer, and retest the model accuracy to mark the sensitive layer; A layer-by-layer pruning module, used to determine a pruning ratio of each of the convolutional layers according to the marked sensitive layer, and prune each of the convolutional layers again layer-by-layer according to the pruning ratio; The global pruning and retraining module is used to globally prune the detection algorithm model obtained by the layer-by-layer pruning, and introduce a sparse regularization term in the loss function to retrain the detection algorithm model until the model accuracy before the layer-by-layer pruning is restored.
9. An electronic device, characterized in that: include: A memory and one or more processors connected to the memory, the memory storing a computer program, the processor being used to execute the computer program to implement the crude oil leakage detection method as described in any one of claims 1-7.
10. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer-executable commands, and the computer-executable commands are used to execute the crude oil leakage detection method according to any one of claims 1-7.