A real-time sentiment analysis method based on adaptive spatio-temporal gating and precedent history prediction update

By employing an adaptive spatiotemporal gating and prior history prediction update method, the problems of high computational overhead and temporal instability in facial expression recognition technology in dynamic video stream environments are solved, enabling efficient and stable real-time emotion analysis on resource-constrained devices.

CN123140207APending Publication Date: 2026-11-20GUIZHOU NORMAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611041659.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-14
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing facial expression recognition technologies suffer from high computational overhead, unstable timing, and uncontrollable latency in real dynamic video stream environments. Furthermore, they are difficult to operate stably on resource-constrained devices or in high-concurrency scenarios. They cannot effectively utilize historical timing information for smoothing and correction, resulting in inconsistent recognition results and increased system latency.

Method used

An adaptive spatiotemporal gating and prior history prediction update method is adopted. The time interval of emotion recognition inference is controlled by the adaptive spatiotemporal gating mechanism, and the emotion state is output by the prior history prediction update mechanism in frames where no complete inference is performed. Combined with the time decay weighted voting mechanism, a smooth and stable emotion trajectory is generated.

Benefits of technology

It significantly reduces GPU computing load and power consumption, improves system throughput, ensures the temporal consistency and stability of recognition results, and adapts to real-time sentiment analysis under different scenarios and resource conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123140207A_ABST
    Figure CN123140207A_ABST
Patent Text Reader

Abstract

The application discloses a real-time emotion analysis method based on adaptive space-time gating and precursor history prediction updating, comprising the following steps: S1, acquiring continuous video frames and performing pretreatment, performing face detection on each frame to obtain a face region set in the current frame, and recording a current timestamp; S2, constructing an adaptive space-time gating mechanism; S3, constructing a precursor history prediction updating mechanism; S4, when the adaptive space-time gating mechanism decides to perform complete emotion recognition reasoning on the current frame, performing preliminary matching on each face detected in the current frame and the historical entries cached under the precursor history prediction updating mechanism; S5, for the entries that fail to match successfully, waiting for the next complete emotion recognition reasoning to initialize the cache record of the entries under the precursor history prediction updating mechanism; for the matched entries, performing weighted smoothing prediction on the emotion history queue of the face and updating the cache.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of facial expression recognition technology, specifically to a real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction updates. Background Technology

[0002] Facial Expression Recognition (FER) is an important research area in computer vision, with wide applications in human-computer interaction, medical monitoring, autonomous driving, and smart education. With the widespread use of deep learning in multimodal perception systems, FER in dynamic scenes has become a research hotspot in computer vision and intelligent interaction.

[0003] In recent years, deep learning methods have continuously improved the accuracy of facial expression classification on static images, but when deployed in real dynamic video streaming environments, they still face problems such as high computational overhead, unstable timing, and difficulty in controlling latency.

[0004] First, facial expressions are a continuous, dynamic, and temporal process with high contextual relevance. However, most existing emotion recognition systems treat each frame of a video stream as an independent static image, ignoring the continuity and smoothness of expressions over time. This "frame-by-frame independent classification" model is easily affected by factors such as instantaneous changes in lighting, slight head movements, and momentary blurring of expressions, leading to drastic and unreasonable jumps in recognition results between adjacent frames. For example, a student may maintain an "angry" expression for several seconds, but the system output may oscillate frequently between "angry," "neutral," and "sad." This volatility in prediction results not only reduces the credibility of the user experience but also fails to accurately reflect the true evolution of the expression. Therefore, it is urgent to design a mechanism that can effectively utilize historical temporal information to smooth and correct current predictions, thereby enhancing the temporal consistency and stability of recognition results and outputting a continuous emotional trajectory that better conforms to human cognitive habits. Second, taking typical dynamic monitoring scenarios (such as shopping malls or classroom teaching environments) as an example, the system usually needs to analyze the facial expressions of dozens of moving targets simultaneously, which places extremely high demands on real-time processing performance. Assuming a scene with 30 moving targets and a real-time benchmark of 24fps, the system needs to complete approximately 720 processing steps per second (30 targets × 24fps), potentially including multiple stages such as face detection, keypoint alignment, feature extraction, and expression classification. Existing solutions, which perform complete inference for each target in every frame, often result in excessive computational demands and increased system latency, making stable operation difficult on resource-constrained devices or in high-concurrency scenarios. Therefore, designing a computationally efficient and memory-friendly model architecture and inference strategy, and optimizing the entire processing pipeline, without significantly sacrificing recognition accuracy, has become a core challenge in achieving real-time sentiment analysis. Summary of the Invention

