Oil inspection AI task dynamic offloading and reasoning shunting method and system of handheld terminal cooperating with edge gateway

CN123020554APending Publication Date: 2026-10-30DAQING ANRUIDA TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611108307.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0007]本发明为了解决现有技术存在的手持终端复杂任务处理能力不足,功耗过高;井场边缘网关算力资源闲置浪费;缺乏精细化动态协同推理与任务卸载机制;异常场景适配能力不足等问题,提出了一种手持终端与边缘网关协同的石油巡检AI任务动态卸载与推理分流方法,所述方法包括:

Benefits of technology

本发明为了解决上述问题,提出了手持终端与边缘网关协同的石油巡检AI任务动态卸载与推理分流方法及系统,具有如下改进效果:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020554A_ABST
    Figure CN123020554A_ABST
Patent Text Reader

Abstract

The present application proposes a handheld terminal and edge gateway collaborative oil inspection AI task dynamic offloading and reasoning shunting method and electronic equipment, belonging to the field of oil intelligent inspection and edge computing technology. In view of the problems of insufficient computing power and high power consumption of handheld terminal in existing oil inspection, idle computing power of edge gateway, coarse task offloading granularity and poor abnormal scene adaptation ability, the present application collects double-end running state and network link state data by handheld terminal; splits the received oil inspection AI task into multiple sub-tasks with dependency relationship according to the network level of the reasoning model and evaluates the calculation amount and data amount; decides the execution position of each sub-task by a deep reinforcement learning model with reasoning delay and terminal power consumption as optimization objectives; executes each sub-task in a pipeline manner in parallel according to the decision scheme, asynchronously streams data and fuses the results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of intelligent oilfield inspection, edge computing scheduling and collaborative reasoning, and particularly to an edge computing power collaborative optimization system in oilfield well site scenarios. Background Technology

[0002] With the continuous advancement of digital transformation in oilfields, intelligent algorithms such as AI visual analysis and multimodal fault diagnosis have been widely applied in oilfield inspection operations. Currently, oilfield well sites typically deploy two types of edge computing devices: one type is handheld terminals carried by inspection personnel, such as explosion-proof PDAs and rugged handheld terminals, which are portable and capable of on-site data acquisition. However, limited by the physical size and power consumption constraints of portable devices, their computing power, storage, and battery life are relatively limited, only able to handle lightweight AI detection tasks; the other type is edge gateways deployed at well stations or field sites, typically equipped with AI acceleration chips, possessing strong AI inference computing power. In current oilfield production operations, AI technology is mainly used for well condition diagnosis, anomaly identification and alarms, predictive maintenance, and energy consumption optimization. However, existing technologies still have the following shortcomings in edge computing power collaboration and task scheduling: First, for computationally intensive AI tasks such as multimodal fusion fault diagnosis and large model semantic analysis, the inference latency of handheld terminals when processing alone generally exceeds 12 seconds, which cannot meet the needs of real-time analysis and emergency response in oilfields; at the same time, the power consumption exceeds 8W under full load operation, which significantly shortens the battery life of field inspections and makes it difficult to support continuous inspection operations around the clock.

[0003] Second, existing well site edge gateways mostly only perform data acquisition and forwarding, and simple threshold alarm functions, with an AI computing power utilization rate of less than 25%. A large amount of computing power resources are not effectively utilized, resulting in a waste of hardware investment. These gateways cannot effectively complement the computing power of the front-end handheld terminals, leading to a serious imbalance in edge resource allocation.

[0004] Third, existing technologies mostly adopt a binary processing mode of "full local execution" or "full cloud offloading", or a coarse-grained task offloading strategy based on a preset communication model; some static offloading schemes cannot adapt to the scenario of fluctuating network bandwidth in oilfields and dynamic changes in load on both ends, the task splitting granularity is coarse, and hierarchical inference routing cannot be achieved, resulting in low collaborative efficiency.

[0005] Fourth, the existing unloading scheme does not fully consider scenarios such as unstable network conditions and temporary equipment failures in the oilfield. Network interruptions or gateway failures can easily lead to task execution failures, affecting the continuity of inspection operations and making it difficult to adapt to the complex field operation environment of the oilfield.

[0006] In summary, existing technologies suffer from drawbacks such as insufficient computing power and battery life of handheld terminals, idle computing power of edge gateways, lack of refined dynamic collaborative reasoning and offloading mechanisms, and easy interruption of task execution in abnormal scenarios. Summary of the Invention

[0007] To address the shortcomings of existing technologies, such as insufficient complex task processing capabilities and excessive power consumption of handheld terminals; idle and wasted computing resources of well site edge gateways; lack of refined dynamic collaborative reasoning and task offloading mechanisms; and insufficient adaptability to abnormal scenarios, this invention proposes a method for dynamic offloading and reasoning offloading of oilfield inspection AI tasks through collaboration between handheld terminals and edge gateways. The method includes: Step 1: Collect the dual-end operating status data of the handheld terminal and the edge gateway, as well as the communication status data of the network link between them. Filter the collected status data and output real-time status data. Step 2: In response to the received oil inspection AI task, according to the network layer of the inference model corresponding to the AI ​​task, the AI ​​task is broken down into multiple sub-tasks with dependencies, the computational and data transmission volume of each sub-task is evaluated, the type and dependency of each sub-task are marked, and the set of sub-tasks is output. Step 3: Obtain the set of subtasks and real-time status data. Input the real-time status data and the set of subtasks into the unloading decision model. The unloading decision model uses the total inference delay of the task and the power consumption of the handheld terminal as optimization objectives to decide the execution position of each subtask and generate an unloading decision scheme. Step 4: Based on the dependencies of each subtask in the subtask set and according to the unloading decision scheme, assign each subtask to the corresponding execution position, control the handheld terminal and the edge gateway to execute each subtask in parallel in a pipeline manner, and transmit the input and output data of each subtask between each execution position through asynchronous streaming transmission. Step 5: Based on the splitting position of each subtask, merge the subtask results output from each execution position and output the final inference result.

[0008] Furthermore, in step one, The dual-end operating status data includes the handheld terminal's CPU utilization, NPU utilization, memory usage, remaining battery power, and real-time power consumption, as well as the edge gateway's AI computing power utilization, general CPU load, memory usage, and storage occupancy rate; the communication status data includes real-time bandwidth, round-trip latency, and packet loss rate. The filtering process for the collected status data specifically involves using a sliding window of size 10 to smooth the real-time bandwidth and round-trip delay, and using the mean value within the output window as the basis for decision-making. The frequency of collecting status data in idle state is 1Hz, and the frequency of collecting status data during task execution is 5Hz.

[0009] Furthermore, in step two, Using a single network layer of the inference model corresponding to the AI ​​task as the smallest unit of division, multiple consecutive layers are merged into one subtask. The subtasks are either computationally intensive or logically controlled; the computationally intensive subtasks include convolution operations, feature extraction, and attention computation, and are offloaded with higher priority than logically controlled subtasks; the logically controlled subtasks include post-processing, non-maximum suppression, and result formatting, and are preferentially retained for execution locally on the handheld terminal. In the set of subtasks, each subtask outputs three quantitative evaluation indicators: floating-point computation volume, input data volume, and output data volume; each subtask is marked with its preceding and following dependent subtasks. For three types of oil inspection tasks—wellhead leak detection, equipment infrared fault diagnosis, and multimodal fusion analysis—corresponding splitting templates are preset. In response to the received oil inspection AI task, the splitting template corresponding to the type of oil inspection AI task is called to split the AI ​​task.

[0010] Furthermore, in step three, The unloading decision model adopts a deep Q-network model; The real-time status data is concatenated with the three quantitative evaluation metrics of each subtask in the subtask set to form a 12-dimensional feature vector, which is then used as the model input. The model outputs the probability distribution of each subtask being assigned to a handheld terminal for local execution or to an edge gateway for remote execution; The unloading decision model uses a reward function to evaluate the unloading decision. The reward function is as follows:

[0011] in, The total inference latency for the task includes computation latency and data transmission latency; The total power consumption for the handheld terminal to perform this task; The reward for completing the task is 1 when the task is successfully completed and 0 when it fails; α is the latency weighting coefficient, β is the power consumption weighting coefficient, and γ is the completion reward coefficient.

[0012] Furthermore, The values ​​of latency weight α and power consumption weight β are dynamically adjusted based on the task priority of the current oil inspection AI task; in high-priority tasks, the value of α is increased and the value of β is decreased; in regular inspection tasks, the value of α is decreased and the value of β is increased.

[0013] Furthermore, Set 10Mbps as the baseline bandwidth threshold. When the monitored smooth bandwidth is lower than the baseline bandwidth threshold, add a data transmission penalty term to the reward function of the offloading decision model to reduce the probability of subtasks with data volume greater than the preset threshold being offloaded to the edge gateway. When the smooth bandwidth is higher than the baseline bandwidth threshold, restore the default weight.

[0014] Furthermore, When the handheld terminal and the edge gateway execute each of the sub-tasks in parallel in a pipeline manner, the execution process of each of the sub-tasks is divided into a data transmission stage, a calculation stage, and a result feedback stage; the handheld terminal and the edge gateway overlap and execute in parallel during the data transmission stage, the calculation stage, and the result feedback stage. When transmitting the input and output data of each subtask between execution locations using asynchronous streaming, the transmitted data is divided into fixed-size data blocks for continuous transmission. The receiving end sets up a data buffer, and the preprocessing process is started after receiving the first data block, so as to achieve time overlap between transmission and computation.

[0015] Furthermore, When fusing the subtask results output from each execution position according to the splitting position of each subtask, if the splitting point is located in the model feature extraction stage, feature-level fusion is performed to stitch and calibrate the feature maps output by the handheld terminal and the edge gateway; if the splitting point is located in the model output stage, result-level fusion is performed to merge and deduplicate the detection results of the handheld terminal and the edge gateway.

[0016] Furthermore, During the execution of each subtask, the status of the communication link and the response status of the edge gateway are continuously monitored. When no response is received from the edge gateway for several consecutive sampling periods, it is determined that the network is interrupted. All remote subtasks that have not yet been executed are switched to be executed locally on the handheld terminal, and the results of the completed remote subtasks are retained. Once the communication link is restored, the system automatically verifies the progress of the transmitted data, resumes transmitting the unfinished data from the point of interruption, and synchronizes the results of the subtasks executed locally on the handheld terminal to the edge gateway.

[0017] This invention proposes a dynamic offloading and inference routing system for oilfield inspection AI tasks, which coordinates handheld terminals and edge gateways, comprising: The status monitoring module is used to collect the dual-end operating status data of the handheld terminal and the edge gateway, as well as the communication status data of the network link between the two. It filters the collected status data and outputs real-time status data. The task splitting module is used to respond to the received oil inspection AI task, split the AI ​​task into multiple sub-tasks with dependencies according to the network layer of the inference model corresponding to the AI ​​task, evaluate the computational and data transmission volume of each sub-task, mark the type and dependency of each sub-task, and output the sub-task set. The unloading decision module is used to acquire the sub-task set and real-time status data, input the real-time status data and sub-task set into the unloading decision model, and the unloading decision model uses the total inference delay of the task and the power consumption of the handheld terminal as optimization objectives to decide the execution position of each sub-task and generate an unloading decision scheme. The collaborative execution module is used to allocate each subtask to the corresponding execution position according to the dependency relationship of each subtask in the subtask set and the unloading decision scheme. It controls the handheld terminal and the edge gateway to execute each subtask in parallel in a pipeline manner, and transmits the input and output data of each subtask between the execution positions through asynchronous streaming. The result fusion module is used to fuse the subtask results output from each execution position according to the split position of each subtask, and output the final inference result.

[0018] The beneficial effects of this invention are: To address the aforementioned problems, this invention proposes a method and system for dynamic offloading and inference routing of AI tasks in oilfield inspection, involving collaboration between handheld terminals and edge gateways, which offers the following improvements: 1. This invention constructs a dual-end, multi-dimensional real-time status monitoring module, achieving real-time perception and smooth filtering of the three dimensions of terminal computing power, gateway computing power, and network link status, providing stable and accurate input for offloading decisions. Based on this, a deep reinforcement learning-based offloading decision module, with total task inference latency and handheld terminal power consumption as dual optimization objectives, achieves dynamic optimal allocation of edge computing resources, effectively extending the endurance of field inspections and supporting continuous all-weather inspection operations.

[0019] 2. This invention, through a hierarchical task splitting and evaluation module and an optimal allocation of the offloading decision model, accurately offloads computationally intensive subtasks to the edge gateway for execution, fully releasing the value of idle computing power and improving the return on investment of hardware.

[0020] 3. This invention achieves inference splitting with a single model layer as the smallest granularity through a hierarchical splitting mechanism, which solves the problem of poor flexibility in traditional whole task or coarse-grained unloading methods. It can dynamically adjust the unloading ratio according to the load on both ends, and achieve fine-grained optimal allocation of edge computing power.

[0021] 4. This invention uses an asynchronous pipelined collaborative reasoning mechanism to divide the execution of subtasks into three stages: data sending, computation, and result feedback, achieving overlapping parallelism, effectively hiding network transmission latency, and maximizing the utilization of dual-end computing resources.

[0022] 5. This invention, through an abnormal scenario degradation protection mechanism, automatically implements task degradation and breakpoint resumption in network interruption scenarios, ensuring the task completion rate in weak network and network outage environments. It is adapted to the complex operating environment of oilfield field networks with large fluctuations and frequent temporary equipment failures, ensuring the continuity and reliability of inspection operations. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0024] Figure 1 This is a schematic diagram of the overall architecture of the present invention; Figure 2 This is a schematic diagram of the core processing flow of the method of the present invention; Figure 3 A smoothed comparison curve for bandwidth data; Figure 4 A bar chart comparing the number of times the unloading decision was switched; Figure 5 A bar chart comparing the average delay fluctuation error of the tasks; Figure 6 A bar chart comparing latency and power consumption at different priorities; Figure 7 A bar chart comparing the standard deviation of task time delay fluctuations; Figure 8 A bar chart comparing the average latency of different solutions in weak network scenarios. Detailed Implementation

[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0026] Combination Figures 1 to 8 This invention proposes a method for dynamic offloading and inference offloading of AI tasks in oilfield inspection through collaboration between handheld terminals and edge gateways. The method includes: Step 1: Collect the dual-end operating status data of the handheld terminal and the edge gateway, as well as the communication status data of the network link between them. Filter the collected status data and output real-time status data. Furthermore, in step one, The dual-end operating status data includes the handheld terminal's CPU utilization, NPU utilization, memory usage, remaining battery power, and real-time power consumption, as well as the edge gateway's AI computing power utilization, general CPU load, memory usage, and storage occupancy rate; the communication status data includes real-time bandwidth, round-trip latency, and packet loss rate. The filtering process for the collected status data specifically involves using a sliding window of size 10 to smooth the real-time bandwidth and round-trip delay, and using the mean value within the output window as the basis for decision-making. The frequency of collecting status data in idle state is 1Hz, and the frequency of collecting status data during task execution is 5Hz.

[0027] Step one is as follows: Complete the communication pairing between the handheld terminal and the edge gateway, initialize the operating parameters of each module, configure core configuration items such as the baseline bandwidth threshold, task priority weight, and reinforcement learning model parameters, and load the split template of typical oilfield inspection tasks.

[0028] The status monitoring module collects operational status data and network link data from handheld terminals and edge gateways at a set frequency. After being filtered by a sliding window, the system status pool is updated to provide real-time status information for offloading decisions.

[0029] To address the characteristics of large network fluctuations and dynamic changes in equipment load at oilfield well sites, a status monitoring system covering three dimensions—terminal computing power, gateway computing power, and network links—is constructed. A sliding window filtering mechanism is employed to smooth status data, avoiding decision-making oscillations caused by instantaneous fluctuations and providing stable and accurate status input for unloading decisions. Breaking through the limitations of traditional single-load indicator monitoring, this system simultaneously collects multi-dimensional status data including computing power, memory, power consumption, bandwidth, and latency. A sliding window bandwidth smoothing algorithm is introduced to adapt to the unstable network signal scenarios in oilfields, improving decision stability. A tiered acquisition frequency design is implemented: low-frequency acquisition during idle states reduces power consumption, while high-frequency acquisition during task execution ensures decision accuracy.

[0030] The specific status collection metrics are as follows: for handheld terminals, these include CPU utilization, NPU utilization, memory utilization, remaining battery power, and real-time power consumption; for edge gateways, these include AI computing power utilization, general CPU load, memory utilization, and storage occupancy; and for network links, these include real-time bandwidth, round-trip latency, and packet loss rate.

[0031] Sliding window filtering uses a sliding window of size 10 to smooth bandwidth and latency data, and the mean value within the output window is used as the basis for decision-making, effectively shielding the interference of instantaneous network fluctuations.

[0032] Sliding window filtering specifically involves: The bandwidth data and round-trip delay data collected in the first 10 collections are sequentially stored into a queue of length N=10 to complete the sliding window initialization; Each time new raw data points are collected First, calculate the mean of the data within the current window. with standard deviation , Exceeding If the range is specified, it is determined to be a transient anomaly caused by signal obstruction or electromagnetic interference in the oilfield, and the current window mean is used. Replace the outlier to obtain preprocessed data. ; Remove the oldest historical data from the head of the queue, and then preprocess the data. Join the end of the queue and complete the window step update; Calculate the arithmetic mean of all data within the current window as the final smoothed state value.

[0033] in This is the current data collection time. For the first Preprocessed collected values ​​at each time point This is the window length.

[0034] The system's sampling frequency is 1Hz when idle, and increases to 5Hz during task execution, balancing power consumption control and real-time decision-making.

[0035] Step 2: In response to the received oil inspection AI task, according to the network layer of the inference model corresponding to the AI ​​task, the AI ​​task is broken down into multiple sub-tasks with dependencies, the computational and data transmission volume of each sub-task is evaluated, the type and dependency of each sub-task are marked, and the set of sub-tasks is output. Furthermore, in step two, Using a single network layer of the inference model corresponding to the AI ​​task as the smallest unit of division, multiple consecutive layers are merged into one subtask. The subtasks are either computationally intensive or logically controlled; the computationally intensive subtasks include convolution operations, feature extraction, and attention computation, and are offloaded with higher priority than logically controlled subtasks; the logically controlled subtasks include post-processing, non-maximum suppression, and result formatting, and are preferentially retained for execution locally on the handheld terminal. In the set of subtasks, each subtask outputs three quantitative evaluation indicators: floating-point computation volume, input data volume, and output data volume; each subtask is marked with its preceding and following dependent subtasks. For three types of oil inspection tasks—wellhead leak detection, equipment infrared fault diagnosis, and multimodal fusion analysis—corresponding splitting templates are preset. In response to the received oil inspection AI task, the splitting template corresponding to the type of oil inspection AI task is called to split the AI ​​task.

[0036] Step two is as follows: After receiving the inspection AI task, the handheld terminal calls the corresponding task splitting template, completes the task splitting according to the model level, generates a set of subtasks with dependencies, and at the same time quantifies and evaluates the computational load and input / output data volume of each subtask, and outputs a subtask evaluation report.

[0037] Using the network hierarchy of the AI ​​inference model as the granularity of decomposition, the complete oilfield inspection AI task is broken down into multiple subtasks with sequential dependencies. Simultaneously, the computational load and input / output data volume of each subtask are quantitatively evaluated, and the computational type and dependencies of each subtask are labeled, providing quantitative support for refined offloading decisions. A hierarchical decomposition mechanism is proposed to replace the traditional coarse-grained mode of whole-task or large-segment decomposition, supporting flexible offloading of single-level or multi-level combinations. Decomposition templates are preset for typical oilfield inspection AI tasks, distinguishing between computationally intensive layers and logic-control layers, providing biased guidance for offloading decisions. A directed acyclic graph of subtask dependencies is established to clarify the execution order and data flow of subtasks, ensuring the correctness of collaborative inference.

[0038] The splitting granularity uses a single network layer of the model as the smallest splitting unit, and can merge multiple consecutive layers into a subtask as needed, supporting flexible adjustment of the splitting granularity.

[0039] Based on computational characteristics, subtasks are divided into two categories: computationally intensive tasks, including convolution operations, feature extraction, and attention calculation, which are preferentially offloaded to the edge gateway for execution; and logic-controlled tasks, including post-processing, non-maximum suppression, and result formatting, which are preferentially retained for execution on the handheld terminal.

[0040] Each subtask outputs three quantitative metrics: floating-point computation volume, input data volume, and output data volume, while also marking the preceding and subsequent dependent subtasks.

[0041] For three typical inspection tasks—oilfield wellhead leak detection, equipment infrared fault diagnosis, and multimodal fusion analysis—optimal split templates are pre-set and can be directly called up to improve task processing efficiency.

[0042] Step 3: Obtain the set of subtasks and real-time status data. Input the real-time status data and the set of subtasks into the unloading decision model. The unloading decision model uses the total inference delay of the task and the power consumption of the handheld terminal as optimization objectives to decide the execution position of each subtask and generate an unloading decision scheme. Furthermore, in step three, The unloading decision model adopts a deep Q-network model; The real-time status data is concatenated with the three quantitative evaluation metrics of each subtask in the subtask set to form a 12-dimensional feature vector, which is then used as the model input. The model outputs the probability distribution of each subtask being assigned to a handheld terminal for local execution or to an edge gateway for remote execution; The unloading decision model uses a reward function to evaluate the unloading decision. The reward function is as follows:

[0043] in, The total inference latency for the task includes computation latency and data transmission latency; The total power consumption for the handheld terminal to perform this task; The reward for completing the task is 1 when the task is successfully completed and 0 when it fails; α is the latency weighting coefficient, β is the power consumption weighting coefficient, and γ is the completion reward coefficient.

[0044] Furthermore, The values ​​of latency weight α and power consumption weight β are dynamically adjusted based on the task priority of the current oil inspection AI task; in high-priority tasks, the value of α is increased and the value of β is decreased; in regular inspection tasks, the value of α is decreased and the value of β is increased.

[0045] Furthermore, Set 10Mbps as the baseline bandwidth threshold. When the monitored smooth bandwidth is lower than the baseline bandwidth threshold, add a data transmission penalty term to the reward function of the offloading decision model to reduce the probability of subtasks with data volume greater than the preset threshold being offloaded to the edge gateway. When the smooth bandwidth is higher than the baseline bandwidth threshold, restore the default weight.

[0046] Step three specifically involves: The unloading decision module reads the current system state and subtask evaluation results, inputs them into the trained deep Q-network model, and the model outputs the optimal execution position for each subtask, generating a complete unloading decision scheme. If the current bandwidth is lower than the threshold, the reward function weights are automatically adjusted and the decision is regenerated to ensure execution efficiency in weak network scenarios.

[0047] A deep Q-network-based offloading decision model is constructed, taking the dual-end running status, network status, and subtask quantification indicators as state inputs and the subtask execution location allocation as action output. A dual-objective reward function integrating task latency and handheld terminal power consumption is designed, and the optimal offloading strategy is generated through reinforcement learning training to achieve dynamic optimal allocation of edge computing resources. A dual-objective reward mechanism for latency and power consumption is designed, which can dynamically adjust the weights of the two indicators according to task priority. High-priority fault detection tasks prioritize latency indicators, while routine inspection tasks prioritize controlling terminal power consumption. A network bandwidth threshold triggering mechanism is introduced, which automatically increases the weight of data transmission overhead when the link bandwidth is lower than the baseline threshold, reducing the offloading of high-data-quantum tasks and adapting to the weak network scenario in oil fields. The decision model is adapted to the task characteristics of oil field inspection, with low inference latency and online real-time decision generation. The state space consists of 12-dimensional feature vectors, including handheld terminal computing power utilization, terminal memory utilization, terminal remaining power, gateway computing power utilization, gateway memory utilization, network bandwidth, network latency, subtask computation volume, subtask input data volume, subtask output data volume, task priority, and current execution progress. The action space for each subtask includes two optional actions: one assigned to be executed locally on the handheld terminal, and the other assigned to be executed remotely on the edge gateway. The reward function is a bi-objective reward constructed using a weighted summation method.

[0048] Based on the safety production level of oilfield inspection tasks, the tasks are divided into three priorities. Differentiated weights are configured under normalization constraints, and the specific rules for dynamic weight adjustment are as follows: Level 1 Priority (Emergency Fault Tasks): Covers emergency detection tasks related to safety production, such as wellhead leak detection, equipment overheating fault diagnosis, and pipeline rupture identification. Configured with α=0.75 and β=0.25, with latency optimization as the core, to minimize inference time and ensure timely on-site emergency response. Secondary priority (routine inspection tasks): covers daily tasks such as equipment appearance inspection, instrument reading recognition, and routine status assessment. It is configured with α=0.45 and β=0.55 to balance inference efficiency and terminal power consumption, and adapts to the battery life requirements of all-day routine inspection. Level 3 Priority (Background Analysis Tasks): This category covers non-real-time background tasks such as historical data review, multi-frame statistical analysis, and incremental model adaptation. It is configured with α=0.2 and β=0.8, with power consumption control as the core, to reduce terminal computing power consumption and extend the field operation cycle.

[0049] Bandwidth threshold linkage mechanism: Set 10Mbps as the baseline bandwidth threshold. When the monitored smooth bandwidth is lower than this threshold, add a data transmission penalty term to the basic reward function. The extended formula is as follows:

[0050] in To transmit penalty weights, This is a normalized value for the total amount of data transmitted by the subtasks; by increasing the offloading penalty for large-volume data, the offloading ratio of high-data quantum tasks is automatically reduced, avoiding excessive transmission latency under weak network conditions, and adapting to the network fluctuation scenario in oilfields.

[0051] Step 4: Based on the dependencies of each subtask in the subtask set and according to the unloading decision scheme, assign each subtask to the corresponding execution position, control the handheld terminal and the edge gateway to execute each subtask in parallel in a pipeline manner, and transmit the input and output data of each subtask between each execution position through asynchronous streaming transmission. Furthermore, When the handheld terminal and the edge gateway execute each of the sub-tasks in parallel in a pipeline manner, the execution process of each of the sub-tasks is divided into a data transmission stage, a calculation stage, and a result feedback stage; the handheld terminal and the edge gateway overlap and execute in parallel during the data transmission stage, the calculation stage, and the result feedback stage. When transmitting the input and output data of each subtask between execution locations using asynchronous streaming, the transmitted data is divided into fixed-size data blocks for continuous transmission. The receiving end sets up a data buffer, and the preprocessing process is started after receiving the first data block, so as to achieve time overlap between transmission and computation.

[0052] Based on subtask dependencies and offloading decisions, a pipelined asynchronous collaborative inference mechanism is constructed, employing streaming data transmission to hide communication latency and enabling parallel computing between handheld terminals and edge gateways. A hierarchical result fusion strategy is designed to calibrate and stitch results at different splitting levels, ensuring that the final inference accuracy is consistent with local execution. An asynchronous streaming transmission mode is adopted, sending data in blocks. The receiving end can start preprocessing and computation upon receiving the first block of data, without waiting for the complete data transmission, effectively hiding network transmission latency. A three-level pipeline scheduling mechanism is constructed, dividing subtask execution into three stages: data transmission, model computation, and result feedback. Both devices execute tasks at different stages in parallel, improving overall execution efficiency. A two-level fusion strategy, at the feature level and result level, is designed to adapt to the fusion requirements of different splitting locations, ensuring no loss of inference accuracy.

[0053] Streaming asynchronous transmission: The input data of the subtask is divided into fixed-size data blocks for continuous transmission. The receiving end sets up a data buffer and starts the preprocessing process as soon as the first data block is received, so as to achieve the overlap of transmission and calculation time and hide the transmission delay.

[0054] Three-level pipeline scheduling: For subtasks offloaded to the gateway, they are divided into three stages: "terminal sending data, gateway calculation, and gateway returning results". This forms a pipeline parallel with the execution process of the local subtasks on the terminal, maximizing the utilization of computing power on both ends.

[0055] Two-level result fusion: If the split point is located in the model feature extraction stage, feature-level fusion is performed to stitch and calibrate the feature maps output from both ends; if the split point is located in the model output stage, result-level fusion is performed to merge and deduplicate the detection results from both ends, ensuring that the final inference result is consistent with the accuracy of the local complete inference.

[0056] Step 5: Based on the splitting position of each subtask, merge the subtask results output from each execution position and output the final inference result.

[0057] Furthermore, When fusing the subtask results output from each execution position according to the splitting position of each subtask, if the splitting point is located in the model feature extraction stage, feature-level fusion is performed to stitch and calibrate the feature maps output by the handheld terminal and the edge gateway; if the splitting point is located in the model output stage, result-level fusion is performed to merge and deduplicate the detection results of the handheld terminal and the edge gateway.

[0058] Step five is as follows: The collaborative reasoning module schedules execution according to the subtask dependencies based on the offloading decision scheme. For subtasks assigned to the edge gateway, input data is sent in a streaming manner. The gateway starts calculation immediately after receiving the data and streams back the results after the calculation is completed. For subtasks assigned to the local device, the handheld terminal executes them in parallel, forming a pipeline collaborative execution mode.

[0059] Furthermore, During the execution of each subtask, the status of the communication link and the response status of the edge gateway are continuously monitored. When no response is received from the edge gateway for several consecutive sampling periods, it is determined that the network is interrupted. All remote subtasks that have not yet been executed are switched to be executed locally on the handheld terminal, and the results of the completed remote subtasks are retained. Once the communication link is restored, the system automatically verifies the progress of the transmitted data, resumes transmitting the unfinished data from the point of interruption, and synchronizes the results of the subtasks executed locally on the handheld terminal to the edge gateway.

[0060] After all subtasks are completed, the result fusion module selects the corresponding fusion strategy based on the split position, calibrates, splices, and deduplicates the output results of the dual-terminal subtasks, generates the final AI inference result, and outputs it to the inspection interaction interface.

[0061] Throughout the entire process, the anomaly protection module monitors the communication status and the status of both ends of the device in real time. If a network interruption or gateway failure occurs, the degradation mechanism is immediately triggered, and the unfinished sub-tasks are switched back to local execution. After the fault is recovered, the data is automatically synchronized and the normal collaborative mode is restored.

[0062] This invention proposes a dynamic offloading and inference routing system for oilfield inspection AI tasks, which coordinates handheld terminals and edge gateways, including: The status monitoring module is used to collect the dual-end operating status data of the handheld terminal and the edge gateway, as well as the communication status data of the network link between the two. It filters the collected status data and outputs real-time status data. The task splitting module is used to respond to the received oil inspection AI task, split the AI ​​task into multiple sub-tasks with dependencies according to the network layer of the inference model corresponding to the AI ​​task, evaluate the computational and data transmission volume of each sub-task, mark the type and dependency of each sub-task, and output the sub-task set. The unloading decision module is used to acquire the sub-task set and real-time status data, input the real-time status data and sub-task set into the unloading decision model, and the unloading decision model uses the total inference delay of the task and the power consumption of the handheld terminal as optimization objectives to decide the execution position of each sub-task and generate an unloading decision scheme. The collaborative execution module is used to allocate each subtask to the corresponding execution position according to the dependency relationship of each subtask in the subtask set and the unloading decision scheme. It controls the handheld terminal and the edge gateway to execute each subtask in parallel in a pipeline manner, and transmits the input and output data of each subtask between the execution positions through asynchronous streaming. The result fusion module is used to fuse the subtask results output from each execution position according to the split position of each subtask, and output the final inference result.

[0063] To address the challenges of unstable networks and frequent equipment malfunctions in oilfield environments, a comprehensive anomaly monitoring and degradation protection mechanism is implemented. This mechanism enables automatic degradation during network outages and resumed transmission after fault recovery, ensuring the continuity of inspection operations. A seamless degradation mechanism is designed to automatically switch unfinished network management subtasks back to the handheld terminal for local execution during network interruptions, requiring no manual intervention. Resumption of transmission is also supported, allowing data to resume from the point of interruption after network recovery, avoiding redundant calculations and improving efficiency.

[0064] Network interruption degradation: If no response is received from the gateway for three consecutive sampling periods, it is determined to be a network interruption. Unexecuted unloaded subtasks are automatically switched to be executed locally on the handheld terminal. The results of completed subtasks are retained to ensure that the task is not interrupted.

[0065] Resume interrupted transmission mechanism: After the network is restored, the progress of the transmitted data is automatically checked and the transmission continues from the interrupted position without resending the complete data, thus reducing transmission overhead.

[0066] Fault recovery synchronization: After the gateway fault is recovered, the task execution results on the terminal are automatically synchronized to maintain data consistency between the two ends.

[0067] This invention takes edge-end computing power collaborative optimization as its core, dual-end state perception as its foundation, hierarchical task decomposition as its premise, deep reinforcement learning decision-making as its core, and asynchronous collaborative reasoning as its execution carrier to construct a five-layer closed-loop system architecture, thereby realizing the dynamic unloading and reasoning diversion of oil inspection AI tasks.

[0068] The system's overall architecture is divided into five layers from bottom to top, with data interconnection and dynamic feedback between layers to form a complete collaborative reasoning closed loop. **State Awareness Layer:** This layer enables real-time acquisition, filtering, and updating of multi-dimensional operational status and network link status of handheld terminals and edge gateways, providing a data foundation for upper-layer decision-making. **Task Decomposition Layer:** This layer receives AI inspection tasks to be executed, decomposes tasks according to the model's hierarchical structure, quantifies and evaluates sub-tasks, identifies dependencies between sub-tasks, and outputs a standardized set of sub-tasks. **Unloading Decision Layer:** Based on the real-time status of both terminals and the sub-task evaluation results, this layer generates the optimal execution position for each sub-task using a deep reinforcement learning model and outputs an unloading decision scheme. **Collaborative Reasoning Layer:** According to the unloading decision scheme, this layer schedules parallel execution of sub-tasks on both terminals, implements pipelined execution of data transmission and computation through asynchronous communication mechanisms, completes the fusion and calibration of sub-task results, and outputs the final reasoning result. **Anomaly Protection Layer:** This layer monitors communication and device status in real time, triggering task degradation, breakpoint resumption, and result synchronization mechanisms in abnormal scenarios to ensure the continuity and reliability of task execution.

[0069] This invention takes edge-end computing power collaborative optimization as its core, dual-end state perception as its foundation, hierarchical task decomposition as its premise, deep reinforcement learning decision-making as its core, and asynchronous collaborative reasoning as its execution carrier to construct a five-layer closed-loop system architecture, thereby realizing the dynamic unloading and reasoning diversion of oil inspection AI tasks.

[0070] This invention proposes a dynamic offloading and inference routing system for oilfield inspection AI tasks, coordinating handheld terminals and edge gateways. The system includes: a dual-terminal multi-dimensional status monitoring module, used to collect real-time data on the computing load, memory resources, power consumption status of the handheld terminal and edge gateway, as well as network link bandwidth, latency, and packet loss rate between the two terminals, outputting real-time status data after sliding window filtering; and a hierarchical task decomposition and evaluation module, used to receive the oilfield inspection AI task to be executed, decompose the complete task into multiple dependent sub-tasks with the model network hierarchy as the smallest decomposition granularity, and quantitatively evaluate the computational load and input of each sub-task. The system outputs data volume, marking the computation type and dependencies of subtasks; a deep reinforcement learning offloading decision module takes real-time state data and subtask evaluation results as input, generates the optimal execution position decision for each subtask through a deep Q-network model, and dynamically outputs an offloading allocation scheme with the total inference latency of the task and the power consumption of the handheld terminal as dual optimization objectives; an asynchronous collaborative inference and result fusion module schedules the parallel execution of subtasks by both ends according to the offloading decision scheme, hides communication latency using a streaming asynchronous transmission mechanism, constructs a pipeline execution mode, and fuses the results of the corresponding strategies for split-level execution to output the final inference result.

[0071] In the hierarchical task splitting and evaluation module, the splitting granularity is a single network level, and it supports merging multiple consecutive layers into sub-tasks. Sub-tasks are divided into computationally intensive and logically controllable tasks according to their computational characteristics. Computationally intensive tasks are preferentially offloaded to the edge gateway, while logically controllable tasks are preferentially retained on the handheld terminal. At the same time, splitting templates for three typical inspection tasks, namely oilfield wellhead leakage detection, equipment fault diagnosis, and pipeline weld inspection, are preset.

[0072] The reward function of the deep reinforcement learning offloading decision module is a dual-objective function weighted by latency and power consumption, as shown in the formula: α is the latency weight and β is the power consumption weight, which can be dynamically adjusted according to task priority; 10Mbps is set as the baseline bandwidth threshold. When the monitored bandwidth is lower than this threshold, a data transmission penalty term is added to the reward function to automatically adjust the offloading strategy.

[0073] The asynchronous collaborative reasoning and result fusion module adopts a streaming block transmission mechanism, and the receiving end can start the calculation as soon as it receives the first block of data; it constructs a three-level pipeline of "data sending, remote calculation, and result feedback" to realize parallel execution on both ends; at the same time, it configures a two-level fusion strategy of feature level and result level to adapt to the fusion requirements of feature layer splitting and output layer splitting respectively.

[0074] It also includes an abnormal scenario degradation protection module, which is used to monitor communication and device status in real time; when no response is received from the gateway for several consecutive sampling cycles, the unfinished offloading subtask is automatically switched to be executed locally on the handheld terminal; after the network is restored, it supports breakpoint resume and result synchronization to ensure the continuity of task execution.

[0075] This invention significantly improves the efficiency of complex task processing. For complex inspection AI tasks such as multimodal fusion fault diagnosis, the total inference latency of the system is reduced by 72% compared to handheld terminal execution alone, from 12.5 seconds to 3.5 seconds, meeting the timeliness requirements of real-time analysis and fault handling in oilfields. Handheld terminal power consumption is effectively reduced. In collaborative inference mode, the handheld terminal does not need to run complex calculations at full load, and the average power consumption is reduced by 37% compared to standalone execution, from 8.2W to 5.2W, effectively extending the endurance of field inspections and supporting all-day inspection operations. Edge gateway computing power utilization is greatly improved. Through dynamic task offloading, the AI ​​computing power utilization rate of the well site edge gateway increases from less than 23% to 70%, fully releasing the value of idle computing power and improving the return on investment in hardware. Scene adaptability is comprehensively enhanced, supporting dynamic network bandwidth adaptation, achieving optimal collaborative efficiency in environments with bandwidths above 10Mbps; it also has anomaly degradation capabilities, maintaining 100% task completion rate even in network interruption scenarios, perfectly adapting to the complex field operation environment of oilfields. The task scheduling fineness has been improved, and the hierarchical splitting mechanism has enabled inference splitting at the single-level granularity. Compared with the whole task unloading mode, the resource scheduling flexibility has been improved by more than 60%, and the unloading ratio can be dynamically adjusted according to the load on both ends to achieve optimal allocation of computing power.

[0076] This invention addresses the issues of high latency and high power consumption in complex AI task inference on handheld terminals, improving the real-time performance and battery life of complex inspection tasks; it also solves the problems of idle computing power and low resource utilization of well site edge gateways, achieving edge-end computing power complementarity and enhancing the value of hardware investment; it addresses the problems of coarse granularity and poor static adaptability of existing offloading schemes, constructing a hierarchical dynamic splitting and intelligent decision-making mechanism to achieve refined inference routing; and it solves the problem of task execution interruption in abnormal scenarios, establishing a degradation protection mechanism to adapt to the complex field operation environment of oilfields.

[0077] The present invention will be further described in detail below with reference to specific embodiments, but the scope of protection of the present invention is not limited to the following embodiments. Unless otherwise specified in the following embodiments, conventional conditions or existing test conditions were followed.

[0078] Example 1 The technical solution of the present invention will be further described in detail below, taking into account the specific application scenario of well site inspection in an oil production plant of Daqing Oilfield.

[0079] This embodiment is applied to the daily inspection operations of a well site in an oil production plant of Daqing Oilfield. The operators carry out wellhead equipment inspections with handheld inspection terminals, and the well site is equipped with an edge gateway to provide edge computing power support. The specific hardware configuration is as follows: Handheld Inspection Terminal: The terminal uses the Mingfan MS-R1 handheld terminal, equipped with the RK3588 main control chip, a built-in NPU with 6 TOPS INT8 computing power, 8GB of RAM, a 5000mAh lithium battery, and supports 4G / 5G and WiFi wireless communication. It is mainly responsible for on-site data collection, lightweight AI detection, and human-computer interaction functions.

[0080] Well site edge gateway: It adopts Huawei Atlas 500 intelligent edge gateway, equipped with Ascend 310B AI chip, with 22 TOPS INT8 computing power and 16GB of RAM. It is deployed in the well site duty room and undertakes data aggregation and complex AI task offloading computing functions.

[0081] Communication link: The well site WiFi local area network is used as the main communication link, and the 4G network is used as the backup link. The bandwidth is 20-50Mbps in normal scenarios and about 5-10Mbps in weak network scenarios.

[0082] System components, including a state monitoring agent, task splitter, and inference execution engine, are deployed on both the handheld terminal and the edge gateway. A two-way certificate authentication mechanism is used to complete communication pairing and identity authentication between the two ends, establishing an encrypted data transmission channel based on the TLS 1.3 protocol to ensure data transmission security.

[0083] Complete system parameter initialization: Configure the baseline bandwidth threshold to 10Mbps; set the sliding window size to 10 sampling periods.

[0084] Define task priorities: High-priority tasks, such as leak detection and fire early warning, have a latency weight of α=0.7 and a power consumption weight. Latency weighting for routine tasks Power consumption weight ; The system loads hierarchical split templates for three typical inspection tasks: wellhead multimodal leakage detection, pumping unit fault diagnosis, and pipeline weld inspection. Each template is stored in JSON format and includes the name and type of each layer of the model (convolutional layer / pooling layer / fully connected layer / activation layer / post-processing operator), estimated computational cost, and recommended grouping strategy.

[0085] Deploy a pre-trained deep Q-network offloading decision model. The model uses two fully connected hidden layers, each with 64 neurons, employing the ReLU activation function. The output layer is a Softmax layer, used to output the probability values ​​of each subtask being offloaded to the gateway.

[0086] Taking the "wellhead multimodal leakage detection task" as an example, the specific execution process of this system is explained in detail: After the inspection personnel arrived at the wellhead, they initiated the leak detection task. The system first collected the current status of both ends: the handheld terminal's NPU utilization rate was 15%, memory utilization rate was 40%, and the remaining power was 85%; the edge gateway's computing power utilization rate was 20%, and memory utilization rate was 35%; the current network smooth bandwidth was 25Mbps, which was higher than the baseline threshold.

