Video stream processing method, device, electronic device and storage medium

By using lightweight neural network models on edge nodes to detect video stream frames and storing them in cache, and using complex neural network models to analyze frame by frame, the problem of low accuracy in high frame rate/HD video stream analysis is solved and low-cost is achieved. , accurate analysis of high frame rate video streams on low computing power devices.

CN115866288BActive Publication Date: 2024-08-27CHINA MOBILE CHENGDU INFORMATION & TELECOMM TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111032463.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-03
Publication Date
2024-08-27
Estimated Expiration
2041-09-03

AI Technical Summary

Technical Problem

Existing technology is difficult to effectively process high frame rate/high-definition video streaming data, resulting in low accuracy of video analysis results of edge computing devices and high cost, making it difficult to deploy on a large scale.

Method used

By using a lightweight neural network model on the edge node to detect whether the video stream frame is the target frame, and storing the frames in a specific state in the cache, the complex neural network model is used to analyze frame by frame to avoid directly analyzing all frames. insufficient.

Benefits of technology

It improves the analysis accuracy of high frame rate and/or high-definition video streams, reduces hardware costs, has a wide range of applications, and is suitable for large-scale deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115866288B
    Figure CN115866288B
Patent Text Reader

Abstract

The present application discloses a video stream processing method, device, electronic device and storage medium. The method includes: an edge node obtains a video stream to be analyzed; for each frame of the video stream, a first model is used to detect whether the corresponding frame is a target frame to obtain a detection result; using the detection result, the state of the corresponding frame is determined; the state of the corresponding frame includes a non-interest interval state, an entry into an interesting interval state, an interesting interval state or an exit from an interesting interval state; the frame interval between two adjacent interesting intervals in the video stream is greater than or equal to N; the corresponding frame in the first state is stored in a cache, and the first state includes an entry into an interesting interval state or an interesting interval state; wherein, after the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result. In the solution provided by the present application, the edge node stores the target frame in the cache for re-analysis, thereby improving the accuracy of the analysis result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence (AI) technology, and in particular to a video stream processing method, device, electronic device and storage medium. Background Art

[0002] In the relevant technologies, the application fields of AI mainly include computer vision, natural language processing, speech recognition and other fields. Typical computer vision AI applications, based on neural network models, detect and analyze targets of interest in input data, such as pictures, video files, and network video streams, so as to achieve the purpose of understanding the content of pictures, files or videos. AI applications can run on servers located in the cloud or on edge computing devices. When AI applications are deployed on edge computing devices, because edge computing devices are close to the source of objects or data, they can generate network service responses faster, meet users' analysis needs for video stream data in a timely manner, and reduce the consumption of bandwidth resources.

[0003] However, compared with cloud servers, edge computing devices have weaker data processing capabilities and are unable to efficiently process high frame rate (i.e., high number of frames displayed per second) / high definition (i.e., high image resolution corresponding to each frame) video stream data. Therefore, there is currently no effective solution for accurately analyzing high frame rate / high definition video stream data using edge computing devices with weaker processing capabilities. Summary of the invention

[0004] To solve related technical problems, embodiments of the present application provide a video stream processing method, device, electronic device and storage medium.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The present application provides a video stream processing method, including:

[0007] Get the video stream to be analyzed;

[0008] For each frame of the video stream, using the first model, detecting whether the corresponding frame is a target frame, and obtaining a detection result; using the detection result, determining the state of the corresponding frame; the state of the corresponding frame includes an interval of interest (IOI) state, entering an IOI state, being in an IOI state, or leaving an IOI state; the frame interval between two adjacent IOIs in the video stream is greater than or equal to N; N is an integer greater than or equal to 2; storing the corresponding frame in a first state into a cache, the first state includes entering an IOI state or being in an IOI state; wherein,

[0009] After the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result.

[0010] In the above method, the using the detection result to determine the state of the corresponding frame includes:

[0011] When it is detected that M consecutive frames before the corresponding frame in the video stream are all target frames, it is determined that the corresponding frame is in the entering IOI state; M is an integer greater than or equal to 1.

[0012] In the above method, the using the detection result to determine the state of the corresponding frame includes:

[0013] When a previous frame of the corresponding frame in the video stream is in the IOI state and it is detected that the corresponding frame is a target frame, it is determined that the corresponding frame is in the IOI state.

[0014] In the above method, the using the detection result to determine the state of the corresponding frame includes:

[0015] When it is detected that the previous frame of the P consecutive frames before the corresponding frame in the video stream is in the IOI state, and the P consecutive frames before the corresponding frame are all non-target frames, it is determined that the corresponding frame is in the leaving IOI state; P is an integer greater than or equal to 1.

[0016] In the above method, the using the detection result to determine the state of the corresponding frame includes:

[0017] When a previous frame of the corresponding frame in the video stream is in the leaving IOI state and it is detected that the corresponding frame is a non-target frame, it is determined that the corresponding frame is in the non-IOI state.

[0018] In the above method, the method further comprises:

[0019] When the corresponding frame is in the entering IOI state, creating the buffer;

[0020] When all frames in the buffer are read, the buffer is deleted.

[0021] In the above method, after all frames in the cache are read, deleting the cache includes:

[0022] After each frame is read from the cache, the corresponding frame is deleted from the cache;

[0023] When the cache is empty, the cache is deleted.

[0024] In the above method, the step of using the first model to detect whether the corresponding frame is a target frame includes:

[0025] Preprocessing the corresponding frame;

[0026] Using the first model, it is detected whether the corresponding frame after preprocessing is a target frame.

[0027] The embodiment of the present application also provides a video stream processing device, including:

[0028] An acquisition unit, used for acquiring a video stream to be analyzed;

