Security monitoring data compression transmission method and system based on edge intelligent analysis
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANYU HEZHONG TECH CO LTD
- Filing Date
- 2026-02-28
- Publication Date
- 2026-07-24
Smart Images

Figure CN121750867B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of data processing, specifically relating to a method and system for compressing and transmitting security monitoring data based on edge-end intelligent analysis. Background Technology
[0002] With the advancement of smart city and safe community construction, a massive number of intelligent surveillance cameras are being deployed in every corner of the city. These edge devices need to perform real-time analysis, encoding, and compression of the high-definition video data they collect locally, and then transmit it back to the cloud platform via the network. However, the hardware resources at the edge (such as CPU computing power and memory) are usually very limited and fluctuate greatly, while network bandwidth is also unstable, which poses a severe challenge to the real-time compression and transmission of video data.
[0003] Existing edge devices typically use the H.264 or H.265 standard for video compression and employ bitrate control algorithms to balance device load. Most mainstream solutions adopt PID control or fuzzy control strategies based on linear error feedback: their basic principle is to monitor the current load of the device in real time (such as the transmit buffer occupancy rate), calculate the difference between it and the target load, and then linearly adjust the quantization parameters (QP value) of the next frame based on this difference.
[0004] However, this linear adjustment mechanism based on the current error has obvious limitations in the sudden scenarios of security monitoring: on the one hand, security scenarios are highly unpredictable. When a crowd suddenly rushes into the frame, the amount of data will increase exponentially. However, the accumulation of the buffer takes time, which causes the response of the linear algorithm to lag behind the actual data burst, which can easily cause the device to freeze or lose packets. On the other hand, in order to deal with the overflow that has already occurred, the linear algorithm often increases the QP value significantly. However, when the buffer is emptied, it quickly returns to normal. This drastic parameter jump will cause the transmission bit rate to fluctuate in a sawtooth pattern, resulting in obvious and drastic fluctuations in the image quality of the monitoring screen. The image clarity jumps repeatedly between blurry and clear, which seriously affects the subsequent evidence collection and analysis results. Summary of the Invention
[0005] This invention provides a method and system for compressing and transmitting security monitoring data based on edge-end intelligent analysis, in order to solve the technical problems of linear adjustment mechanisms in security emergency scenarios, such as response lag, easy packet loss, and QP value jumps causing image quality fluctuations.
[0006] In a first aspect, the present invention provides a method for compressing and transmitting security monitoring data based on edge-end intelligent analysis, comprising the following steps:
[0007] The number of bytes occupied in the current network transmission buffer of the edge computing device is collected, as well as the macroblock motion vectors of the current frame and the previous frame of the video encoder front end;
[0008] Based on the number of bytes already occupied and the change amplitude of the macroblock motion vector, calculate the scenario data potential energy index, which represents the data burst pressure in the near future.
[0009] Based on the scene data potential energy index and the preset safety potential energy threshold, a nonlinear response gain is constructed using an exponential function. The nonlinear response gain changes nonlinearly with the scene data potential energy index.
[0010] Based on the nonlinear response gain and the difference between the current device load rate and the target load rate, the quantization parameters of the current frame are calculated and updated, and video data compression and transmission are performed based on the updated quantization parameters.
[0011] By integrating existing physical load data with incremental video feature data, a scene data potential energy index reflecting future pressure can be constructed, thereby sensing the data burst trend in advance before the buffer is filled, solving the problem of lag in response of traditional algorithms.
[0012] Furthermore, the scenario data potential energy index, which characterizes the pressure of data explosion in the near future, is calculated using the following formula:
[0013] ;
[0014] In the formula, This represents the potential energy index of the scene data. This indicates the number of bytes currently occupied in the network transmit buffer. This indicates the current physical maximum capacity of the network send buffer. This represents the average motion vector magnitude of the current frame. This represents the average motion vector magnitude of the previous frame. Indicates the reference value for changes in the baseline motion. Indicates the weighting coefficient. Represents the natural logarithm function. This indicates taking the absolute value.
[0015] By processing motion change characteristics using logarithmic functions, the magnitude of changes in the intensity of motion in the scene can be captured, causing the potential energy index of the scene data to rise rapidly in the early stages of data bursts, thus enabling accurate prediction of pressure.
[0016] Furthermore, the nonlinear response gain is constructed using an exponential function, achieved through the following relationship:
[0017] ;
[0018] In the formula, Indicates the gain of the nonlinear response. This represents the basic adjustment coefficient. Indicates the sensitivity factor. This represents the preset safety potential energy threshold. This represents the potential energy index of the scene data. Represented by natural constant An exponential function with base 0.
[0019] By constructing a nonlinear relationship through an exponential function, the adjustment intensity is gradual in non-emergency situations, but explodes when pressure is anticipated, overcoming the lag and oscillation of linear adjustment.
[0020] Furthermore, calculating and updating the quantization parameters of the current frame includes calculating temporary quantization parameters, which are obtained through the following formula:
[0021] ;
[0022] In the formula, This represents the temporary quantization parameter obtained from the calculation. This indicates the quantization parameters used in the previous frame. Indicates the gain of the nonlinear response. Indicates the current device load rate. This indicates the target load rate.
[0023] By introducing a dynamically changing nonlinear response gain, the adjustment of quantization parameters can maintain stable image quality under normal circumstances and suppress data volume in case of emergencies, thus eliminating the breathing effect of the monitoring screen.
[0024] Furthermore, calculating and updating the quantization parameters for the current frame also includes boundary constraints on temporary quantization parameters, which are achieved through the following relationship:
[0025] ;
[0026] In the formula, This indicates the quantization parameters ultimately used in the current frame. and These represent the maximum and minimum values of the quantization parameters specified in the video coding standard, respectively. This represents the function that takes the minimum value. This represents the function that takes the maximum value.
[0027] By imposing strict boundary restrictions, the calculated quantization parameters are prevented from exceeding the range allowed by the coding standard, thus ensuring the stability and reliability of the system operation.
[0028] Furthermore, methods for compressing and transmitting security monitoring data also include:
[0029] After compressing and transmitting video data based on the updated quantization parameters, it is determined whether the potential energy index of the scene data is greater than a preset warning line.
[0030] If the potential energy index of the scene data is determined to be greater than the preset warning line, then non-key frames with motion amplitudes smaller than the preset amplitude are discarded first, based on the size of the macroblock motion vector.
[0031] By combining a proactive frame dropping strategy with the potential energy index of scene data, the transmission of key moving targets can be prioritized under extreme congestion conditions, thereby enhancing the practical value of security monitoring.
[0032] Furthermore, based on the magnitude of the macroblock motion vector, non-keyframes with motion amplitudes smaller than a preset amplitude are preferentially discarded, including the following steps:
[0033] Identify the frame type of the video frame to be transmitted;
[0034] If the current video frame to be transmitted is determined to be an I-frame, then the current video frame to be transmitted is retained and transmitted first.
[0035] If the current video frame to be transmitted is determined to be a P-frame, and the average motion vector amplitude corresponding to the P-frame is less than a preset motion threshold, then the P-frame is discarded as a background frame.
[0036] Furthermore, the number of bytes currently occupied in the network transmission buffer of the edge computing device is collected, including: reading the transmission queue length of the network interface as the number of bytes currently occupied in the network transmission buffer through the kernel interface or socket interface of the operating system.
[0037] Furthermore, the acquisition of macroblock motion vectors from the current frame and the previous frame of the video encoder front end includes: before the video data enters entropy coding, using the encoder's motion estimation module to extract the motion vectors of all macroblocks in the current frame and calculate the average amplitude of the motion vectors of all macroblocks in the current frame, as well as obtaining the stored average motion vector amplitude of the previous frame.
[0038] Secondly, the present invention provides a security monitoring data compression and transmission system based on edge intelligent analysis, including a memory and a processor. The memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned security monitoring data compression and transmission method based on edge intelligent analysis is implemented.
[0039] The beneficial effects are as follows: This invention introduces the motion change trend of video content as a feedforward signal to construct a scene data potential energy index that reflects the pressure of future data bursts. Based on the scene data potential energy index, a nonlinear response gain is constructed using an exponential function, allowing for early intervention and control at the initial stage of data bursts. This mechanism achieves extremely rapid response and crisis prediction, enabling it to detect data surges earlier than physical buffers, thus preventing equipment crashes; in non-emergency situations, it avoids drastic changes in image quality caused by overreaction, eliminates the breathing effect, and ensures the transmission quality and system stability of security monitoring data. Attached Figure Description
[0040] Figure 1 A flowchart of a security monitoring data compression and transmission method based on edge-based intelligent analysis;
[0041] Figure 2 Comparison chart of curves for predicting and analyzing data pressure in a given scenario;
[0042] Figure 3 This is a comparison chart of QP regulation response. Detailed Implementation
[0043] refer to Figure 1 The security monitoring data compression and transmission method based on edge intelligent analysis includes the following steps:
[0044] S101: Collect the number of bytes occupied in the current network transmission buffer of the edge computing device, as well as the macroblock motion vectors of the current frame and the previous frame of the video encoder front end.
[0045] In step S101, the edge computing device collects multi-dimensional status data in real time through the underlying driver interface and the status callback interface of the video encoder.
[0046] Specifically, for data reflecting the current physical load of the device, the send queue length of the network interface is read through the operating system's kernel interface (such as the / proc / net / dev file in Linux or the SIOCINQ ioctl command in the Socket API). Here, the definition is... This represents the number of bytes currently occupied in the network transmit buffer, and also retrieves the maximum physical capacity of the current network transmit buffer, denoted as . .
[0047] For trend data reflecting the characteristics of the video stream source, the motion vectors of macroblocks are directly extracted using the motion estimation module at the encoder front end before the video data enters entropy coding. Specifically, the average magnitude of the motion vectors of all macroblocks in the current frame (i.e., the average motion vector magnitude of the current frame) is calculated and denoted as... Simultaneously, record the average motion vector magnitude of the previous frame, denoted as... The magnitude of the average motion vector in the current frame directly determines the encoding difficulty and the amount of data generated for the current image, while the rate of change of the average motion vector magnitude in the current frame relative to the average motion vector magnitude in the previous frame indicates the acceleration of data growth.
[0048] For example, in a security monitoring scenario, the device detects that the maximum physical capacity of the current network transmission buffer is 10MB, and the number of bytes currently occupied in the current network transmission buffer is 2MB. Meanwhile, the average motion vector amplitude of the previous frame, obtained through the video encoder interface, is 5 pixels / frame, while in the current frame, due to the presence of running people in the frame, the average motion vector amplitude increases to 15 pixels / frame.
[0049] By collecting existing physical load data and source data of video features in real time, an accurate and comprehensive data foundation can be provided for subsequent stress prediction, ensuring the real-time nature of system perception.
[0050] S102: Calculate the scenario data potential energy index, which represents the data burst pressure in the near future, based on the number of bytes already occupied and the change amplitude of the macroblock motion vector.
[0051] Step S102 constructs an index that can detect pressure in advance. This index is used to assess the potential for a data explosion in the current scenario in the near future, and its calculation formula is as follows:
[0052] ;
[0053] In the formula, This represents the potential energy index of the scene data. This indicates the number of bytes currently occupied in the network transmit buffer. This represents the maximum physical capacity of the current network transmit buffer, which is a constant. , This represents the average motion vector magnitude of the current frame. This represents the average motion vector magnitude of the previous frame. Taking the absolute value indicates the magnitude of change in the intensity of motion in the image. This represents a reference value for the change in baseline motion. It is a constant used to eliminate dimensions and normalize, for example... =10.0, This represents the weighting coefficient, and its value range is... Preferably, Take the smaller value, for example =0.2, so as to give the latter item a higher weight, thereby reflecting the predictive characteristics. The constant 1 is added to the natural logarithm function to ensure that the argument is always greater than or equal to 1, thus guaranteeing that the calculation result is always greater than or equal to 0.
[0054] In one example, continuing from the data in S101: [The following is a list of known data points.] ;set up .
[0055] First, calculate the load term: Then calculate the motion change term: .
[0056] Substitute the relational expression into the potential energy index of the data in the calculation scenario:
[0057] .
[0058] As can be seen, although the current buffer occupancy rate is only 0.2, the scene data potential energy index has risen to about 0.6 under the influence of drastic changes in motion, which indicates that the system has anticipated the upcoming data pressure.
[0059] By constructing a scene data potential energy index, the data burst trend caused by drastic changes in the scene can be captured before the buffer is filled, thus enabling early perception of network pressure.
[0060] S103: Based on the scene data potential energy index and the preset safety potential energy threshold, a nonlinear response gain is constructed using an exponential function, wherein the nonlinear response gain changes nonlinearly with the scene data potential energy index.
[0061] In step S103, the adjustment force of the compression parameters is calculated based on the potential energy index of the scene data. Here, an exponential function is introduced, and its relationship is shown below:
[0062] ;
[0063] In the formula, Indicates the gain of the nonlinear response; This represents the basic adjustment coefficient, which is an empirical constant, for example... =0.5 represents the adjustment step size of the system in a steady state; This represents the sensitivity factor, which is a constant, for example... =2.0, used to control the rate of nonlinear amplification; This represents the preset safety potential energy threshold, which is a constant, for example... =0.4), representing the pressure level at which the system can operate comfortably; For the natural constant An exponential function with base 0.
[0064] In one example, following the calculation results of S102, it is known that... ;set up .
[0065] Calculation of the index: .
[0066] Substitute into the formula to calculate the nonlinear response gain: = .
[0067] In another example, assuming the scene is stable, It is only 0.3, which is less than The exponential part is ,at this time .
[0068] As can be seen from the comparison, when the potential energy index of the scene data exceeds the safe potential energy threshold, the nonlinear response gain will increase rapidly, which means that the adjustment force is significantly enhanced.
[0069] By constructing a nonlinear response gain using an exponential function, the system maintains a fine-tuning mode to preserve image quality when the pressure is low, and can quickly intervene and adjust with explosive force when the pressure is anticipated, overcoming the lag of traditional algorithms.
[0070] S104: Calculate and update the quantization parameters of the current frame based on the nonlinear response gain and the difference between the current device load rate and the target load rate, and perform video data compression and transmission based on the updated quantization parameters.
[0071] In step S104, the quantization parameters (QP values) of the video coding are dynamically adjusted using the calculated nonlinear response gain, and boundary constraints are applied. The relationship is shown below:
[0072] ;
[0073] ;
[0074] In the formula, This indicates the quantization parameters ultimately used in the current frame. This indicates the quantization parameters used in the previous frame. This represents the quantization parameters obtained through calculation. This indicates the current device load rate, which can be directly taken from step S101. Or, combined with CPU utilization, Indicates the target load rate, for example =0.7 means that we want the buffer to be maintained at around 70%. These represent the maximum and minimum values of the quantization parameters specified by the video coding standard. For example, in the H.264 standard, =51, =0.
[0075] In one example, following the calculation result of step S103, it is known that... , set up , ;set up .
[0076] First, calculate the load error: .
[0077] Calculate the temporary quantization parameters: .
[0078] Due to the current low device load, the system tends to reduce the QP value to improve image quality.
[0079] In another example, if the number of bytes occupied in the current network transmit buffer suddenly increases, causing the current device load rate to increase to 0.9, and the scene data potential index is extremely high, causing the nonlinear response gain to rise to 3.0.
[0080] but .
[0081] In this invention, the nonlinear response gain becomes very large due to intense motion. If the potential energy exponent of the scene data further increases, causing the nonlinear response gain to increase to 10.0, then... This means that even if the current load is only slightly exceeded, the QP value will increase rapidly due to the large nonlinear response gain, thereby suppressing the upcoming data surge.
[0082] Finally, perform boundary processing: (Use after rounding).
[0083] Furthermore, step S104 also includes data stream shaping and post-processing. If, after adjustment, the predicted scene data potential index still exceeds the preset warning line, the system will initiate an active frame dropping mechanism. However, this is not random packet dropping; instead, based on the macroblock motion vector extracted in step S101, non-critical frames with small motion amplitudes are prioritized for dropping. Specifically, the frame type of the current video frame to be transmitted is determined. If the current video frame to be transmitted is determined to be an I-frame (critical frame), it is retained and transmitted first to ensure the integrity and recoverability of the image. If the current video frame to be transmitted is determined to be a P-frame (predicted frame), and the average motion vector amplitude corresponding to the P-frame is less than the preset motion threshold, the P-frame is considered a background frame with little contribution to the dynamics of the image and is discarded. Through this differentiated packet dropping strategy, key activity information in the video can be preserved to the greatest extent possible even when bandwidth is extremely limited.
[0084] In one example Figure 2 The scene data pressure prediction analysis curve is displayed. Figure 2In the process, the sudden motion characteristics of the screen rise first at time T=15; due to the time consumption of physical transmission, the accumulation of the transmission buffer, representing the prior art, is significantly delayed; while the scene potential energy index, representing the present invention, is highly synchronized with the sudden motion characteristics of the screen, and rises immediately at time T=15, achieving millisecond-level prediction; and falls back quickly after the data source disappears.
[0085] like Figure 3 It can be seen that the traditional linear adjustment method is slow to respond and exhibits violent oscillations in the later stages, while the nonlinear potential energy control of this invention benefits from the prediction of the potential energy index of the scene data and intervenes in advance at T=15. The whole process presents a smooth trapezoidal structure, proving that this invention provides higher quality and more stable video quality while ensuring smooth transmission.
[0086] By using dynamic parameter correction and boundary constraints based on nonlinear gain, combined with an active frame dropping strategy based on frame type and motion characteristics, precise control of the video encoding process can be achieved, which avoids buffer overflow and ensures the smoothness and clarity of the video.
[0087] An embodiment of the security monitoring data compression and transmission system based on edge intelligent analysis provided by this invention:
[0088] The security monitoring data compression and transmission system based on edge intelligent analysis includes a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the aforementioned security monitoring data compression and transmission method based on edge intelligent analysis.
[0089] The security monitoring data compression and transmission system based on edge intelligent analysis also includes other components well known to those skilled in the art, such as communication interfaces. Their settings and functions are known in the art and will not be described in detail here.
[0090] In addition, in the description of this specification, "multiple" means at least two, such as two, three or more, etc., unless otherwise expressly and specifically defined.
Claims
1. A method for compressing and transmitting security monitoring data based on edge-end intelligent analysis, characterized in that, Includes the following steps: The number of bytes occupied in the current network transmission buffer of the edge computing device is collected, as well as the macroblock motion vectors of the current frame and the previous frame of the video encoder front end; Based on the number of bytes already occupied and the magnitude of the change in the macroblock motion vector, calculate the scenario data potential energy index, which characterizes the data burst pressure in the near future. , ; In the formula, This indicates the number of bytes currently occupied in the network transmit buffer. This indicates the current physical maximum capacity of the network send buffer. This represents the average motion vector magnitude of the current frame. This represents the average motion vector magnitude of the previous frame. Indicates the reference value for changes in the baseline motion. Indicates the weighting coefficient. Represents the natural logarithm function. Indicates taking the absolute value; Based on the scenario data potential energy index and the preset safety potential energy threshold, a nonlinear response gain is constructed using an exponential function. , ; In the formula, This represents the basic adjustment coefficient. Indicates the sensitivity factor. Indicates the preset safety potential energy threshold Represented by natural constant The nonlinear response gain is an exponential function with base 0, and it changes nonlinearly with the potential energy exponential of the scene data. Based on the nonlinear response gain and the difference between the current device load rate and the target load rate, the quantization parameters of the current frame are calculated and updated, and video data compression and transmission are performed based on the updated quantization parameters.
2. The security monitoring data compression and transmission method based on edge intelligent analysis according to claim 1, characterized in that, Calculating and updating the quantization parameters for the current frame includes calculating temporary quantization parameters, which are obtained using the following formula: ; In the formula, This represents the temporary quantization parameter obtained from the calculation. This indicates the quantization parameters used in the previous frame. Indicates the gain of the nonlinear response. Indicates the current device load rate. This indicates the target load rate.
3. The security monitoring data compression and transmission method based on edge intelligent analysis according to claim 2, characterized in that, Calculating and updating the quantization parameters for the current frame also includes boundary constraints on temporary quantization parameters, which are achieved through the following relationship: ; In the formula, This indicates the quantization parameters ultimately used in the current frame. and These represent the maximum and minimum values of the quantization parameters specified in the video coding standard, respectively. This represents the function that takes the minimum value. This represents the function that takes the maximum value.
4. The security monitoring data compression and transmission method based on edge-end intelligent analysis according to claim 1, characterized in that, Security monitoring data compression and transmission methods also include: After compressing and transmitting video data based on the updated quantization parameters, it is determined whether the potential energy index of the scene data is greater than a preset warning line. If the potential energy index of the scene data is determined to be greater than the preset warning line, then non-key frames with motion amplitudes smaller than the preset amplitude are discarded first, based on the size of the macroblock motion vector.
5. The security monitoring data compression and transmission method based on edge-end intelligent analysis according to claim 4, characterized in that, Based on the size of the macroblock motion vector, non-key frames with motion amplitudes smaller than a preset amplitude are discarded preferentially, including the following steps: Identify the frame type of the video frame to be transmitted; If the current video frame to be transmitted is determined to be an I-frame, then the current video frame to be transmitted is retained and transmitted first. If the current video frame to be transmitted is determined to be a P-frame, and the average motion vector amplitude corresponding to the P-frame is less than a preset motion threshold, then the P-frame is discarded as a background frame.
6. The security monitoring data compression and transmission method based on edge intelligent analysis according to claim 1, characterized in that, Collect the number of bytes currently occupied in the network transmission buffer of the edge computing device, including: reading the transmission queue length of the network interface through the kernel interface or socket interface of the operating system as the number of bytes currently occupied in the network transmission buffer.
7. The security monitoring data compression and transmission method based on edge-end intelligent analysis according to claim 1, characterized in that, Acquire macroblock motion vectors from the current frame and the previous frame of the video encoder front end, including: before the video data enters entropy coding, extracting the motion vectors of all macroblocks in the current frame using the encoder's motion estimation module and calculating the average amplitude of the motion vectors of all macroblocks in the current frame, and obtaining the stored average motion vector amplitude of the previous frame.
8. A security monitoring data compression and transmission system based on edge-end intelligent analysis, characterized in that, It includes a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the security monitoring data compression and transmission method based on edge intelligent analysis as described in any one of claims 1-7 is implemented.