[0087] The system calls the wellhead multimodal leak detection task splitting template, which splits the complete model, which includes five modules: visible light feature extraction, infrared feature extraction, cross-modal fusion, detection head, and post-processing, into eight sub-tasks. Among them, visible light feature extraction, infrared feature extraction, and cross-modal fusion are computationally intensive sub-tasks, while detection head and post-processing are logic control sub-tasks. The system quantifies the computational and data volume of each sub-task and generates a sub-task dependency graph.

[0088] Input the current state and subtask evaluation data into the deep Q-network model, and the model outputs the decision result: offload 3 computationally intensive subtasks to the edge gateway for execution, and keep 2 logic control subtasks to be executed locally on the handheld terminal.

[0089] The handheld terminal first acquires visible light and infrared images, and then streams the input data to the edge gateway. Upon receiving the first data block, the gateway immediately initiates feature extraction calculations; simultaneously, the handheld terminal performs local preprocessing operations in parallel. After completing feature extraction and cross-modal fusion, the gateway streams the fused features back to the handheld terminal, which then executes detection head and post-processing operations. The entire process forms a pipeline in parallel.

[0090] After the handheld terminal completes the processing, it generates the final leak detection results, including the leak location, leak concentration, and risk level, which are displayed on the terminal's interactive interface and simultaneously uploaded to the gateway for archiving.

[0091] If the network bandwidth drops to 8Mbps during execution, which is below the baseline threshold, the system will automatically adjust the reward function weight and switch some subtasks with large data volumes back to local execution to ensure that the overall latency is controllable. If the network is completely interrupted, the system will automatically switch all unfinished subtasks to local execution and wait for the network to recover and synchronize the results after the tasks are completed.

[0092] A comparative test was conducted under the above implementation scenario, and the test results are as follows: Total inference time for multimodal leak detection task: 12.5 seconds for terminal to execute alone, and 3.4 seconds for system to execute collaboratively, a latency reduction of 72.8%.

[0093] Average power consumption of handheld terminal during task execution: 8.2W when the terminal executes alone, and 5.1W when the system executes in conjunction with it, a power consumption reduction of 37.8%.

[0094] Peak computing power utilization of edge gateway: 21% under normal conditions, and 71% when executing collaborative tasks, an improvement of 50%.

[0095] In weak network scenarios, the task completion rate reached 100% with a bandwidth of 8Mbps, and the inference latency was controlled within 5 seconds, meeting the on-site requirements.

[0096] Example 2 To verify the effectiveness of the technical solution of this invention, two sets of comparative experiments were conducted in the actual operation scenario of a well site in an oil production plant in Daqing Oilfield. The experimental hardware environment is as follows: the handheld inspection terminal used was the Mingfan MS-R1 handheld terminal, the edge gateway used was the Huawei Atlas 500 intelligent edge gateway, and the communication link simulated the outdoor WiFi signal fluctuation scenario in the Daqing Oilfield well site, with a bandwidth range of 2-30Mbps random fluctuation.

[0097] 1. Performance Comparison Experiment of Sliding Window Filtering Algorithm This experiment verifies the smoothing effect of the proposed sliding window filtering algorithm with outlier removal on state data in a fluctuating network environment in an oilfield, and its improvement on the stability of unloading decisions. The network environment simulates the fluctuating WiFi signal scenario in the Daqing Oilfield well site, with bandwidth ranging from 2-30 Mbps and random fluctuations, including 10% instantaneous outlier interference points. Three control schemes were set up: unfiltered raw data; ordinary sliding window mean filtering; and the sliding window filtering scheme of this invention. The data acquisition frequency was 5 Hz, the test duration was 300 seconds per group, and the test was repeated 5 times, with the average value taken.

[0098] Combination Figure 3 As can be seen from the bandwidth data smoothing comparison curve, the solution of this invention can effectively eliminate instantaneous abnormal bandwidth jumps caused by derrick obstruction and electromagnetic interference from pumping unit start-up and shutdown, outputting smooth and stable bandwidth estimates. From Figure 4 It can be seen that the decision-flipping number of the proposed solution is reduced by 68% compared to the ordinary sliding window mean filtering solution, and by 82% compared to the solution using unfiltered raw data. From... Figure 5 It can be seen that the standard deviation of task delay under the scheme of the present invention is ±0.6s, while that of ordinary sliding window mean filtering scheme is ±1.3s and that of no filtering scheme is ±2.1s.

[0099] The above results demonstrate that this invention addresses the specific problem of instantaneous network fluctuations caused by terrain obstruction and electromagnetic interference from pumping unit start-up and shutdown in oilfield well sites. By first removing sudden outliers and then performing window mean smoothing, it effectively shields against instantaneous signal interference from derrick obstruction and the start-up and shutdown of large equipment. This avoids the additional transmission overhead and computing power loss caused by frequent switching of unloading decisions, ensuring the decision-making stability of inspection operations in complex electromagnetic and terrain environments. This design represents a core difference from general edge computing unloading solutions that are not optimized for oilfield conditions, solving the pain point of frequent decision jitter under non-stationary fluctuations in oilfield networks.

[0100] 2. Experiment to verify the adaptability of the dynamic weighted reward function This experiment is used to verify the effect of dynamic weight adjustment mechanism on the differentiated control of latency and power consumption under different task priorities, as well as the adaptability of bandwidth threshold linkage penalty mechanism in weak network scenarios.

[0101] The experimental conditions involved selecting three types of typical oilfield inspection tasks: Level 1 priority tasks (multimodal leak detection, corresponding to high real-time safety production tasks), Level 2 priority tasks (instrument reading identification, corresponding to routine inspection tasks), and Level 3 priority tasks (historical data statistical analysis, corresponding to background analysis tasks). The network environment consisted of two typical oilfield scenarios: normal bandwidth (25Mbps) and weak network bandwidth (8Mbps). Three control schemes were set up: a fixed-weight general scheme (α=0.5, β=0.5); a scheme without bandwidth penalty mechanism; and the dynamic weight and bandwidth penalty scheme of this invention. Test metrics included total inference latency for a single task, average terminal power consumption, and task completion rate in weak network scenarios.

[0102] The latency-power consumption comparison results under different priorities are as follows: Figure 6 As shown, under the first priority task, the inference latency of the present invention is reduced by 22% compared with the fixed weight scheme, reaching 3.4 seconds, which meets the emergency response requirement of producing results within 3 seconds for leak detection in oil fields; under the third priority task, the terminal power consumption of the present invention is reduced by 28% compared with the fixed weight scheme, down to 4.2W, which can support more than 8 hours of all-day field inspection operations.

[0103] The average latency comparison results of different solutions in weak network scenarios are as follows: Figure 8 As shown, the average inference latency of the present invention is 4.8 seconds at 8Mbps bandwidth, which is 31% lower than the solution without bandwidth penalty mechanism.

[0104] The above results demonstrate that the dynamic weighting mechanism of this invention is designed with graded control based on the differences in safety production levels of oilfield inspection tasks, breaking through the limitations of the single optimization objective of general unloading schemes and accurately matching the operational needs of oilfields to "ensure timeliness for emergency tasks and ensure sustainability for daily tasks." The weak network bandwidth penalty mechanism can automatically adapt to the uneven characteristics of oilfield edge network infrastructure, maintaining a 100% task completion rate even under low bandwidth conditions, which is consistent with the actual working conditions of uneven network coverage in oilfield well sites.

