A video stream data dynamic processing method and system based on memory computing
By dividing the dynamic memory pool in the memory and constructing a spatiotemporal graph, and using the policy network to make intelligent decisions, the problem of inflexible resource allocation in traditional video stream processing is solved, and efficient and stable video stream processing is achieved.
Patent Information
- Application Number
- CN202510085484.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-01-20
AI Technical Summary
Traditional video stream processing technology cannot dynamically adjust resource allocation according to actual needs, resulting in resource waste or shortage, and cannot flexibly respond to complex scenarios, affecting the stable transmission and playback quality of video streams.
A dynamic memory pool is divided in the memory, and a spatiotemporal graph is constructed by extracting frame-level features and optical flow information of key frames. A policy network is used to make intelligent decisions based on the processing status of the video stream and adjust the compression ratio, computing resources and transmission protocol.
It realizes dynamic adjustment of memory allocation according to the real-time demand of video stream, improves the efficiency and quality of video stream processing, can flexibly respond to complex scenarios, avoids waste and shortage of resources, and improves the overall performance of the system.
Smart Images

Figure CN120014512B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video processing technology, and in particular to a method and system for dynamically processing video stream data based on memory computing. Background Art
[0002] Traditional video stream processing technologies rely primarily on fixed processing strategies and manual rules to process video data. These typically involve encoding, decoding, compression, transmission, and playback of video streams based on pre-set algorithms and parameters.
[0003] However, this traditional processing technology has many defects: it is unable to make real-time decisions based on the actual processing status of the video stream, and cannot flexibly respond to various complex scenarios and changes. For example, when the network conditions are poor, it is impossible to automatically adjust the transmission protocol or compression ratio to ensure stable transmission and high-quality playback of the video stream; it often adopts fixed processing parameters and strategies, and cannot dynamically allocate computing resources and network resources according to actual needs, which may result in either underutilization of resources, resulting in waste, or insufficient resources, affecting the processing effect of the video stream; for video streams with different resolutions and bit rates, different processing algorithms and parameters may need to be developed separately, increasing development costs and maintenance difficulties; unstable quality may occur when processing video streams. For example, when the network conditions fluctuate, the video stream may experience problems such as freezes, screen distortion, or audio and video asynchrony, affecting the user experience. Summary of the Invention
[0004] Based on this, the purpose of the present invention is to propose a method and system for dynamic processing of video stream data based on memory computing to solve the above-mentioned problems.
[0005] According to the present invention, a method for dynamically processing video stream data based on memory computing is provided, the method comprising:
[0006] A dynamic memory pool is allocated in the memory for storing and processing video stream data;
[0007] Get video stream data in real time and split it into individual frames;
[0008] Extract frame-level features of key frames;
[0009] Calculate optical flow for key frames;
[0010] Combining frame-level features with optical flow information to construct a spatiotemporal graph, and analyzing the spatiotemporal graph to extract spatiotemporal features;
[0011] The processing state of the video stream is represented as a state vector, a policy network is trained, and the policy network decides the next processing action based on the current state, where the processing state includes processing speed, memory usage, number of abnormal frames, and spatiotemporal domain characteristics. The processing actions include adjusting the compression ratio, allocating computing resources, adjusting the cache strategy, and dynamically adjusting the transmission protocol.
[0012] Furthermore, calculating the optical flow of the key frames includes:
[0013] Select feature points in keyframes;
[0014] Calculating the optical flow of feature points between adjacent key frames using an optical flow algorithm, wherein the optical flow is used to represent the displacement vector of the feature points between consecutive key frames;
[0015] Optical flow features are extracted from the optical flow data, where the optical flow features include the magnitude and direction of the optical flow vector.
[0016] Furthermore, the frame-level features and optical flow information are combined to construct a spatiotemporal graph, including:
[0017] Treat a keyframe as a node in the spatiotemporal graph, where each node contains the frame-level features of the keyframe;
[0018] The edges in the spatiotemporal graph are constructed based on the optical flow information between each pair of adjacent key frames, where each edge connects the nodes of adjacent key frames, and the weight or attribute of the edge is set as the optical flow feature.
[0019] Furthermore, the analyzing the spatiotemporal graph to extract spatiotemporal features includes:
[0020] The spatiotemporal graph is represented and learned through a graph representation learning algorithm to obtain a graph representation learning model;
[0021] Spatiotemporal features are extracted from the graph representation learning model, where the spatiotemporal features are used to represent the main change information of the video stream in the two dimensions of time and space.
[0022] Furthermore, the processing state of the video stream is represented as a state vector, a policy network is trained, and the policy network is used to decide the next processing action based on the current state, including:
[0023] Define the state vector S according to the processing state of the video stream t , wherein the processing status includes processing speed, memory usage, number of abnormal frames and spatiotemporal domain characteristics, which are used to describe the environmental status of the video stream processing system at the current moment or the status of the video stream itself;
[0024] An action space is defined based on processing actions of the video stream, wherein the processing actions include adjusting compression ratio, allocating computing resources, adjusting cache strategy, and dynamically adjusting transmission protocol, and each processing action is represented as a;
[0025] The neural network structure is used as a policy network, which receives the state vector as input and outputs the probability distribution of the action to be taken in the current state. The policy network is represented by π θ (a|S t ), where θ is the parameter of the policy network, a is the action, S t is the current state;
[0026] defining a reward function R(s, a) for evaluating the quality of taking action a in state s according to processing objectives, wherein the processing objectives include optimizing video quality, improving processing speed, reducing memory usage, and / or reducing abnormal frames;
[0027] The policy network is trained using reinforcement learning. During the training process, the expected cumulative reward is maximized by optimizing the policy network parameters θ. The policy network is then guided by the evaluation of the value network to automatically adjust the processing actions according to the current processing state. Through continuous trial and error and optimization, the optimal processing strategy is learned, thereby improving the overall performance of video stream processing.
[0028] Apply the trained policy network to decide the next processing action based on the current state, and the processing action includes:
[0029] Furthermore, the policy network is trained using reinforcement learning. During the training process, the expected cumulative reward is maximized by optimizing the policy network parameters θ. The policy network is then guided by the evaluation of the value network to automatically adjust the processing actions according to the current processing state. Through continuous trial and error and optimization, the optimal processing strategy is learned to improve the overall performance of video stream processing, including:
[0030] Randomly initialize the parameters θ of the policy network;
[0031] Collect a sample of states, actions, and rewards;
[0032] Calculate the gradient of the objective function J(θ) with respect to the policy network parameters The calculation formula is:
[0033]
[0034] Among them, Q is estimated approximately through the value network πθ (S t ,a),Q πθ (S t , a) represents the state vector S under the strategy πθ tThe expected cumulative reward after taking action a, E πθ [] represents the expectation under the strategy πθ, represents the logarithmic gradient of the policy network output action probability, π θ (a|S t ) represents the policy network in the state vector S t The probability of taking action a under
[0035] Update the parameters θ of the policy network by the gradient ascent method. The update formula is:
[0036]
[0037] Among them, α is the learning rate, which controls the step size of parameter update;
[0038] Repeat the training until the policy network converges to obtain a trained policy network, which is used to improve the overall performance of video stream processing.
[0039] Furthermore, the approximate estimation of Q through the value network πθ (S t , a), including:
[0040] Construct a value network based on the neural network, expressed as Q ω (s, a), where ω is the parameter of the value network. The input of the value network is state s and action a, and the output is the Q-value estimate of taking action a in state s;
[0041] Train the value network to make the Q value output by the value network close to the true expected cumulative reward;
[0042] During the training process, the state vector S is propagated forward. t And action a is input into the value network to obtain the Q value estimate Q ω (S t , a);
[0043] Estimate the Q value Q ω (S t , a) as Q πθ (S t , an approximate estimate of a).
[0044] Furthermore, the application of the trained policy network determines the next processing action based on the current state, including:
[0045] Obtain the processing speed, memory usage, number of abnormal frames, and spatiotemporal features of the current video stream and combine them into a state vector S t ;
[0046] The state vector S tInput into the trained policy network to obtain the probability distribution π of the action to be taken in the current state θ (a|S t );
[0047] Choose an action based on a probability distribution.
[0048] The present invention further proposes a video stream data dynamic processing system based on memory computing, which is used to implement the above-mentioned video stream data dynamic processing method based on memory computing. The system includes:
[0049] Partitioning module: used to divide a dynamic memory pool in the memory for storing and processing video stream data;
[0050] Data acquisition module: used to acquire video stream data in real time and split it into separate frames;
[0051] Feature extraction module: used to extract frame-level features of key frames;
[0052] Optical flow calculation module: used to calculate the optical flow of key frames;
[0053] Spatiotemporal feature module: used to combine frame-level features and optical flow information to construct a spatiotemporal graph, and analyze the spatiotemporal graph to extract spatiotemporal features;
[0054] Action decision module: used to represent the processing state of the video stream as a state vector, train a policy network, and use the policy network to decide the next processing action based on the current state, wherein the processing state includes processing speed, memory usage, number of abnormal frames and spatiotemporal domain characteristics. The processing actions include adjusting the compression ratio, allocating computing resources, adjusting the cache strategy and dynamically adjusting the transmission protocol.
[0055] In summary, the method for dynamically processing video stream data based on memory computing of the present invention divides a dynamic memory pool in the memory, which is specifically used to store and process video stream data. The divided dynamic memory pool can dynamically adjust memory allocation according to the real-time demand of video stream data, avoiding the problem of memory waste or shortage caused by fixed memory allocation.
[0056] The frame-level features of key frames and optical flow information are combined to construct a spatiotemporal graph and extract spatiotemporal features. Optical flow information is used to accurately capture the key changes in the video content to enhance the spatiotemporal graph's ability to express the dynamic content of the video. The spatiotemporal graph combines information in the time and space domains, allowing the extracted spatiotemporal features to more accurately reflect the key changes in the video.
[0057] By quantifying the processing state of the video stream into a state vector, the policy network can fully and accurately perceive the current processing environment and conditions as well as the state of the video itself. The policy network makes intelligent decisions on processing actions based on the state vector and can quickly output the optimal processing action, avoiding decision delays and inefficiencies caused by relying on manual rules or fixed strategies. This intelligent decision-making mechanism enables the memory system to more efficiently respond to various complex video stream processing scenarios and changes, improve the overall processing efficiency and performance of the memory system, and more accurately process video data, thereby improving video quality.
[0058] Additional aspects and advantages of the present invention will be set forth in part in the following description and, in part, will be obvious from the following description, or may be learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments with reference to the accompanying drawings, in which:
[0060] Figure 1 This is a flowchart of a method for dynamically processing video stream data based on memory computing according to the first embodiment of the present invention;
[0061] Figure 2 This is a system block diagram of a video stream data dynamic processing system based on memory computing according to the second embodiment of the present invention. DETAILED DESCRIPTION
[0062] To facilitate understanding of the present invention, the present invention will be described more fully below with reference to the accompanying drawings. The drawings illustrate several embodiments of the present invention. However, the present invention may be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and comprehensive understanding of the present invention.
[0063] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be an intermediate element. When an element is referred to as being "connected to" another element, it may be directly connected to the other element or there may be an intermediate element. The terms "vertical," "horizontal," "left," "right," and similar expressions used herein are for illustrative purposes only.
[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this invention pertains. The terms used in this specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0065] Example 1
[0066] See also Figure 1 The present invention proposes a method for dynamically processing video stream data based on memory computing, the method comprising steps S101 to S106:
[0067] S101, a dynamic memory pool is allocated in the memory for storing and processing video stream data.
[0068] It's important to note that creating a dynamic memory pool allows for efficient storage and processing of video stream data. This pool dynamically adjusts memory allocation based on the real-time demands of video stream data. Compared to static memory, this provides greater flexibility and avoids memory waste or insufficiency caused by allocation.
[0069] The dynamic memory pool is implemented by managing a series of memory blocks, each of which can store a certain size of video stream data. When new data needs to be stored, the dynamic memory pool allocates an appropriate memory block; when the data is no longer needed, the memory block is recycled and added back to the memory pool.
[0070] S102, acquiring video stream data in real time and dividing it into separate frames.
[0071] It should be noted that the video stream data may come from various cameras, network video streams or existing video files.
[0072] Video stream data consists of a series of continuous image frames, each containing the information that makes up the video image. The system extracts data from the video stream in real time and segments it into individual frames. This typically involves decoding the video stream data and then segmenting the decoded data into individual frames at intervals (e.g., 24 or 30 frames per second). These segments need to be stored in a memory pool for subsequent processing and analysis.
[0073] S103: Extract frame-level features of key frames.
[0074] It should be noted that frame-level features refer to representative information extracted from a single video frame. This information can reflect the content, structure or motion characteristics of the frame. Frame-level features may include color features, texture features, shape features, etc.
[0075] During keyframe extraction, we can extract frame-level features from video frames and calculate inter-frame feature similarity to identify frames with significant content changes. These frames can be selected as keyframes because they better represent the main content of the video clip. For example, we can use color histograms to calculate inter-frame color similarity, or use optical flow to calculate inter-frame motion similarity.
[0076] S104: Calculate optical flow for the key frames.
[0077] It's important to note that optical flow is used to accurately capture motion in videos, enhancing the spatiotemporal graph's ability to express dynamic video content. Computing optical flow between keyframes focuses on key changes in the video content, reducing unnecessary computational overhead while extracting effective motion information. This is particularly useful when processing long videos or real-time video streams, significantly improving processing efficiency and accuracy.
[0078] Further optionally, calculating the optical flow for the key frames includes:
[0079] Select feature points in keyframes;
[0080] Calculating the optical flow of feature points between adjacent key frames using an optical flow algorithm, wherein the optical flow is used to represent the displacement vector of the feature points between consecutive key frames;
[0081] Optical flow features are extracted from the optical flow data, where the optical flow features include the magnitude and direction of the optical flow vector.
[0082] It is understandable that key frames are identified in the video stream. These key frames can be frames where the video content changes significantly, or frames selected according to specific strategies (such as content difference thresholds, etc.). In the selected key frames, representative or easy-to-track feature points are selected, and these feature points will be used for tracking between adjacent key frames.
[0083] Optical flow algorithms (such as the Lucas-Kanade method and the Farneback method) are used to calculate the optical flow of feature points between adjacent keyframes. Optical flow represents the displacement vector of feature points between consecutive keyframes, reflecting the motion information of the object between keyframes.
[0084] The calculated optical flow data is analyzed to extract optical flow features, including the magnitude (indicating motion speed) and direction of the optical flow vector. These optical flow features are used in the subsequent construction and analysis of the spatiotemporal graph to extract information about changes in the video stream in both time and space.
[0085] S105, combining the frame-level features and the optical flow information to construct a spatiotemporal graph, and analyzing the spatiotemporal graph to extract spatiotemporal features;
[0086] It should be noted that after extracting the frame-level features of the key frames and calculating the optical flow of the key frames, the frame-level features and optical flow information are combined to construct a spatiotemporal graph of the key frames. By analyzing the spatiotemporal graph based on the key frames, important change information of the video stream in both time and space dimensions, namely, spatiotemporal features, can be extracted. By analyzing the spatiotemporal features of the key frames, the system can identify anomalies or key events in the video stream, such as the sudden appearance of objects, scene switching, etc., which is of great significance for triggering corresponding processing actions (such as adjusting the compression ratio, reallocating computing resources, etc.).
[0087] Further optionally, combining the frame-level features and the optical flow information to construct a spatiotemporal graph includes:
[0088] Treat a keyframe as a node in the spatiotemporal graph, where each node contains the frame-level features of the keyframe;
[0089] The edges in the spatiotemporal graph are constructed based on the optical flow information between each pair of adjacent key frames, where each edge connects the nodes of adjacent key frames, and the weight or attribute of the edge is set as the optical flow feature.
[0090] It can be understood that key frames are identified in the video stream, and each key frame is used as a node in the spatiotemporal graph. Each node contains the frame-level features of the corresponding key frame image, such as color histogram, edge features, texture features, etc.
[0091] For each pair of adjacent keyframes, edges in the spatiotemporal graph are constructed based on the optical flow information between them. Each edge connects the nodes of adjacent keyframes, and the edge weights or attributes are set as optical flow features, such as the magnitude and direction of the optical flow vector. These optical flow features reflect the motion information and degree of change of the object between adjacent keyframes.
[0092] The spatiotemporal graph constructed in this embodiment focuses more closely on key changes in video content, reducing the impact of non-key frames on the spatiotemporal graph's complexity while retaining important information about changes in both time and space. This is particularly effective when processing videos with significant motion or content changes, improving the accuracy and efficiency of spatiotemporal graph analysis.
[0093] Further optionally, analyzing the spatiotemporal graph to extract spatiotemporal domain features includes:
[0094] The spatiotemporal graph is represented and learned through a graph representation learning algorithm to obtain a graph representation learning model;
[0095] Spatiotemporal features are extracted from the graph representation learning model. The spatiotemporal features are used to represent the main change information of the video stream in the two dimensions of time and space, focusing on key changes and anomaly detection.
[0096] It is understandable that a graph attention network can be used to learn the representation of the spatiotemporal graph of key frames to obtain a graph representation learning model. The graph attention network dynamically assigns the importance of different edges through the attention mechanism, flexibly captures the structural information of the graph, and can process the node features, edge features and structural information of the spatiotemporal graph, thereby generating a graph representation learning model that fully reflects the characteristics of the spatiotemporal graph. Specifically, it includes:
[0097] The feature vectors of all nodes are combined into a feature matrix as the input of the graph attention layer; for each node, the attention weight between it and its neighboring nodes is calculated; based on the calculated attention weight, the features of the neighboring nodes are weighted summed to aggregate the information of the neighboring nodes. Multiple independent attention heads can be used to calculate the attention weight and weighted feature aggregation in parallel; the output results of multiple attention heads are merged; by stacking multiple graph attention layers, nodes can fuse more levels of neighboring node information, thereby learning deeper graph structure features.
[0098] Based on the graph representation learning model, spatiotemporal features are extracted. These features can include the dynamic change patterns of nodes, the connection strength and temporal evolution of edges, and the structure and evolution of subgraphs. These features can capture the spatiotemporal correlations and changes between key frames in the video stream.
[0099] S106: Represent the processing state of the video stream as a state vector, train a policy network, and use the policy network to decide the next processing action based on the current state. The processing state includes processing speed, memory usage, number of abnormal frames, and spatiotemporal domain features, and the processing actions include adjusting the compression ratio, allocating computing resources, adjusting the cache strategy, and dynamically adjusting the transmission protocol.
[0100] It should be noted that various state information in the video stream processing process are quantified to form a state vector. The processing state includes processing speed (indicating the current processing frame rate or processing delay of the video stream), memory usage (reflecting the system memory occupancy or remaining memory), the number of abnormal frames (the number of abnormal frames detected in the past period of time, such as screen freezes, screen distortion, etc.) and the spatiotemporal characteristics of key frames (the characteristics of key frames in time and space, such as color distribution, texture characteristics, motion trajectory, optical flow, etc.).
[0101] The processing state of a video stream is represented as a state vector, and a policy network is trained. The policy network then determines the optimal next action based on the current state (for example, when memory usage is high and the number of abnormal frames increases, the compression ratio is reduced to preserve more detail; when processing is slow and motion trajectories are complex, more computing resources are allocated to accelerate processing). This intelligent decision-making approach for video streams can dynamically adapt to various changes in the video stream processing process, improving the system's flexibility and efficiency.
[0102] Among them, the policy network is a deep learning model, such as a convolutional neural network combined with a recurrent neural network or a long short-term memory network, which can adapt to the high dimensionality and temporal nature of the state vector.
[0103] During the decision-making process, the current state vector is input into the policy network, which then outputs one or more possible actions based on the learned mapping relationship. The system then executes one of these actions based on a certain strategy (e.g., selecting the action with the highest probability, considering the cost and benefit of the action, etc.).
[0104] Further optionally, the processing state of the video stream is represented as a state vector, a policy network is trained, and the next processing action is determined by the policy network according to the current state, including:
[0105] Define the state vector S according to the processing state of the video stream t , wherein the processing status includes processing speed, memory usage, number of abnormal frames and spatiotemporal domain characteristics, which are used to describe the environmental status of the video stream processing system at the current moment or the status of the video stream itself;
[0106] An action space is defined based on processing actions of the video stream, wherein the processing actions include adjusting compression ratio, allocating computing resources, adjusting cache strategy, and dynamically adjusting transmission protocol, and each processing action is represented as a;
[0107] The neural network structure is used as a policy network, which receives the state vector as input and outputs the probability distribution of the action to be taken in the current state. The policy network is represented by π θ (a|S t ), where θ is the parameter of the policy network, a is the action, S t is the current state;
[0108] defining a reward function R(s, a) for evaluating the quality of taking action a in state s according to processing objectives, wherein the processing objectives include optimizing video quality, improving processing speed, reducing memory usage, and / or reducing abnormal frames;
[0109] The policy network is trained using reinforcement learning. During the training process, the expected cumulative reward is maximized by optimizing the policy network parameters θ. The policy network is then guided by the evaluation of the value network to automatically adjust the processing actions according to the current processing state. Through continuous trial and error and optimization, the optimal processing strategy is learned, thereby improving the overall performance of video stream processing.
[0110] Apply the trained policy network to decide the next processing action based on the current state, and the processing action includes:
[0111] As can be understood, the present invention utilizes reinforcement learning methods to train the policy network, and combined with the evaluation guidance of the value network, through continuous trial and error and optimization, maximizes the expected cumulative reward, enables the policy network to quickly and automatically adjust the processing action according to the current processing state, and learns the optimal processing strategy. The trained policy network is applied to determine the next processing action based on the current state. These processing actions include adjusting the compression ratio, allocating computing resources, adjusting the cache strategy, and dynamically adjusting the transmission protocol, thereby optimizing the overall performance of video stream processing in real time.
[0112] Optionally, the policy network is trained using reinforcement learning. During the training process, the policy network parameters θ are optimized to maximize the expected cumulative reward. The policy network is guided by the evaluation of the value network to automatically adjust the processing action according to the current processing state. Through continuous trial and error and optimization, the optimal processing strategy is learned to improve the overall performance of video stream processing, including:
[0113] Randomly initialize the parameters θ of the policy network;
[0114] You can collect a series of state, action, and reward samples by simulating or actually running the video stream processing system.
[0115] Calculate the gradient of the objective function J(θ) with respect to the policy network parameters The calculation formula is:
[0116]
[0117] Among them, Q is estimated approximately through the value network πθ (S t ,a),Q πθ (S t , a) represents the state vector S under the strategy πθ t The expected cumulative reward after taking action a, E πθ [] represents the expectation under the strategy πθ, represents the logarithmic gradient of the policy network output action probability, π θ (a|S t ) represents the policy network in the state vector St The probability of taking action a under
[0118] Update the parameters θ of the policy network by the gradient ascent method. The update formula is:
[0119]
[0120] Among them, α is the learning rate, which controls the step size of parameter update;
[0121] Repeat the training until the policy network converges to obtain a trained policy network, which is used to improve the overall performance of video stream processing.
[0122] Optionally, the approximate estimation of Q by the value network πθ (S t , a), including:
[0123] Construct a value network based on the neural network, expressed as Q ω (s, a), where ω is the parameter of the value network. The input of the value network is state s and action a, and the output is the Q-value estimate of taking action a in state s;
[0124] The goal of training the value network is to make the Q value output by the value network as close as possible to the true expected cumulative reward;
[0125] During the training process, the state vector S is propagated forward. t And action a is input into the value network to obtain the Q value estimate Q ω (S t , a);
[0126] Estimate the Q value Q ω (S t , a) as Q πθ (S t , an approximate estimate of a).
[0127] It is understandable that the value network of the present invention is constructed based on a neural network and has a strong nonlinear fitting ability. It can accurately estimate the Q value in a complex environment, that is, the expected cumulative reward of the state-action pair. It not only quickly calculates the Q value estimate through forward propagation, thereby improving training efficiency, but also handles the problem of high-dimensional state and action space well. At the same time, it provides a stable gradient estimate for the policy network, which helps to prevent oscillations and divergence during training. It also defines an optimization goal for the policy network. By maximizing the Q value, it promotes the policy network to gradually learn a better processing strategy, thereby significantly improving the overall performance of video stream processing.
[0128] Further optionally, the application of the trained policy network to decide the next processing action based on the current state includes:
[0129] Obtain the processing speed, memory usage, number of abnormal frames, and spatiotemporal features of the current video stream and combine them into a state vector S t ;
[0130] The state vector S t Input into the trained policy network to obtain the probability distribution π of the action to be taken in the current state θ (a|S t );
[0131] Choose an action based on a probability distribution.
[0132] As you can see, when applying a trained policy network to determine the next action, the first step is to obtain key processing metrics for the current video stream, including processing speed, memory usage, number of abnormal frames, and spatiotemporal characteristics. These metrics together form a state vector that describes the current state of the video stream processing and comprehensively reflects the real-time status of the video stream processing system.
[0133] This state vector is then fed into a trained policy network. Based on its learned policy and parameters, the policy network processes the input state vector and outputs a probability distribution for each action that should be taken in the current state. This probability distribution reflects the likelihood of obtaining the desired reward for each action.
[0134] Finally, based on this probability distribution, an action is selected for execution. This selection process can be based on a greedy strategy, an ε-greedy strategy, or other exploration-exploitation balanced strategy to ensure that the system can both utilize the currently known optimal strategy and explore new possible strategies to a certain extent, thereby continuously optimizing and improving the selection of processing actions.
[0135] The present invention provides an efficient and adaptive processing action selection mechanism for a video stream processing system by executing intelligent decision-making based on reinforcement learning.
[0136] In summary, the method for dynamically processing video stream data based on memory computing of the present invention divides a dynamic memory pool in the memory, which is specifically used to store and process video stream data. The divided dynamic memory pool can dynamically adjust memory allocation according to the real-time demand of video stream data, avoiding the problem of memory waste or shortage caused by fixed memory allocation.
[0137] The frame-level features of key frames and optical flow information are combined to construct a spatiotemporal graph and extract spatiotemporal features. Optical flow information is used to accurately capture the key changes in the video content to enhance the spatiotemporal graph's ability to express the dynamic content of the video. The spatiotemporal graph combines information in the time and space domains, allowing the extracted spatiotemporal features to more accurately reflect the key changes in the video.
[0138] By quantifying the processing state of the video stream into a state vector, the policy network can fully and accurately perceive the current processing environment and conditions as well as the state of the video itself. The policy network makes intelligent decisions on processing actions based on the state vector and can quickly output the optimal processing action, avoiding decision delays and inefficiencies caused by relying on manual rules or fixed strategies. This intelligent decision-making mechanism enables the memory system to more efficiently respond to various complex video stream processing scenarios and changes, improve the overall processing efficiency and performance of the memory system, and more accurately process video data, thereby improving video quality.
[0139] Example 2
[0140] See also Figure 2 The present invention proposes a video stream data dynamic processing system based on memory computing, the system comprising:
[0141] Partitioning module: used to divide a dynamic memory pool in the memory for storing and processing video stream data;
[0142] Data acquisition module: used to acquire video stream data in real time and split it into separate frames;
[0143] Feature extraction module: used to extract frame-level features of key frames;
[0144] Optical flow calculation module: used to calculate the optical flow of key frames;
[0145] Spatiotemporal feature module: used to combine frame-level features and optical flow information to construct a spatiotemporal graph, and analyze the spatiotemporal graph to extract spatiotemporal features;
[0146] Action decision module: used to represent the processing state of the video stream as a state vector, train a policy network, and use the policy network to decide the next processing action based on the current state, wherein the processing state includes processing speed, memory usage, number of abnormal frames and spatiotemporal domain characteristics. The processing actions include adjusting the compression ratio, allocating computing resources, adjusting the cache strategy and dynamically adjusting the transmission protocol.
[0147] Further optionally, the optical flow calculation module is further used to:
[0148] Select feature points in keyframes;
[0149] Calculating the optical flow of feature points between adjacent key frames using an optical flow algorithm, wherein the optical flow is used to represent the displacement vector of the feature points between consecutive key frames;
[0150] Optical flow features are extracted from the optical flow data, where the optical flow features include the magnitude and direction of the optical flow vector.
[0151] Further optionally, the spatiotemporal feature module is further used to:
[0152] Treat a keyframe as a node in the spatiotemporal graph, where each node contains the frame-level features of the keyframe;
[0153] The edges in the spatiotemporal graph are constructed based on the optical flow information between each pair of adjacent key frames, where each edge connects the nodes of adjacent key frames, and the weight or attribute of the edge is set as the optical flow feature.
[0154] Further optionally, the spatiotemporal feature module is further used to:
[0155] The spatiotemporal graph is represented and learned through a graph representation learning algorithm to obtain a graph representation learning model;
[0156] Spatiotemporal features are extracted from the graph representation learning model, where the spatiotemporal features are used to represent the main change information of the video stream in the two dimensions of time and space.
[0157] Further optionally, the action decision module is further configured to:
[0158] Define the state vector S according to the processing state of the video stream t , wherein the processing status includes processing speed, memory usage, number of abnormal frames and spatiotemporal characteristics, which are used to describe the environmental status of the video stream processing system at the current moment or the status of the video stream itself;
[0159] An action space is defined based on processing actions of the video stream, wherein the processing actions include adjusting compression ratio, allocating computing resources, adjusting cache strategy, and dynamically adjusting transmission protocol, and each processing action is represented as a;
[0160] The neural network structure is used as a policy network, which receives the state vector as input and outputs the probability distribution of the action to be taken in the current state. The policy network is represented by π θ (a|S t ), where θ is the parameter of the policy network, a is the action, S t is the current state;
[0161] defining a reward function R(s, a) for evaluating the quality of taking action a in state s according to processing objectives, wherein the processing objectives include optimizing video quality, improving processing speed, reducing memory usage, and / or reducing abnormal frames;
[0162] The policy network is trained using reinforcement learning. During the training process, the expected cumulative reward is maximized by optimizing the policy network parameters θ. The policy network is then guided by the evaluation of the value network to automatically adjust the processing actions according to the current processing state. Through continuous trial and error and optimization, the optimal processing strategy is learned, thereby improving the overall performance of video stream processing.
[0163] Apply the trained policy network to decide the next processing action based on the current state, and the processing action includes:
[0164] Further optionally, the spatiotemporal feature module is further used to:
[0165] Randomly initialize the parameters θ of the policy network;
[0166] Collect a sample of states, actions, and rewards;
[0167] Calculate the gradient of the objective function J(θ) with respect to the policy network parameters The calculation formula is:
[0168]
[0169] Among them, Q is estimated approximately through the value network πθ (S t ,a),Q πθ (S t , a) represents the state vector S under the strategy πθ t The expected cumulative reward after taking action a, E πθ [] represents the expectation under the strategy πθ, represents the logarithmic gradient of the policy network output action probability, π θ (a|S t ) represents the policy network in the state vector S t The probability of taking action a under
[0170] Update the parameters θ of the policy network by the gradient ascent method. The update formula is:
[0171]
[0172] Among them, α is the learning rate, which controls the step size of parameter update;
[0173] Repeat the training until the policy network converges to obtain a trained policy network, which is used to improve the overall performance of video stream processing.
[0174] Further optionally, the spatiotemporal feature module is further used to:
[0175] Construct a value network based on the neural network, expressed as Q ω(s, a), where ω is the parameter of the value network. The input of the value network is state s and action a, and the output is the Q-value estimate of taking action a in state s;
[0176] Train the value network to make the Q value output by the value network close to the true expected cumulative reward;
[0177] During the training process, the state vector S is propagated forward. t And action a is input into the value network to obtain the Q value estimate Q ω (S t , a);
[0178] Estimate the Q value Q ω (S t , a) as Q πθ (S t , an approximate estimate of a).
[0179] Further optionally, the spatiotemporal feature module is further used to:
[0180] Obtain the processing speed, memory usage, number of abnormal frames, and spatiotemporal features of the current video stream and combine them into a state vector S t ;
[0181] The state vector S t Input into the trained policy network to obtain the probability distribution π of the action to be taken in the current state θ (a|S t );
[0182] Choose an action based on a probability distribution.
[0183] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
Claims
1. A method for dynamic processing of video stream data based on memory computing, characterized in that: The method comprises: A dynamic memory pool is allocated in the memory for storing and processing video stream data; Get video stream data in real time and split it into individual frames; Extract frame-level features of key frames; Calculate optical flow for key frames; Combining frame-level features with optical flow information to construct a spatiotemporal graph, and analyzing the spatiotemporal graph to extract spatiotemporal features; The processing state of the video stream is represented as a state vector, a policy network is trained, and the policy network determines the next processing action based on the current state, wherein the processing state includes processing speed, memory usage, number of abnormal frames, and spatiotemporal characteristics. The processing actions include adjusting the compression ratio, allocating computing resources, adjusting the cache strategy, and dynamically adjusting the transmission protocol. The calculating of optical flow for the key frames includes: Select feature points in keyframes; Calculating the optical flow of feature points between adjacent key frames using an optical flow algorithm, wherein the optical flow is used to represent the displacement vector of the feature points between consecutive key frames; Extracting optical flow features from the optical flow data, wherein the optical flow features include the magnitude and direction of the optical flow vector; The process of combining frame-level features with optical flow information to construct a spatiotemporal graph includes: Treat a keyframe as a node in the spatiotemporal graph, where each node contains the frame-level features of the keyframe; Construct edges in the spatiotemporal graph based on the optical flow information between each pair of adjacent keyframes, where each edge connects the nodes of adjacent keyframes, and the weight or attribute of the edge is set as the optical flow feature; Analyzing the spatiotemporal graph to extract spatiotemporal features includes: The spatiotemporal graph is represented and learned through a graph representation learning algorithm to obtain a graph representation learning model; Spatiotemporal features are extracted from the graph representation learning model, where the spatiotemporal features are used to represent the main change information of the video stream in the two dimensions of time and space.
2. The method for dynamic processing of video stream data based on memory computing according to claim 1, characterized in that: The processing state of the video stream is represented as a state vector, a policy network is trained, and the policy network is used to decide the next processing action based on the current state, including: Define the state vector S according to the processing state of the video stream t , wherein the processing status includes processing speed, memory usage, number of abnormal frames and spatiotemporal domain characteristics, which are used to describe the environmental status of the video stream processing system at the current moment or the status of the video stream itself; An action space is defined based on processing actions of the video stream, wherein the processing actions include adjusting compression ratio, allocating computing resources, adjusting cache strategy, and dynamically adjusting transmission protocol, and each processing action is represented as a; The neural network structure is used as a policy network, which receives the state vector as input and outputs the probability distribution of the action to be taken in the current state. The policy network is represented by π θ (a|S t ), where θ is the parameter of the policy network, a is the action, S t is the current state; defining a reward function R(s, a) for evaluating the quality of taking action a in state s according to processing objectives, wherein the processing objectives include optimizing video quality, improving processing speed, reducing memory usage, and / or reducing abnormal frames; The policy network is trained using reinforcement learning. During the training process, the expected cumulative reward is maximized by optimizing the policy network parameters θ. The policy network is then guided by the evaluation of the value network to automatically adjust the processing actions according to the current processing state. Through continuous trial and error and optimization, the optimal processing strategy is learned, thereby improving the overall performance of video stream processing. Apply the trained policy network to decide the next processing action based on the current state, and the processing action includes:
3. The method for dynamic processing of video stream data based on memory computing according to claim 2, characterized in that: The policy network is trained using reinforcement learning. During the training process, the expected cumulative reward is maximized by optimizing the policy network parameters θ. The policy network is then guided by the evaluation of the value network to automatically adjust the processing actions according to the current processing state. Through continuous trial and error and optimization, the optimal processing strategy is learned to improve the overall performance of video stream processing, including: Randomly initialize the parameters θ of the policy network; Collect a sample of states, actions, and rewards; Calculate the gradient ∇ of the objective function J(θ) with respect to the policy network parameters θ J(θ) is calculated as: ∇ θ J(θ)=E πθ [∇ θ logπ θ (a∣S t )⋅Q πθ (S t ,a)], Among them, Q is estimated approximately through the value network πθ (S t ,a),Q πθ (S t , a) represents the state vector S under the strategy πθ t The expected cumulative reward after taking action a, E πθ [ ] represents the expectation under the policy πθ, ∇ θ logπ θ (a|S t ) represents the logarithmic gradient of the policy network output action probability, π θ (a|S t ) represents the policy network in the state vector S t The probability of taking action a under Update the parameters θ of the policy network by the gradient ascent method. The update formula is: θ←θ+α∇ θ J(θ), Among them, α is the learning rate, which controls the step size of parameter update; Repeat the training until the policy network converges to obtain a trained policy network, which is used to improve the overall performance of video stream processing.
4. The method for dynamic processing of video stream data based on memory computing according to claim 3, characterized in that: The value network approximates Q πθ (S t , a), including: Construct a value network based on the neural network, expressed as Q ω (s, a), where ω is the parameter of the value network. The input of the value network is state s and action a, and the output is the Q-value estimate of taking action a in state s; Train the value network to make the Q value output by the value network close to the true expected cumulative reward; During the training process, the state vector S is propagated forward. t And action a is input into the value network to obtain the Q value estimate Q ω (S t , a); Estimate the Q value Q ω (S t , a) as Q πθ (S t , an approximate estimate of a).
5. The method for dynamic processing of video stream data based on memory computing according to claim 2, characterized in that: The trained policy network is applied to decide the next processing action based on the current state, including: Obtain the processing speed, memory usage, number of abnormal frames, and spatiotemporal features of the current video stream and combine them into a state vector S t ; The state vector S t Input into the trained policy network to obtain the probability distribution π of the action to be taken in the current state θ (a|S t ); Choose an action based on a probability distribution.
6. A video stream data dynamic processing system based on memory computing, used to implement the video stream data dynamic processing method based on memory computing according to any one of claims 1 to 5, characterized in that: The system comprises: Partitioning module: used to divide a dynamic memory pool in the memory for storing and processing video stream data; Data acquisition module: used to acquire video stream data in real time and split it into separate frames; Feature extraction module: used to extract frame-level features of key frames; Optical flow calculation module: used to calculate the optical flow of key frames; Spatiotemporal feature module: used to combine frame-level features and optical flow information to construct a spatiotemporal graph, and analyze the spatiotemporal graph to extract spatiotemporal features; Action Decision Module: This module is used to represent the processing state of the video stream as a state vector, train a policy network, and use the policy network to determine the next processing action based on the current state. The processing state includes processing speed, memory usage, number of abnormal frames, and spatiotemporal characteristics. The processing actions include adjusting the compression ratio, allocating computing resources, adjusting the cache strategy, and dynamically adjusting the transmission protocol. The optical flow calculation module is further used to: Select feature points in keyframes; Calculating the optical flow of feature points between adjacent key frames using an optical flow algorithm, wherein the optical flow is used to represent the displacement vector of the feature points between consecutive key frames; Extracting optical flow features from the optical flow data, wherein the optical flow features include the magnitude and direction of the optical flow vector; The spatiotemporal feature module is also used for: Treat a keyframe as a node in the spatiotemporal graph, where each node contains the frame-level features of the keyframe; Construct edges in the spatiotemporal graph based on the optical flow information between each pair of adjacent keyframes, where each edge connects the nodes of adjacent keyframes, and the weight or attribute of the edge is set as the optical flow feature; The spatiotemporal feature module is also used for: The spatiotemporal graph is represented and learned through a graph representation learning algorithm to obtain a graph representation learning model; Spatiotemporal features are extracted from the graph representation learning model, where the spatiotemporal features are used to represent the main change information of the video stream in the two dimensions of time and space.
Citation Information
Patent Citations
Video feature extraction method and device, equipment and storage medium
CN115115991A
Chip platform hardware abstraction layer construction method
CN119312219A