[0005] The purpose of this application is to provide a real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction updates, the specific technical solution of which is as follows:

[0006] A real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction update includes: S1, acquiring and preprocessing continuous video frames, performing face detection on each frame to obtain the set of face regions in the current frame, and recording the current timestamp; S2, constructing an adaptive spatiotemporal gating mechanism to control the time interval for triggering a complete sentiment recognition inference; S3, constructing a prior history prediction update mechanism to output the sentiment state in frames where the adaptive spatiotemporal gating mechanism in S2 decides not to perform complete sentiment recognition inference; S4, when the adaptive spatiotemporal gating mechanism in S2 decides that the current... When performing complete emotion recognition inference in a frame, each face detected in the current frame is initially matched with the historical entries cached under the predecessor history prediction update mechanism in S3; in S5, for entries that are successfully matched in S4, the emotional history queue of that face is used to perform weighted smooth prediction and update the cache, which is used to suppress instantaneous noise by considering a certain length of history, so as to finally output a smoother, more stable and reliable emotional trajectory on the timeline; for entries that are not successfully matched in S4, they wait for the next complete emotion recognition inference to initialize their cached records under the predecessor history prediction update mechanism in S3.

[0007] The adaptive spatiotemporal gating mechanism in S2 includes: S2.1, introducing a dynamically adjustable time factor to control the minimum time interval for triggering a complete emotion recognition inference. This time factor is dynamically adjusted according to the real-time performance of the system within a predefined reasonable range; S2.2, introducing a time interval constraint based on the time factor in S2.1 to further coordinate the triggering timing of a complete emotion recognition inference, thereby achieving a dynamic balance between computing resources and recognition requirements, and ensuring that the system always maintains smooth operation in complex and ever-changing environments.

[0008] When introducing a dynamically adjustable time factor in S2.1, the following are included:

[0009] S2.11, Time Factor The adjustment is based on the system's current actual processing capacity, and this time factor... Within a predefined reasonable range Within, to smooth the average frame rate As a core indicator, By analyzing the recent The average frame processing time is used to buffer instantaneous fluctuations and more stably reflect the system load, expressed as:

[0010] ,

[0011] in, This indicates the system's current actual frame rate;

[0012] S2.12, Set a frame rate threshold The time factor at every moment The update expression is:

[0013] ,

[0014] in, For adjustment functions;

[0015] S2.13, Adjusting the function in S2.12 based on the deviation between current performance and the target. The calculation is performed and expressed as follows:

[0016] ,

[0017] Among them, when When this occurs, it indicates that the system load is high and the processing speed is reduced. For positive, Tends to increase, but not exceeding ;when At this time, it indicates that the system load is low, and there is room for more detailed analysis. Negative, Decrease, but not lower than ; The adjustment range is designed to be either adaptive or fixed.

[0018] When introducing time interval constraints in S2.2, the following are included:

[0019] S2.21. Express the time interval constraint as:

[0020] ,

[0021] in, This represents the time interval since the last complete model inference was completed. This is the current timestamp. The time when the last sentiment analysis was completed;

[0022] S2.22, Based on S2.21, the gating mechanism is formally expressed as:

[0023] ,

[0024] Among them, when When the current frame does not trigger computationally intensive full model inference, a lightweight predecessor history prediction update mechanism is enabled to generate smooth sentiment predictions; when At that time, execute a complete "emotion recognition" process, update the cache and reset the timer;