[0105] The above provides a detailed description of the method and system for dynamic offloading and inference routing of AI tasks in oilfield inspection, which involves collaboration between handheld terminals and edge gateways, as proposed in this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A method for dynamic offloading and inference offloading of AI tasks in oilfield inspection through collaboration between a handheld terminal and an edge gateway, characterized in that, Includes the following steps: Step 1: Collect the dual-end operating status data of the handheld terminal and the edge gateway, as well as the communication status data of the network link between them. Filter the collected status data and output real-time status data. Step 2: In response to the received oil inspection AI task, according to the network layer of the inference model corresponding to the AI ​​task, the AI ​​task is broken down into multiple sub-tasks with dependencies, the computational and data transmission volume of each sub-task is evaluated, the type and dependency of each sub-task are marked, and the set of sub-tasks is output. Step 3: Obtain the set of subtasks and real-time status data. Input the real-time status data and the set of subtasks into the unloading decision model. The unloading decision model uses the total inference delay of the task and the power consumption of the handheld terminal as optimization objectives to decide the execution position of each subtask and generate an unloading decision scheme. Step 4: Based on the dependencies of each subtask in the subtask set and according to the unloading decision scheme, assign each subtask to the corresponding execution position, control the handheld terminal and the edge gateway to execute each subtask in parallel in a pipeline manner, and transmit the input and output data of each subtask between each execution position through asynchronous streaming transmission. Step 5: Based on the splitting position of each subtask, merge the subtask results output from each execution position and output the final inference result.

2. The method according to claim 1, characterized in that, In step one, The dual-end operating status data includes the handheld terminal's CPU utilization, NPU utilization, memory usage, remaining battery power, and real-time power consumption, as well as the edge gateway's AI computing power utilization, general CPU load, memory usage, and storage occupancy rate; the communication status data includes real-time bandwidth, round-trip latency, and packet loss rate. The filtering process for the collected status data specifically involves using a sliding window of size 10 to smooth the real-time bandwidth and round-trip delay, and using the mean value within the output window as the basis for decision-making. The frequency of collecting status data in idle state is 1Hz, and the frequency of collecting status data during task execution is 5Hz.

3. The method according to claim 1, characterized in that, In step two, Using a single network layer of the inference model corresponding to the AI ​​task as the smallest unit of division, multiple consecutive layers are merged into one subtask. The subtasks are either computationally intensive or logically controlled; the computationally intensive subtasks include convolution operations, feature extraction, and attention computation, and are offloaded with higher priority than logically controlled subtasks; the logically controlled subtasks include post-processing, non-maximum suppression, and result formatting, and are preferentially retained for execution locally on the handheld terminal. In the set of subtasks, each subtask outputs three quantitative evaluation indicators, namely floating-point computation volume, input data volume, and output data volume. Each subtask is marked with its preceding and following dependent subtasks; For three types of oil inspection tasks—wellhead leak detection, equipment infrared fault diagnosis, and multimodal fusion analysis—corresponding splitting templates are preset. In response to the received oil inspection AI task, the splitting template corresponding to the type of oil inspection AI task is called to split the AI ​​task.

4. The method according to claim 3, characterized in that, In step three, The unloading decision model adopts a deep Q-network model; The real-time status data is concatenated with the three quantitative evaluation metrics of each subtask in the subtask set to form a 12-dimensional feature vector, which is then used as the model input. The model outputs the probability distribution of each subtask being assigned to a handheld terminal for local execution or to an edge gateway for remote execution; The unloading decision model uses a reward function to evaluate the unloading decision. The reward function is as follows: in, The total inference latency for the task includes computation latency and data transmission latency; The total power consumption for the handheld terminal to perform this task; The reward for completing the task is 1 when the task is successfully completed and 0 when it fails; α is the latency weighting coefficient, β is the power consumption weighting coefficient, and γ is the completion reward coefficient.

5. The method according to claim 4, characterized in that, The values ​​of latency weight α and power consumption weight β are dynamically adjusted based on the task priority of the current oil inspection AI task; in high-priority tasks, the value of α is increased and the value of β is decreased. In routine inspection tasks, the value of α decreases and the value of β increases.

6. The method according to claim 4, characterized in that, Set 10Mbps as the baseline bandwidth threshold. When the monitored smooth bandwidth is lower than the baseline bandwidth threshold, add a data transmission penalty term to the reward function of the offloading decision model to reduce the probability of subtasks with data volume greater than the preset threshold being offloaded to the edge gateway. When the smooth bandwidth is higher than the baseline bandwidth threshold, restore the default weight.

7. The method according to claim 1, characterized in that, In step four, When controlling the handheld terminal and the edge gateway to execute each of the sub-tasks in parallel in a pipeline manner, the execution process of each of the sub-tasks is divided into a data sending stage, a calculation stage, and a result feedback stage. The handheld terminal and the edge gateway overlap and execute in parallel during the data transmission phase, the computation phase, and the result feedback phase. When transmitting the input and output data of each subtask between execution locations using asynchronous streaming, the transmitted data is divided into fixed-size data blocks for continuous transmission. The receiving end sets up a data buffer, and the preprocessing process is started after receiving the first data block, so as to achieve time overlap between transmission and computation.

8. The method according to claim 1, characterized in that, In step five, When fusing the subtask results output from each execution position according to the splitting position of each subtask, if the splitting point is located in the model feature extraction stage, feature-level fusion is performed to stitch and calibrate the feature maps output by the handheld terminal and the edge gateway. If the split point is located in the model output stage, then result-level fusion is performed to merge and deduplicate the detection results of the handheld terminal and the edge gateway.

9. The method according to claim 1, characterized in that, During the execution of each subtask, the status of the communication link and the response status of the edge gateway are continuously monitored. When no response is received from the edge gateway for several consecutive sampling periods, it is determined that the network is interrupted. All remote subtasks that have not yet been executed are switched to be executed locally on the handheld terminal, and the results of the completed remote subtasks are retained. Once the communication link is restored, the system automatically verifies the progress of the transmitted data, resumes transmitting the unfinished data from the point of interruption, and synchronizes the results of the subtasks executed locally on the handheld terminal to the edge gateway.

10. A dynamic offloading and inference routing system for oilfield inspection AI tasks, coordinating handheld terminals and edge gateways, characterized in that... include: The status monitoring module is used to collect the dual-end operating status data of the handheld terminal and the edge gateway, as well as the communication status data of the network link between the two. It filters the collected status data and outputs real-time status data. The task splitting module is used to respond to the received oil inspection AI task, split the AI ​​task into multiple sub-tasks with dependencies according to the network layer of the inference model corresponding to the AI ​​task, evaluate the computational and data transmission volume of each sub-task, mark the type and dependency of each sub-task, and output the sub-task set. The unloading decision module is used to acquire the sub-task set and real-time status data, input the real-time status data and sub-task set into the unloading decision model, and the unloading decision model uses the total inference delay of the task and the power consumption of the handheld terminal as optimization objectives to decide the execution position of each sub-task and generate an unloading decision scheme. The collaborative execution module is used to allocate each subtask to the corresponding execution position according to the dependency relationship of each subtask in the subtask set and the unloading decision scheme. It controls the handheld terminal and the edge gateway to execute each subtask in parallel in a pipeline manner, and transmits the input and output data of each subtask between the execution positions through asynchronous streaming. The result fusion module is used to fuse the subtask results output from each execution position according to the split position of each subtask, and output the final inference result.