CN113132742B - Queue-based double-buffer AI video transmission method and related equipment - Google Patents
Queue-based double-buffer AI video transmission method and related equipment Download PDFInfo
- Publication number
- CN113132742B CN113132742B CN202110353455.1A CN202110353455A CN113132742B CN 113132742 B CN113132742 B CN 113132742B CN 202110353455 A CN202110353455 A CN 202110353455A CN 113132742 B CN113132742 B CN 113132742B
- Authority
- CN
- China
- Prior art keywords
- queue
- video stream
- video
- buffer
- time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000005540 biological transmission Effects 0.000 title claims abstract description 141
- 238000000034 method Methods 0.000 title claims abstract description 73
- 238000013473 artificial intelligence Methods 0.000 claims abstract description 60
- 238000003860 storage Methods 0.000 claims abstract description 19
- 238000004422 calculation algorithm Methods 0.000 claims description 14
- 238000004891 communication Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 7
- 230000009977 dual effect Effects 0.000 claims description 2
- 230000000977 initiatory effect Effects 0.000 claims 1
- 238000005516 engineering process Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 10
- 238000012544 monitoring process Methods 0.000 description 5
- 230000003139 buffering effect Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/21—Server components or server architectures
- H04N21/218—Source of audio or video content, e.g. local disk arrays
- H04N21/21805—Source of audio or video content, e.g. local disk arrays enabling multiple viewpoints, e.g. using a plurality of cameras
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/21—Server components or server architectures
- H04N21/218—Source of audio or video content, e.g. local disk arrays
- H04N21/2181—Source of audio or video content, e.g. local disk arrays comprising remotely distributed storage units, e.g. when movies are replicated over a plurality of video servers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/231—Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/23418—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The invention provides a queue-based double-buffer AI video transmission method, which comprises the following steps: s1, acquiring a video stream acquired in real time; s2, storing the video stream into a first queue cache region, carrying out artificial intelligence recognition on the video stream while storing, and judging whether a recognition target is recognized or not: if so, continuing to store the video stream into the first queue cache region, forwarding and copying the video stream before a preset time to a second queue cache region, simultaneously storing the video stream into the second queue cache region, and then starting to transmit the video stream cached into the second queue cache region to a cloud server through a network; if not, the video stream is continuously stored in the first queue buffer area only. The invention also provides a video transmission system, a video transmission device and a computer readable storage medium. Compared with the related technology, the technical scheme of the invention can only transmit high-value video and ensure good integrity and high transmission efficiency.
Description
[ technical field ] A method for producing a semiconductor device
The present invention relates to the field of internet of things technology, and in particular, to a double-buffer AI video transmission method, a video transmission system, a video transmission device, and a computer-readable storage medium.
[ background of the invention ]
At present, the application of the internet of things system is more and more important, wherein the data transmission amount is more and more, and how to apply video transmission is an important part in the internet of things technology.
The internet of things system in the related art comprises a terminal and a cloud server, wherein the terminal comprises a plurality of video cameras. The terminal and the cloud server transmit a large amount of video data through communication connection. Real-time video data collected by the video camera are transmitted to the cloud server through data.
However, a large amount of real-time video data is transmitted to the cloud server, the cloud server needs a huge storage space, and meanwhile, the transmission bandwidth is also required to be large enough for transmitting the data, especially for a city-level internet of things, the number of cameras is over 10 thousands, the large amount of video data is completely stored and transmitted, and the internet of things system bears the cost and the performance pressure of the storage and transmission bandwidth. In reality, most of the time of the video is only background, and the transmission and storage values are extremely small. In the existing optimization scheme, artificial Intelligence (AI) recognition is adopted, and after scenes such as human faces, vehicles and the like are recognized through the AI recognition, video data are transmitted. However, the method loses the site before artificial intelligence identification, damages the integrity of video data and cannot meet the monitoring requirement. How to transmit video data by applying artificial intelligence technology is a technical problem to be solved.
Therefore, there is a need to provide a new method, system and device to solve the above technical problems.
[ summary of the invention ]
The present invention is directed to overcome the above-mentioned problems, and provides a queue-based double-buffer AI video transmission method, a video transmission system, a video transmission device, and a computer-readable storage medium, which can transmit only high-value video and ensure good integrity of the high-value video, and have high transmission efficiency.
In order to achieve the above object, the present invention provides a queue-based double-buffer AI video transmission method, which is applied to an internet of things terminal, and comprises the following steps:
s1, acquiring a video stream acquired in real time;
s2, storing the video stream into a first queue cache region, carrying out artificial intelligence recognition on the video stream while storing, and judging whether a recognition target is recognized or not:
if yes, continuing to store the video stream into the first queue cache region, forwarding and copying the video stream before preset time to a second queue cache region, simultaneously storing the video stream into the second queue cache region, and then starting to transmit the video stream cached into the second queue cache region to a cloud server through a network;
if not, the video stream is continuously stored in the first queue buffer area only.
Preferably, before the step S1, the queue-based double-buffer AI video transmission method further includes the steps of:
s0, configuring the size of the first queue cache area to be A, and setting the offset of the head address and the offset of the tail address of the first queue cache area to be 0; configuring the size of the second queue buffer area as B, and setting the offset of the head address and the tail address of the second queue buffer area as 0; setting a preset time t; enabling the first queue cache area and the second queue cache area to be in communication connection with the cloud server; and setting the identification state flag of the terminal of the Internet of things as a false value, wherein the identification state flag is used for judging whether the artificial intelligence of the terminal of the Internet of things identifies the identification target.
Preferably, the step S2 specifically includes:
step S21, storing the video stream into the first queue buffer area, and judging whether a video transmission mark of the Internet of things terminal is a true value: if so, continuing to store the current video stream into the second queue cache region, caching the current video stream into the second queue cache region, and transmitting the current video stream to a cloud server through a network; if not, the step S22 is carried out;
step S22, carrying out the artificial intelligence recognition on the video stream and judging whether the recognition target is recognized or not, if so, setting the recognition state flag to be a true value, and if not, setting the recognition state flag to be a false value;
step S23, judging the identification state mark and the video transmission mark simultaneously:
if the video transmission flag is false value and the identification status flag is false value, returning to the step S21;
if the video transmission flag is false value and the identification status flag is true value,
forwarding and copying the video stream before the preset time t to a second queue buffer area, simultaneously storing the video stream into the second queue buffer area, setting the video transmission flag to be a true value, then starting to transmit the video stream cached into the second queue buffer area to a cloud server through a network, and simultaneously returning to the step S21;
if the video transmission flag is a true value and the identification status flag is a false value, further determining whether the video stream is being transmitted to a cloud server through a network, if so, continuing the network transmission, otherwise, setting the video transmission flag to be the false value, and returning to the step S21.
Preferably, in step S23, if the video transmission flag is a true value and the identification status flag is a false value, it is further determined whether the video stream is being transmitted to a cloud server through a network, and if not, the video transmission flag is set to the false value after a preset time delay.
Preferably, the video stream is stored in the first queue buffer area and the video stream is stored in the second queue buffer area according to a queue buffer area algorithm, and the queue buffer area algorithm is applied to enqueue, add and dequeue in the video stream;
the queue buffer area comprises a time queue and a data buffer area, the time queue is an array, and the structure of elements in the time queue comprises time, data buffer area offset and data length; the data buffer area is a memory space;
the process of applying the queue buffer algorithm comprises:
step S31, determining whether the current video time of the video stream is the same as the time at the end of the time queue in the first queue buffer:
if not, determining the video stream as a new video stream, storing the video stream into the first queue buffer area,
if so, judging that the video stream is the video stream which is being stored, and continuously storing the video stream into the first queue buffer area;
step S32, determining whether the video transmission flag is true, and simultaneously determining whether the current video time of the video stream is the same as the time at the end of the time queue in the first queue buffer:
if not, determining the video stream as a new video stream, and storing the video stream into the second queue buffer area,
if yes, the video stream is judged to be the video stream which is being stored, and the video stream is continuously stored into the second queue buffer area.
Preferably, the process of applying the queue buffer algorithm further includes:
step S41, caching the data into the second queue buffer area, dequeuing the time queue, copying the buffer data at the head of the queue, and transmitting the copied buffer data to a cloud server through a network;
and S42, repeating the step S41 until the second queue buffer is emptied.
Preferably, the process of starting the application of the queue buffer algorithm in the network transmission for the first time includes:
step S51, starting from the head of the time queue in the first queue buffer, sequentially determining whether each inherent time of the element is a first time: if so, stopping the judgment, otherwise, entering step S52, wherein the first time is greater than or equal to the difference value obtained by subtracting a preset forward pushing time length from the current time;
step S52, the queue head of the first queue buffer area is set as the element corresponding to the first time;
step S53, dequeuing the first queue buffer area, and enqueuing the dequeued data in the second queue buffer area;
step S54, repeating the step S51-the step S53 until the first queue buffer enters a queue empty state;
step S55, repeating the step S41 and the step S42 in sequence;
and step S56, setting the video transmission flag to a true value.
The invention further provides a video transmission system which comprises a cloud server and an internet of things terminal applying the queue-based double-buffer AI video transmission method, wherein the cloud server is in communication connection with the internet of things terminal.
The invention also provides a video transmission device, which comprises a processor and a memory, wherein the processor is used for reading a program in the memory and executing the steps in the queue-based double-buffer AI video transmission method.
The present invention also provides a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the steps in the queue-based double-buffered AI video transmission method as set forth in any of the above.
Compared with the prior art, the queue-based double-buffer AI video transmission method, the video transmission system, the video transmission device and the computer-readable storage medium of the present invention are implemented by applying the queue-based double-buffer AI video transmission method. The method comprises the following steps: s1, acquiring a video stream acquired in real time; s2, storing the video stream into a first queue cache region, carrying out artificial intelligence recognition on the video stream while storing, and judging whether a recognition target is recognized or not: if yes, continuing to store the video stream into the first queue cache region, simultaneously storing the video stream into a second queue cache region, and then starting to transmit the video stream cached into the second queue cache region to a cloud server through a network; if not, the video stream is continuously stored in the first queue buffer area only. According to the method, the first queue buffer area and the second queue buffer area are arranged, and the target is identified through artificial intelligence, so that high-value videos are transmitted, the occupied transmission bandwidth is small, and the transmission efficiency is high; therefore, double buffering operation of the queue is realized, and transmitted data is kept on site before artificial intelligence identification; the video stream before the preset time is pushed forward and copied to a second queue cache region, so that after the artificial intelligence identifies the identification target, the video data before identification can be transmitted to the cloud server, loss of high-value videos is avoided, integrity of the video data at the bottom end is good, and monitoring requirements are met.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained by those skilled in the art without inventive efforts, wherein,
FIG. 1 is a block diagram of a process of a queue-based double-buffer AI video transmission method according to the invention;
FIG. 2 is a block diagram of a flow chart of an embodiment of a queue-based double-buffer AI video transmission method of the present invention;
FIG. 3 is a block diagram of a flow chart of an embodiment of a queue-based double-buffer AI video transmission method according to the invention;
FIG. 4 is another block diagram of a queue-based double-buffered AI video transmission method according to an embodiment of the invention;
FIG. 5 is a block diagram of another flow chart of an embodiment of a queue-based double-buffered AI video transmission method of the present invention;
FIG. 6 is a schematic diagram of a video transmission system according to the present invention;
fig. 7 is a schematic structural diagram of a video transmission apparatus according to the present invention.
[ detailed description ] A
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "comprising" and "having," and any variations thereof, in the description and claims of this application and the description of the figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or the accompanying drawings are used for distinguishing between different objects and not for describing a particular order. Reference herein to "an embodiment or this implementation" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein may be combined with other embodiments.
The invention provides a queue-based double-buffer AI video transmission method.
Referring to fig. 1, fig. 1 is a block diagram illustrating a flow chart of a queue-based double-buffer AI video transmission method according to the present invention.
The queue-based double-buffer AI video transmission method is applied to the terminal of the Internet of things. The method comprises the following steps:
s1, acquiring a video stream acquired in real time.
S2, storing the video stream into a first queue cache region, carrying out artificial intelligence recognition on the video stream while storing, and judging whether a recognition target is recognized or not:
if so, continuing to store the video stream into the first queue cache region, forwarding and copying the video stream before the preset time to a second queue cache region, simultaneously storing the video stream into the second queue cache region, and then starting to transmit the video stream cached into the second queue cache region to a cloud server through a network.
If not, the video stream is continuously stored in the first queue buffer area only.
In summary, in the video transmission method, the first queue buffer area and the second queue buffer area are set, and the target is identified through artificial intelligence, so that high-value video is transmitted, the occupied transmission bandwidth is small, and the transmission efficiency is high; therefore, double buffering operation of the queue is realized, and transmitted data is kept on site before artificial intelligence identification; the video stream before the preset time is pushed forward and copied to a second queue cache region, so that after the artificial intelligence identifies the identification target, the video data before identification can be transmitted to the cloud server, loss of high-value videos is avoided, integrity of the video data at the bottom end is good, and monitoring requirements are met.
In order to better illustrate the working process of the video transmission method of the present invention, the following detailed description is made with reference to a specific embodiment. Referring to fig. 2, fig. 2 is a flowchart illustrating an embodiment of a queue-based double-buffer AI video transmission method according to the present invention.
The queue-based double-buffer AI video transmission method is applied to the Internet of things terminal. The method comprises the following steps:
s0, configuring the size of the first queue cache area to be A, and setting the offset of the head address and the offset of the tail address of the first queue cache area to be 0; configuring the size of the second queue buffer area as B, and setting the offset of the head address and the tail address of the second queue buffer area as 0; setting a preset time as t; enabling the first queue buffer area and the second queue buffer area to be in communication connection with the cloud server; and setting the identification state flag of the terminal of the Internet of things as a false value. The identification state mark is used for judging whether the artificial intelligence of the Internet of things terminal identifies the identification target. The identification state flag is a false value, which indicates that the identification target is not identified in the current video stream. Conversely, the value of true for the identification status flag indicates that the identification target has been identified by the current video stream. The preset time is set to t, namely the duration of the forward pushed video stream is set to t duration before the current time, and t is greater than 0; in the present embodiment, t is set as a time in seconds.
And the step S0 completes initialization and internal configuration of the Internet of things terminal.
S1, acquiring a video stream acquired in real time. The step S1 is realized through a camera and a video gateway of the terminal of the Internet of things.
The step S2 comprises the following substeps:
step S21, storing the video stream into the first queue buffer area, and judging whether a video transmission mark of the terminal of the Internet of things is a true value:
if so, continuing to store the current video stream into the second queue buffer area, caching the current video stream into the second queue buffer area, and transmitting the current video stream to a cloud server through a network. The value of the video transmission flag is true to indicate that the video stream is being transmitted. If yes, the front-segment video stream of the current video stream is transmitted, namely the current video stream is not transmitted completely.
If not, the process proceeds to step S22. That is, the video transmission flag is false value, and the video transmission flag is false value indicating that the video stream is not transmitted.
And S22, carrying out artificial intelligence identification on the video stream and judging whether the identification target is identified or not, if so, setting the identification state flag to be a true value, and if not, setting the identification state flag to be a false value.
Step S23, judging the identification state mark and the video transmission mark simultaneously:
if the video transmission flag is false and the identification status flag is false, the process returns to the step S21.
If the video transmission flag is false value and the identification status flag is true value,
and forwarding and copying the video stream before the preset time t to a second queue buffer area, simultaneously storing the video stream into the second queue buffer area, setting the video transmission flag to be a true value, starting to transmit the video stream cached into the second queue buffer area to a cloud server through a network, and simultaneously returning to the step S21.
The operation enables the artificial intelligence to identify the identification target and then transmit the video data before identification to the cloud server, and therefore loss of high-value videos is avoided.
If the video transmission flag is a true value and the identification status flag is a false value, further determining whether the video stream is being transmitted to a cloud server through a network, if so, continuing the network transmission, otherwise, setting the video transmission flag to be the false value, and returning to the step S21.
In order to better implement state control and data transmission and avoid transmission errors, in this embodiment, in step S23, if the video transmission flag is a true value and the identification state flag is a false value, it is further determined whether the video stream is being transmitted to a cloud server through a network, and if not, the video transmission flag is set to the false value after a preset time delay. Wherein the delay preset time may be set to a time length in seconds. By setting the delay preset time and then setting the video transmission flag to be the false value, the condition inaccuracy caused by transmission extension and the like can be avoided, and the transmission reliability is improved.
And storing the video stream into the first queue buffer area and storing the video stream into the second queue buffer area according to a queue buffer area algorithm.
The queue buffer area comprises a time queue and a data buffer area. The time queue is an array. The structure of the elements in the time queue includes time, data buffer offset, and data length. The data buffer area is a memory space.
The queue buffer algorithm is applied to enqueue, append, and dequeue in the video stream.
In particular, the method comprises the following steps of,
the enqueuing is as follows:
and after the data is stored at the tail position of the time queue, adding 1 to the head array value of the time queue.
And after adding 1 to the queue tail number group value, if the queue head number group value is equal to the queue tail number group value, judging that the queue is full, adding 1 to the queue head number group value, and performing data copying coverage.
And if the value of the queue tail number group or the value of the queue head number group is larger than the size of the time queue, setting the value of the queue tail number group to be 0 or setting the value of the queue head number group to be 0.
And adding the data length to the previous offset value of the data buffer area as the offset value of the current queue tail array value, if the offset value is larger than the size of the data buffer area, subtracting the size of the data buffer area, and setting the length of the time queue according to the actual video data length.
And when the stored data of the video stream is shifted to the data buffer area at the tail of the queue, if the sum of the data buffer area shift value and the data length is larger than the size of the data buffer area, storing the data twice. The method specifically comprises the following steps: copying the data buffer offset value to the data with the size of the data buffer area, and then copying 0 to second data, wherein the second data is the data with the data length added to the data buffer offset value and the size of the data buffer area subtracted.
The addition is as follows:
and adding and storing the new data packet of the video stream into buffer data at the tail of the queue, wherein the buffer data is the sum of the offset value of the data buffer area at the tail of the queue and the data length.
If the sum of the offset value of the data buffer zone and the data length is larger than the size of the data buffer zone, the data is stored twice. The method specifically comprises the following steps: copying the data with the data buffer size added with the data length to the data with the data buffer offset value, and then copying 0 to third data, wherein the third data is the data with the data buffer offset value added with the data length, added with the data length of the new video stream, and then subtracting the data with the data buffer size.
And the data length of the time queue is the sum of the data length of the tail of the queue and the data length of a data packet of the new video stream.
The dequeuing is as follows:
and after the buffer data of the head of the queue is copied, adding 1 to the head of the queue array value, if the head of the queue array value is equal to the tail of the queue array value, judging that the queue is empty, and forbidding dequeue operation of the time queue.
If the sum of the offset value of the data buffer area and the data length is larger than the size of the data buffer area, the data is copied twice, specifically: copying the data buffer offset value to the data with the size of the data buffer, and copying 0 to fourth data, wherein the fourth data is the data with the data length added to the data buffer offset value and the data with the size of the data buffer subtracted.
Referring to fig. 3, the process of applying the queue buffer algorithm includes:
step S31, determining whether the current video time of the video stream is the same as the time at the end of the time queue in the first queue buffer area.
If not, determining the video stream as a new video stream, storing the video stream into the first queue buffer area,
if yes, the video stream is judged to be the video stream which is being stored, and the video stream is continuously stored into the first queue buffer area.
Step S32, determining whether the video transmission flag is a true value, and simultaneously determining whether the video time of the current video stream is the same as the time at the end of the time queue in the first queue buffer.
If not, determining the video stream as a new video stream, and storing the video stream into the second queue buffer area,
if yes, the video stream is judged to be the video stream which is being stored, and the video stream is continuously stored into the second queue buffer area.
Referring to fig. 4, the process of applying the queue buffer algorithm further includes:
and S41, caching the data into the second queue buffer area, dequeuing the time queue, copying the buffer data at the head of the queue, and transmitting the copied buffer data to a cloud server through a network.
And S42, repeating the step S41 until the second queue buffer is emptied.
Referring to fig. 5, the process of starting the application of the queue buffer algorithm in network transmission for the first time includes:
step S51, starting from the head of the time queue in the first queue buffer, sequentially determining whether each inherent time of the element is a first time:
if yes, stopping judging.
If not, the process proceeds to step S52.
The first time is larger than or equal to the difference value obtained by subtracting a preset forward pushing time length from the current time.
Step S52, setting the head of the first queue buffer to the element corresponding to the first time.
And S53, dequeuing the first queue buffer area, and enqueuing the dequeued data in the second queue buffer area.
And S54, repeating the steps S51-S53 until the first queue buffer area enters a queue empty state.
Step S55, repeating the step S41 and the step S42 in sequence.
And S56, setting the video transmission flag to be a true value.
In summary, the video transmission method transmits high-value video by setting the first queue buffer area and the second queue buffer area and identifying the target through artificial intelligence, and has the advantages of small occupied transmission bandwidth and high transmission efficiency; therefore, double buffering operation of the queue is realized, transmitted data are kept on site before artificial intelligence identification, integrity of bottom video data is good, and monitoring requirements are met.
The present invention also provides a video transmission system 100.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a video transmission system according to the present invention.
The video transmission system comprises a cloud server 1 and an Internet of things terminal 2 applying the queue-based double-buffer AI video transmission method. The cloud server 1 is in communication connection with the internet of things terminal 2. The cloud server 1 includes a plurality of servers.
And the terminal 2 of the internet of things acquires the video stream acquired in real time.
The internet of things terminal 2 stores the video stream into a first queue cache region, performs artificial intelligence recognition on the video stream while storing the video stream, and judges whether a recognition target is recognized: if yes, continuing to store the video stream into the first queue cache region, simultaneously storing the video stream into a second queue cache region, and then starting to transmit the video stream cached into the second queue cache region to a cloud server through a network; if not, the video stream is continuously stored in the first queue buffer area only.
It should be noted that the cloud server 1 and the internet of things terminal 2 are both common devices or instruments in the art in the field, and the specific model thereof needs to be selected according to the actual design needs of the product, which is not described in detail herein.
The present invention also provides a video transmission device 1000. Referring to fig. 7, fig. 4 is a schematic structural diagram of a video transmission apparatus 1000 according to the present invention.
The video transmission apparatus 1000 includes a processor 1001, a memory 1002, a network interface 1003, and a computer program stored in the memory 1002 and executable on the processor 1001, wherein the processor 1001 is configured to read the program stored in the memory 1002, and the processor 1001, when executing the computer program, implements the steps in the queue-based double-buffer AI video transmission method provided by the embodiment. That is, the processor 1001 performs the steps in the queue-based double-buffered AI video transmission method.
Specifically, the processor 1001 is configured to perform the following steps:
s1, acquiring a video stream acquired in real time.
S2, storing the video stream into a first queue cache region, only carrying out artificial intelligence recognition on the video stream at the same time, and judging whether a recognition target is recognized or not:
if yes, the video stream is continuously stored into the first queue cache region, the video stream is simultaneously stored into a second queue cache region, and then the video stream cached into the second queue cache region is started to be transmitted to a cloud server through a network.
If not, the video stream is continuously stored in the first queue buffer area only.
The video transmission device 1000 according to the embodiment of the present invention can implement various implementation manners in the queue-based double-buffer AI video transmission method embodiment, and has corresponding beneficial effects, which are not described herein again to avoid repetition.
It is noted that only 1001-1003 having components are shown, but it is understood that not all of the illustrated components are required to be implemented, and that more or fewer components may alternatively be implemented. As will be understood by those skilled in the art, the video transmission device 1000 is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable gate array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The memory 1002 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 1002 may be an internal storage unit of the video transmission apparatus 1000, such as a hard disk or a memory of the video transmission apparatus. In other embodiments, the memory 1002 may also be an external storage device of the video transmission device 1000, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the video transmission device 1000. Of course, the memory 1002 may also include both an internal storage unit and an external storage device of the video transmission device. In this embodiment, the memory 1002 is generally used for storing an operating system and various types of application software installed in the video transmission apparatus 1000, such as program codes of a queue-based double-buffer AI video transmission method of the video transmission apparatus 1000. The memory 1002 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 1001 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor, or other data Processing chip in some embodiments. The processor 1001 is generally used to control the overall operation of the video transmission apparatus 1000. In this embodiment, the processor 1001 is configured to run a program code stored in the memory 1002 or process data, for example, a program code of a queue-based double-buffer AI video transmission method of the video transmission apparatus 1000.
The network interface 1003 may include a wireless network interface or a wired network interface, and the network interface 1003 is generally used to establish a communication connection between the video transmission apparatus 1000 and other electronic apparatuses.
The present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program includes program instructions, and when the program instructions are executed by the processor 1001, the steps in the queue-based double-buffer AI video transmission method described in any of the above are implemented, and the same technical effects can be achieved, and are not described herein again to avoid repetition.
It will be understood by those skilled in the art that all or part of the processes in the queue-based dual-buffer AI video transmission method for implementing the video transmission apparatus according to the embodiments may be implemented by a computer program instructing associated hardware, and the program may be stored in a computer-readable storage medium, and when executed, may include processes such as those of the embodiments of the methods. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The present embodiment mentioned in the examples of the present invention is for convenience of description. The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.
Compared with the prior art, the queue-based double-buffer AI video transmission method, the video transmission system, the video transmission device and the computer-readable storage medium of the present invention are implemented by applying the queue-based double-buffer AI video transmission method. The method comprises the following steps: s1, acquiring a video stream acquired in real time; s2, storing the video stream into a first queue cache region, carrying out artificial intelligence recognition on the video stream while storing, and judging whether a recognition target is recognized or not: if yes, continuing to store the video stream into the first queue cache region, simultaneously storing the video stream into a second queue cache region, and then starting to transmit the video stream cached into the second queue cache region to a cloud server through a network; if not, the video stream is continuously stored in the first queue buffer area only. According to the method, the first queue buffer area and the second queue buffer area are arranged, and the target is identified through artificial intelligence, so that high-value videos are transmitted, the occupied transmission bandwidth is small, and the transmission efficiency is high; therefore, double buffering operation of the queue is realized, and transmitted data is kept on site before artificial intelligence identification; the video stream before the preset time is pushed forward and copied to a second queue cache region, so that after the artificial intelligence identifies the identification target, the video data before identification can be transmitted to the cloud server, loss of high-value videos is avoided, integrity of the video data at the bottom end is good, and monitoring requirements are met.
While the foregoing is directed to embodiments of the present invention, it will be understood by those skilled in the art that various changes may be made without departing from the spirit and scope of the invention.
Claims (8)
1. A queue-based double-buffer AI video transmission method is applied to an Internet of things terminal, and is characterized by comprising the following steps:
s1, acquiring a video stream acquired in real time;
s2, storing the video stream into a first queue cache region, carrying out artificial intelligence recognition on the video stream while storing, and judging whether a recognition target is recognized or not:
if so, continuing to store the video stream into the first queue cache region, forwarding and copying the video stream before a preset time to a second queue cache region, simultaneously storing the video stream into the second queue cache region, and then starting to transmit the video stream cached into the second queue cache region to a cloud server through a network;
if not, the video stream is continuously stored in the first queue buffer area only;
before the step S1, the queue-based double-buffer AI video transmission method further includes the steps of:
s0, configuring the size of the first queue cache area to be A, and setting the offset of the head address and the offset of the tail address of the first queue cache area to be 0; configuring the size of the second queue buffer area as B, and setting the offset of the head address and the tail address of the second queue buffer area as 0; setting a preset time t, wherein t is greater than 0; enabling the first queue cache area and the second queue cache area to be in communication connection with the cloud server; setting an identification state flag of the terminal of the Internet of things as a false value, wherein the identification state flag is used for judging whether the artificial intelligence of the terminal of the Internet of things identifies the identification target;
the step S2 specifically includes:
step S21, storing the video stream into the first queue buffer area, and judging whether a video transmission mark of the Internet of things terminal is a true value: if so, continuing to store the current video stream into the second queue cache region, caching the current video stream into the second queue cache region, and transmitting the current video stream to a cloud server through a network; if not, the step S22 is executed;
step S22, carrying out artificial intelligence identification on the video stream and judging whether the identification target is identified or not, if so, setting the identification state flag to be a true value, and if not, setting the identification state flag to be a false value;
step S23, judging the identification state mark and the video transmission mark simultaneously:
if the video transmission flag is false and the identification status flag is false, returning to the step S21;
if the video transmission flag is false value and the identification status flag is true value,
forwarding and copying the video stream before the preset time t to a second queue buffer area, simultaneously storing the video stream into the second queue buffer area, setting the video transmission flag to be a true value, then starting to transmit the video stream cached into the second queue buffer area to a cloud server through a network, and simultaneously returning to the step S21;
if the video transmission flag is a true value and the identification status flag is a false value, further determining whether the video stream is being transmitted to a cloud server through a network, if so, continuing the network transmission, otherwise, setting the video transmission flag to be the false value, and returning to the step S21.
2. The queue-based dual-buffer AI video transmission method according to claim 1, wherein in step S23, if the video transmission flag is true value and the identification status flag is false value, it is further determined whether the video stream is being transmitted to a cloud server via a network, and if not, the video transmission flag is set to the false value after a preset time delay.
3. The queue-based double-buffer AI video transmission method according to claim 1, wherein the storing of the video stream into the first queue buffer and the storing of the video stream into the second queue buffer are both performed according to a queue buffer algorithm applied to enqueue, append, and dequeue in the video stream;
the queue buffer area comprises a time queue and a data buffer area, the time queue is an array, and the structure of elements in the time queue comprises time, data buffer area offset and data length; the data buffer area is a memory space;
the process of applying the queue buffer algorithm comprises:
step S31, determining whether the current video time of the video stream is the same as the time at the end of the time queue in the first queue buffer:
if not, determining the video stream as a new video stream, storing the video stream into the first queue buffer area,
if so, judging that the video stream is the video stream which is being stored, and continuously storing the video stream into the first queue buffer area;
step S32, determining whether the video transmission flag is true, and simultaneously determining whether the current video time of the video stream is the same as the time at the end of the time queue in the first queue buffer:
if not, determining the video stream as a new video stream, and storing the video stream into the second queue buffer area,
if yes, the video stream is judged to be the video stream which is being stored, and the video stream is continuously stored into the second queue buffer area.
4. The queue-based double-buffered AI video transmission method according to claim 3, wherein the process of applying the queue buffer algorithm further comprises:
step S41, caching the data into the second queue buffer area, dequeuing the time queue, copying the buffer data at the head of the queue, and transmitting the copied buffer data to a cloud server through a network;
and S42, repeating the step S41 until the second queue buffer is emptied.
5. The queue-based double-buffer AI video transmission method according to claim 4, wherein the process of applying the queue buffer algorithm in the first initiation of transmission over the network comprises:
step S51, starting from the head of the time queue in the first queue buffer, sequentially determining whether each inherent time of the element is a first time: if yes, stopping the judgment, otherwise, entering a step S52, wherein the first time is greater than or equal to the difference value obtained by subtracting a preset forward pushing time length from the current time;
step S52, the queue head of the first queue buffer area is set as the element corresponding to the first time;
step S53, dequeuing the first queue buffer area, and enqueuing the dequeued data in the second queue buffer area;
step S54, repeating the step S51-the step S53 until the first queue buffer enters a queue empty state;
step S55, repeating the step S41 and the step S42 in sequence;
and S56, setting the video transmission flag to be a true value.
6. A video transmission system, comprising a cloud server and an internet of things terminal applying the queue-based double-buffer AI video transmission method according to any one of claims 1 to 5, wherein the cloud server is in communication connection with the internet of things terminal.
7. Video transmission device, characterized in that it comprises a processor and a memory, said processor being adapted to read a program in said memory, to carry out the steps in the queue-based double-buffered AI video transmission method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that it stores a computer program comprising program instructions which, when executed by a processor, implement the steps in the queue-based double-buffered AI video transmission method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110353455.1A CN113132742B (en) | 2021-03-31 | 2021-03-31 | Queue-based double-buffer AI video transmission method and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110353455.1A CN113132742B (en) | 2021-03-31 | 2021-03-31 | Queue-based double-buffer AI video transmission method and related equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113132742A CN113132742A (en) | 2021-07-16 |
CN113132742B true CN113132742B (en) | 2023-04-14 |
Family
ID=76774534
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110353455.1A Active CN113132742B (en) | 2021-03-31 | 2021-03-31 | Queue-based double-buffer AI video transmission method and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113132742B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116743948A (en) * | 2023-06-15 | 2023-09-12 | 上海山源电子科技股份有限公司 | Method, device and equipment for monitoring video recording and computer readable storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108491822A (en) * | 2018-04-02 | 2018-09-04 | 杭州高创电子科技有限公司 | A kind of Face datection De-weight method based on the limited caching of embedded device |
CN110298306A (en) * | 2019-06-27 | 2019-10-01 | 北京百度网讯科技有限公司 | The determination method, device and equipment of target object motion information |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1145122C (en) * | 1996-10-31 | 2004-04-07 | 传感电子公司 | Intelligent video information management system |
US9584710B2 (en) * | 2008-02-28 | 2017-02-28 | Avigilon Analytics Corporation | Intelligent high resolution video system |
CN101568029B (en) * | 2008-11-28 | 2011-01-19 | 深圳市高斯贝尔家居智能电子有限公司 | Device and method for monitoring mobile phone video based on optimized H.264 coding standard |
KR101627185B1 (en) * | 2009-04-24 | 2016-06-03 | 삼성전자 주식회사 | Control method of image photographing apparatus |
CN104144312B (en) * | 2013-05-09 | 2018-06-05 | 腾讯科技(深圳)有限公司 | A kind of method for processing video frequency and relevant apparatus |
CN108965831B (en) * | 2018-09-05 | 2020-09-25 | 北京疯景科技有限公司 | Video processing method and device and intelligent visual doorbell |
CN112465398B (en) * | 2020-12-16 | 2024-04-16 | 合安科技技术有限公司 | Statistical method, statistical system, server and storage device for urban street lamp lighting rate |
-
2021
- 2021-03-31 CN CN202110353455.1A patent/CN113132742B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108491822A (en) * | 2018-04-02 | 2018-09-04 | 杭州高创电子科技有限公司 | A kind of Face datection De-weight method based on the limited caching of embedded device |
CN110298306A (en) * | 2019-06-27 | 2019-10-01 | 北京百度网讯科技有限公司 | The determination method, device and equipment of target object motion information |
Also Published As
Publication number | Publication date |
---|---|
CN113132742A (en) | 2021-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100810771B1 (en) | Accelerated tcptransport control protocol stack processing | |
JP2022552986A (en) | Information transmission method, device, readable storage medium and electronic device | |
CN110535861B (en) | Method and device for counting SYN packet number in SYN attack behavior identification | |
CN110247986A (en) | A kind of document transmission method, device and electronic equipment | |
CN111625503B (en) | Method and equipment for locally and randomly pre-reading file of distributed file system | |
CN116527593B (en) | Network traffic congestion control method and related device | |
CN113132742B (en) | Queue-based double-buffer AI video transmission method and related equipment | |
CN112925297B (en) | Automatic driving algorithm verification method, device, equipment, storage medium and product | |
CN112433920A (en) | Buried point data reporting method, device, equipment and medium | |
CN114788199A (en) | Data verification method and device | |
CN108063809B (en) | Machine equipment data acquisition method and acquisition system | |
CN112235422A (en) | Data processing method and device, computer readable storage medium and electronic device | |
CN111835801A (en) | File downloading method, device, server, edge device, terminal and medium | |
CN113626483B (en) | Front-end caching method, system, equipment and storage medium for filling forms | |
CN108140005B (en) | System and method for providing file information in a memory system protocol | |
CN111669431B (en) | Message transmission method and device, computer equipment and storage medium | |
CN114710426A (en) | Method, device, system and related equipment for determining round-trip delay of read operation | |
CN112055058A (en) | Data storage method and device and computer readable storage medium | |
CN113127222B (en) | Data transmission method, device, equipment and medium | |
CN114610691B (en) | Storage object acquisition method, storage object acquisition device, equipment and medium | |
CN111083413B (en) | Image display method and device, electronic equipment and storage medium | |
CN117118876B (en) | Heartbeat connection detection method and device, electronic equipment and storage medium | |
CN112417022B (en) | Method, device, terminal and storage medium for acquiring data | |
CN114679425B (en) | Message processing method, network equipment and storage medium under 5G network | |
CN117714553A (en) | Data transmission method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |