Disclosure of Invention
In order to solve the problems, the invention provides a video analysis method and a system based on Bian Yun cooperative computing in a smart lever scene, which are used for classifying video streams according to different pressure demands of the video streams on computing resources, and setting video stream forwarding thresholds of different levels according to computing resources of an edge gateway and a cloud server, so that effective cooperation of the smart edge gateway and the cloud server is ensured, occupation of network bandwidth is reduced, and data congestion is not formed.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
in a first aspect, the present invention provides a video analysis method based on Bian Yun collaborative computing in a smart bar scene, including:
acquiring video data;
dividing video data into continuous frame extraction video and discontinuous frame extraction video according to the demand of computing resources;
and dynamically distributing the continuous frame extraction video and the discontinuous frame extraction video to the edge gateway and the cloud server for video analysis according to the computing resource occupancy rates of the edge gateway and the cloud server and the set threshold rules.
As an alternative embodiment, the process of dynamic allocation includes: and if the computing resource occupancy rate of the edge gateway is smaller than a first threshold value, the edge gateway performs video analysis processing on the continuous frame extraction video and the discontinuous frame extraction video.
As an alternative embodiment, the process of dynamic allocation includes: if the computing resource occupancy rate of the edge gateway exceeds the first threshold and is smaller than the second threshold, forwarding the discontinuous frame extraction video to a cloud server, performing video analysis processing by the cloud server, and feeding back an analysis result to the edge gateway.
As an alternative embodiment, the process of dynamic allocation includes: and if the computing resource occupancy rate of the edge gateway exceeds the second threshold and is smaller than the third threshold, forwarding part of the continuous frame extraction video to the cloud server until the computing resource occupancy rate of the edge gateway is recovered to be lower than the second threshold or the first threshold.
As an alternative embodiment, the process of dynamic allocation includes: and if the computing resource occupancy rates of the edge gateway and the cloud server simultaneously exceed a third threshold, suspending receiving the new video data until the computing resource occupancy rates of the edge gateway and the cloud server are reduced below the third threshold.
As an alternative embodiment, the process of acquiring video data includes: acquiring video data in a smart rod scene, wherein a camera device is arranged on the smart rod, and the camera device acquires video data of the periphery of the smart rod; and simultaneously sends the video data to the edge gateway.
Alternatively, the discontinuous frame-pumping video is transmitted in a segmented mode or in a frame-skipping mode.
In a second aspect, the present invention provides a video analysis system based on Bian Yun collaborative computing in a smart bar scenario, including:
a video acquisition module configured to acquire video data;
the video classification module is configured to divide video data into continuous frame extraction video and discontinuous frame extraction video according to the requirement on computing resources;
the video distribution module is configured to dynamically distribute the continuous frame extraction video and the discontinuous frame extraction video to the edge gateway and the cloud server for video analysis according to the computing resource occupancy rates of the edge gateway and the cloud server and the set threshold rules.
In a third aspect, the invention provides an electronic device comprising a memory and a processor and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the method of the first aspect.
In a fourth aspect, the present invention provides a computer readable storage medium storing computer instructions which, when executed by a processor, perform the method of the first aspect.
Compared with the prior art, the invention has the beneficial effects that:
the invention provides a video analysis method and a system based on Bian Yun collaborative calculation in a smart rod scene, which adopt a method for carrying out video analysis at an edge gateway, a front-end camera device is not bound with an algorithm, can be flexibly configured in the edge gateway, dynamically invokes the calculation resource of a cloud server according to the monitoring of the calculation resource, does not generate data congestion at the smart rod side, effectively shares the calculation pressure of the cloud server, and realizes the high-efficiency processing analysis of video data.
According to the method and the system, the video streams are classified according to different pressure requirements of the video streams on the computing resources, when the computing resources of the intelligent edge gateway are tense, the video streams can be forwarded according to different categories, the computing pressure of the video streams is relieved, and the computing capacities of the intelligent edge gateway and the cloud service are utilized efficiently.
According to the intelligent edge gateway and cloud server computing resource real-time monitoring method, the computing resources of the intelligent edge gateway and the cloud server are monitored in real time, and the video stream dispatching processing mechanism meeting the intelligent bar application scene is formed by setting the video stream forwarding thresholds of different levels, so that the intelligent edge gateway and the cloud server are guaranteed to be effectively cooperated, the occupation of network bandwidth is reduced, and data congestion is not formed.
The invention adopts the mode of cooperative calculation of the edge gateway and the cloud server in the intelligent pole, compared with the mode of directly carrying out video analysis in the camera, the invention can provide stronger computing power, flexibly configures the algorithm for the camera in the background through the service system, and meets the requirement of urban treatment scenes.
Additional aspects of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
The invention is further described below with reference to the drawings and examples.
It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the invention. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular forms also are intended to include the plural forms, and furthermore, it is to be understood that the terms "comprises" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions, such as, for example, processes, methods, systems, products or devices that comprise a series of steps or units, are not necessarily limited to those steps or units that are expressly listed, but may include other steps or units that are not expressly listed or inherent to such processes, methods, products or devices.
Embodiments of the invention and features of the embodiments may be combined with each other without conflict.
Example 1
As shown in fig. 1, the present embodiment provides a video analysis method based on Bian Yun collaborative computing in a smart bar scene, which includes:
s1: acquiring video data;
s2: dividing video data into continuous frame extraction video and discontinuous frame extraction video according to the demand of computing resources;
s3: and dynamically distributing the continuous frame extraction video and the discontinuous frame extraction video to the edge gateway and the cloud server for video analysis according to the computing resource occupancy rates of the edge gateway and the cloud server and the set threshold rules.
In this embodiment, in the step S1, video data in a smart bar scene is obtained, and an imaging device is disposed on the smart bar, and the imaging device collects video data around the smart bar;
the camera device is in communication connection with the edge gateway and is used for sending the collected video data to the edge gateway;
the edge gateway is in communication connection with the cloud server and is used for acquiring video data and sending the video data to be analyzed to the cloud server according to the occupancy rate of computing resources.
Alternatively, the communication connection is a wired communication or a wireless communication.
In this embodiment, after the acquired video data is sent to the edge gateway, the video data is divided into a continuous frame-drawing video and a discontinuous frame-drawing video in the edge gateway;
alternatively, the continuous frame-extracting video refers to a video stream in which the video analysis algorithm needs to analyze each frame of the video stream, and the overall analysis result is determined by the analysis result of each frame in the video. Such as monitoring vehicle stopping recognition (continuous stopping exceeds 3 minutes), fighting recognition (continuous multiple actions), personnel falling recognition (personnel falling continuously for more than 20 seconds), and the like; that is, for example, a monitoring analysis for a fall of a person requires analysis of the contents of all frames in 20 seconds in succession, and the person can be judged as a fall without standing up on the ground.
The discontinuous frame extraction video is a video stream which can generate a causal relationship conclusion only by judging the content of a certain frame in the video and without comparing and analyzing the content with the previous and the next frames of the video; such video streams may be analyzed by frame skipping (frame extraction) or video content at intervals, without affecting the analysis results. As long as one frame of judgment result is provided, the result output by the whole algorithm to the outside is established. Such as face recognition, mask recognition, riding without safety helmet recognition, road garbage drop recognition, etc.
Therefore, the continuous frame extraction video is higher in computing resource occupancy rate and data transmission bandwidth occupancy than the discontinuous frame extraction video due to continuous frame extraction analysis, so that the computing pressure generated by the continuous frame extraction video on computing resources (such as CPU, GPU and memory) of video analysis equipment is much higher than that generated by the discontinuous frame extraction video.
Therefore, in this embodiment, the continuous frame extraction video is locally calculated on the edge gateway side preferentially, so as to save network transmission traffic; the discontinuous frame extraction video is transmitted in a segmented mode or in a frame skip mode, the occupied network bandwidth and the requirement are low, and the discontinuous frame extraction video is sent to a cloud server for calculation.
The video distribution and calculation strategy of the embodiment is different from the existing cloud computing strategy in the internet of vehicles or other services in that the videos collected by the internet of vehicles are not distinguished into continuous or discontinuous frame extraction types, the internet of vehicles needs to analyze and calculate each frame of the videos, and the frames cannot be skipped or the videos which are not analyzed are omitted, so that the classification speaking is omitted, the forwarding of video streams is not prioritized, and the traffic distribution mechanism for reducing the occupation of network bandwidth traffic is not involved.
In this embodiment, the video data is classified according to different demands of the video data on computing resources, and when the computing resources of the edge gateway are tense, the video data is forwarded according to different categories, so as to relieve the computing pressure of the edge gateway.
Meanwhile, the camera device at the front end is not bound with the algorithm, the algorithm is flexibly configured in the edge gateway, cloud resources are dynamically called according to the monitoring of the computing capacity of the edge gateway, and efficient processing analysis of video data is achieved.
Specifically, in the step S3, if the computing resource occupancy rate of the edge gateway is smaller than the first threshold, the intelligent edge gateway processes the continuous frame extraction video and the discontinuous frame extraction video, and generates alarm information according to the processing result.
If the computing resource occupancy rate of the edge gateway exceeds a first threshold and is smaller than a second threshold, the edge gateway is controlled to forward the discontinuous frame extraction video to the cloud server so as to reduce the self computing pressure; and after receiving the discontinuous frame extraction video, the cloud server performs video analysis and processing, and feeds back an analysis result to the edge gateway.
If the computing resource occupancy rate of the edge gateway continues to rise and exceeds a second threshold value and is smaller than a third threshold value, the intelligent edge gateway is controlled to forward part of continuous frame-drawing video to the cloud server so as to further reduce the computing pressure of the intelligent edge gateway until the computing resource occupancy rate is restored to be below the second threshold value or the first threshold value.
And if the computing resource occupancy rates of the edge gateway and the cloud server simultaneously exceed a third threshold value, controlling the edge gateway to pause receiving new video data so as to relieve the overall computing pressure and avoid system congestion, and controlling the edge gateway to re-receive the video data to be analyzed and processed until the overall computing resource is reduced below the third threshold value.
Continuously monitoring the computing resource occupancy rate of the edge gateway and the cloud server, and dynamically distributing video streams from the edge gateway to the cloud server for processing; and the edge gateway mobilizes relevant terminal equipment on the intelligent pole to link according to an analysis result of the video stream or a received video analysis result sent back by the cloud server, such as performing operations of video broadcasting, broadcasting prompt, camera follow shooting and the like.
As an alternative implementation manner, the values of the first threshold, the second threshold and the third threshold are set according to actual requirements.
The embodiment provides a complete solution and a complete system for video analysis and flow allocation based on Bian Yun cooperative calculation in a smart rod scene. The cloud server computing pressure is reduced, the network bandwidth occupation is reduced, the situation that data blocking is not formed on the edge gateway side can be guaranteed, and the advantages of the edge cloud collaborative video analysis are fully exerted.
Example 2
As shown in fig. 2, the present embodiment provides a video analysis system based on Bian Yun collaborative computing in a smart bar scenario, integrated at an edge gateway, including:
a video acquisition module configured to acquire video data;
the video classification module is configured to divide video data into continuous frame extraction video and discontinuous frame extraction video according to the requirement on computing resources;
the video distribution module is configured to dynamically distribute the continuous frame extraction video and the discontinuous frame extraction video to the edge gateway and the cloud server for video analysis according to the computing resource occupancy rates of the edge gateway and the cloud server and the set threshold rules.
In this embodiment, the system further includes a cloud system in communication with the edge gateway, and a camera device; as shown in fig. 3, the camera device is mounted on the smart bar, collects video data around the smart bar, and sends the video data to the edge gateway, and the edge gateway classifies and distributes the video data and then sends the video to be analyzed to the cloud server.
In addition, the above modules correspond to the steps described in embodiment 1, and the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in embodiment 1. It should be noted that the modules described above may be implemented as part of a system in a computer system, such as a set of computer-executable instructions.
In further embodiments, there is also provided:
an electronic device comprising a memory and a processor and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the method described in embodiment 1. For brevity, the description is omitted here.
It should be appreciated that in this embodiment, the processor may be a central processing unit CPU, but the processor may also be other general purpose processors, graphics processor GPU, digital signal processor DSP, application specific integrated circuit ASIC, off-the-shelf programmable gate array FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may include read only memory and random access memory and provide instructions and data to the processor, and a portion of the memory may also include non-volatile random access memory. For example, the memory may also store information of the device type.
A computer readable storage medium storing computer instructions which, when executed by a processor, perform the method described in embodiment 1.
The method in embodiment 1 may be directly embodied as a hardware processor executing or executed with a combination of hardware and software modules in the processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method. To avoid repetition, a detailed description is not provided herein.
Those of ordinary skill in the art will appreciate that the elements of the various examples described in connection with the present embodiments, i.e., the algorithm steps, can be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
While the foregoing description of the embodiments of the present invention has been presented in conjunction with the drawings, it should be understood that it is not intended to limit the scope of the invention, but rather, it is intended to cover all modifications or variations within the scope of the invention as defined by the claims of the present invention.