[0029] The first processing unit is configured to detect, for each frame of the video stream, whether the corresponding frame is a target frame by using the first model, and obtain a detection result; determine the state of the corresponding frame by using the detection result; the state of the corresponding frame includes a non-IOI state, an IOI state, an IOI state, or an IOI state; the frame interval between two adjacent IOIs in the video stream is greater than or equal to N; N is an integer greater than or equal to 2;

[0030] The second processing unit is configured to store the corresponding frame in a first state into a cache, wherein the first state includes entering an IOI state or being in an IOI state; wherein,

[0031] After the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result.

[0032] The present application also provides an electronic device, including: a processor and a memory for storing a computer program that can be run on the processor.

[0033] Wherein, the processor is used to execute the steps of any of the above-mentioned video stream processing methods when running the computer program.

[0034] An embodiment of the present application further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned video stream processing methods are implemented.

[0035] The video stream processing method, device, electronic device and storage medium provided by the embodiments of the present application are as follows: an edge node obtains a video stream to be analyzed; for each frame of the video stream, a first model is used to detect whether the corresponding frame is a target frame to obtain a detection result; the state of the corresponding frame is determined using the detection result; the state of the corresponding frame includes a non-IOI state, entering an IOI state, being in an IOI state or leaving an IOI state; the frame interval between two adjacent IOIs in the video stream is greater than or equal to N; N is an integer greater than or equal to 2; the corresponding frame in a first state is stored in a cache, and the first state includes entering an IOI state or being in an IOI state; wherein, after the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result. According to the technical solution provided by the embodiment of the present application, for the video stream to be analyzed, the edge node (i.e., the edge computing device) stores the corresponding frames in the video stream that are in the IOI state and in the IOI state into a cache, and then analyzes the corresponding frames in the cache frame by frame to obtain the analysis results, thereby avoiding the low reliability of the video analysis results caused by insufficient processing power of the edge node when directly analyzing all frames in the video stream, thereby improving the accuracy of the video analysis results, that is, realizing the accurate analysis of high frame rate and / or high-definition video streams using edge nodes with low computing power and low processing power. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A schematic diagram of a method flow for video stream processing according to an embodiment of the present application;

[0037] Figure 2 This is a structural diagram of the frame interval between IOIs in the video stream of an embodiment of the present application;

[0038] Figure 3 A schematic diagram of a video stream processing method according to an embodiment of the present application;

[0039] Figure 4 This is a structural diagram of the state of the frame in the video stream of the application embodiment of the present application

[0040] Figure 5 This is a schematic diagram of the structure of a video stream processing device according to an embodiment of the present application;

[0041] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0042] The present invention is further described in detail below through the accompanying drawings and specific embodiments.

[0043] Before further explaining the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0044] (1) AI: It is a technical science that uses theories, methods, technologies and application systems to simulate, extend and expand human intelligence. Its main application areas include computer vision, natural language processing and speech recognition.

[0045] (2) Edge computing node: refers to a node that is located close to the source of objects or data and uses an open platform that integrates network, computing, storage, and application core capabilities to provide services nearby and meet users' basic needs in terms of real-time business, application intelligence, security, and privacy protection.

[0046] (3) Real Time Streaming Protocol (RTSP): It is an application layer protocol in the Transmission Control Protocol (TCP) / Internet Protocol (IP) protocol system, and uses TCP or User Datagram Protocol (UDP) to complete data transmission.

[0047] With the popularization of the fifth generation of mobile communication technology (5G, 5th Generation), videos occupy an increasingly higher proportion in users' lives. Therefore, the demand for analysis and understanding of video content is also increasing.

[0048] The current mainstream AI video analysis programs generally run on servers located on the cloud side. The server receives video data from user terminals (such as mobile phones, tablets, and surveillance cameras) through the network, and then uses the algorithm model running on the server to analyze and understand the video data, and then sends the analysis results to the user terminal, or directly stores them on the server. In this process, as the number of video sensors increases, thousands of terminals will generate huge amounts of video data. If a large amount of video data is uploaded to the server, it will consume huge network bandwidth resources. At the same time, it will also increase the processing pressure of the server, making it difficult for the server to process a large amount of video data in a timely manner.

[0049] Based on this, in the related technology, it is proposed to deploy AI video analysis programs on the edge side, that is, on edge nodes (also called edge computing devices). Since edge nodes are close to user terminals that send video data, they can generate faster network service responses and meet users' analysis needs for video data in a timely manner. At the same time, it can also reduce the consumption of bandwidth resources. Specifically, the following four methods of using edge nodes to process high frame rate / HD video streams are proposed:

[0050] The first method is to achieve accurate analysis of high frame rate / high-definition video streams by improving the computing power of edge nodes. Specifically, the processing power of edge nodes is improved by improving the configuration and number of the central processing unit (CPU) and graphics processing unit (GPU) of the hardware devices corresponding to the edge nodes, so as to achieve a processing power equivalent to or close to that of the server on the cloud side. In this way, when a complex neural network model (i.e., a neural network model with many network layers and a large number of neurons in each layer) is used for analysis, the edge nodes can achieve efficient and accurate processing of high frame rate / high-definition video streams. However, due to the high cost of improving the hardware devices corresponding to the edge nodes, it is difficult to achieve large-scale deployment, that is, the scope of application of the above solution is limited.

[0051] The second method is to use a lightweight neural network model to analyze and understand the video stream data. Compared with complex neural network models, lightweight neural network models have fewer layers and fewer neurons in each layer, which can complete the analysis of video stream data faster, that is, they can process high frame rate / high-definition video stream data in real time. However, in this process, due to the small number of neurons and layers in the lightweight neural network model, the accuracy of the video analysis algorithm will be affected, resulting in low accuracy of the analysis results of the video stream data.