[0025] When building the predecessor history prediction and update mechanism in S3, a cache space is set. This is used to store the emotion recognition results and their contextual information for each tracked face in the most recent complete emotion recognition inferences. Each cache entry... A tuple containing sentiment category labels The probability value predicted by the model and the coordinates of the face bounding box corresponding to this recognition. , expressed as:

[0026] ,

[0027] The cache space is managed using first-in-first-out or fixed-length queues to ensure the timeliness of information and prevent outdated data from interfering with current decisions.

[0028] The initial matching in S4 includes:

[0029] S4.1 Let the set of currently detected faces be... Each face Each has its own bounding box For each detected face Calculate the center point of its bounding box. ;

[0030] S4.2, Regarding cache space Each entry in Calculate its historical center point ;

[0031] S4.3 Calculate each detected face in S4.1 and cache space in S4.2 Each entry in Euclidean distance between ;

[0032] S4.4. An adaptive threshold calculation method is used to set the distance threshold for Euclidean distance in S4.3. , expressed as:

[0033] ,

[0034] in, To smooth out control parameters; The horizontal length of the face bounding box is calculated as follows: , Let be the vertical length of the face bounding box, calculated as . ;when hour, become Candidate matches constitute the candidate set. ;

[0035] S4.5. Based on S4.4, define a comprehensive scoring function that considers both spatial proximity and the confidence level of historical predictions, expressed as:

[0036] ,

[0037] in, For normalized distance weights, As a confidence weight, the historical item with the highest score will be selected in the end. This serves as the result of the current face matching.

[0038] In S5, weighted smoothing prediction incorporates information from the entire historical queue to generate a more stable output. It employs a time-decay weighted voting mechanism: more recent historical data has higher weights. Specifically, it includes: assuming the set of possible sentiment categories in the queue is... For each category Its smoothing score is calculated as follows:

[0039] ,

[0040] ,

[0041] in, As an indicator function, when the first [item] in the queue... One history tag equals The value is 1 if it is true, and 0 otherwise. The decay coefficient controls the rate at which the weights decrease over time; ultimately, it smooths the predicted sentiment labels. It is determined by the category with the highest score.

[0042] The beneficial effects of this application lie in the introduction of an adaptive time factor adjustment mechanism based on real-time frame rate feedback. This time factor is dynamically optimized according to the current system processing load and automatically converges to the optimal value within a predefined upper and lower bound. This mechanism enables the system to adaptively adjust the inference frequency according to hardware resources and scene complexity, avoiding resource waste or response latency issues caused by fixed sampling strategies. It automatically reduces the call frequency under high load scenarios to ensure smooth system operation, and increases the call frequency under low load scenarios to achieve more refined emotion tracking. A spatiotemporal gating function is designed to transform traditional frame-by-frame dense inference into an event-driven sparse inference mode, triggering complete neural network inference only when the time interval condition is met, with other frames being quickly predicted through historical caching. This architecture reduces the call frequency of complete model inference, significantly reducing GPU computational load and power consumption. Expensive deep model inference is viewed as an "observation update" of the system's hidden state (real emotion), while low-cost spatiotemporal matching and historical weighted smoothing are viewed as "predictive recursion" based on a state transition model. This framework not only theoretically guarantees the temporal consistency of the output emotion trajectory, but more importantly, it provides a general method to significantly improve system throughput by reducing the "observation" frequency. The adaptive gating function acts as the feedback controller for this model, dynamically adjusting the "observation" sampling rate based on the system performance metric (frame rate), thus forming a stable closed-loop optimization system. This theoretical framework provides a new design paradigm and analysis tool for deploying high-performance temporal vision perception systems in resource-constrained environments. Attached Figure Description

[0043] Figure 1 This is a schematic diagram of the overall process of this application;

[0044] Figure 2 This is a schematic diagram of the predecessor history prediction update mechanism (PH-FUM) in this application;

