Long-term violation video evidence storage method adopting hierarchical queues
By adopting a hierarchical queue storage method, the problem of high computing resources consumption and poor real-time performance in storing long-term videos is solved, and efficient and real-time video storage is achieved to ensure the integrity and reliability of the video.
Patent Information
- Application Number
- CN202311556127.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-21
- Publication Date
- 2025-05-23
AI Technical Summary
When storing long-term videos, the prior art consumes large computing resources and poor real-time performance, making it difficult to meet engineering scenarios with high real-time performance requirements.
Using the storage method of hierarchical queues, the sampling and storage of video frames is achieved by defining multi-level queues, including the capacity and sampling rate of each level queue. The sampling rate of each level queue is the product of the sampling rates of all previous levels of queues, ensuring continuous storage of video frames.
It effectively reduces the consumption of computing resources, improves real-time performance, and can efficiently store long-term video information to ensure the integrity and reliability of the video.
Smart Images

Figure CN120029520A_ABST
Abstract
Description
Technical Field
[0001] The invention specifically relates to a long-term traffic violation video evidence storage method using a hierarchical queue, and belongs to the technical field of traffic violation detection. Background Art
[0002] In many engineering and technical fields, it is necessary to store and manage videos over a long period of time. For example, in the field of traffic management, it is necessary to monitor vehicle violations in real time and preserve driving videos as evidence of violations for a long time. Traditional methods for storing videos over such a long period of time include: fixed sampling, storing frames on a large disk, and synthesizing frames into several short videos and storing them on disk. However, these methods are difficult to be effectively applied to engineering scenarios with high real-time requirements: 1. Fixed sampling, usually a fixed sampling rate is set manually for sampling and storage, and the sampling rate is difficult to control accurately. If the sampling rate is set too small, when the video span is large, a large number of images will need to be stored, and for many application scenarios, a large part of these images may be useless. In this case, the sampling rate will consume a lot of computing power in vain, occupy a lot of space, and lead to poor real-time performance; then, conversely, if the sampling rate is set too large, it is very likely that useful images will be omitted and not stored, resulting in inaccurate, incomplete, and unreliable subsequent analysis results; Second, the frames are stored on a large disk. Similarly, when the video span is large, a large number of images need to be stored on the same disk, and a large amount of disk space is occupied, which affects the computer performance to varying degrees and leads to poor real-time performance. 3. Combining the frames into several short videos and storing them on disk still has the above problems. Summary of the invention
[0003] The present invention aims to solve the technical problems of the prior art in storing long-term videos, such as large consumption of computing resources and poor real-time performance, and proposes a long-term violation video evidence storage method using a hierarchical queue.
[0004] In order to achieve the above technical objectives, the following technical solutions are proposed: The first purpose of the technical solution is to provide: a method for storing long-term traffic violation video evidence using a hierarchical queue, characterized in that it includes the following steps: S1: define a multi-level queue, including defining the capacity and sampling rate of each level of the multi-level queue; Wherein, an n-level queue for storing the video to be stored is defined, n is the minimum number of levels that can be satisfied by storing all frame images of the video to be stored under the conditions of determined capacity and sampling rate, and n is an integer not less than 2; each level of the multi-level queue is arranged in order of precedence, with the queue arranged at the front as the first-level queue and the queue arranged at the end as the last-level queue; Each queue level in a multi-level queue includes three definable properties: capacity, storage location, and sampling rate; The sampling rate refers to how many frames of images are sampled at a corresponding queue, and the sampling rate of each level of queue is ≥1, and the sampling rate of the first level queue is 1; the storage location includes a computer storage medium.
[0005] S2: Determine whether the multi-level queue meets the requirements for evidence synthesis of violation videos; S21: Calculate the video frame number span that can be stored in each level of queues, and obtain the sum of the video frame number spans that can be stored in each level of queues. The video frame number span is equal to the product of the cumulative multiplication of the sampling rates of all queues arranged before the corresponding queue and the capacity of the queue at this level; S22: Compare the obtained sum value with the entire frame number span of the video to be stored. If the sum value is greater than or equal to the entire frame number span of the video to be stored, the defined multi-level queue is sufficient to store the entire frame number span of the video to be stored, that is, the multi-level queue satisfies the evidence synthesis of the violation video. If the sum value is less than the entire frame number span of the video to be stored, redefine the multi-level queue, that is, adjust the capacity and / or sampling rate in the multi-level queue until the multi-level queue is sufficient to store the entire frame number span of the video to be stored; S3: Counting the input violation images for each level of the multi-level queue; S4: continuously storing the input violation image according to the sampling rate of the corresponding level queue; S5: Determine whether the storage capacity reaches the capacity of the corresponding level queue itself; When the storage capacity reaches the capacity of the corresponding queue, determine whether the corresponding queue has a queue at the next level; if yes, remove the earliest frame of violation image stored in the corresponding queue and transfer it to the queue at the next level; if no, directly remove the earliest frame of violation image stored in the corresponding queue; When the storage amount does not reach the capacity of the corresponding level queue itself, step S4 is repeated.
[0006] The second objective of the present technical solution is to provide: a computer-readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the steps of the above-mentioned method for storing long-term traffic violation video evidence using a hierarchical queue.
[0007] The third objective of the present technical solution is to provide: an information data processing terminal that adopts a long-term violation video evidence storage method using a hierarchical queue.
[0008] The beneficial technical effects brought about by adopting this technical solution are: 1. The present invention adopts a hierarchical queue to realize the storage of long-term violation video evidence, solving the technical problems of the prior art in storing long-term videos, such as large consumption of computing resources and poor real-time performance; Second, in the present invention, since the sampling rate of each level of queue is the product of the sampling rates of all previous levels of queues, the hierarchical queue can store long-term video information, which makes up for the shortcomings of the prior art in storing videos with a long time span, that is, the storage method in the present invention has the advantage of long-term storage capacity; 3. In the present invention, the number of queue levels, the capacity of each queue level, the sampling rate and the storage location can be dynamically and flexibly configured according to the computer hardware conditions and application scenario requirements in actual applications, so that the storage requirements of various long-term videos in actual applications can be met to the greatest extent. The advantages brought by dynamic configuration are as follows: 1) Combined control of coarse and fine granularity: The sampling rate of each level of the hierarchical queue is set as needed. By adjusting the sampling rate of each level of the queue, coarse and fine granularity control of sampling and storage in different time periods can be achieved, thereby avoiding the technical problem that the existing technology uses a fixed sampling rate to sample, which consumes a lot of computing power and occupies a lot of space in vain, resulting in poor real-time performance when the set sampling rate is too small; at the same time, it avoids the existing technology using a fixed sampling rate to sample, and when the set sampling rate is too large, important images are omitted, making the subsequent analysis results more accurate, complete and reliable; 2) Saving storage space: Compared with the fixed sampling method in the prior art, the present invention can flexibly set the capacity of each level of the hierarchical queue according to the actual application scenario, thereby controlling the number of video frames to be stored, thereby greatly reducing the waste of unnecessary storage space and effectively saving storage space; 3) Higher computer performance and real-time performance: The storage location of each level of queue can also be configured according to actual needs. It can be set to be stored in storage media such as memory or disk to avoid the technical problem of poor computer performance and poor real-time performance caused by storing all video frames in the same medium in the existing technology; In summary, the storage method using hierarchical queues provided by the present invention consumes less computing resources and has high real-time performance when storing long-term videos. It can not only improve the efficiency of video storage, but also ensure the integrity and reliability of the video, thereby providing more efficient and reliable technical support for the fields of justice, security, transportation, and oil drilling violation identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1A structural diagram (I) of a hierarchical storage queue for storing long-term videos in the present invention; Figure 2 A structural diagram (II) of a hierarchical storage queue for storing long-term videos in the present invention; Figure 3 It is a flow chart of the long-term traffic violation video evidence storage method using a hierarchical queue in the present invention; DETAILED DESCRIPTION
[0010] The following is a clear and complete description of the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0011] Example 1 This embodiment provides: a hierarchical queue for storing long-term videos, the structure of which is as follows: Define an n-level queue for storing the video to be stored, where n is the minimum number of levels that can be satisfied by storing all frame images of the video to be stored under the conditions of determined capacity and sampling rate, and n is an integer ≥ 2; In the n-level queue, each level of queue is arranged in order, and the queue arranged at the front is regarded as the first-level queue, and the queue arranged at the end is regarded as the last-level queue. For any q-level queue other than the first-level queue and the last-level queue, the queues before and after it are respectively regarded as the first-level queue and the last-level queue of the q-level queue (such as Figure 1 shown); Each level of the n-level queue includes three definable properties: capacity, storage location and sampling rate, wherein the sampling rate refers to how many frames of images are sampled at a time for the corresponding queue, and the sampling rate of each level of queue is ≥1, and the sampling rate of the first queue is generally 1; the storage location includes computer storage media such as memory and disk.
[0012] Then, before using the n-level queue to store the video, it is necessary to determine whether the defined n-level queue is sufficient to store the entire frame number span of the video to be stored. The specific determination method is: 1) Calculate the span of video frame numbers that can be stored in queues at each level, specifically: the product of the sampling rates of all queues arranged in front of the corresponding queue * the capacity of the queue at this level; it can be seen that the actual sampling rate of each queue is the product of the sampling rates of all queues in front of it; 2) The calculated sum of the spans of video frame numbers that can be stored in queues at all levels; 3) Determine whether the sum value obtained in step S2 is not less than the entire frame number span of the video to be stored. If so, the defined n-level queue is sufficient to store the entire frame number span of the video to be stored; otherwise, adjust the capacity and / or sampling rate of the n-level queue until the n-level queue is sufficient to store the entire frame number span of the video to be stored; Finally, for any queue q in the above n-level queues, count the input images. Whenever the count reaches the sampling rate of queue q, queue q stores the current frame. When the storage capacity reaches the capacity of queue q itself, determine whether queue q has a queue at the next level. If so, remove the earliest frame of image stored in queue q and pass it to the queue at the next level. If not, directly remove the earliest frame of image stored in queue q.
[0013] Example 2 This embodiment provides a long-term violation video evidence storage method using a hierarchical queue for the application of the hierarchical queue in Embodiment 1, wherein the storage of violation evidence in the field of oil drilling is taken as an example to explain in detail how the hierarchical queue specifically stores long-term videos. In addition, in the storage of violation evidence in the field of oil drilling, each violation needs to be synthesized as evidence of the violation, and the synthesized video requires all frame images from the occurrence to the end of the violation. The duration of some violation-related videos is relatively long. The storage method can be used to store these violation images under the conditions of low computing power consumption, strong real-time performance, and high efficiency.
[0014] The specific steps include: 1) Assuming that the duration of a traffic violation video exceeds 2 hours and the frame rate is 10 frames per second, 10 * 60 * 60 * 2 = 72,000 frames of traffic violation images need to be stored, that is, the entire frame number span of the video to be stored; 2) Take n=3, that is, define a three-level queue, which is recorded as level 0 queue, level 1 queue, and level 2 queue in order of arrangement. The first level 0 queue is the first queue, and the last level 2 queue is the last queue. The level 0 queue and the level 2 queue are the first and last queues of the level 1 queue respectively (such as Figure 2 shown); 3) The capacities of the level 0 queue, level 1 queue, and level 2 queue in the three-level queue are defined as 700, 700, and 700, respectively, and the sampling rates are defined as 1, 10, and 10, respectively. Then, a total of 1*700+1*10*700+1*10*10*700=77700 frames of images can be stored, that is, the total value of the span of the video frame number to be stored is obtained; 4) By comparing the entire frame number span of the video to be stored with the sum of the frame number spans of the video to be stored, it is known that the sum of the frame number spans of the video to be stored obtained in step S3 can satisfy the evidence synthesis of the above 2h traffic violation video; 5) Next, we will explain how the three-level queue implements the storage of the 2-hour traffic violation video: For the level 0 queue: the input violation images are counted, and the sampling rate is 1. Therefore, the level 0 queue will continue to store the input violation images frame by frame. When the storage capacity reaches the level 0 queue's own capacity of 700, it is determined that the level 0 queue has a next level queue - the level 1 queue. Therefore, the earliest frame of the violation image stored in the level 0 queue is removed and transferred to the level 1 queue. For the first-level queue: the input violation images are counted, and the sampling rate is 10. Whenever the input violation image count reaches 10, the first-level queue stores the current frame. When the storage capacity reaches the capacity of the first-level queue itself, 700, it is determined that the first-level queue has a next-level queue, the second-level queue. Therefore, the earliest frame of the violation image stored in the first-level queue is removed and transferred to the second-level queue. For the Level 2 queue: the input violation images are counted with a sampling rate of 10. Whenever the input violation image count reaches 10, the Level 2 queue stores the current frame. When the storage capacity reaches the Level 2 queue's own capacity of 700, it is determined that the Level 2 queue has no next queue. Therefore, the earliest frame of the violation image stored in the Level 2 queue is directly removed.
[0015] Example 3 This embodiment provides: a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned method for storing long-term traffic violation video evidence using a hierarchical queue are implemented.
[0016] Example 4 This embodiment provides: an information data processing terminal of a long-term traffic violation video evidence storage method using a hierarchical queue.
[0017] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described with reference to the above embodiment, it is still possible for a person skilled in the art to modify the technical solutions described in the above embodiment or to replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A long-term traffic violation video evidence storage method using a hierarchical queue, It is characterized in that The steps include: S1: define a multi-level queue, including defining the capacity and sampling rate of each level of the multi-level queue; S2: Determine whether the multi-level queue meets the requirements for evidence synthesis of violation videos; S21: Calculate the span of video frame numbers that can be stored in queues at each level, and obtain the total value of the span of video frame numbers that can be stored in queues at each level; S22: Compare the obtained sum value with the entire frame number span of the video to be stored. If the sum value is greater than or equal to the entire frame number span of the video to be stored, the defined multi-level queue is sufficient to store the entire frame number span of the video to be stored, that is, the multi-level queue satisfies the evidence synthesis of the violation video. If the sum value is less than the entire frame number span of the video to be stored, redefine the multi-level queue, that is, adjust the capacity and / or sampling rate in the multi-level queue until the multi-level queue is sufficient to store the entire frame number span of the video to be stored; S3: Counting the input violation images for each level of the multi-level queue; S4: continuously storing the input violation image according to the sampling rate of the corresponding level queue; S5: Determine whether the storage capacity reaches the capacity of the corresponding level queue itself; When the storage capacity reaches the capacity of the corresponding queue, determine whether the corresponding queue has a queue at the next level; if yes, remove the earliest frame of violation image stored in the corresponding queue and transfer it to the queue at the next level; if no, directly remove the earliest frame of violation image stored in the corresponding queue; When the storage amount does not reach the capacity of the corresponding level queue itself, step S4 is repeated.
2. The long-term traffic violation video evidence storage method using a hierarchical queue according to claim 1, It is characterized in that In the multi-level queue definition, an n-level queue for storing the video to be stored is defined, where n is the minimum number of levels that can be satisfied by storing all frame images of the video to be stored under the conditions of determined capacity and sampling rate, and n is an integer not less than 2; Each level of queues in the multi-level queue is arranged in order of priority, with the queue arranged at the front as the first-level queue and the queue arranged at the end as the last-level queue.
3. The long-term traffic violation video evidence storage method using a hierarchical queue according to claim 2, It is characterized in that Each queue level in the multi-level queue includes three definable attributes: capacity, storage location, and sampling rate; The sampling rate refers to how many frames of images are sampled at a corresponding queue, and the sampling rate of each level of queue is ≥1, and the sampling rate of the first level queue is 1; the storage location includes a computer storage medium.
4. The long-term traffic violation video evidence storage method using a hierarchical queue according to claim 1, Features: In step S21, the video frame number span is equal to the product of the cumulative multiplication of the sampling rates of all queues arranged before the corresponding queue and the capacity of the queue at this level.
5. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method for storing long-term traffic violation video evidence using a hierarchical queue as described in any one of claims 1 to 4 are implemented.
6. An information data processing terminal for the long-term illegal video evidence storage method using a hierarchical queue according to any one of claims 1-4.