[0052] The third method is to adopt a frame skipping strategy to analyze high frame rate / high-definition video stream data. Specifically, the edge node obtains video frames in the video stream at a fixed frame interval, such as every 2 or 3 frames, and then uses a complex neural network model for analysis. That is, by reducing the number of video frames to be analyzed, the purpose of real-time processing of video stream data is achieved. However, in this process, when video frames are obtained at a fixed frame interval, the video frames that are not obtained will be directly discarded, which will cause the data corresponding to some frames to be lost, thereby affecting the accuracy of the video analysis results.

[0053] The fourth method is to reduce the frame rate or image resolution of the input video stream to reduce the size of the input data per unit time, which can reduce the processing load of the edge node and realize real-time processing of the video stream. However, when using a neural network model to analyze video frames, it is usually necessary to input continuous frames so that the neural network model can extract optical flow features based on continuous frames to identify the target behavior in the video stream. If the input frame resolution is low or the interval is far, the extracted optical flow features will be inaccurate, which will affect the analysis and recognition accuracy of the video stream.

[0054] Based on this, in various embodiments of the present application, the edge node obtains the video stream to be analyzed, stores the corresponding frames in a specific state in the video stream into a cache (which can be expressed as buffer in English), reads them from the cache and performs frame-by-frame analysis to obtain corresponding analysis results, thereby avoiding the situation in which the reliability of the video analysis results is low due to the low computing power of the edge node and the low accuracy of the analysis algorithm when directly analyzing the video stream, thereby achieving accurate analysis of high frame rate and / or high-definition video streams by edge nodes with low computing power. At the same time, the above-mentioned solution has low implementation cost and can be deployed on a large scale, that is, it has a wide range of applications.

[0055] The present application embodiment provides a video stream processing method, which is applied to edge nodes, such as Figure 1 As shown, the following steps are included:

[0056] Step 101: Obtain a video stream to be analyzed;

[0057] Step 102: for each frame of the video stream, using the first model, detecting whether the corresponding frame is a target frame, and obtaining a detection result; using the detection result, determining the state of the corresponding frame;

[0058] The state of the corresponding frame includes a non-IOI state, an IOI state, an IOI state, or an IOI state; the frame interval between two adjacent IOIs in the video stream is greater than or equal to N; N is an integer greater than or equal to 2;

[0059] Step 103: storing the corresponding frame in the first state into a cache, wherein the first state includes entering an IOI state or being in an IOI state; wherein, after the corresponding frame is stored in the cache, reading the corresponding frame from the cache, and analyzing the read corresponding frame using the second model to obtain an analysis result.

[0060] In practical application, the first model may be a lightweight neural network model for detecting targets, such as ssd-mobilenetve and yolov4-tiny.

[0061] In step 101, the edge node collects video stream data. In actual application, the edge node can receive the video stream to be analyzed from the user terminal based on RTSP; the terminal includes a mobile phone, a tablet computer, a network camera, etc. The embodiment of the present application does not limit the specific implementation of this step.

[0062] In practical applications, for each frame in the video stream to be analyzed, the first model can be used to detect whether the corresponding frame is a target frame, thereby obtaining a detection result, that is, detecting whether the corresponding frame contains an object of interest; wherein the first model includes a lightweight neural network model. Specifically, the edge node can extract image features corresponding to the corresponding frame through the first model. Then, the first model is used to classify the extracted image features, and then whether the corresponding frame is a target frame is determined based on the classification result.

[0063] In actual application, when the first model is used to detect the corresponding frame, the corresponding frame may be preprocessed first to facilitate more accurate target detection.

[0064] Based on this, in one embodiment, the step of using the first model to detect whether the corresponding frame is a target frame includes:

[0065] Preprocessing the corresponding frame;

[0066] Using the first model, it is detected whether the corresponding frame after preprocessing is a target frame.

[0067] The preprocessing includes operations such as scaling, filtering and denoising, distortion correction, and color space conversion.

[0068] In actual application, when the ratio of the area corresponding to the object in the acquired video stream to the area corresponding to the corresponding frame is lower than the threshold, the object in the corresponding frame can be enlarged by a scaling operation, so as to detect whether the object in the corresponding frame is the target object by using the first model, thereby determining whether the corresponding frame after preprocessing is the target frame. In actual application, the size of the threshold can be set as needed.

[0069] In practical applications, if the acquired video stream has video noise (which can be understood as random changes in brightness or color between consecutive frames in the video stream), a filtering model can be used to delete the noise in the corresponding frame.

[0070] In practical applications, if there are corresponding frames with curved image edges in the acquired video stream, the corresponding frames can be dedistorted to ensure the accuracy of image features.

[0071] In actual application, when the edge node obtains the video stream to be analyzed, the corresponding frame in the video stream may include three color space channels of RGB. When the edge node uses the first model to detect whether the corresponding frame is the target frame, if the three color space channels of the first model are GBR, it is necessary to first match the channels of the obtained video stream with the channels of the first model, and then use the first model for detection. At this time, the edge node can perform a color space conversion operation on the corresponding frame, that is, convert the color space channel of the video stream into GBR, and then input the preprocessed corresponding frame into the first model to detect the target frame.

[0072] Here, the lightweight neural network model belongs to a single-stage target detection model, which contains fewer network layers and fewer neurons in each layer. Correspondingly, the amount of calculation corresponding to the detection of the corresponding frame using the lightweight neural network model is also less, so that the feature extraction and classification of the corresponding frame can be quickly realized, so that the processing speed of target detection is not lower than the frame rate of the video stream. Exemplarily, if the frame rate of the video stream obtained by the network camera is K fps (frames per second), that is, K frames appear in one second, then the target detection speed of the lightweight neural network model is greater than or equal to K frames per second. In other words, for each frame of the video stream, the target detection time of the lightweight neural network model does not exceed 1 / K seconds.

[0073] In actual application, for time-domain sparse target scenarios, edge nodes can use the above-mentioned video stream processing method to analyze video streams; the time-domain sparse scenario refers to a scenario in which the time interval between the appearance of the target of interest is relatively long, that is, the target does not appear frequently, such as intrusion detection, fire channel monitoring and other scenarios.

[0074] Here, the video stream to be analyzed may correspond to the time domain, that is, the video stream to be analyzed corresponds to the time interval. In this case, each frame in the video stream to be analyzed may correspond to a time node in the time interval. For the video stream to be analyzed, there may be multiple IOIs; the IOI may be understood as an interval corresponding to a frame containing an object of interest; or may be understood as a time interval corresponding to a frame containing an object of interest in the time interval of the video stream.

[0075] In practical applications, in the scenario of sparse targets in the time domain, the frame interval between two adjacent IOIs in the video stream to be analyzed needs to be greater than or equal to N frames to ensure that the time interval between the appearance of the target of interest in the video stream is longer; where N is an integer greater than or equal to 2.

[0076] Here, in actual application, the value of N can be set as needed, and the embodiment of the present application does not limit the value of N.

[0077] For example, Figure 2 As shown, the horizontal axis represents the time domain corresponding to the video stream, and the numbers represent the identification of the frames in the video stream. When the target of interest appears in the 2nd-4th frame, the 8th-9th frame, and the 12th-14th frame, the above three intervals can be called IOI. Among them, the first IOI and the second IOI are two adjacent IOIs, and the frame interval between the first IOI and the second IOI can be understood as the frame distance between the last frame of the first IOI and the first frame of the second IOI, that is, the frame interval between the two is 4 frames.

[0078] In step 102, in actual application, if the corresponding frame is stored in the cache, it means that the video stream to be analyzed contains the target that the user is interested in. In this case, the edge node can read the corresponding frame from the cache and analyze it using the second model to obtain the analysis result; wherein the second model can be a complex neural network model for analyzing target behavior, such as I3D, a dual-stream network model.

[0079] Exemplarily, after the edge node reads the corresponding frame from the cache, it uses a complex neural network model to extract target features; the target features may include target contours, target edges or motion features, etc. Then, the extracted target features are combined, and the combined target features are classified using the complex neural network model to obtain the target behavior analysis results corresponding to the corresponding frames. In this process, since the complex neural network model has a large number of network layers and a large number of neurons in each layer, the number of extracted target features is large, and the corresponding amount of calculation is also large. Therefore, the accuracy of the extracted target features can be improved, and accordingly, more accurate target behavior analysis results can be obtained.

[0080] Among them, the embodiment of the present application does not limit the specific process of using the second model for analysis.

[0081] In actual application, if no corresponding frame is stored in the cache, it means that the video stream to be analyzed does not contain the target of interest to the user. Then, the edge node does not need to analyze the frames in the video stream, and further, does not need to generate analysis results.

[0082] It is understandable that when the time interval between the appearance of the target of interest in the video stream is far, the edge node can use the first model to quickly determine the target frame in the first state in the current video stream and store it in the cache. Then, using the second model, the target frame in the cache is analyzed frame by frame to obtain accurate analysis results. In other words, the edge node can use the computing power corresponding to IOI in the video stream to store the frame in IOI in the cache and analyze it synchronously. At the same time, since the time interval between two adjacent IOIs is long, the edge node can also borrow the computing power corresponding to non-IOI in the video stream to continue analyzing the frame in IOI in the cache, thereby realizing the accurate analysis of the high frame rate video stream by the edge node with low computing power.

[0083] In actual application, the edge node can determine the state of the corresponding frame by introducing a state machine; the state machine includes a non-IOI state, an entering IOI state, an IOI state, and an leaving IOI state.

[0084] Accordingly, the edge node may use the detection result of the frame before the corresponding frame in the video stream to determine whether the corresponding frame is in the IOI state.

[0085] Based on this, in one embodiment, using the detection result to determine the state of the corresponding frame includes:

[0086] When it is detected that M consecutive frames before the corresponding frame in the video stream are all target frames, it is determined that the corresponding frame is in the IOI state; M is an integer greater than or equal to 1.

[0087] In actual application, the value of M can be set as needed.

[0088] Exemplarily, when the edge node just analyzes the video stream to be analyzed, the initialization state of the state machine is the non-IOI state. If the value of M is set to 1, when the edge node detects that the previous frame of the corresponding frame is the target frame, and detects that the corresponding frame is also the target frame, that is, when the target frame is detected for two consecutive frames, it can be determined that the target has just appeared, and the state machine is transferred from the non-IOI state to the IOI state, and it is determined that the corresponding frame is in the IOI state.

[0089] In actual application, the edge node can use the state of the previous frame of the corresponding frame in the video stream in combination with the detection result of the corresponding frame to determine whether the corresponding frame is in the IOI state.

[0090] Based on this, in one embodiment, using the detection result to determine the state of the corresponding frame includes:

[0091] When a previous frame of the corresponding frame in the video stream is in the IOI state and it is detected that the corresponding frame is a target frame, it is determined that the corresponding frame is in the IOI state.

[0092] Here, if the previous frame of the corresponding frame is in the IOI state and the corresponding frame is the target frame, it can be considered that the video stream continues to contain the target, and the state machine is transferred from the IOI state to the interesting state interval, that is, the corresponding frame is determined to be in the IOI state.

[0093] In actual application, if the previous frame of the corresponding frame is in the IOI state and the corresponding frame is the target frame, it can also be considered that the video stream continues to contain the target, and the state machine will remain in the IOI state, that is, it is determined that the corresponding frame is in the IOI state.

[0094] In actual application, the edge node can use the detection result of the frame before the corresponding frame in the video stream to determine whether the corresponding frame is in the IOI state.