[0045] Figure 3 The images show screenshots of the real-time frame rate and recognition results based on the 50th frame of two sample videos when PH-FUM is off, and screenshots of the real-time frame rate and recognition results based on the 50th frame of the same video when PH-FUM is on.

[0046] Figure 4 This is a schematic diagram illustrating the similarity comparison analysis between the general FER model and the model optimized using the spatiotemporal domain method in this application;

[0047] Figure 5 Based on this application Figure 3 The video samples shown differ between the general FER model and the model with added spatiotemporal optimization. Comparative analysis of real-time performance results of emotion recognition under different parameters. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to specific embodiments and accompanying drawings. It should be understood that these descriptions are merely exemplary and not intended to limit the scope of this application. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.

[0049] like Figure 1 As shown, a real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction updates includes:

[0050] S1. Acquire continuous video frames and preprocess them. Perform face detection on each frame to obtain the set of face regions in the current frame and record the current timestamp.

[0051] S2. Construct an adaptive spatiotemporal gating mechanism to control the time interval for triggering a complete emotion recognition inference. Specifically, the adaptive spatiotemporal gating mechanism includes: S2.1, introducing a dynamically adjustable time factor to control the minimum time interval for triggering a complete emotion recognition inference. This time factor is dynamically adjusted based on the system's real-time performance within a predefined reasonable range; S2.2, introducing time interval constraints based on the time factor in S2.1 to further coordinate the triggering timing of a complete emotion recognition inference, thereby achieving a dynamic balance between computing resources and recognition requirements, ensuring that the system maintains smooth operation in complex and ever-changing environments.

[0052] When introducing a dynamically adjustable time factor in S2.1, the following are included:

[0053] S2.11, Time Factor The adjustment is based on the system's current actual processing capacity, and this time factor... Within a predefined reasonable range Within, to smooth the average frame rate As a core indicator, By analyzing the recent The average frame processing time is used to buffer instantaneous fluctuations and more stably reflect the system load, expressed as:

[0054] ,

[0055] S2.12, Set a frame rate threshold The time factor at every moment The update expression is:

[0056] ,

[0057] in, For adjustment functions;

[0058] S2.13, Adjusting the function in S2.12 based on the deviation between current performance and the target. The calculation is performed and expressed as follows:

[0059] ,

[0060] Among them, when When this occurs, it indicates that the system load is high and the processing speed is reduced. For positive, Tends to increase, but not exceeding ;when At this time, it indicates that the system load is low, and there is room for more detailed analysis. Negative, Decrease, but not lower than ; The adjustment range is designed to be either adaptive or fixed.

[0061] When introducing time interval constraints in S2.2, the following are included:

[0062] S2.21. Express the time interval constraint as:

[0063] ,

[0064] in, This represents the time interval since the last complete model inference was completed. This is the current timestamp. The time when the last sentiment analysis was completed;

[0065] S2.22, Based on S2.21, the gating mechanism is formally expressed as:

[0066] ,

[0067] Among them, when When the current frame does not trigger computationally intensive full model inference, a lightweight predecessor history prediction update mechanism is enabled to generate smooth sentiment predictions; when At that time, execute a complete "emotion recognition" process, update the cache and reset the timer.

[0068] like Figure 2 As shown, S3 establishes a predecessor history prediction and update mechanism to output sentiment states in frames where the adaptive spatiotemporal gating mechanism in S2 does not perform complete sentiment recognition inference. Specifically, when establishing the predecessor history prediction and update mechanism, a cache space is set. This is used to store the emotion recognition results and their contextual information for each tracked face in the most recent complete emotion recognition inferences. Each cache entry... A tuple containing sentiment category labels The probability value predicted by the model and the coordinates of the face bounding box corresponding to this recognition. , expressed as:

[0069] ,

[0070] The cache space is managed using first-in-first-out or fixed-length queues to ensure the timeliness of information and prevent outdated data from interfering with current decisions.

[0071] S4. When the adaptive spatiotemporal gating mechanism in S2 makes a decision to perform complete emotion recognition inference on the current frame, it performs a preliminary match between each face detected in the current frame and the cached historical entries under the predecessor history prediction update mechanism in S3. Specifically, the preliminary match includes:

[0072] S4.1 Let the set of currently detected faces be... Each face Each has its own bounding box For each detected face Calculate the center point of its bounding box. ;

[0073] S4.2, Regarding cache space Each entry in Calculate its historical center point ;

[0074] S4.3 Calculate each detected face in S4.1 and cache space in S4.2 Each entry in Euclidean distance between ;

[0075] S4.4. An adaptive threshold calculation method is used to set the distance threshold for Euclidean distance in S4.3. , expressed as:

[0076] ,

[0077] in, To smooth out control parameters; The horizontal length of the face bounding box is calculated as follows: , Let be the vertical length of the face bounding box, calculated as . ;when hour, become Candidate matches constitute the candidate set. ;

[0078] S4.5. Based on S4.4, define a comprehensive scoring function that considers both spatial proximity and the confidence level of historical predictions, expressed as:

[0079] ,

[0080] in, For normalized distance weights, As a confidence weight, the historical item with the highest score will be selected in the end. This serves as the result of the current face matching.

[0081] S5. For entries that did not match successfully in S4, wait for the next complete emotion recognition inference to initialize their cached records under the predecessor history prediction update mechanism in S3. For entries that matched successfully in S4, use the emotion history queue of that face for weighted smooth prediction and update the cache. This is used to suppress instantaneous noise by considering a certain length of history, thus ultimately outputting a smoother, more stable, and reliable emotion trajectory on the timeline. Specifically, when performing weighted smooth prediction, the entire historical queue information is combined to generate a more stable output, which adopts a time decay weighted voting mechanism: the more recent the history, the higher its weight. Specifically, let the set of possible emotion categories in the queue be... For each category Its smoothing score is calculated as follows:

[0082] ,

[0083] ,

[0084] in, As an indicator function, when the first [item] in the queue... One history tag equals The value is 1 if it is true, and 0 otherwise. The decay coefficient controls the rate at which the weights decrease over time; ultimately, it smooths the predicted sentiment labels. It is determined by the category with the highest score.

[0085] To make this application easier to understand, the following examples illustrate it further.

[0086] This case study presents a real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction updates. This method employs a fusion strategy of adaptive temporal gating and prior history prediction updates, which effectively improves processing efficiency when handling real-time facial emotion recognition problems in multiple scenarios.

[0087] Data sets and evaluation metrics.

[0088] Dataset: The real-time performance of the proposed method was evaluated using two video samples captured from a real classroom environment. The first video sample was approximately 8 seconds long, containing 223 frames, with a resolution of 1280×720 pixels; the second video sample was approximately 10.5 seconds long, containing 325 frames, with a resolution of 960×544 pixels. Each video frame captured the facial expressions of approximately 25 to 30 students.

[0089] Evaluation metrics: Frames Per Second (fps) is used to measure the model's inference speed on real video streams. Average prediction similarity is used to quantify the consistency of the model's output emotion recognition results before and after introducing the PH-FUM mechanism.

[0090] Experimental procedure.

[0091] (1) A general FER model without PH-FUM mechanism (Res2Net50 used in this experiment for facial expression recognition, hereinafter referred to as the general FER model) is used to perform complete emotion recognition inference on the faces detected in each frame of the video, and the real-time recognition results and face bounding box coordinates are stored as labels.

[0092] (2) Real-time face detection and emotion recognition are performed on the same video frames using a general FER model that combines the PH-FUM mechanism. The Intersection over Union (IoU) algorithm is used to match each face in each frame. If the match is successful, it is determined whether the emotion recognition results of the two methods are consistent, and finally the similarity between the recognition results of each frame is calculated. However, it should be noted that the predicted similarity is not equal to the accuracy, nor does it indicate which model, the original model or the model using the PH-FUM mechanism, has a higher accuracy in the real environment.

[0093] (3) Comparison of PH-FUM mechanism with different maximum time parameter settings The impact on the frame rate of the general FER model. Test scenarios include... Figure 3 The video showcases a classroom scene with multiple faces and real-time emotion analysis of a single face.

[0094] Hyperparameter configuration.

[0095] Lower optimization boundary Upper optimization boundary Frame rate threshold Distance threshold Scoring function parameters and decay queue length decay coefficient .

[0096] Experimental results.

[0097] By employing the PH-FUM mechanism, which integrates data in the spatiotemporal domain, the model's real-time processing capability is significantly enhanced. Specifically, the frame rates for Sample 1 and Sample 2 are increased from 5.76 fps and 6.95 fps to 30.48 fps and 33.81 fps, respectively, representing a significant improvement compared to the performance of the general FER model without the PH-FUM mechanism. These results demonstrate that the model not only maintains high recognition accuracy but also effectively suppresses fluctuations in single-frame predictions, providing more stable and continuous recognition results.

[0098] Figure 3 Experimental results in a real classroom setting are presented, showing screenshots from the 50th frame of each video. Compared to the general FER model without the PH-FUM mechanism, the proposed method improves real-time performance by 4 to 5 times, providing a solid theoretical foundation for real-time, large-scale monitoring of students' emotional states.

[0099] Figure 4 The predicted similarity between video samples using and without the PH-FUM mechanism was compared and analyzed. The results show that after using the PH-FUM mechanism, the average predicted similarity between video sample 1 and sample 2 reached 94.21% and 94.93%, respectively, maintaining a high level of predictive consistency compared with the model without the mechanism.

