A DRL-based edge video object detection task offloading method and system
By combining deep reinforcement learning and LSTM models in the MEC environment, we optimize the offloading strategy of video tasks, solve the challenges of delay and energy consumption of video analysis tasks in the MEC environment, and achieve improvements in system efficiency and stability.
Patent Information
- Application Number
- CN202210607997.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-05-31
AI Technical Summary
It is difficult for existing technologies to effectively handle the latency and energy consumption of video analysis tasks in the mobile edge computing (MEC) environment, especially in high-complexity and dynamic scenarios. Traditional optimization methods and table-based reinforcement learning algorithms suffer from dimensionality explosion. and inefficiency issues.
An edge video target detection task offloading method based on deep reinforcement learning (DRL) is adopted. By establishing a system model of multi-terminal devices and MEC servers, the weighted costs of delay and energy consumption are optimized, and an offloading strategy based on DQN and Actor-Critic algorithms is designed. , and combined with the LSTM model and improved experience replay mechanism to achieve dynamic decision-making and resource optimization.
It achieves the weighted minimization of video task processing delay and energy consumption in the MEC environment, improves system efficiency and stability, adapts to complex and dynamic network environments, and reduces system costs.
Smart Images

Figure CN115022319B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology and relates to data processing technology, and specifically to a method and system for offloading edge video target detection tasks based on deep reinforcement learning. Background Art
[0002] With the rapid development of the Internet of Things (IoT), Internet of Vehicles, and mobile Internet, computing-intensive and latency-sensitive applications have increased. Centralized task offloading solutions based on mobile cloud computing (MCC) are difficult to apply to such scenarios. At the same time, for applications with data privacy and data sensitivity, it is difficult to ensure the security of their data when transmitting or storing it in a cloud server. Mobile Edge Computing (MEC), as an emerging computing paradigm, deploys computing resources at the edge of the network closer to the terminal device, thereby bringing cloud services closer to users.
[0003] The object detection computing tasks generated by video analysis applications usually involve multiple computing links, and there are complex dependencies between the links. In recent years, a variety of lightweight computer vision algorithms such as the YOLO series and MobileNet have appeared in the field of object detection. In addition, with the hardware upgrade of terminal devices such as mobile phones and webcams, terminal devices equipped with GPU (or NPU) accelerated computing chips can run the above algorithms and independently complete certain video analysis tasks. However, video analysis applications usually require low latency and fast response, and terminal devices are still limited by their power consumption or storage resources, making it difficult to meet the needs of such applications.
[0004] Therefore, the terminal device offloads the video analysis task to the edge server for processing by combining MEC computing offloading technology, thereby expanding the computing power of the terminal device and effectively reducing the processing delay of the video task. In recent years, more and more research has focused on the design and optimization of task offloading strategies. On the one hand, most traditional optimization methods based on heuristic algorithms and genetic algorithms are difficult to apply to highly dynamic MEC network scenarios; on the other hand, although the offloading strategy based on the reinforcement learning (RL) algorithm can adapt to the dynamic environment of MEC, as the state space and action space increase, the RL algorithm that stores the state value in a table will face the challenge of dimensional explosion. In this regard, the deep reinforcement learning (DRL) algorithm combines the dynamic applicability of the RL algorithm with the powerful fitting ability of the deep neural network (DNN) to characterize high-dimensional complex state information. By searching the prior art, Lu et al. proposed a task offloading scheme based on the deep Q-network (DQN) for large-scale multi-node MEC systems. Zhang et al. considered that the task offloading rate and local computing power in the multi-device MEC scenario are continuous values and proposed a task offloading solution based on the Actor-Critic algorithm. Du et al. considered the time-varying nature of the wireless channel and proposed a DRL-based solution to learn the optimal viewport rendering offloading and transmission power to minimize energy consumption. However, none of the above literatures comprehensively considers the efficient processing of the complex computing process of video analysis tasks and the dynamic impact of the time-varying nature of the MEC network on the video task offloading decision. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention proposes a computational offloading method and system for video target detection tasks in MEC. The present invention minimizes the weighted cost of task delay and energy consumption by optimizing the offloading decisions of each terminal device in the MEC system.
[0006] The present invention adopts the following technical scheme:
[0007] A DRL-based edge video object detection task unloading method comprises the following steps:
[0008] S1, establish a system model of multiple terminal devices and a single MEC server;
[0009] S2, establish a delay model for processing video tasks;
[0010] S3, establishes an energy consumption model for processing video tasks;
[0011] S4, establish a problem model with the optimization goal of minimizing the weighted cost of task processing delay and energy consumption of the MEC system;
[0012] S5, design a video task offloading strategy based on deep reinforcement learning;
[0013] S6, initialize network weights, experience replay pool, and MEC system queue states;
[0014] S7, the terminal device executes the offloading decision according to the offloading policy and interacts with the environment;
[0015] S8, extract experience samples to update network weights;
[0016] S9, repeat the above steps S7 and S8 until the reward curve converges.
[0017] The present invention considers a MEC system model consisting of a single MEC server and multiple terminal devices with the same hardware configuration. The terminal device set is defined as M = {1, 2, ..., M}, and m∈M is defined as the device index; each device is connected to the MEC server via wireless, and the MEC server provides computing resources for the terminal device.
[0018] Preferably, step S1 is specifically as follows:
[0019] S1.1, Establishing the video analysis task model
[0020] MEC system time can be represented by a time slot set T = {1, 2, ..., T}, where the time slot index and time slot length are represented by t∈T and Δ (in seconds) respectively. Assume that at the start of each time slot, each terminal device generates a video analysis task V m (t) = {Z m (t),D m (t)}. Among them, Z m (t) represents the data size of the video task (in bits), D m (t) represents the duration of the video task (in seconds).
[0021] S1.2, Design of video task offloading decision
[0022] In order to realize the "edge-end" collaborative processing of video tasks, the present invention considers dividing the video into multiple video segments (video chunks, hereinafter referred to as video chunks) according to its time axis before executing the calculation of the video task. Then, the offloading problem of a complete video analysis task is converted into the offloading problem of multiple subtasks. Specifically, the terminal device performs the task V m (t) The number of video blocks generated after segmentation is defined as K m (t), that is, the number of video blocks. It is expressed by formula (1):
[0023]
[0024] Where d represents the duration of a single video block (in seconds). The unloading decision of the terminal device m at time t is defined as task V m Unloading rate α of (t) m (t)∈[0,1]. Therefore, task V m (t) Number of video chunks to be offloaded As shown in formula (2):
[0025]
[0026] In the above formula Indicates rounding up. Then, task V m (t) Number of video chunks computed locally It is expressed as:
[0027]
[0028] Preferably, step S2, establishing a delay model for processing video tasks, specifically as follows;
[0029] For video analysis applications, the computing latency is usually one of the key application requirements, and the computing results need to be fed back to the user or aggregated to the server in a timely manner with low latency. The research in this paper mainly focuses on production quality inspection and other scenarios in the industrial Internet, so the subsequent experimental scenarios will aggregate the computing results on the MEC server for centralized management.
[0030] S2.1, Establishing a delay model for local computing of video tasks
[0031] For the computational process of the video target detection task, for task V m (t) After segmentation and preprocessing, the local computing process of the video block is: video codec, deep learning model inference, and uploading inference results. Video blocks, calculate and analyze the delay cost of each link:
[0032] First, the deep learning model needs to input frame data in RGB format for inference calculation, so the video block needs to complete the video encoding and decoding operation first. Specifically, a single video block is converted from the original data format (abbreviated as RAW format) to RGB format frame data. The delay consumption of this process is shown in formula (4):
[0033]
[0034] In the above formula, Cr2r Indicates the number of cycles required for a single video block to complete r2r encoding and decoding (r2r stands for RAW to RGB); Defined as the computing power of the terminal device, expressed in terms of cycle frequency.
[0035] In addition, the video block calculation process needs to consider the state of the calculation queue in which it is located, that is, the length of the R2R codec queue in the terminal device m at time t Then for video blocks, where the queuing delay of the i-th video block is As shown in formula (5):
[0036]
[0037] In the above formula, the first term represents the processing delay of the remaining tasks in the r2r encoding and decoding queue; the second term represents the processing delay of the first i-1 video blocks. Therefore, the delay consumption caused by completing r2r encoding and decoding of the i-th video block is shown in (6):
[0038]
[0039] Next, the video block that has completed the r2r encoding and decoding is subjected to the deep learning model reasoning link in the form of frame data. For a terminal device equipped with a GPU chip (such as the NVIDIA Jetson Nano B01 development board used in the simulation experiment of the present invention), its model reasoning operation is usually completed by the chip. The delay required for a single video block to complete reasoning in the terminal device is shown by formula (7):
[0040]
[0041] In the above formula Indicates the GPU operating frequency of the local terminal device; C inf Indicates the number of cycles required for a single video block to complete model inference. Combined with the latency calculation of the encoding and decoding process above, the model inference process also needs to consider the queuing latency. Defined as the model inference queue length of device m at time t. Number of video blocks processed locally When it is zero, the local device only needs to process the remaining tasks in the inference queue, and the delay consumption is expressed as formula (8):
[0042]
[0043] for situation, assuming As its video block index. Then the delay of completing the inference of the i-th video block is as shown in formula (9):
[0044]
[0045] Since the inference results are usually transmitted to the MEC server in small data files such as JSON format, the amount of inference result data in this MEC scenario is approximately equal to one thousandth of the video input data. Therefore, the inference result upload delay is ignored in this problem model.
[0046] Based on the above analysis, the latency cost of terminal device m to complete local processing of all tasks at time t is expressed as formula (10):
[0047]
[0048] S2.2, Delay Model of Computation Offloading for Video Task Execution
[0049] Different from the local computing model, when the terminal device offloads the video task, the processing of its video block mainly involves: video encoding and decoding, network transmission and deep learning model reasoning. For the video task V arriving at the terminal device m at time t m (t), the quantity is The video blocks will be offloaded to the MEC server for processing. The following is an analysis of the delay consumption in each link during the offloading process.
[0050] The input data of model reasoning is required to be frame data in RGB format, but the video data involves network transmission during the offloading process. The transmission of RGB frame data after the terminal device performs r2r encoding and decoding may cause too high transmission delay. The present invention considers using the H.264 format based on video compression technology as the data transmission format during calculation offloading (the present invention only uses the H.264 format to represent a series of video compression formats, focusing on the efficiency of data transmission based on video compression formats).
[0051] Combined with the above analysis, the terminal device first converts the video data from the original format to the H.264 compression format (ie RAW to H.264, i.e. r2h). Similar to r2r encoding and decoding, the jth video block The encoding and decoding delay needs to take into account the time it takes to complete the r2h encoding and decoding and the queuing time, which is specifically given by formula (11):
[0052]
[0053] In the above formula Represents the length of the r2h encoding and decoding queue at time t; the r2h time of a single video block (Indicates the computing resources required to complete r2h encoding and decoding of a single video block).
[0054] Next, the H.264 format data that has completed r2h encoding and decoding will be uploaded to the MEC server through the wireless link. The delay generated by this transmission process will be mainly determined by the amount of video data and the transmission rate. The uplink transmission rate r(t) between the terminal device and the MEC server at time t is obtained according to Shannon's theorem, as follows:
[0055]
[0056] Where W(t) represents the network channel bandwidth at time t; h represents the channel gain between the terminal device and the MEC server; P represents the transmission power of the terminal device; σ 2 is the Gaussian white noise power. Since the time slot interval of the proposed system scenario is small, it is assumed that the transmission rate r(t) remains unchanged from the start time of time slot t to the start time of time slot t+1.
[0057] Considering that video analysis in actual systems usually involves multiple computing links, the serial processing flow cannot efficiently utilize the computing resources of the device, which may lead to inefficient processing. On the contrary, parallel processing of video analysis tasks can make full use of the available resources of the device, and multiple computing links work efficiently in parallel. Due to the parallel working mode of multiple processes and the influence of the time-varying nature of the MEC network on the network transmission time, the delay of video block j finally reaching the MEC server is difficult to accurately express by mathematical formulas. In this regard, the following method is considered to approximate its transmission delay, as shown in formula (13):
[0058]
[0059] In the above formula represents the waiting time before the video block j starts to be processed, and its corresponding calculation method is as shown in formula (14):
[0060]
[0061] In formula (14), It is defined as the network transmission queue length of terminal device m at time t. The first item in the max(·) item is the expected transmission time of the remaining tasks in the transmission queue, and the second item is the queuing time required for r2h encoding and decoding of video block j.
[0062] The max(·) term in formula (13) is used to approximately represent the time taken for video block j to be processed from the beginning to reach the MEC server, wherein the first term represents the r2h encoding and decoding time taken for the video block, and the second term represents its expected transmission time taken. The present invention experimentally found in various network states in real scenarios that: 1) When the network state is good (i.e., the uplink rate r(t) is high), the data packets generated by the encoding and decoding process can reach the MEC server with a low delay, and the max(·) term is approximately equal to the r2h encoding and decoding time taken for the video block; 2) However, when the network state is poor (i.e., the uplink rate r(t) is low), the network transmission is too slow, resulting in a large number of data packets completed by r2h encoding and decoding being accumulated in the transmission queue, and the expected transmission time taken is much longer than the encoding and decoding time taken, and the max(·) term can be approximately equal to the transmission time taken. Combined with the above analysis, the delay of video block j finally reaching the MEC server is expressed in an approximate manner.
[0063] After the H.264-formatted video block arrives at the MEC server, the MEC server needs to encode and decode it to convert it into RGB frame data (i.e. H.264 to RGB, referred to as h2r) for subsequent deep learning model inference. Similar to the encoding and decoding delay calculation method in the local computing model, the delay consumption from the generation of video block j by device m to the completion of h2r encoding and decoding at the server is directly given here:
[0064]
[0065] Above represents the queuing delay of the video block in the r2h queue; L s,h2r Indicates the time consumed by h2r encoding and decoding.
[0066] Finally, the delay of video block j to complete model inference on the MEC server is expressed by formula (16):
[0067]
[0068] The max(·) term in formula (16) represents the waiting time before the video block j starts reasoning, which means that the video block j must meet two prerequisites to start reasoning: 1) the video block has completed h2r encoding and decoding; 2) the previous j-1 video blocks have completed model reasoning. In addition, Indicates the GPU operating frequency of the MEC server.
[0069] Based on the analysis of this step, the terminal device m uninstalls at time t The expected delay consumption of video blocks is:
[0070]
[0071] In summary, the terminal device m has a m (t) Execute the uninstall decision αm (t), the expected delay L to complete all tasks m (t) is determined by the local computing delay and the offloading computing delay. Specifically, as shown in formula (18):
[0072]
[0073] Preferably, step S3, establishing an energy consumption model for processing video tasks, specifically as follows:
[0074] For terminal devices such as mobile phones, task processing requirements should take into account their battery resource status. Therefore, a reasonable offloading strategy should fully consider both latency and energy consumption. The energy consumption model is constructed as follows:
[0075] S3.1, Calculate the energy consumption of terminal equipment
[0076] The energy consumption of video tasks in local terminal computing is mainly determined by r2r encoding and decoding, r2h encoding and decoding, and model reasoning. And r2h codec energy consumption As shown in formula (19) and formula (20):
[0077]
[0078]
[0079] In the above formula, κ represents the energy consumption coefficient of the terminal device, and its value depends on the device chip. and They represent the energy consumption of completing r2r encoding and decoding and r2h encoding and decoding of a single video block locally.
[0080] The terminal device uses GPU chips to perform model inference calculations. The energy consumption of this process is mainly due to the number of local video blocks. and the device GPU operating frequency, as shown in formula (21):
[0081]
[0082] In summary, at time t, terminal device m processes task V m (t), the total energy consumption generated locally for:
[0083]
[0084] S3.2, Calculate network transmission energy consumption
[0085] The energy consumption generated when the terminal device performs computational offloading of tasks is mainly due to the number of unloaded video blocks. Video block data volume Z m(t) / K m (t) and the uplink transmission rate r(t), as shown in formula (23):
[0086]
[0087] S3.3, Calculate the energy consumption of MEC servers
[0088] The MEC server mainly receives and processes the video data transmitted by the terminal device, including video h2r encoding and decoding and deep learning model inference. Therefore, the number of terminal devices m to be uninstalled is The video blocks are encoded and decoded by h2r on the MEC server, generating energy consumption. As shown in formula (24):
[0089]
[0090] κ s Represents the energy consumption coefficient of the MEC server, Represents the energy consumption of a single video block to complete h2r encoding and decoding. Similarly, It represents the energy consumption of a single video block when the server completes the inference. Therefore, the energy consumption of the MEC server for model inference on the video block is shown in formula (25):
[0091]
[0092] Therefore, for the task V arriving at terminal device m at time t m (t), the corresponding energy consumption of MEC is:
[0093]
[0094] In summary, for the video tasks arriving at each device of the MEC system at time t, the energy consumption generated by its processing can be summarized as:
[0095]
[0096] Preferably, in step S4, a problem model is established whose optimization goal is to minimize the weighted cost of task processing delay and energy consumption of the MEC system, as follows:
[0097] The present invention regards the terminal device set M=={1,2,...,M} and an MEC server as a MEC system, and the delay of the entire MEC system is equivalent to the maximum value of the task processing delay of all devices (that is, the moment when the last task is completed is regarded as the moment when all tasks are processed). Then the expected task completion delay of all terminal devices at time t can be expressed by formula (28):
[0098] L(t)=(L1(t),...,L m(t),...,L M (t)) (28)
[0099] Combined with the energy cost function E(t) established in the previous step, the weighted sum of latency and energy consumption is used as the MEC system cost. Therefore, the optimization goal is to minimize the MEC system cost function by jointly optimizing the unloading decisions of each terminal device. M (t)) is defined as the joint offloading decision vector of all terminal devices. In summary, the problem model is shown in formula (29):
[0100]
[0101] In the above formula, λ1 and λ2 represent the trade-off coefficients of delay and energy consumption respectively.
[0102] Preferably, step S5, designing a video task offloading strategy based on deep reinforcement learning
[0103] According to the problem model established in the previous step, its objective function is non-convex, and the increase in the number of terminal devices causes the problem scale to increase exponentially, making it difficult to solve the problem using traditional optimization methods; more importantly, the MEC offloading problem needs to consider the dynamics of complex environments and output decisions in real time. In this regard, a DRL-based offloading method is proposed below to iteratively learn the optimal offloading strategy through historical interaction experience.
[0104] In view of the fact that the offloading problem belongs to the continuous action space, the Twin Delayed Deep Deterministic Policy Gradient (TD3) algorithm is used to learn the optimal offloading decision. As an improved version of the Deep Deterministic Policy Gradient (DDPG) algorithm, this algorithm effectively solves the over-estimation problem in DDPG, and adds delayed updates and smooth target actions to make the algorithm convergence more efficient and stable.
[0105] The details of this step are as follows:
[0106] S5.1, Establishing Markov Decision Process Model
[0107] The Markov decision process mainly includes three key elements: state, action and reward. First, the state space S(t) at time t is defined as the combination vector of task state, terminal device and server queue state and network bandwidth state, as shown in formula (30):
[0108]
[0109] Wherein, vector Z(t) and vector D(t) represent the task data volume and duration of the terminal device set, respectively, which can be specifically expressed as Z(t)=(Z1(t),Z2(t),...,Z M (t)), D(t)=(D1(t),D2(t),...,D M (t)). In addition, the vector Q l (t), Q s (t) and Q trans (t) respectively represent the queue status of each device at time t, as shown in (31), (32) and (33):
[0110]
[0111] Q s (t)=(Q s,h2r (t),Q s,inf (t)) (32)
[0112]
[0113] In formula (30), W(t) represents the bandwidth at the current moment; It represents the network dynamic prediction information. The numerical calculation method will be introduced in detail in the next section S5.2.
[0114] Secondly, the action space A(t) is defined as the offloading decision vector composed of all terminal devices, which is specifically expressed as
[0115] A(t)=(α1(t),...,α m (t),...,α M (t)), The unloading rate in this action space is a continuous value. However, if discrete action modeling is used, since each time slot K m Different values of (t) will result in the inability to unify the dimensions of the action space of each time slot, and thus the DRL algorithm model structure cannot be applied.
[0116] Finally, the present invention defines the reward as a negative function of the objective function. The goal of reinforcement learning is to maximize the long-term reward, and ultimately minimize the system cost. The reward function R(t) is defined as R(t) = -(λ1max(L(t)) + λ2E(t)).
[0117] S5.2, building a network dynamics prediction module based on LSTM
[0118] During the simulation experiment, it was found that the unloading method based on the original TD3 algorithm outputs the unloading decision of the current time slot, which is difficult to obtain the long-term optimal return. The main reason for this problem is that the original state space only considers the network state of the current time slot and lacks dynamic information about the MEC network. In view of the fact that the LSTM sequence model has the ability to memorize and learn the temporal state and can effectively capture the dynamic changes of the network, the present invention combines the TD3 algorithm with the LSTM sequence model to solve the above bottleneck.
[0119] The LSTM model contains an encoder and a decoder. The present invention uses a historical bandwidth sequence of length H as the encoder input, and the encoder extracts features from the input sequence; the decoder outputs the target sequence based on the features, and finally outputs the network state prediction for the next time slot through a fully connected layer. The H-dimensional bandwidth sequence is expressed as
[0120] W(t)=(W(tH),...,W(t-2),W(t-1)),1≤H≤T,1≤t≤T.
[0121] Will and the original state vector (Z(t), D(t), Q l (t),Q s (t),Q trans (t), W(t)) are concatenated to form a new state vector S(t), which is the vector shown in formula (30).
[0122] S5.3, improved original experience playback mechanism
[0123] The original experience replay mechanism is one of the key technologies of the DRL algorithm. The agent's interactive experience samples are stored in the experience replay buffer, and the samples are randomly sampled to greatly eliminate the correlation between samples. However, during the DRL algorithm training process, it is difficult to obtain the most "learning-valuable" experience samples by random sampling when using this mechanism to update the strategy, resulting in poor algorithm convergence. In addition, for the MEC task offloading system scenario, it is difficult for the agent to obtain "successful samples" in the traditional sense, which will make the algorithm learning process more challenging.
[0124] To solve the above problems, the present invention proposes a new experience replay mechanism to store experience samples in a graded manner. Specifically, a series of benchmark reward schemes are set in the algorithm training phase, and then the actual experience samples are compared with their benchmark rewards in terms of reward value, and finally stored in the corresponding experience replay pool according to the graded standards.
[0125] The selection of the benchmark reward scheme is mainly based on the following ideas: 1) Reasonable allocation of computing resources is particularly important in the MEC scenario, so the offloading strategy should try to avoid outputting all-0 or all-1 offloading decisions, so that a large number of tasks will not be piled up on the same device; 2) The benchmark reward scheme is used in the training phase of the DRL algorithm, so it is necessary to consider choosing an offloading method with lower time complexity (for example, the greedy strategy has a higher time complexity when the number of terminal devices is large, which seriously affects the training efficiency of the DRL algorithm).
[0126] The present invention considers the full local computing strategy and the full offloading strategy as the benchmark reward scheme. Among them, the experience replay pool A is used to store experience samples with reward values higher than the benchmark reward; the experience replay pool B is used to store experience samples with lower rewards. X represents the number of samples sampled when the algorithm is updated, and δ represents the sampling weight of the sample, which is 0≤δ≤1.
[0127] Preferably, step S6 initializes the network weight, experience replay pool, and the state of each queue of the MEC system, specifically:
[0128] The TD3 algorithm is a model structure proposed based on the Actor-Critic framework, which is mainly composed of an Actor network and a Critic network. To solve the overestimation problem, the algorithm proposes a model structure with 6 neural networks, namely: an Actor network and its target network, two Critic networks, and two Critic target networks. Therefore, before the training phase begins, the Actor network weights θ need to be randomly initialized. μ and Critic network weight and Then their respective target network weight copies are initialized.
[0129] Set the dual experience replay pools to have the same maximum capacity and clear the experience replay pools. The experience replay pool is used to store experience samples generated by the interaction between the agent and the environment. Each experience sample is usually represented by a four-tuple (S(t), A(t), R(t), S(t+1)). It also provides experience samples for the DRL algorithm network to update weights. The specific sampling method is that the dual experience replay pools in step 5 are sampled according to the weight coefficient δ.
[0130] Before the training phase begins, the internal queue states of each terminal device and MEC server in the MEC system are initialized. Next, the state S(1) of the environment at the start time is obtained, and the historical network bandwidth sequence W(1) is reset to an H-dimensional all-zero vector.
[0131] Preferably, in step S7, the terminal device executes the uninstallation decision according to the uninstallation policy and interacts with the environment, specifically:
[0132] According to the task offloading method proposed in the present invention, the current state vector S(t) is output as the action vector A(t), that is, the offloading decision of each terminal device. The specific method is shown in formula (34):
[0133]
[0134] In the above formula, σ0 represents the noise strategy, c represents the noise threshold, and the purpose of cutting noise is to make the target as close to the original action as possible.
[0135] Each terminal device makes an offload decision for the video task based on the action vector A(t), and obtains an immediate reward R(t) from the above reward function. The environment state is updated from S(t) to S(t+1), and the historical network bandwidth sequence W(t) is updated at the same time. Finally, the experience sample (S(t), A(t), R(t), S(t+1)) is stored in the corresponding experience replay pool according to the benchmark reward.
[0136] Preferably, step S8, extracting experience samples to update the algorithm network weights, specifically:
[0137] The number of experience samples extracted each time the network weight is updated is X. According to the sampling coefficient δ, experience samples are sampled from the experience replay pool A and the experience replay pool B respectively, and finally X samples (S i ,A i ,R i ,S i+1 ). The Actor network and the Critic network update their weights by calculating gradients, and their target networks update their weights by soft updating.
[0138] Preferably, step S9, repeat the above steps S7 and S8 until the algorithm reward curve converges
[0139] The iteration process can be ended by iteratively updating the network parameters so that the reward value curve tends to converge. This means that the cost of the MEC system tends to converge after multiple iterations and eventually reaches the minimum value.
[0140] The present invention also discloses a DRL-based edge video object detection task unloading system, which includes the following modules:
[0141] System model building module, building a system model of multiple terminal devices and a single MEC server;
[0142] The delay model building module builds the delay model for processing video tasks;
[0143] Energy consumption model building module, building energy consumption model for processing video tasks;
[0144] The problem model building module builds a problem model whose optimization goal is to minimize the weighted cost of task processing delay and energy consumption of the MEC system;
[0145] Video task offloading strategy design module, which designs video task offloading strategies based on deep reinforcement learning;
[0146] Initialization module, which initializes network weight, experience replay pool, and the status of each queue of the MEC system;
[0147] Execution module, the terminal device executes the uninstallation decision according to the uninstallation strategy and interacts with the environment;
[0148] Update the weight module and extract experience samples to update the network weights;
[0149] The iteration module makes the execution module and the weight update module execute repeatedly until the reward curve converges.
[0150] The present invention discloses a method and system for offloading edge video target detection tasks based on deep reinforcement learning, and the present invention provides a computational offloading solution for video tasks for terminal devices. According to the system model of a single MEC server with multiple terminal devices, the present invention constructs a delay model and energy consumption model for "edge-end" collaborative processing of video tasks, and then designs a video task offloading strategy based on a deep reinforcement learning algorithm according to the optimization goal of minimizing task delay and weighted cost of energy consumption; considering the network dynamics of the MEC system and the learning efficiency of the deep reinforcement learning algorithm, the LSTM timing model is introduced and the original experience playback mechanism is improved; finally, an LD-TD3 algorithm is proposed, and the terminal device outputs the optimal offloading decision according to the environmental state to achieve the minimum system cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0151] Figure 1 It is a flow chart of a DRL-based edge video target detection task unloading method of the present invention;
[0152] Figure 2 This is the model diagram of the MEC video task offloading system;
[0153] Figure 3 This is a comparison chart of the transmission time of different video data formats;
[0154] Figure 4 It is a schematic diagram of the video unloading process;
[0155] Figure 5 It is to improve the structure diagram of the experience replay mechanism;
[0156] Figure 6 It is the performance of system cost under different numbers of terminal devices;
[0157] Figure 7This is a comparison chart of the transmission time of different video data formats;
[0158] Figure 8 It is a block diagram of a DRL-based edge video target detection task unloading system of the present invention. DETAILED DESCRIPTION
[0159] The present invention is described in detail below with reference to the accompanying drawings and examples. The described embodiments are only for the purpose of illustration and are not intended to limit the scope of the present invention.
[0160] The purpose of the present invention is to overcome the shortcomings of the above research work and propose a video analysis task offloading method based on the DRL algorithm for the computational offloading problem of video analysis tasks. The method achieves weighted minimization of task processing delay and energy consumption by optimizing the offloading decisions of multiple terminal devices.
[0161] Example 1
[0162] like Figure 1 As shown, this embodiment provides a DRL-based edge video target detection task unloading method, including the following steps:
[0163] S1, establish a system model of multiple terminal devices and a single MEC server, as follows:
[0164] like Figure 2 As shown, the present invention considers a MEC system model consisting of a single MEC server and multiple terminal devices with the same hardware configuration. The terminal device set is defined as M = {1, 2, ..., M}, and m∈M is defined as the device index; each device is connected to the MEC server via wireless, and the MEC server provides computing resources for the terminal device.
[0165] S1.1, Video Analysis Task Model
[0166] MEC system time can be represented by a time slot set T = {1, 2, ..., T}, where the time slot index and time slot length are represented by t∈T and Δ (in seconds) respectively. Assume that at the start of each time slot, each terminal device generates a video analysis task V m (t) = {Z m (t),D m (t)}. Among them, Z m (t) represents the data size of the video task (in bits), D m (t) represents the duration of the video task (in seconds).
[0167] S1.2, Video task offloading decision
[0168] In order to realize the "edge-end" collaborative processing of video tasks, the present invention considers dividing the video into multiple video segments (video chunks, hereinafter referred to as video chunks) according to its time axis before executing the calculation of the video task. Then, the offloading problem of a complete video analysis task is converted into the offloading problem of multiple subtasks. Specifically, the terminal device performs the task V m (t) The number of video blocks generated after segmentation is defined as K m (t), that is, the number of video blocks. It is expressed by formula (1):
[0169]
[0170] Where d represents the duration of a single video block (in seconds). Here, the unloading decision of the terminal device m at time t is defined as task V m Unloading rate α of (t) m (t)∈[0,1]. Therefore, task V m (t) Number of video chunks to be offloaded As shown in formula (2):
[0171]
[0172] In the above formula Indicates rounding up. Then, task V m (t) Number of video chunks computed locally It is expressed as:
[0173]
[0174] S2, establish the delay model for processing video tasks, as follows:
[0175] For video analysis applications, the computing latency is usually one of the key application requirements, and the computing results need to be fed back to the user or aggregated to the server in a timely manner with low latency. The research in this paper mainly focuses on production quality inspection and other scenarios in the industrial Internet, so the subsequent experimental scenarios will aggregate the computing results on the MEC server for centralized management.
[0176] S2.1, Establishing a delay model for local computing of video tasks
[0177] For the computational process of the video target detection task, for task V m (t) After segmentation and preprocessing, the local computing process of the video block is: video codec, deep learning model inference, and uploading inference results. Video blocks, calculate and analyze the delay cost of each link:
[0178] First, the deep learning model needs to input frame data in RGB format for inference calculation, so the video block needs to complete the video encoding and decoding operation first. Specifically, a single video block is converted from the original data format (abbreviated as RAW format) to RGB format frame data. The delay consumption of this process is shown in formula (4):
[0179]
[0180] In the above formula, C r2r Indicates the number of cycles required for a single video block to complete r2r encoding and decoding (r2r stands for RAW to RGB); Defined as the computing power of the terminal device, expressed in terms of cycle frequency.
[0181] In addition, the video block calculation process needs to consider the state of the calculation queue in which it is located, that is, the length of the R2R codec queue in the terminal device m at time t Then for video blocks, where the queuing delay of the i-th video block is As shown in formula (5):
[0182]
[0183] In the above formula, the first term represents the processing delay of the remaining tasks in the r2r codec queue; the second term represents the processing delay of the first i-1 video blocks.
[0184] Therefore, the delay consumption caused by completing r2r encoding and decoding of the i-th video block is shown in (6):
[0185]
[0186] Next, the video block that has completed the r2r encoding and decoding is subjected to the deep learning model reasoning link in the form of frame data. For a terminal device equipped with a GPU chip (such as the NVIDIA Jetson Nano B01 development board used in the simulation experiment of the present invention), its model reasoning operation is usually completed by the chip. The delay required for a single video block to complete reasoning in the terminal device is shown by formula (7):
[0187]
[0188] In the above formula Indicates the GPU operating frequency of the local terminal device; C inf Indicates the number of cycles required for a single video block to complete model inference. Combined with the latency calculation of the encoding and decoding process above, the model inference process also needs to consider the queuing latency. Defined as the model inference queue length of device m at time t. Number of video blocks processed locally When it is zero, the local device only needs to process the remaining tasks in the inference queue, and the delay consumption is expressed as formula (8):
[0189]
[0190] for situation, assuming As its video block index. Then the delay of completing the inference of the i-th video block is as shown in formula (9):
[0191]
[0192] Since the inference results are usually transmitted to the MEC server in small data files such as JSON format, the amount of inference result data in this MEC scenario is approximately equal to one thousandth of the video input data. Therefore, the inference result upload delay is ignored in this problem model.
[0193] Based on the above analysis, the latency cost of terminal device m to complete local processing of all tasks at time t is expressed as formula (10):
[0194]
[0195] S2.2, Delay Model of Computation Offloading for Video Task Execution
[0196] Different from the local computing model, when the terminal device offloads the video task, the processing of its video block mainly involves: video encoding and decoding, network transmission and deep learning model reasoning. For the video task V arriving at the terminal device m at time t m (t), the quantity is The video blocks will be offloaded to the MEC server for processing. The following will analyze the delay consumption in each link of the offloading process.
[0197] The input data for model inference is required to be frame data in RGB format, but the video data involves network transmission during the offloading process. The transmission of RGB frame data after the terminal device performs r2r encoding and decoding may result in excessive transmission delay. Figure 3 As shown in the figure, the transmission delay of two data formats under a fixed uplink bandwidth of 10Mbps is given. Figure 3 It can be seen that the frame data transmission delay based on the RGB format increases with the increase of the frame data volume; while the video compression data based on the H.264 format can still maintain a low transmission delay as the frame data volume increases, and even its transmission efficiency is nearly 10 times better than that of the RGB format after the data volume is greater than 20 frames. Therefore, the present invention considers using the H.264 format based on video compression technology as the data transmission format during computational offloading (the present invention only uses the H.264 format to represent a series of video compression formats, and focuses on the high efficiency of data transmission based on video compression formats).
[0198] Combined with the above analysis, the terminal device first converts the video data from the original format to the H.264 compression format (ie RAW to H.264, i.e. r2h). Similar to r2r encoding and decoding, the jth video block The encoding and decoding delay needs to take into account the time it takes to complete the r2h encoding and decoding and the queuing time, which is specifically given by formula (11):
[0199]
[0200] In the above formula Represents the length of the r2h encoding and decoding queue at time t; the r2h time of a single video block (Indicates the computing resources required to complete r2h encoding and decoding of a single video block).
[0201] Next, the H.264 format data that has completed r2h encoding and decoding will be uploaded to the MEC server through the wireless link. The delay generated by this transmission process will be mainly determined by the amount of video data and the transmission rate. The uplink transmission rate r(t) between the terminal device and the MEC server at time t is obtained according to Shannon's theorem, as follows:
[0202]
[0203] Where W(t) represents the network channel bandwidth at time t; h represents the channel gain between the terminal device and the MEC server; P represents the transmission power of the terminal device; σ 2 is the Gaussian white noise power. Since the time slot interval of the proposed system scenario is small, it is assumed that the transmission rate r(t) remains unchanged from the start time of time slot t to the start time of time slot t+1.
[0204] Considering that video analysis in actual systems usually involves multiple computing links, the serial processing flow cannot efficiently utilize the computing resources of the device, which may lead to inefficient processing. On the contrary, parallel processing of video analysis tasks can make full use of the available resources of the device, and multiple computing links work efficiently in parallel. Figure 4 As shown in FIG. 1 , the video data network transmission process and the r2h encoding and decoding process work in parallel. Specifically, after each video block completes the r2h encoding and decoding in a data packet of a fixed length (in bytes), it enters the network transmission process ( Figure 4 The header information is added to parse the data packet to distinguish whether the data type is video data or inference result). Due to the parallel working mode of multiple processes and the influence of network transmission time on the time-varying nature of the MEC network, the delay of video block j finally reaching the MEC server is difficult to accurately express by mathematical formula. In this regard, the following method is considered to approximate its transmission delay, as shown in formula (13):
[0205]
[0206] In the above formula represents the waiting time before the video block j starts to be processed, and its corresponding calculation method is as shown in formula (14):
[0207]
[0208] In formula (14), It is defined as the network transmission queue length of terminal device m at time t. The first item in the max(·) item is the expected transmission time of the remaining tasks in the transmission queue, and the second item is the queuing time required for r2h encoding and decoding of video block j.
[0209] The max(·) term in formula (13) is used to approximately represent the time taken for video block j to be processed from the beginning to reach the MEC server, wherein the first term represents the r2h encoding and decoding time taken for the video block, and the second term represents its expected transmission time taken. The present invention experimentally found in various network states in real scenarios that: 1) When the network state is good (i.e., the uplink rate r(t) is high), the data packets generated by the encoding and decoding process can reach the MEC server with a low delay, at which time the max(·) term is approximately equal to the r2h encoding and decoding time taken for the video block; 2) However, when the network state is poor (i.e., the uplink rate r(t) is low), the network transmission is too slow, resulting in a large number of data packets completed by r2h encoding and decoding being accumulated in the transmission queue, and the expected transmission time taken is much longer than the encoding and decoding time taken, at which time the max(·) term can be approximately equal to the transmission time taken. Combined with the above analysis, the delay of video block j finally reaching the MEC server is expressed in an approximate manner.
[0210] After the H.264-formatted video block arrives at the MEC server, the MEC server needs to encode and decode it to convert it into RGB frame data (i.e. H.264 to RGB, referred to as h2r) for subsequent deep learning model inference. Similar to the encoding and decoding delay calculation method in the local computing model, the delay consumption from the generation of video block j by device m to the completion of h2r encoding and decoding at the server is directly given here:
[0211]
[0212] Above represents the queuing delay of the video block in the r2h queue; L s,h2r Indicates the time consumed by h2r encoding and decoding.
[0213] Finally, the delay of video block j to complete model inference on the MEC server is expressed by formula (16):
[0214]
[0215] The max(·) term in formula (16) represents the waiting time before the video block j starts reasoning, which means that the video block j must meet two prerequisites to start reasoning: 1) the video block has completed h2r encoding and decoding; 2) the previous j-1 video blocks have completed model reasoning. In addition, Indicates the GPU operating frequency of the MEC server.
[0216] Based on the analysis of this step, the terminal device m uninstalls at time t The expected delay consumption of video blocks is:
[0217]
[0218] In summary, the terminal device m has a m (t) Execute the uninstall decision α m (t), the expected delay L to complete all tasks m (t) is determined by the local computing delay and the offloading computing delay. Specifically, as shown in formula (18):
[0219]
[0220] S3, establishes the energy consumption model for processing video tasks, as follows:
[0221] For terminal devices such as mobile phones, task processing requirements should take into account their battery resource status. Therefore, a reasonable offloading strategy should fully consider both latency and energy consumption. The energy consumption model is constructed as follows:
[0222] S3.1, Calculate the energy consumption of terminal equipment
[0223] The energy consumption of video tasks in local terminal computing is mainly determined by r2r encoding and decoding, r2h encoding and decoding, and model reasoning. And r2h codec energy consumption As shown in formula (19) and formula (20):
[0224]
[0225]
[0226] In the above formula, κ represents the energy consumption coefficient of the terminal device, and its value depends on the device chip. and They represent the energy consumption of completing r2r encoding and decoding and r2h encoding and decoding of a single video block locally.
[0227] The terminal device uses GPU chips to perform model inference calculations. The energy consumption of this process is mainly due to the number of local video blocks. and the device GPU operating frequency, as shown in formula (21):
[0228]
[0229] In summary, at time t, terminal device m processes task V m (t), the total energy consumption generated locally for:
[0230]
[0231] S3.2, Calculate network transmission energy consumption
[0232] The energy consumption generated when the terminal device performs computational offloading of tasks is mainly due to the number of unloaded video blocks. Video block data volume Z m (t) / K m (t) and the uplink transmission rate r(t), as shown in formula (23):
[0233]
[0234] S3.3, MEC server energy consumption
[0235] The MEC server mainly receives and processes the video data transmitted by the terminal device, including video h2r encoding and decoding and deep learning model inference. Therefore, the number of terminal devices m to be uninstalled is The video blocks are encoded and decoded by h2r on the MEC server, generating energy consumption. As shown in formula (24):
[0236]
[0237] κ s Represents the energy consumption coefficient of the MEC server, Represents the energy consumption of a single video block to complete h2r encoding and decoding. Similarly, It represents the energy consumption of a single video block when the server completes the inference. Therefore, the energy consumption of the MEC server for model inference on the video block is shown in formula (25):
[0238]
[0239] Therefore, for the task V arriving at terminal device m at time t m (t), the corresponding energy consumption of MEC is:
[0240]
[0241] In summary, for the video tasks arriving at each device of the MEC system at time t, the energy consumption generated by its processing can be summarized as:
[0242]
[0243] S4, establish a problem model with the optimization goal of minimizing the weighted cost of task processing delay and energy consumption of the MEC system, as follows:
[0244] The present invention regards the terminal device set M = {1, 2, ..., M} and an MEC server as a MEC system, and the delay of the entire MEC system is equivalent to the maximum value of the task processing delay of all devices (that is, the moment when the last task is completed is regarded as the moment when all tasks are processed). Then the expected task completion delay of all terminal devices at time t can be expressed by formula (28):
[0245] L(t)=(L1(t),...,L m (t),...,L M (t)) (28)
[0246] Combined with the energy cost function E(t) established in the previous step, the weighted sum of latency and energy consumption is used as the MEC system cost. Therefore, the optimization goal is to minimize the MEC system cost function by jointly optimizing the unloading decisions of each terminal device. M (t)) is defined as the joint offloading decision vector of all terminal devices. In summary, the problem model is shown in formula (29):
[0247]
[0248] In the above formula, λ1 and λ2 represent the trade-off coefficients of delay and energy consumption respectively.
[0249] S5, design a video task offloading strategy based on deep reinforcement learning, as follows:
[0250] According to the problem model established in the previous step, its objective function is non-convex, and the increase in the number of terminal devices causes the problem scale to increase exponentially, making it difficult to solve the problem using traditional optimization methods; more importantly, the MEC offloading problem needs to consider the dynamics of complex environments and output decisions in real time. In this regard, a DRL-based offloading method is proposed below to iteratively learn the optimal offloading strategy through historical interaction experience.
[0251] In view of the fact that the offloading problem belongs to the continuous action space, the Twin Delayed Deep Deterministic Policy Gradient (TD3) algorithm is used to learn the optimal offloading decision. As an improved version of the Deep Deterministic Policy Gradient (DDPG) algorithm, this algorithm effectively solves the over-estimation problem in DDPG, and adds delayed updates and smooth target actions to make the algorithm convergence more efficient and stable.
[0252] S5.1, Establishing Markov Decision Process Model
[0253] The Markov decision process mainly includes three key elements: state, action and reward. First, the state space S(t) at time t is defined as the combination vector of task state, terminal device and server queue state and network bandwidth state, as shown in formula (30):
[0254]
[0255] Wherein, vector Z(t) and vector D(t) represent the task data volume and duration of the terminal device set, respectively, which can be specifically expressed as Z(t)=(Z1(t),Z2(t),...,Z M (t)), D(t)=(D1(t),D2(t),...,D M (t)). In addition, the vector Q l (t), Q s (t) and Q trans (t) respectively represent the queue status of each device at time t, as shown in (31), (32) and (33):
[0256]
[0257] Q s (t)=(Q s,h2r (t),Q s,inf (t)) (32)
[0258]
[0259] In formula (30), W(t) represents the bandwidth at the current moment; It represents the network dynamic prediction information. The numerical calculation method will be introduced in detail in the next step S5.2.
[0260] Secondly, the action space A(t) is defined as the offloading decision vector composed of all terminal devices, which is specifically expressed as
[0261] A(t)=(α1(t),...,α m (t),...,α M (t)), The unloading rate in this action space is a continuous value. However, if discrete action modeling is used, since each time slot K m Different values of (t) will result in the inability to unify the dimensions of the action space of each time slot, and thus the DRL algorithm model structure cannot be applied.
[0262] Finally, the present invention defines the reward as a negative function of the objective function. The goal of reinforcement learning is to maximize the long-term reward, and ultimately minimize the system cost. The reward function R(t) is defined as R(t) = -(λ1max(L(t)) + λ2E(t)).
[0263] S5.2, building a network dynamics prediction module based on LSTM
[0264] During the simulation experiment, it was found that the unloading method based on the original TD3 algorithm outputs the unloading decision of the current time slot, which is difficult to obtain the long-term optimal return. The main reason for this problem is that the original state space only considers the network state of the current time slot and lacks dynamic information about the MEC network. In view of the fact that the LSTM sequence model has the ability to memorize and learn the temporal state and can effectively capture the dynamic changes of the network, the present invention combines the TD3 algorithm with the LSTM sequence model to solve the above bottleneck.
[0265] The LSTM model contains an encoder and a decoder. The present invention uses a historical bandwidth sequence of length H as the encoder input, and the encoder extracts features from the input sequence; the decoder outputs the target sequence based on the features, and finally outputs the network state prediction for the next time slot through a fully connected layer. The H-dimensional bandwidth sequence is expressed as
[0266] W(t)=(W(tH),...,W(t-2),W(t-1)),1≤H≤T,1≤t≤T.
[0267] Will and the original state vector (Z(t), D(t), Q l (t),Q s (t),Q trans (t), W(t)) are concatenated to form a new state vector S(t), which is the vector shown in formula (30).
[0268] S5.3, improved original experience playback mechanism
[0269] The original experience replay mechanism is one of the key technologies of the DRL algorithm. The agent's interactive experience samples are stored in the experience replay buffer, and the samples are randomly sampled to greatly eliminate the correlation between samples. However, during the DRL algorithm training process, it is difficult to obtain the most "learning-valuable" experience samples by random sampling when using this mechanism to update the strategy, resulting in poor algorithm convergence. In addition, for the MEC task offloading system scenario, it is difficult for the agent to obtain "successful samples" in the traditional sense, which will make the algorithm learning process more challenging.
[0270] To solve the above problems, the present invention proposes a new experience replay mechanism to store experience samples in a graded manner. Specifically, a series of benchmark reward schemes are set in the algorithm training phase, and then the actual experience samples are compared with their benchmark rewards in terms of reward value, and finally stored in the corresponding experience replay pool according to the graded standards.
[0271] The selection of the benchmark reward scheme is mainly based on the following ideas: 1) Reasonable allocation of computing resources is particularly important in the MEC scenario, so the offloading strategy should try to avoid outputting all-0 or all-1 offloading decisions, so that a large number of tasks will not be piled up on the same device; 2) The benchmark reward scheme is used in the training phase of the DRL algorithm, so it is necessary to consider choosing an offloading method with lower time complexity (for example, the greedy strategy has a higher time complexity when the number of terminal devices is large, which seriously affects the training efficiency of the DRL algorithm).
[0272] like Figure 5 As shown, the present invention considers the full local computing strategy and the full offloading strategy as the benchmark reward scheme. In the figure, the experience replay pool A is used to store experience samples with reward values higher than the benchmark reward; the experience replay pool B is used to store experience samples with lower rewards. X represents the number of samples sampled when the algorithm is updated, and δ represents the sampling weight of the sample, which is 0≤δ≤1.
[0273] S6, initialize the network weight, experience replay pool, and the status of each queue of the MEC system, as follows:
[0274] The TD3 algorithm is a model structure based on the Actor-Critic framework, so its main body consists of an Actor network and a Critic network. To solve the overestimation problem, the algorithm proposes a model structure with 6 neural networks, namely: an Actor network and its target network, two Critic networks, and two Critic target networks. Therefore, before the training phase begins, the Actor network weights θ need to be randomly initialized. μ and Critic network weights θQ1 and θQ2; then their respective target network weights are copied and initialized.
[0275] Set the dual experience replay pools to have the same maximum capacity and clear the experience replay pools. The experience replay pool is used to store experience samples generated by the interaction between the agent and the environment. Each experience sample is usually represented by a four-tuple (S(t), A(t), R(t), S(t+1)). It also provides experience samples for the DRL algorithm network to update weights. The specific sampling method is that the dual experience replay pools in step 5 are sampled according to the weight coefficient δ.
[0276] Before the training phase begins, the internal queue states of each terminal device and MEC server in the MEC system are initialized. Next, the state S(1) of the environment at the start time is obtained, and the historical network bandwidth sequence W(1) is reset to an H-dimensional all-zero vector.
[0277] S7: The terminal device executes the uninstallation decision according to the uninstallation policy and interacts with the environment as follows:
[0278] According to the task offloading method proposed in the present invention, the current state vector S(t) is output as the action vector A(t), that is, the offloading decision of each terminal device. The specific method is shown in formula (34):
[0279]
[0280] In the above formula, σ0 represents the noise strategy, c represents the noise threshold, and the purpose of cutting noise is to make the target as close to the original action as possible.
[0281] Each terminal device makes an offload decision for the video task based on the action vector A(t), and obtains an immediate reward R(t) from the above reward function. The environment state is updated from S(t) to S(t+1), and the historical network bandwidth sequence W(t) is updated at the same time. Finally, the experience sample (S(t), A(t), R(t), S(t+1)) is stored in the corresponding experience replay pool according to the benchmark reward.
[0282] S8, extract experience samples to update the algorithm network weights, as follows:
[0283] The number of experience samples extracted each time the network weight is updated is X. According to the sampling coefficient δ, experience samples are extracted from the experience replay pool A and the experience replay pool B respectively, and finally X samples (S i ,A i ,R i ,S i+1 ). The Actor network and the Critic network update their respective network weights by calculating gradients, and the Actor target network and the Critic target network both update their weights by soft updating.
[0284] S9, repeat the above steps S7 and S8 until the algorithm reward curve converges
[0285] The iteration process can be ended by iteratively updating the network parameters so that the reward value curve tends to converge. This means that the cost of the MEC system tends to converge after multiple iterations and eventually reaches the minimum value.
[0286] The simulation experiment parameter settings and the corresponding experimental results analysis are given below.
[0287] This experiment was implemented in Python 3.7 under the Ubuntu 18.04LTS operating system. The deep learning algorithm and DRL algorithm involved in model reasoning were implemented using the PyTorch 1.7.0 framework. The relevant parameters in the simulation experiment refer to the actual data measured in the real MEC scenario. The terminal device uses the NVIDIA Jetson Nano B01 4GB development board, the CPU of the MEC server uses the Intel Core i7-7700, and the GPU is the NVIDIA GeForce GTX 2080 chip. The transmission power P of the terminal device is 20dBm, and the noise power σ 2 For 10 -10 W / Hz. The video task generated by the terminal device has its FPS set to 30 (frames per second); the amount of random data generated in each time slot is in the range of 2.4Mb to 14.4Mb, and the video duration ranges from 2 seconds to 12 seconds. Other experimental parameter configurations are shown in Table 1, and the hyperparameters related to the DRL algorithm are shown in Table 2.
[0288] Table 1 MEC system parameter configuration
[0289]
[0290] Table 2 DRL algorithm hyperparameter settings
[0291]
[0292] Experimental results and analysis
[0293] The comparison algorithms selected in this experiment include three general benchmark strategies and two offloading strategies based on the DRL algorithm. The three benchmark strategies are: 1) All Local Computing Policy (All-Loc), 2) All Offloading Policy (All-Off), 3) Random Offloading Policy (Random); the two offloading strategies based on the DRL algorithm are: 1) Offloading strategy based on the original TD3 algorithm (used to verify the effectiveness of adding LSTM modules); 2) Offloading strategy based on TD3+LSTM (used to verify the effectiveness of the experience replay mechanism proposed in this invention). The corresponding algorithm of this invention is LD-TD3 (TD3 with LSTM and Dual ExperienceReplay).
[0294] Comparative experiment 1: Figure 6 The comparison of the MEC system cost under various offloading strategies with different numbers of terminal devices is given. As can be seen from the figure, compared with other benchmark strategies, the LD-TD3 algorithm can achieve the lowest system cost under different numbers of terminal devices. Specifically, the algorithm proposed in the present invention is superior to the "TD3+LSTM" offloading strategy in terms of system cost, which proves the effectiveness of the experience replay mechanism proposed in the present invention in improving performance; at the same time, "TD3+LSTM" is superior to the original TD3 algorithm in most cases, which also illustrates the role of the LSTM module in improving algorithm performance. According to the overall experimental results, the offloading strategies based on the DRL algorithm are significantly superior to the All-Loc, All-Off and random strategies, which shows that the problem of task calculation offloading in the MEC scenario can be better solved by the DRL algorithm. In addition, with the continuous increase in the number of terminal devices, it means that the task volume of the MEC server has increased significantly, and the overall cost of the MEC system has increased. However, the offloading strategy based on the DRL algorithm can still learn effective information from the interaction and obtain better performance.
[0295] Comparative experiment 2: Figure 7 The system cost comparison of each offloading strategy under different task arrival intervals is given. It is not difficult to see from the figure that each strategy can achieve better performance when the interval time is large and more computing resources are available; but as the interval of task arrival becomes smaller, it means that the computing resources of terminal devices and MEC servers are reduced, and the pressure of processing tasks increases, resulting in aggravated task queue accumulation, and thus a significant increase in system costs. Figure 7As shown in the figure, the three offloading strategies based on the DRL algorithm are better than the other three benchmark strategies, which shows that the DRL algorithm can adapt to the dynamic changes of different system environments, update strategies based on historical experience, and thus obtain lower system costs. More importantly, the LD-TD3 algorithm proposed in the present invention can obtain lower system costs than other algorithms in each case, thereby achieving efficient processing of video tasks.
[0296] Example 2
[0297] like Figure 8 As shown, this embodiment provides a DRL-based edge video object detection task offloading system, including the following modules:
[0298] System model building module, building a system model of multiple terminal devices and a single MEC server;
[0299] The delay model building module builds the delay model for processing video tasks;
[0300] Energy consumption model building module, building energy consumption model for processing video tasks;
[0301] The problem model building module builds a problem model whose optimization goal is to minimize the weighted cost of task processing delay and energy consumption of the MEC system;
[0302] Video task offloading strategy design module, which designs video task offloading strategies based on deep reinforcement learning;
[0303] Initialization module, which initializes network weight, experience replay pool, and the status of each queue of the MEC system;
[0304] Execution module, the terminal device executes the uninstallation decision according to the uninstallation strategy and interacts with the environment;
[0305] Update the weight module and extract experience samples to update the network weights;
[0306] The iteration module makes the execution module and the weight update module execute repeatedly until the reward curve converges.
[0307] For other contents of this embodiment, please refer to Embodiment 1.
[0308] The present invention has described the proposed task offloading method in detail through the above implementation scheme, but certain modifications and optimizations can still be made on the basis of the present invention. Therefore, without departing from the design spirit of the present invention, the modifications and optimizations made by those skilled in the art to the technical solution of the present invention should fall within the protection scope of the present invention.
Claims
1. A DRL-based edge video object detection task offloading method. It is characterized in that The steps include: S1, establish a system model of multiple terminal devices and a single MEC server; S2, establish a delay model for processing video tasks; S3, establishes an energy consumption model for processing video tasks; S4, establish a problem model with the optimization goal of minimizing the weighted cost of task processing delay and energy consumption of the MEC system; S5, design a video task offloading strategy based on deep reinforcement learning; S6, initialize network weights, experience replay pool, and MEC system queue status; S7, the terminal device executes the offloading decision according to the offloading policy and interacts with the environment; S8, extract experience samples to update network weights; S9, repeating the above steps S7 and S8 until the reward curve converges; Step S4 is as follows: The terminal device set M = {1, 2, ..., M} and an MEC server are regarded as a MEC system. The delay of the entire MEC system is equivalent to the maximum value of the task processing delay of all devices, that is, the moment when the last task is completed is regarded as the moment when all tasks are processed. Then, the expected task completion delay of all terminal devices at time t is expressed by formula (28): L(t)=(L 1 (t),…,L m (t),...,L M (t)) (28) Combined with the energy cost function E(t) established in the previous step, the weighted sum of latency and energy consumption is used as the MEC system cost; therefore, the optimization goal is to minimize the MEC system cost function by jointly optimizing the unloading decisions of each terminal device; α(t) = (α 1 (t),α 2 (t),...,α M (t)) is defined as the joint offloading decision vector of all terminal devices; the problem model is shown in formula (29): In the above formula, 1 and λ 2 They represent the trade-off coefficients between delay and energy consumption respectively; Step S5 is specifically as follows: using a double-delayed deep deterministic policy gradient TD3 algorithm to learn the optimal offloading decision; S5.1, Establishing Markov decision process model The Markov decision process contains three key elements: state, action and reward. The state space S(t) at time t is defined as the combination vector of task state, terminal device and server queue state and network bandwidth state, as shown in formula (30): Wherein, vector Z(t) and vector D(t) represent the task data volume and duration of the terminal device set, respectively, which can be specifically expressed as Z(t)=(Z 1 (t),Z 2 (t),...,Z M (t)), D(t)=(D 1 (t),D 2 (t),...,D M (t)); vectors Ql(t), Qs(t) and Qtrans(t) respectively represent the state of each device queue at time t, as shown in (31), (32) and (33): Q s (t)=(Q s,h2r (t),Q s,inf (t)) (32) In formula (30), W(t) represents the bandwidth at the current moment; Represents network dynamic prediction information; The action space A(t) is defined as the offloading decision vector composed of all terminal devices, which is specifically expressed as The reward is defined as a negative function of the objective function, and the reward function R(t) is defined as R(t) = -(λ 1 max(L(t))+λ 2 E(t)); S5.2, building a network dynamics prediction module based on LSTM The LSTM model contains an encoder and a decoder. The historical bandwidth sequence of length H is used as the encoder input, and the encoder extracts features from the input sequence. The decoder outputs the target sequence based on the features and outputs the network state prediction for the next time slot through a fully connected layer. The H-dimensional bandwidth sequence is expressed as W(t)=(W(tH),...,W(t-2),W(t-1)), 1≤H≤T, 1≤t≤T; Will and the original state vector (Z(t), D(t), Q l (t),Q s (t),Q trans (t), W(t)) are concatenated to form a new state vector S(t), which is the vector shown in formula (30); S5.3, improved original experience playback mechanism During the algorithm training phase, a series of benchmark reward schemes are set, and then the actual experience samples are compared with their benchmark rewards, and finally stored in the corresponding experience replay pool according to the grading standards; The all-local computing strategy and the all-offloading strategy are used as the benchmark reward scheme, where the experience replay pool A is used to store experience samples with reward values higher than the benchmark reward; the experience replay pool B is used to store experience samples with rewards lower than or equal to the benchmark reward; X represents the number of samples sampled during algorithm update, and δ represents the sampling weight of the sample, which is 0≤δ≤1; Step S6 is as follows: The main body of the TD3 algorithm consists of an Actor network and a Critic network. The algorithm proposes a model structure with six neural networks to solve the overestimation problem, namely: an Actor network and its target network, two Critic networks, and two Critic target networks; before the training phase begins, the Actor network weights θ are randomly initialized. μ and the critic network weight θ Q1 and θ Q2 , and then initialize their respective target network weight copies; Set the two experience replay pools to have the same maximum capacity and clear the experience replay pools; The experience replay pool is used to store experience samples generated by the interaction between the agent and the environment. Each experience sample is represented by a four-tuple (S(t), A(t), R(t), S(t+1)). It also provides experience samples for the DRL algorithm network to update weights. The specific sampling method is that the dual experience replay pool in step S5 samples according to the weight coefficient δ. Before the training phase begins, the internal queue states of each terminal device and MEC server in the MEC system are initialized; the state S(1) at the start of the environment is obtained, and the historical network bandwidth sequence W(1) is reset to an H-dimensional all-zero vector.
2. A DRL-based edge video object detection task offloading method as claimed in claim 1, It is characterized in that Step S1 is specifically as follows: Suppose a MEC system model consists of a single MEC server and multiple terminal devices with the same hardware configuration; where the terminal device set is defined as M=={1,2,...,M}, and m∈M is defined as the device index; each device is connected to the MEC server via wireless, and the MEC server provides computing resources for the terminal device; S1.1, Establishing the video analysis task model The MEC system time is represented by the time slot set T = {1, 2, ..., T}, and the time slot index and time slot length are represented by t∈T and Δ respectively; assuming that at the start of each time slot, each terminal device generates a video analysis task V m (t) = {Z m (t),D m (t)}; where Zm(t) represents the data size of the video task, D m (t) represents the duration of the video task; S1.2, Design of video task offloading decision Before the video task is executed, the video is evenly divided into multiple video segments, i.e., video blocks, according to its time axis. Then, the offloading problem of a complete video analysis task is transformed into multiple subtask offloading problems. Specifically, the terminal device performs the task V m (t) The number of video blocks generated after segmentation is defined as K m (t), that is, the number of video blocks, is expressed by formula (1): Where d represents the duration of a single video block; the unloading decision of the terminal device m at time t is defined as task V m Unloading rate α of (t) m (t)∈[0,1]; therefore, task V m (t) Number of video chunks to be offloaded As shown in formula (2): In the above formula Indicates rounding up; Task V m (t) Number of video chunks computed locally It is expressed as:
3. A DRL-based edge video object detection task offloading method as claimed in claim 2, It is characterized in that Step S2 is specifically as follows: S2.1, Establishing a delay model for local computing of video tasks For the computational process of the video target detection task, for task V m (t) After segmentation preprocessing, the local computing process of the video block is: video encoding and decoding, deep learning model inference and uploading inference results; local processing for terminal device m at time t Video blocks, calculate and analyze the delay cost of each link: First, the deep learning model needs to input frame data in RGB format for inference calculation, so the video block needs to complete the video encoding and decoding operation first; specifically, a single video block is converted from the original data format, that is, RAW format, to frame data in RGB format. The delay consumption of this process is shown in formula (4): In the above formula, C r2r Indicates the number of cycles required for a single video block to complete r2r encoding and decoding, where r2r stands for RAW to RGB; Defined as the computing power of the terminal device, expressed by the cycle frequency; The video block calculation process needs to consider the state of the calculation queue in which it is located, that is, the length of the R2R codec queue in the terminal device m at time t Then for video blocks, where the queuing delay of the i-th video block is As shown in formula (5): In the above formula, the first term represents the processing delay of the remaining tasks in the r2r encoding and decoding queue; the second term represents the processing delay of the first i-1 video blocks; therefore, the delay consumption caused by completing r2r encoding and decoding of the i-th video block is shown in (6): Secondly, the video blocks that have completed r2r encoding and decoding are used in the form of frame data for deep learning model inference. For terminal devices equipped with GPU chips, the model inference operation is completed by the chip. The delay required for a single video block to complete inference on the terminal device is shown in formula (7): In the above formula Indicates the GPU operating frequency of the local terminal device; C inf Indicates the number of cycles required for a single video block to complete model inference; combined with the above encoding and decoding process delay calculation, the model inference process also needs to consider the queuing delay. Defined as the model inference queue length of device m at time t; the number of video blocks processed locally When it is zero, the local device only needs to process the remaining tasks in the inference queue, and the delay consumption is expressed as formula (8): for situation, assuming as its video block index; then the delay of completing the inference of the i-th video block is as shown in formula (9): The latency cost of terminal device m to complete local processing of all tasks at time t is expressed as formula (10): S2.2, Delay Model of Computation Offloading for Video Task Execution When the terminal device offloads the video task, the processing of its video block involves: video encoding and decoding, network transmission and deep learning model reasoning; for the video task V arriving at the terminal device m at time t m (t), the quantity is The video chunks will be offloaded to the MEC server for processing; The following is an analysis of the delay consumption in each link of the unloading process; The H.264 format based on video compression technology is used as the data transmission format during computing offloading, and the H.264 format represents a series of video compression formats; The terminal device first converts the video data from the original format to H.264 compression format, namely RAW to H.264, i.e., r2h. The encoding and decoding delay of the jth video block needs to consider the time it takes to complete the r2h encoding and decoding and its queuing time. Given by formula (11): In the above formula Represents the length of the r2h encoding and decoding queue at time t; the r2h time of a single video block Indicates the computing resources required to complete r2h encoding and decoding of a single video block; The H.264 format data that has completed r2h encoding and decoding is uploaded to the MEC server through the wireless link. The delay generated by the transmission process will be determined by the amount of video data and the transmission rate. The uplink transmission rate r(t) between the terminal device and the MEC server at time t is obtained according to Shannon's theorem, as follows: Where W(t) represents the network channel bandwidth at time t; h represents the channel gain between the terminal device and the MEC server; P represents the transmission power of the terminal device; σ 2 is the Gaussian white noise power; assume that the transmission rate r(t) remains unchanged from the start time of time slot t to the start time of time slot t+1; The transmission delay is expressed in the following way, as shown in formula (13): In the above formula represents the waiting time before the video block j starts to be processed, and its corresponding calculation method is as shown in formula (14): In formula (14), It is defined as the length of the network transmission queue of terminal device m at time t; the first item in the max(·) item is the expected transmission time of the remaining tasks in the transmission queue, and the second item is the queue time required for r2h encoding and decoding of video block j; The max(·) term in formula (13) is used to represent the time taken for video block j to arrive at the MEC server from the start of processing, where the first term represents the r2h encoding and decoding time of the video block, and the second term represents its expected transmission time; After the video block based on H.264 format arrives at the MEC server, the MEC server needs to encode and decode it to convert it into RGB frame data, namely H.264 to RGB, referred to as h2r, for subsequent deep learning model inference; the delay consumption from the generation of video block j by device m to the completion of h2r encoding and decoding at the server is given as: Above represents the queuing delay of the video block in the r2h queue; L s,h2r Indicates the time taken for h2r encoding and decoding; The delay for video block j to complete model inference on the MEC server is expressed by formula (16): The max(·) term in formula (16) represents the waiting time before the video block j starts reasoning, which means that the video block j must meet two prerequisites to start reasoning: 1) the video block has completed h2r encoding and decoding; 2) the previous j-1 video blocks have completed model reasoning; in addition, Indicates the GPU operating frequency of the MEC server; Terminal device m is unloaded at time t The expected delay consumption of video blocks is: Terminal device m for task V m (t) Execute the uninstall decision α m (t), the expected delay L to complete all tasks m (t) is determined by the local computing delay and the offloading computing delay; specifically, as shown in formula (18):
4. A DRL-based edge video object detection task offloading method as claimed in claim 3, It is characterized in that Step S3 is as follows: S3.1, Calculate the energy consumption of terminal equipment The energy consumption of video tasks in local terminal computing is determined by r2r encoding and decoding, r2h encoding and decoding, and model reasoning, where r2r encoding and decoding energy consumption And r2h codec energy consumption As shown in formula (19) and formula (20): In the above formula, κ represents the energy consumption coefficient of the terminal device, which depends on the device chip; and They represent the energy consumption of a single video block when completing r2r encoding and decoding and r2h encoding and decoding locally respectively; The terminal device uses GPU chips to perform model inference calculations. The energy consumption generated by this process is reduced by the number of local processing video blocks. and the device GPU operating frequency, as shown in formula (21): At time t, terminal device m processes task V m (t), the total energy consumption generated locally for: S3.2, Calculate network transmission energy consumption The energy consumption generated when the terminal device performs computational offloading on the task is determined by the number of video blocks offloaded. Video block data volume Z m (t) / K m (t) and the uplink transmission rate r(t), as shown in formula (23): S3.3, Calculate the energy consumption of MEC servers The number of uninstalls of terminal device m is The video blocks are encoded and decoded by h2r on the MEC server, generating energy consumption. As shown in formula (24): κ s Represents the energy consumption coefficient of the MEC server, Indicates the energy consumption of a single video block to complete h2r encoding and decoding; represents the energy consumption of a single video block when the server completes the inference; therefore, the energy consumption of the MEC server performing model inference on the video block is shown in formula (25): For task V arriving at terminal device m at time t m (t), the corresponding energy consumption of MEC is: For the video tasks arriving at each device of the MEC system at time t, the energy consumption generated by its processing can be summarized as follows:
5. A DRL-based edge video object detection task offloading method as claimed in claim 1, It is characterized in that Step S7 is as follows: the current state vector S(t) is output as the action vector A(t), that is, the uninstallation decision of each terminal device, and the specific method is shown in formula (34): In the above formula, σ 0 represents the noise strategy, c represents the noise critical value; Each terminal device makes an offloading decision for the video task execution according to the action vector A(t), and obtains an immediate reward R(t) by the above reward function; The environment state is updated from S(t) to S(t+1), and the historical network bandwidth sequence W(t) is updated at the same time; the current experience sample (S(t), A(t), R(t), S(t+1)) is stored in the corresponding experience replay pool according to the benchmark reward.
6. A DRL-based edge video object detection task offloading method as claimed in claim 5, It is characterized in that Step S8 is as follows: the number of experience samples extracted each time the network weight is updated is X, and experience samples are sampled from experience replay pool A and experience replay pool B respectively according to the sampling coefficient δ, and finally X samples (S i ,A i ,R i ,S i+1 ); The Actor network and the Critic network update their weights by calculating gradients, and their target networks update their weights by soft updating.
7. A DRL-based edge video object detection task offloading system, It is characterized in that Includes the following modules: System model building module, building a system model of multiple terminal devices and a single MEC server; The delay model building module builds the delay model for processing video tasks; Energy consumption model building module, building energy consumption model for processing video tasks; The problem model building module builds a problem model whose optimization goal is to minimize the weighted cost of task processing delay and energy consumption of the MEC system; Video task offloading strategy design module, which designs video task offloading strategies based on deep reinforcement learning; Initialization module, which initializes network weight, experience replay pool, and the status of each queue of the MEC system; Execution module, the terminal device executes the uninstallation decision according to the uninstallation strategy and interacts with the environment; Update the weight module and extract experience samples to update the network weights; The iteration module makes the execution module and the weight update module execute repeatedly until the reward curve converges; The specific problem model building module is as follows: the terminal device set M = {1, 2, ..., M} and an MEC server are regarded as a MEC system. The delay of the entire MEC system is equivalent to the maximum value of the task processing delay of all devices, that is, the moment when the last task is completed is regarded as the completion of all tasks. Then, the expected task completion delay of all terminal devices at time t is expressed by formula (28): L(t)=(L 1 (t),...,L m (t),...,L M (t)) (28) Combined with the energy cost function E(t) established in the previous step, the weighted sum of latency and energy consumption is used as the MEC system cost; therefore, the optimization goal is to minimize the MEC system cost function by jointly optimizing the unloading decisions of each terminal device; α(t) = (α 1 (t),α 2 (t),…,α M (t)) is defined as the joint offloading decision vector of all terminal devices; the problem model is shown in formula (29): In the above formula, 1 and λ 2 They represent the trade-off coefficients between delay and energy consumption respectively; The video task offloading strategy design module is as follows: a double-delayed deep deterministic policy gradient TD3 algorithm is used to learn the optimal offloading decision; S5.1, Establishing Markov decision process model The Markov decision process contains three key elements: state, action and reward. The state space S(t) at time t is defined as the combination vector of task state, terminal device and server queue state and network bandwidth state, as shown in formula (30): Wherein, vector Z(t) and vector D(t) represent the task data volume and duration of the terminal device set, respectively, which can be specifically expressed as Z(t)=(Z 1 (t),Z 2 (t),…,Z M (t)), D(t)=(D 1 (t),D 2 (t),…,D M (t)); vector Q l (t), Q s (t) and Q trans (t) respectively represent the queue status of each device at time t, as shown in (31), (32) and (33): Q s (t)=(Q s,h2r (t),Q s,inf (t)) (32) In formula (30), W(t) represents the bandwidth at the current moment; Represents network dynamic prediction information; The action space A(t) is defined as the offloading decision vector composed of all terminal devices, which is specifically expressed as The reward is defined as a negative function of the objective function, and the reward function R(t) is defined as R(t) = -(λ 1 max(L(t))+λ 2 E(t)); S5.2, building a network dynamics prediction module based on LSTM The LSTM model contains an encoder and a decoder. The historical bandwidth sequence of length H is used as the encoder input, and the encoder extracts features from the input sequence. The decoder outputs the target sequence based on the features and outputs the network state prediction for the next time slot through a fully connected layer. The H-dimensional bandwidth sequence is expressed as W(t) = (W(tH), ..., W(t-2), W(t-1)), 1≤H≤T, 1≤t≤T; Will and the original state vector (Z(t), D(t), Q l (t),Q s (t),Q trans (t), W(t)) are concatenated to form a new state vector S(t), which is the vector shown in formula (30); S5.3, improved original experience playback mechanism During the algorithm training phase, a series of benchmark reward schemes are set, and then the actual experience samples are compared with their benchmark rewards, and finally stored in the corresponding experience replay pool according to the grading standards; The all-local computing strategy and the all-offloading strategy are used as the benchmark reward scheme, where the experience replay pool A is used to store experience samples with reward values higher than the benchmark reward; the experience replay pool B is used to store reward experience samples; X represents the number of samples sampled when the algorithm is updated, and δ represents the sampling weight of the sample, which is 0≤δ≤1; The initialization module is as follows: The main body of the TD3 algorithm consists of an Actor network and a Critic network. The algorithm proposes a model structure with six neural networks to solve the overestimation problem, namely: an Actor network and its target network, two Critic networks, and two Critic target networks; before the training phase begins, the Actor network weights θ are randomly initialized μ and Critic network weight and Then initialize their respective target network weight copies; Set the two experience replay pools to have the same maximum capacity and clear the experience replay pools; The experience replay pool is used to store experience samples generated by the interaction between the agent and the environment. Each experience sample is represented by a four-tuple (S(t), A(t), R(t), S(t+1)). It also provides experience samples for the DRL algorithm network to update weights. The specific sampling method is that the dual experience replay pool in step S5 samples according to the weight coefficient δ. Before the training phase begins, the internal queue states of each terminal device and MEC server in the MEC system are initialized; the state S(1) at the start of the environment is obtained, and the historical network bandwidth sequence W(1) is reset to an H-dimensional all-zero vector.