[0095] Based on this, in one embodiment, using the detection result to determine the state of the corresponding frame includes:

[0096] When it is detected that the previous frame of the P consecutive frames before the corresponding frame in the video stream is in the IOI state, and the P consecutive frames before the corresponding frame are all non-target frames, it is determined that the corresponding frame is in the leaving IOI state; P is an integer greater than or equal to 1.

[0097] In actual application, the value of P can be set as needed.

[0098] Exemplarily, if the value of P is set to 1, when the edge node detects that the previous frame of the previous frame of the corresponding frame is in the IOI state, the previous frame of the corresponding frame is a non-target frame, and the corresponding frame is also a non-target frame, that is, no target frame is detected for two consecutive frames, and the previous frame of the previous frame of the corresponding frame is in the IOI state, then it can be determined that the target has just disappeared, the state machine is transferred from the IOI state to the leaving IOI state, and it is determined that the corresponding frame is in the leaving IOI state.

[0099] In actual application, the edge node can use the state of the previous frame of the corresponding frame in the video stream in combination with the detection result of the corresponding frame to determine whether the corresponding frame is in the non-IOI state.

[0100] Based on this, in one embodiment, using the detection result to determine the state of the corresponding frame includes:

[0101] When a previous frame of the corresponding frame in the video stream is in the leaving IOI state and it is detected that the corresponding frame is a non-target frame, it is determined that the corresponding frame is in the leaving IOI state.

[0102] Here, if the previous frame of the corresponding frame is in the Leaving IOI state and the corresponding frame is a non-target frame, it can be considered that the target in the video stream disappears completely, the state machine transfers from the Leaving IOI state to the Non-IOI state, and determines that the corresponding frame is in the Non-IOI state.

[0103] In actual application, the edge node can manage the creation and deletion of the cache based on the status of the corresponding frame, so that the storage space can be flexibly adjusted.

[0104] Based on this, in one embodiment, the method may further include:

[0105] When the corresponding frame is in the entering IOI state, creating the buffer;

[0106] When all frames in the buffer are read, the buffer is deleted.

[0107] In actual application, when the edge node determines that the corresponding frame is in the IOI state, it creates a cache so as to store the corresponding frame in the IOI state or in the IOI state into the cache and analyze it to obtain the analysis result.

[0108] Here, the edge node can be used as a cache by dividing the corresponding storage space in the memory.

[0109] Accordingly, when the edge node determines that all frames in the cache have been read, it means that all frames have been analyzed. At this time, the memory corresponding to the storage space can be released, that is, the cache is deleted.

[0110] In one embodiment, after all frames in the cache are read, deleting the cache includes:

[0111] After each frame is read from the cache, the corresponding frame is deleted from the cache;

[0112] When the cache is empty, the cache is deleted.

[0113] In actual application, after the edge node reads and analyzes each frame from the cache, it deletes the corresponding frame from the cache. In this way, when the cache is empty, it means that all frames in the cache have been read and analyzed, and the cache can be deleted at this time.

[0114] The video stream processing method provided by the embodiment of the present application is as follows: an edge node obtains a video stream to be analyzed; for each frame of the video stream, a first model is used to detect whether the corresponding frame is a target frame to obtain a detection result; the state of the corresponding frame is determined using the detection result; the state of the corresponding frame includes a non-IOI state, entering an IOI state, being in an IOI state, or leaving an IOI state; the frame interval between two adjacent IOIs in the video stream is greater than or equal to N; N is an integer greater than or equal to 2; the corresponding frame in a first state is stored in a cache, and the first state includes entering an IOI state or being in an IOI state; wherein, after the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result. According to the technical solution provided by the embodiment of the present application, for the video stream to be analyzed, the edge node stores the corresponding frames in the video stream that are in the IOI state and in the IOI state into a cache, and then analyzes the corresponding frames in the cache frame by frame to obtain the analysis results, thereby avoiding the low reliability of the video analysis results caused by insufficient processing power of the edge node when directly analyzing all frames in the video stream, thereby improving the accuracy of the video analysis results, that is, realizing the accurate analysis of high frame rate and / or high-definition video streams using edge nodes with low computing power and low processing power.

[0115] The present application is further described in detail below in conjunction with application examples.

[0116] In this application embodiment, a video stream analysis solution based on a two-layer neural network (including a lightweight neural network and a complex neural network) and a cache is proposed, which is suitable for scenarios with sparse targets in the time domain, and realizes the analysis and understanding of high frame rate / high-definition video stream data using low-computing edge computing devices, and ensures the accuracy of the analysis and understanding algorithm. At the same time, the edge computing device introduces a state machine to judge the state of the video frame, and combined with the detection results of the lightweight neural network for the video frame, it can flexibly control the creation, deletion and storage of the cache, improve the flexibility of the video stream analysis method, and save storage resources.

[0117] Specifically, the edge computing device may include: a video stream data acquisition module, a target detection module, an IOI judgment module, and a video analysis and understanding module; wherein,

[0118] A video stream data acquisition module, used to acquire the video stream to be analyzed;

[0119] The target detection module is used to detect whether the corresponding frame in the video stream is the target frame and generate a detection result;

[0120] The IOI judgment module is used to judge the state of the corresponding frame based on the detection result, store the corresponding frame in a specific state into the cache, and create the cache;

[0121] The video analysis and understanding module is used to analyze and understand the corresponding frames after reading the corresponding frames from the cache, and delete the cache.

[0122] The process of edge nodes processing video streams in this application embodiment is as follows: Figure 3 As shown, the following steps are included:

[0123] Step 301: The data stream data acquisition module obtains the video stream;

[0124] Here, the data stream acquisition module can obtain the video stream from the network camera through RTSP as the video stream to be analyzed, and then execute step 302.

[0125] Step 302: the target detection module performs target detection on each frame of the video stream;

[0126] In actual application, for each frame of the video stream, the target detection module can first perform a preprocessing operation on the corresponding frame, and then perform target detection on the preprocessed corresponding frame; the preprocessing type includes scale scaling, filtering and noise removal, distortion correction, color space conversion, etc. Specifically, the target detection module can use a lightweight target detection network model to detect whether the corresponding frame contains an object of interest, that is, whether it is a target frame. Then, the target detection module can send the detection result of the corresponding frame to the IOI judgment module to facilitate the execution of step 303.

[0127] Step 303: The IOI determination module determines whether to store the corresponding frame into the cache;

[0128] Here, based on the detection result of the corresponding frame, the IOI judgment module can determine the state of the corresponding frame through a state machine, and then make a judgment based on the determined state; wherein the state machine includes non-IOI, entering IOI, being in IOI and leaving IOI.

[0129] Here, the initial state of the state machine is non-IOI.

[0130] If the IOI judgment module determines not to store the corresponding frame in the cache, step 306 is executed; if the corresponding frame is stored in the cache, step 304 is executed, and at the same time, the state of the corresponding frame is sent to the video analysis and understanding module.

[0131] For example, Figure 4 As shown, the status of the corresponding frame can be determined by:

[0132] Entering the IOI state: When the IOI judgment module detects that two consecutive frames are both target frames, it is determined that the target has just appeared in the camera field of view, that is, the IOI interval has just appeared. At this time, the state machine switches from the initial non-IOI to entering the IOI (i.e., S1-S2). At this time, after the IOI judgment module determines that the corresponding frame is in the IOI state, it creates a cache and stores the corresponding frame in the cache. Among them, in this application embodiment, since the cache can be created and deleted as needed, the cache can also be called an intelligent cache.

[0133] In IOI state: when the IOI judgment module determines that the previous frame of the corresponding frame is in the IOI state, and detects that the corresponding frame is the target frame, it means that the target continues to appear in the camera field of view and is in the IOI interval, and the state machine switches from entering IOI to being in IOI (i.e., S2-S3). At this time, the IOI judgment module determines that the corresponding frame is in the IOI state; or, when the previous frame of the corresponding frame is in the IOI state, and detects that the corresponding frame is the target frame, it means that the target continues to appear in the camera field of view (i.e., S3-S3), in the IOI interval, the state machine remains in IOI, and at this time, the IOI judgment module determines that the corresponding frame is in the IOI state. Accordingly, the corresponding frame can be stored in the cache.

[0134] Leaving IOI state: When the IOI judgment module detects that the current state machine is in the IOI state (i.e., the previous frame of the previous frame of the corresponding frame is in the IOI state), and two consecutive frames are non-target frames, it is determined that the target has just left the camera field of view, that is, has just left the IOI interval, and the state machine switches from being in IOI to leaving IOI (i.e., S3-S4). At this time, the IOI judgment module determines that the corresponding frame is in the leaving IOI state; accordingly, the corresponding frame is stopped from being stored in the cache.

[0135] Non-IOI state: When the IOI judgment module determines that the previous frame of the corresponding frame is in the leaving IOI state, and determines that the corresponding frame is a non-target frame, it means that the target has completely left the camera field of view, that is, completely left the current IOI interval, and is ready to enter the next IOI interval. At this time, the state machine switches from leaving IOI to non-IOI (i.e. S4-S1), and the IOI judgment module determines that the corresponding frame is in the non-IOI state, and accordingly, stops storing the corresponding frame in the cache.

[0136] Step 304: the video analysis and understanding module reads the corresponding frame and performs analysis;

[0137] In actual application, after the corresponding frame is stored in the cache, the video analysis and understanding module can read and analyze each frame from the cache based on the state of the corresponding frame. In this process, after each frame is read from the cache, the video analysis and understanding module deletes the corresponding frame from the cache.

[0138] Specifically, when the corresponding frame is in the IOI state, it is determined that the target has just appeared, the video analysis and understanding module reads the frame from the cache, analyzes it, and then deletes the corresponding frame.

[0139] When the corresponding frame is in the IOI state, the video analysis and understanding module continues to read the frame from the cache and analyzes it, and then deletes the corresponding frame.

[0140] When the corresponding frame is in the leaving IOI state, since the storage speed of the corresponding frame is higher than the analysis speed of the video analysis and understanding module, the video analysis and understanding module can continue to read the frame from the cache and analyze it, and then delete the corresponding frame.

[0141] When the corresponding frame is in a non-IOI state, it means that the video stream has left an IOI interval, and the video analysis and understanding module needs to first determine whether the cache exists. If it exists, it means that there are still frames to be analyzed corresponding to the IOI interval in the cache, and it is necessary to continue reading and analyzing until all frames in the cache are read, and then delete the cache; if it does not exist, it means that no target appears in the current video stream, that is, it has not entered the next IOI interval, and the frames to be analyzed in the IOI interval have been analyzed. At this point, the video analysis and understanding module can stop the analysis operation.

[0142] Step 305: The video analysis and understanding module displays the analysis results;

[0143] Here, the video analysis module can display the analysis results corresponding to the video stream to the user terminal through the network.

[0144] Step 306: End the current processing flow.

[0145] The solution provided by the application embodiment of the present application introduces intelligent caching and two neural network models. The edge node uses a lightweight neural network model to detect each frame in the video stream, and uses the detection results to determine the state of the corresponding frame, so that the corresponding frame in a specific state is stored in the intelligent cache. Then, the corresponding frames in the cache are analyzed frame by frame using a complex neural network model. In the above scheme, the frames in a specific state are stored in the cache and then processed frame by frame. Because the frames in non-specific states are not of interest to the edge nodes, the processing power corresponding to the edge nodes when the frames in non-specific states appear can be used to analyze the frames in the cache in a specific state frame by frame, thereby solving the contradiction between low-computing edge nodes and high-frame-rate video streams. At the same time, since the above scheme does not require the improvement of hardware configuration, the cost is controllable, which is convenient for large-scale deployment and productization.

[0146] In addition, the edge node can flexibly control the creation and deletion (i.e., destruction) of the intelligent cache by combining the target detection results of the video frame and the corresponding IOI status, which can save storage resources. At the same time, it can also realize the flexible adjustment of storage space and improve the flexibility of cache management.

[0147] In order to implement the solution of the embodiment of the present application, the embodiment of the present application also provides a video stream processing device, which is arranged on an edge node, such as Figure 5 As shown, the device comprises:

[0148] An acquisition unit 501 is used to acquire a video stream to be analyzed;

[0149] The first processing unit 502 detects, for each frame of the video stream, whether the corresponding frame is a target frame using the first model, and obtains a detection result; determines the state of the corresponding frame using the detection result; the state of the corresponding frame includes a non-IOI state, an IOI state, an IOI state, or an IOI state; the frame interval between two adjacent IOIs in the video stream is greater than or equal to N; N is an integer greater than or equal to 2;

[0150] The second processing unit 503 is used to store the corresponding frame in the first state into the cache, wherein the first state includes entering the IOI state or being in the IOI state; wherein,

[0151] After the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result.

[0152] Here, it should be noted that the function of the acquisition unit 501 is equivalent to the function of the video stream data acquisition module in the application embodiment; the function of the first processing unit 502 is equivalent to the function of the target detection module and the IOI judgment module in the application embodiment to determine the corresponding frame state; the function of the second processing unit 503 is equivalent to the function of the video analysis and understanding module and the function of the IOI judgment module to store the corresponding frame into the cache in the application embodiment; the cache is equivalent to the intelligent cache in the application embodiment.

[0153] In one embodiment, the first processing unit 502 is used to determine that the corresponding frame is in the IOI state when it is detected that M consecutive frames before the corresponding frame in the video stream are all target frames; M is an integer greater than or equal to 1.

[0154] In one embodiment, the first processing unit 502 is used to determine that the corresponding frame is in the IOI state when the previous frame of the corresponding frame in the video stream is in the IOI state and it is detected that the corresponding frame is the target frame.

[0155] In one embodiment, the first processing unit 502 is used to determine that the corresponding frame is in the leaving IOI state when it is detected that the previous frame of the P consecutive frames before the corresponding frame in the video stream is in the IOI state, and the P consecutive frames before the corresponding frame are all non-target frames; P is an integer greater than or equal to 1.

[0156] In one embodiment, the first processing unit 502 is used to determine that the corresponding frame is in the non-IOI state when the previous frame of the corresponding frame in the video stream is in the leaving IOI state and it is detected that the corresponding frame is a non-target frame.

[0157] In one embodiment, the first processing unit 502 is further configured to:

[0158] When the corresponding frame is in the entering IOI state, creating the buffer;

[0159] When all frames in the buffer are read, the buffer is deleted.

[0160] In one embodiment, the second processing unit 503 is used to:

[0161] After each frame is read from the cache, the corresponding frame is deleted from the cache;

[0162] When the cache is empty, the cache is deleted.

[0163] In one embodiment, the first processing unit 502 is used to:

[0164] Preprocessing the corresponding frame;

[0165] Using the first model, it is detected whether the corresponding frame after preprocessing is a target frame.

[0166] In actual application, the acquisition unit 501 can be implemented by a processor in the video stream processing device in combination with a communication interface; the first processing unit 502 and the second processing unit 503 can be implemented by a processor in the video stream processing device.

[0167] It should be noted that: the video stream processing device provided in the above embodiment only uses the division of the above program units as an example to illustrate when performing video stream processing. In actual applications, the above processing can be assigned to different program units as needed, that is, the internal structure of the device is divided into different program units to complete all or part of the processing described above. In addition, the video stream processing device provided in the above embodiment and the video stream processing method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0168] Based on the hardware implementation of the above program modules, and in order to implement the method for video stream processing in the embodiment of the present application, the embodiment of the present application also provides an electronic device, namely an edge node, such as Figure 6 As shown, the electronic device 600 includes:

[0169] Communication interface 601, capable of interacting with other devices;

[0170] A processor 602, connected to the communication interface 601 to interact with other devices, and configured to execute the method provided by one or more of the above technical solutions when running a computer program;

[0171] A memory 603 , on which the computer program is stored.

[0172] Specifically, the processor 602 is configured to:

[0173] Acquire the video stream to be analyzed through the communication interface 601;

[0174] For each frame of the video stream, using the first model, detecting whether the corresponding frame is a target frame, and obtaining a detection result; using the detection result, determining the state of the corresponding frame; the state of the corresponding frame includes a non-IOI state, entering an IOI state, being in an IOI state, or leaving an IOI state; the frame interval between two adjacent IOIs in the video stream is greater than or equal to N; N is an integer greater than or equal to 2; storing the corresponding frame in a first state into a cache, the first state includes entering an IOI state or being in an IOI state; wherein,

[0175] After the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result.

[0176] In one embodiment, the processor 602 is used to determine that the corresponding frame is in the IOI state when it is detected that M consecutive frames before the corresponding frame in the video stream are all target frames; M is an integer greater than or equal to 1.

[0177] In one embodiment, the processor 602 is used to determine that the corresponding frame is in the IOI state when the previous frame of the corresponding frame in the video stream is in the IOI state and it is detected that the corresponding frame is the target frame.