[0100] Finally, Figure 5 In the experiment, the results showed that increasing It can significantly improve processing efficiency, but a balance must be maintained between detection sensitivity and computational resource utilization. However, excessively large... This could cause the model to miss transient emotional changes, while an excessively small [emotional threshold] could lead to [the model missing] these changes. This could lead to the processing of redundant frames. Therefore, the parameters , and Appropriate constraints should be imposed based on the application scenario. The PH-FUM mechanism can iteratively optimize within these constraints to determine the optimal time factor. For example, in a typical multi-face scenario (such as a classroom with approximately 30 people), the following settings should be considered: and It achieves a good balance between recognition accuracy and real-time performance. In simpler scenarios, such as single-face monitoring, the settings ( A value of 0.05 can increase FPS from 25.45 to 49.55, enhancing the model's real-time performance while accurately capturing subtle micro-expressions. This mechanism demonstrates excellent adaptability in various scenarios. Parameter adjustments only require fine-tuning based on task requirements, scene complexity, and device performance.

Claims

1. A real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction updates, characterized in that, include: S1. Acquire continuous video frames and preprocess them. Perform face detection on each frame to obtain the set of face regions in the current frame and record the current timestamp. S2. Construct an adaptive spatiotemporal gating mechanism to control the time interval for triggering a complete emotion recognition inference; S3. Construct a predecessor history prediction and update mechanism to output emotional state in frames in S2 where the adaptive spatiotemporal gating mechanism decides not to perform complete emotion recognition reasoning. S4. When the adaptive spatiotemporal gating mechanism in S2 makes a decision to perform complete emotion recognition reasoning on the current frame, each face detected in the current frame is initially matched with the cached historical entries under the predecessor history prediction update mechanism in S3. S5. For entries that did not match successfully in S4, wait for the next complete emotion recognition inference to initialize their cached records under the predecessor history prediction update mechanism in S3; for entries that matched successfully in S4, use the emotion history queue of the face to perform weighted smooth prediction and update the cache, in order to suppress instantaneous noise by considering a certain length of history, so as to finally output a smoother, more stable and reliable emotion trajectory on the timeline.

2. The real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction update as described in claim 1, characterized in that, The adaptive spatiotemporal gating mechanism constructed in S2 includes: S2.1 Introduce a dynamically adjustable time factor to control the minimum time interval for triggering a complete emotion recognition inference. This time factor is dynamically adjusted within a predefined reasonable range based on the real-time performance of the system. S2.

2. Based on the time factor in S2.1, a time interval constraint is introduced to further coordinate the triggering timing of a complete emotion recognition reasoning, thereby achieving a dynamic balance between computing resources and recognition requirements, and ensuring that the system always maintains smooth operation in complex and ever-changing environments.

3. The real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction update as described in claim 2, characterized in that, When introducing a dynamically adjustable time factor in S2.1, it includes: S2.11, Time Factor The adjustment is based on the system's current actual processing capacity, and this time factor... Within a predefined reasonable range Within, to smooth the average frame rate As a core indicator, By analyzing the recent The average frame processing time is used to buffer instantaneous fluctuations and more stably reflect the system load, expressed as: , S2.12, Set a frame rate threshold The time factor at every moment The update expression is: , in, For adjustment functions; S2.

13. Adjust the function in S2.12 based on the deviation between the current performance and the target. The calculation is performed and expressed as follows: , Among them, when When this occurs, it indicates that the system load is high and the processing speed is reduced. For positive, Tends to increase, but not exceeding ;when At this time, it indicates that the system load is low, and there is room for more detailed analysis. Negative, Decrease, but not lower than ; The adjustment range is designed to be either adaptive or fixed.

4. The real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction update as described in claim 3, characterized in that, The time interval constraint introduced in S2.2 includes: S2.

21. Express the time interval constraint as: , in, This represents the time interval since the last complete model inference was completed. This is the current timestamp. The time when the last sentiment analysis was completed; S2.

22. Based on S2.21, the gating mechanism is formally expressed as follows: , Among them, when When the current frame does not trigger computationally intensive full model inference, a lightweight predecessor history prediction update mechanism is enabled to generate smooth sentiment predictions; when At that time, execute a complete "emotion recognition" process, update the cache and reset the timer.

5. The real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction update as described in claim 2, characterized in that, When constructing the predecessor history prediction and update mechanism in S3, a cache space is set. This is used to store the emotion recognition results and their contextual information for each tracked face in the most recent complete emotion recognition inferences. Each cache entry... A tuple containing sentiment category labels The probability value predicted by the model and the coordinates of the face bounding box corresponding to this recognition. , expressed as: , The cache space is managed using first-in-first-out or fixed-length queues to ensure the timeliness of information and prevent outdated data from interfering with current decisions.

6. The real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction update as described in claim 5, characterized in that, The initial matching process in S4 includes: S4.1 Let the set of currently detected faces be... Each face Each has its own bounding box For each detected face Calculate the center point of its bounding box. ; S4.2, Regarding cache space Each entry in Calculate its historical center point ; S4.3 Calculate the number of detected faces in S4.

1. and the cache space in S4.2 Each entry in Euclidean distance between ; S4.

4. An adaptive threshold calculation method is used to set the distance threshold for the Euclidean distance in S4.

3. , expressed as: , in, To smooth out control parameters; The horizontal length of the face bounding box is calculated as follows: , Let be the vertical length of the face bounding box, calculated as ;when hour, become Candidate matches constitute the candidate set. ; S4.

5. Based on S4.4, define a comprehensive scoring function that considers both spatial proximity and the confidence level of historical predictions, expressed as: , in, For normalized distance weights, As a confidence weight, the historical item with the highest score will be selected in the end. As the result of the current face matching.

7. The real-time sentiment analysis method based on adaptive spatiotemporal gating and prior history prediction update as described in claim 6, characterized in that, In S5, when performing weighted smoothing prediction, information from the entire historical queue is incorporated to generate a more stable output. This output employs a time-decay weighted voting mechanism: the more recent the historical data, the higher its weight. Specifically, this includes: assuming the set of possible sentiment categories in the queue is... For each category Its smoothing score is calculated as follows: , , in, As an indicator function, when the first [item] in the queue... One historical tag equals The value is 1 if it is true, and 0 otherwise. The decay coefficient controls the rate at which the weights decrease over time; ultimately, it smooths the predicted sentiment labels. It is determined by the category with the highest score.