[0178] In one embodiment, the processor 602 is used to determine that the corresponding frame is in the leaving IOI state when it is detected that the previous frame of the P consecutive frames before the corresponding frame in the video stream is in the IOI state, and the P consecutive frames before the corresponding frame are all non-target frames; P is an integer greater than or equal to 1.

[0179] In one embodiment, the processor 602 is used to determine that the corresponding frame is in the non-IOI state when the previous frame of the corresponding frame in the video stream is in the leaving IOI state and it is detected that the corresponding frame is a non-target frame.

[0180] In one embodiment, the processor 602 is further configured to:

[0181] When the corresponding frame is in the entering IOI state, creating the buffer;

[0182] When all frames in the buffer are read, the buffer is deleted.

[0183] In one embodiment, the processor 602 is configured to:

[0184] After each frame is read from the cache, the corresponding frame is deleted from the cache;

[0185] When the cache is empty, the cache is deleted.

[0186] In one embodiment, the processor 602 is configured to:

[0187] Preprocessing the corresponding frame;

[0188] Using the first model, it is detected whether the corresponding frame after preprocessing is a target frame.

[0189] It should be noted that the specific processing process of the processor 602 can be understood by referring to the above method.

[0190] Of course, in actual application, the various components in the electronic device 600 are coupled together through the bus system 604. It can be understood that the bus system 604 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 604 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 6 Various buses are labeled as bus system 604 .

[0191] The memory 603 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device 600. Examples of such data include: any computer program used to operate on the electronic device 600.

[0192] The method disclosed in the above embodiment of the present application can be applied to the processor 602, or implemented by the processor 602. The processor 602 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 602 or an instruction in the form of software. The above-mentioned processor 602 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 602 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in the memory 603, and the processor 602 reads the information in the memory 603 and completes the steps of the above method in combination with its hardware.

[0193] In an exemplary embodiment, the electronic device 600 can be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field programmable gate array (FPGA), general processor, controller, microcontroller (MCU), microprocessor, or other electronic components to execute the aforementioned method.

[0194] In an exemplary embodiment, the embodiment of the present application further provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, including a memory 603 storing a computer program, and the above-mentioned computer program can be executed by a processor 602 of an electronic device 600 to complete the aforementioned steps of video stream processing. The computer-readable storage medium can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory.

[0195] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0196] In addition, the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.

[0197] The above is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of protection of the present application.

Claims

1. A video stream processing method, It is characterized in that Applied to edge nodes, including: Get the video stream to be analyzed; For each frame of the video stream, using the first model, detect whether the corresponding frame is a target frame to obtain a detection result; using the detection result, determine the state of the corresponding frame; the state of the corresponding frame includes a non-interest interval state, an entry into an interesting interval state, an interesting interval state or an exit from an interesting interval state; the frame interval between two adjacent interesting intervals in the video stream is greater than or equal to N; N is an integer greater than or equal to 2; the corresponding frame in the first state is stored in a cache, and the first state includes an entry into an interesting interval state or an interesting interval state; wherein, After the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result.

2. The method according to claim 1, It is characterized in that The using the detection result to determine the state of the corresponding frame includes: When it is detected that M consecutive frames before the corresponding frame in the video stream are all target frames, it is determined that the corresponding frame is in a state of entering an interval of interest; M is an integer greater than or equal to 1.

3. The method according to claim 1, It is characterized in that The using the detection result to determine the state of the corresponding frame includes: When a previous frame of the corresponding frame in the video stream is in an entering-interest interval state and the corresponding frame is detected as a target frame, it is determined that the corresponding frame is in an entering-interest interval state.

4. The method according to claim 1, It is characterized in that The using the detection result to determine the state of the corresponding frame includes: When it is detected that the previous frame of the P consecutive frames before the corresponding frame in the video stream is in the interesting interval state, and the P consecutive frames before the corresponding frame are all non-target frames, it is determined that the corresponding frame is in the leaving interesting interval state; P is an integer greater than or equal to 1.

5. The method according to claim 1, It is characterized in that The using the detection result to determine the state of the corresponding frame includes: When a previous frame of the corresponding frame in the video stream is in a state of leaving an interesting interval and it is detected that the corresponding frame is a non-target frame, it is determined that the corresponding frame is in a state of a non-interest interval.

6. The method according to claim 2, It is characterized in that The method further comprises: When the corresponding frame is in a state of entering an interesting interval, creating the buffer; When all frames in the buffer are read, the buffer is deleted.

7. The method according to claim 6, It is characterized in that After all frames in the cache are read, deleting the cache comprises: After each frame is read from the cache, the corresponding frame is deleted from the cache; When the cache is empty, the cache is deleted.

8. The method according to any one of claims 1 to 7, It is characterized in that The using the first model to detect whether the corresponding frame is a target frame includes: Preprocessing the corresponding frame; Using the first model, it is detected whether the corresponding frame after preprocessing is a target frame.

9. A video stream processing device, It is characterized in that include: An acquisition unit, used for acquiring a video stream to be analyzed; The first processing unit is used to detect, for each frame of the video stream, whether the corresponding frame is a target frame using the first model to obtain a detection result; determine the state of the corresponding frame using the detection result; the state of the corresponding frame includes a non-interest interval state, an entry into an interesting interval state, an interesting interval state, or an exit from an interesting interval state; the frame interval between two adjacent interesting intervals in the video stream is greater than or equal to N; N is an integer greater than or equal to 2; The second processing unit is used to store the corresponding frame in a first state into a cache, wherein the first state includes entering an interesting interval state or being in an interesting interval state; wherein, After the corresponding frame is stored in the cache, the corresponding frame is read from the cache, and the read corresponding frame is analyzed using the second model to obtain an analysis result.

10. An electronic device, It is characterized in that include: a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the steps of the method described in any one of claims 1 to 8.

11. A storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.