Edge terminal resource allocation method and device, edge terminal and storage medium
By dynamically allocating video stream resources within and between edge terminals, the resource utilization problem caused by fixed binding between edge terminals and cameras is solved, and the security incident detection speed and resource utilization rate are improved.
Patent Information
- Application Number
- CN202510223587.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-05-30
AI Technical Summary
In the existing security management system, the fixed binding of edge terminals to cameras leads to unbalanced resource utilization, resulting in a reduced speed of security incident detection.
By monitoring the resource usage rate of each video stream in each edge terminal, first allocate resources for each video stream within the edge terminal. When resources cannot be allocated within the edge terminal, the target video stream is connected to other edge terminals.
It realizes dynamic allocation of video stream resources within and between edge terminals, solves the problem of unbalanced resource utilization, and improves security event detection speed and resource utilization rate of edge terminals.
Smart Images

Figure CN120071097A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technologies, and in particular, to a method and device for edge terminal resource allocation, an edge terminal, and a storage medium. Background Art
[0002] In a security management system, cameras are set in each monitoring area to collect video streams and send them to an edge terminal for security event detection. For example, it is detected whether an employee wears a safety helmet or an anti-static suit when entering a production workshop.
[0003] In the architecture of the existing security management system, in order to reduce the load of the server, an edge terminal is set in the system. The edge terminal receives the video streams collected by the cameras for security event detection. A single edge terminal accesses multiple video streams collected by multiple cameras. Currently, the common practice is to configure a single edge terminal to be connected to a fixed number of cameras. For example, Figure 1 as shown, the edge terminal numbered C is configured to receive the video streams collected by the cameras numbered C1, C2, and C3, and the edge terminal numbered A is configured to obtain the video streams collected by the cameras numbered A1, A2, and A3.
[0004] In the above method of fixedly binding the edge terminal to the camera, since the monitoring areas of the cameras are different and the data volumes of the collected video streams are different, the resource utilization rate of some edge terminals is too high, resulting in a decrease in the security event detection speed, and the resource utilization rate of some edge terminals is too low, and the resource utilization rate of the edge terminals is unbalanced. Summary of the Invention
[0005] The present invention provides a method and device for edge terminal resource allocation, an edge terminal, and a storage medium to solve the problem that the fixed binding of the edge terminal to the camera leads to unbalanced resource utilization rate of the edge terminal and a decrease in the security event detection speed.
[0006] In a first aspect, the present invention provides a method for edge terminal resource allocation, which is applied to an edge terminal connected to a camera, and includes:
[0007] A first edge terminal obtains the resource utilization rate of each video stream of the connected cameras;
[0008] When the resource utilization rate of any video stream is greater than a preset first threshold, the video stream with the resource utilization rate greater than the first threshold is determined as a target video stream;
[0009] It is determined whether the first edge terminal meets the resource internal allocation condition;
[0010] If so, the resource usage amount of the target video stream is increased within the first edge terminal;
[0011] Otherwise, determine a second edge terminal that meets the resource allocation condition;
[0012] Connect the target video stream to the second edge terminal.
[0013] In a second aspect, the present invention provides an edge terminal resource allocation device, which is applied to an edge terminal. The edge terminal is connected to a camera and includes:
[0014] A usage rate acquisition module, configured to acquire the resource usage rate of each video stream of the camera accessed by the first edge terminal;
[0015] A target video stream determination module, configured to determine the video stream with a resource usage rate greater than a preset first threshold as the target video stream when the resource usage rate of any video stream is greater than the first threshold;
[0016] An internal allocation condition judgment module, configured to judge whether the first edge terminal meets the internal resource allocation condition. If so, execute the internal resource allocation module; if not, execute the second edge terminal determination module;
[0017] An internal resource allocation module, configured to increase the resource usage amount of the target video stream within the first edge terminal;
[0018] A second edge terminal determination module, configured to determine a second edge terminal that meets the resource allocation condition;
[0019] An inter-terminal resource allocation module, configured to allocate the target video stream to the second edge terminal for access.
[0020] In a third aspect, the present invention provides an edge terminal, which includes:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program executable by the at least one processor. When the computer program is executed by the at least one processor, the at least one processor can execute any one of the edge terminal resource allocation methods in the first aspect of the present invention.
[0024] In a fourth aspect, the present invention provides a computer-readable storage medium, which stores computer instructions for causing a processor to implement any one of the edge terminal resource allocation methods in the first aspect of the present invention when executed.
[0025] In the embodiment of the present invention, by obtaining the resource utilization rate of each video stream of the camera accessed by the first edge terminal, after determining the target video stream with the resource utilization rate greater than the first threshold, first determine whether the first edge terminal meets the resource internal allocation condition. If so, increase the resource usage amount of the target video stream in the first edge terminal. If not, determine the second edge terminal that meets the resource allocation from multiple edge terminals, and connect the target video stream to the second edge terminal. It realizes the allocation of resources for each video stream in the edge terminal by monitoring the resource utilization rate of each video stream in each edge terminal. When the resources cannot be allocated within the edge terminal, the target video stream is connected to other edge terminals. It can not only allocate resources for each video stream within the edge terminal, but also dynamically allocate resources for each video stream between edge terminals, solving the problem that the fixed binding of the edge terminal and the camera leads to too high resource utilization rate of some edge terminals and insufficient resources to analyze the video stream, resulting in the reduction of the safety event detection speed, enabling the video streams collected by each camera to have sufficient resources for processing, improving the speed of obtaining the safety event detection result by video analysis, and balancing the resources of each edge terminal and improving the resource utilization rate of the edge terminal.
[0026] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0028] Figure 1 is a schematic diagram of the architecture of the security management system in the prior art;
[0029] Figure 2 is a flowchart of a method for edge terminal resource allocation provided in Embodiment 1 of the present invention;
[0030] Figure 3 is a flowchart of a method for edge terminal resource allocation provided in Embodiment 2 of the present invention;
[0031] Figure 4 is a schematic diagram of the architecture of the security management system according to the embodiment of the present invention;
[0032] Figure 5 is a schematic diagram of resource allocation between edge terminals;
[0033] Figure 6 It is a schematic structural diagram of an edge terminal resource allocation device provided in Embodiment 3 of the present invention;
[0034] Figure 7 It is a schematic structural diagram of an edge terminal provided in Embodiment 4 of the present invention. Specific embodiments
[0035] In order to enable those skilled in the art to better understand the solution of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0036] Embodiment 1
[0037] Figure 2 It is a flowchart of an edge terminal resource allocation method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation of allocating resources for edge terminals in a security management system. This method can be executed by an edge terminal resource allocation device, and the edge terminal resource allocation device can be implemented in the form of hardware and / or software and can be configured in an edge terminal. As Figure 2 shown, the edge terminal resource allocation method includes:
[0038] S201. The first edge terminal obtains the resource utilization rate of each video stream of the connected camera.
[0039] The security management system of this embodiment may include cameras, switches, and edge terminals, and may also include servers. Among them, the cameras communicate with the edge terminals through switches. One edge terminal can be connected to multiple cameras, and each camera collects one video stream and sends it to the edge terminal. Multiple video streams can be processed simultaneously in the edge terminal. For example, security event detection is performed on the video stream in the edge terminal, such as security event detection in areas such as roads in the park of a manufacturing enterprise, production workshops, office areas, elevators, and parking lots.
[0040] Among them, the first edge terminal can be any edge terminal in the security management system. Resources can be allocated in advance for each video stream connected to the first edge terminal. In the first edge terminal, resources can refer to computing power resources such as CPU, memory, and processes. Initial resources can be allocated for each video stream, and the resource utilization rate of each video stream is monitored in real time. The resource utilization rate is the ratio of the actual amount of resources used for processing the video stream to the allocated amount of resources.
[0041] S202. When the resource utilization rate of any one video stream is greater than a preset first threshold, determine the video stream with a resource utilization rate greater than the first threshold as the target video stream.
[0042] In the first edge terminal, if among the multiple video streams accessed, the resource utilization rate of any one video stream is greater than the first threshold (such as 80%), it can be determined that the resource usage of this video stream is too high, there may be shortages, and resources need to be added to this video stream. This video stream can be determined as the target video stream.
[0043] S203. Determine whether the first edge terminal meets the resource internal allocation condition.
[0044] When the resource utilization rate of any one video stream in the first edge terminal is greater than the first threshold, first consider allocating resources to this video stream within the first edge terminal. Optionally, the resource shortage of the target video stream can be determined first, then the resource idle amount of the first edge terminal can be determined, and further calculate the total resource utilization rate of the first edge terminal after allocating resources to the target video stream. If the resource idle amount of the first edge terminal is greater than the resource shortage of the target video stream, and the total resource utilization rate is less than the second threshold, it is determined that the first edge terminal meets the resource internal allocation condition. That is, in the first edge terminal, the resource internal allocation condition is that the resource idle amount is greater than the resource shortage of the target video stream, and the total resource utilization rate is less than the second threshold. If it is satisfied, execute S204; if not, execute S205.
[0045] S204. Increase the resource usage amount of the target video stream within the first edge terminal.
[0046] When the first edge terminal meets the resource internal allocation condition, the idle resources in the first edge terminal can be allocated to the target video stream, and the amount of resource adjustment is equal to or greater than the resource shortage of the target video stream.
[0047] S205. Determine the second edge terminal that meets the resource allocation condition.
[0048] When the first edge terminal does not meet the resource internal allocation condition, the second edge terminal that meets the resource allocation condition can be determined from multiple edge terminals other than the first edge terminal. Exemplarily, the resource allocation condition can be that the resource idle amount is greater than the total amount of resources required by the target video stream, and the total resource utilization rate of the edge terminal after accessing the target video stream is less than the second threshold. If there is no second edge terminal that meets the resource allocation condition, the edge terminal closest to the first edge terminal can be determined as the second edge terminal, or the edge terminal with the largest resource idle amount can be determined as the second edge terminal.
[0049] S206. Access the target video stream in the second edge terminal.
[0050] After determining the second edge terminal, the camera for collecting the target video stream can be connected to the second edge terminal to access the target video stream in the second edge terminal and release the resources occupied by the target video stream in the first edge terminal.
[0051] In the embodiments of the present invention, by monitoring the resource utilization rate of each video stream in each edge terminal, resources are first allocated to each video stream inside the edge terminal. When resources cannot be allocated inside the edge terminal, the target video stream is connected to other edge terminals. Resources can be allocated to each video stream both inside the edge terminal and dynamically allocated to each video stream between edge terminals, solving the problem that the fixed binding of the edge terminal and the camera causes the resource utilization rate of some edge terminals to be too high and there is not enough resources to analyze the video stream, resulting in a decrease in the detection speed of security events, enabling the video streams collected by each camera to have sufficient resources for processing, improving the speed of obtaining the security event detection result by video analysis, and balancing the resources of each edge terminal and improving the resource utilization rate of the edge terminal.
[0052] Embodiment 2
[0053] Figure 3 It is a flowchart of a method for allocating resources of an edge terminal provided in Embodiment 2 of the present invention. The embodiments of the present invention are optimized on the basis of the above Embodiment 1. As Figure 3 shown, the method for allocating resources of the edge terminal includes:
[0054] S301. Determine a host edge terminal and multiple slave edge terminals from multiple edge terminals, and load an edge terminal list and a camera list in the host edge terminal.
[0055] As Figure 4 shown is a schematic architecture diagram of an example of a security management system according to an embodiment of the present invention. The security management system may include multiple cameras, multiple edge terminals, and a switch. The multiple cameras are connected to the edge terminals through the switch, the edge terminals are connected to each other through the switch, and the video stream collected by the camera is sent to the edge terminal through the switch.
[0056] When the security management system is first installed and deployed, the basic parameters of the system operating environment can be configured. Among them, an installation and debugging personnel can select an edge terminal as the host edge terminal, and other edge terminals as slave edge terminals. And the installation and debugging personnel can pre-configure the edge terminal list and the camera list. Among them, the edge terminal list can be the IP list of all edge terminals in the system, and the camera list can be the IP list of all cameras in the system, and load the edge terminal list and the camera list in the host edge terminal.
[0057] Taking Figure 4As an example, with edge terminal C as the host and edge terminal A as the slave, the edge terminal list and camera list can be loaded in edge terminal C. Among them, the cameras include cameras C1 - C3 and cameras A1 - A3. Of course, Figure 4 only two edge terminals are taken as examples here. In actual applications, there can be more edge terminals and cameras.
[0058] S302. The host edge terminal and the slave edge terminal are connected to the cameras, and a video processing sandbox is created for the video stream of each camera in the host edge terminal and the slave edge terminal, and the resource usage rate of each sandbox is detected as the resource usage rate of each video stream.
[0059] In this embodiment, the sandbox tool Cgroups, the monitoring software tool Zabbix, and the resource allocation application program are installed in each edge terminal. Among them, Sandboxing (also known as sandbox technology) is a security mechanism used to isolate running programs. It can abstract various entity resources (such as CPU, memory, disk space, etc.) in the edge terminal into a state that can be divided and recombined to re - allocate hardware resources. The sandbox tool can include Sandboxie, Cameyo, Cgroups, etc.
[0060] The monitoring software tool Zabbix is a monitoring and collection platform tool that can monitor and collect relevant metrics, such as monitoring and collecting data on CPU usage rate, device temperature, memory usage rate, etc. The Zabbix tool used in this embodiment includes two parts: Server and Proxy. Zabbix Server is the server side of Zabbix, responsible for data collection or reception and data caching, with extremely low usage rate of system resources. Zabbix Proxy is used to report the collected data such as CPU usage rate, memory usage rate, etc. to Zabbix Server at regular intervals. In each edge terminal, Zabbix Server and Zabbix Proxy can achieve role conversion through the configuration of the configuration file. Except for not having the receiving function of Zabbix Server, other functions of Zabbix Proxy can be the same as those of Zabbix Server. Therefore, it can be configured as Zabbix Server through the Zabbix Proxy configuration file for use, and multiple Zabbix Proxies can be configured. The resource allocation application program is responsible for services such as edge terminal resource allocation and receiving notification messages, and can also be the core program of the automatic load - balancing algorithm, which is a logical algorithm for realizing resource allocation.
[0061] During the installation and debugging process, the host edge terminal can first power on to load the edge terminal list and camera list. After the slave edge terminal powers on, the slave edge terminal synchronizes the camera list to the host edge terminal and applies for the IP of the cameras to be accessed to the host edge terminal. After receiving the camera access application from the slave edge terminal, the host edge terminal assigns the unallocated camera IPs in the camera list to the slave edge terminal until all cameras are assigned to the slave edge terminal. It should be noted that the host edge terminal can also process video streams and the host edge terminal also assigns cameras.
[0062] The host edge terminal and the slave edge terminal apply for the IPs of the cameras to be accessed. A sandbox is created for each accessed video stream through the sandbox tool, and video analysis and processing are performed on the video stream in the sandbox. In one edge terminal, the number of sandboxes is equal to the number of accessed video streams, so that one sandbox processes one video stream.
[0063] As Figure 4 shown, the edge terminal C is used as the host to access cameras C1, C2, and C3. Sandboxes 1, 2, and 3 are created in the edge terminal C to process the video streams of C1, C2, and C3 respectively. Similarly, the edge terminal A is used as the slave to access cameras A1, A2, and A3, and three sandboxes are also created to process the video streams of each path respectively. Initial resources are allocated to each sandbox.
[0064] In addition, for each sandbox, a Zabbix Proxy is created respectively to monitor the resource utilization rate of the video stream in the sandbox. For example, in the edge terminal C, a Zabbix Proxy is created for each of the C1 path, C2 path, and C3 path. In addition, an additional Zabbix Proxy is created in the edge terminal C to monitor and collect the total resource utilization rate of the entire edge terminal C. The data monitored and collected by each Zabbix Proxy is uploaded to the Zabbix Server.
[0065] S303. The host edge terminal generates a global parameter list and a local parameter list, the slave edge terminal generates a local parameter list. The slave edge terminal synchronizes the edge terminal list, camera list, global parameter list, and local parameter list from the host edge terminal according to a preset period, and uploads the local parameter list to the host edge terminal.
[0066] In this embodiment, both the host edge terminal and the slave edge terminal maintain a local parameter list, which records the cameras currently connected to the edge terminal and the resource utilization rate of the edge terminal (which may include the total resource utilization rate and the resource utilization rate of each sandbox). The host edge terminal also additionally maintains a global parameter list, which records the cameras and resource utilization rates of each edge terminal (including the host and the slave), and the host edge terminal also maintains a list of loaded edge terminals and a list of cameras.
[0067] The slave edge terminal and the host edge terminal can report their online status to each other through heartbeats. The slave edge terminal periodically synchronizes the edge terminal list, the camera list, the global parameter list, and the local parameter list from the host edge terminal. The slave edge terminal also periodically uploads the local parameter list to the host edge terminal, and the host edge terminal senses the online status of the slave edge terminal and edits and updates the global parameter list based on the data in the local parameter list uploaded by the slave edge terminal.
[0068] During the installation and debugging of this embodiment, the debugger selects the host edge terminal and pre-configures the edge terminal list and the slave edge terminal list. After the host edge terminal in the system loads the edge terminal list and the slave edge terminal list, the host edge terminal in the system automatically allocates cameras, eliminating the need for the debugger to observe the resource usage of each edge terminal and repeatedly attempt to configure the cameras connected to each edge terminal, reducing the installation and debugging difficulty, shortening the installation and debugging time, and improving the installation and debugging efficiency of the system.
[0069] S304. Monitor the resource utilization rate of each video stream obtained by each sandbox on the first edge terminal.
[0070] In this embodiment, the first edge terminal can be a host edge terminal or a slave edge terminal. Each Zabbix Proxy in the first edge terminal monitors the resource utilization rate of its corresponding sandbox as the resource utilization rate of the video stream processed in the sandbox and uploads it to the Zabbix Server for preservation.
[0071] S305. When the resource utilization rate of any video stream is greater than a preset first threshold, determine the video stream with a resource utilization rate greater than the first threshold as the target video stream.
[0072] In the first edge terminal, the resource allocation application polls the resource utilization rates of each sandbox maintained in the Zabbix Server and determines whether the resource utilization rate of each sandbox is greater than the first threshold (such as 80%). If so, it is determined that resource allocation is required, and the video stream processed in the sandbox is determined as the target video stream.
[0073] S306. Calculate the resource deficit of the target video stream, determine the idle resources of the first edge terminal, and calculate the total resource utilization rate of the first edge terminal based on the resource deficit.
[0074] Exemplarily, taking Figure 4 edge terminal A in the middle as an example, the resource allocation application in edge terminal A perceives through polling the Zabbix Server that the resource utilization rate of sandbox 2 exceeds 80%, indicating that the A2 video stream requires more resources.
[0075] Suppose the memory allocated to sandbox 2 is 2G and 90% of it is used. To make the resource utilization of sandbox 2 reach the optimal utilization rate of 60%, the resource allocation application can calculate the resource deficit of the A2 video stream in sandbox 2 in the following way: (2G × 90%) ÷ 60% - 2G = 1G, that is, the resource deficit of the A2 video stream is 1G, which means the resource deficit of the video stream is the deficit when the resource utilization rate of the video stream reaches the preset optimal utilization rate.
[0076] In practical applications, the resource utilization rate of edge terminal A is also monitored through the Zabbix Proxy in edge terminal A. The Zabbix Proxy or the resource allocation application can calculate the total resource utilization rate after resource allocation based on the resource deficit, the current resource usage of edge terminal A, and the total resources.
[0077] S307. Determine whether the idle resources are greater than the resource deficit and whether the total resource utilization rate is less than the second threshold.
[0078] Continuing with the example of sandbox 2 above, the resource allocation application calculates that 1G of memory needs to be added to sandbox 2. If edge terminal A has more than 1G of memory resources idle and on the premise that the total resource utilization rate of edge terminal A does not exceed the second threshold (such as 80%), it is determined that edge terminal A meets the resource internal allocation condition and S308 can be executed; otherwise, it is determined that the resource internal allocation condition is not met and S310 is executed.
[0079] S308. Determine that the first edge terminal meets the resource internal allocation condition.
[0080] If the idle resources of the first edge terminal are greater than the resource deficit and the total resource utilization rate is less than the second threshold, it is determined that the first edge terminal meets the resource internal allocation condition, and resources can be added to the target video stream within the first edge terminal.
[0081] S309. Add resources with an amount equal to the resource deficit to the sandbox of the target video stream within the first edge terminal, and update the total resource utilization rate in the local parameter list of the first edge terminal.
[0082] Specifically, within the first edge terminal, the resource allocation application can increase the resources equivalent to the resource deficit for the sandbox where the target video stream is located through Cgroups instructions. For example, in the above example, the resource allocation application in Edge Terminal A can adjust the resource memory of Sandbox 2 from 2G to 3G, and update the resource utilization rate of Sandbox 2 and the total resource utilization rate of Edge Terminal A in the local parameter list of Edge Terminal A. When Edge Terminal A is not the host edge terminal, it is also necessary to send the local parameter list to the host edge terminal. For example, Figure 4 in Edge Terminal A uploads the local parameter list to the host edge terminal C.
[0083] S310. Determine that the first edge terminal does not meet the resource internal allocation condition.
[0084] If the amount of free resources of the first edge terminal is less than the resource deficit, or the total resource utilization rate is greater than the second threshold, it is determined that the first edge terminal does not meet the resource internal allocation condition, and resources need to be allocated for the target video stream from other edge terminals outside the first edge terminal.
[0085] S311. Determine whether the first edge terminal is a slave edge terminal.
[0086] For example, Figure 4 as shown, if the first edge terminal is Edge Terminal A and the host in the system is Edge Terminal C, it can be determined that the first edge terminal is a slave, and S312 can be executed. If the first edge terminal is the host, S314 can be executed.
[0087] S312. The first edge terminal generates a resource allocation request and sends it to the host edge terminal. The resource allocation request includes the ID of the camera that captures the target video stream and the parameters of the sandbox of the target video stream. After receiving the resource allocation request, the host edge terminal determines the second edge terminal that meets the resource allocation condition according to the global parameter list, and sends the ID of the camera and the parameters of the sandbox of the target video stream to the second edge terminal. The second edge terminal creates a sandbox according to the parameters of the sandbox and sends a resource release request to the host edge terminal.
[0088] When the first edge terminal is not the host, Figure 4As an example, the first edge terminal is edge terminal A. When the internal resources of edge terminal A cannot meet the resource requirements of sandbox 2, edge terminal A sends a resource allocation request to host edge terminal C. The resource allocation request includes the IP of camera A2 for the A2 video stream in sandbox 2 and the parameters (required resources) of sandbox 2. After receiving the request, host edge terminal C determines, through the global parameter list maintained in host edge terminal C, a second edge terminal whose available resource amount is greater than the resource amount required by sandbox 2 and whose total resource usage rate is less than the second threshold (80%) after accessing the target video stream. For example, if host edge terminal C meets the conditions, then host edge terminal C is the second edge terminal. Of course, the second edge terminal can also be other edge terminals (if there are edge terminals other than host edge terminal C and slave edge terminal A). The second edge terminal creates a new sandbox according to the parameters of sandbox 2, and accesses the video stream in sandbox 2 to the new sandbox, that is, the second edge terminal accesses camera A2 and processes the video stream of camera A2 in the new sandbox. At the same time, the second edge terminal sends a resource release request to the host edge terminal (when the second edge terminal is not the host edge terminal). The host edge terminal sends this request to the first edge terminal, and the first edge terminal releases the resources occupied by sandbox 2.
[0089] S313. The first edge terminal updates the local parameter list and uploads it to the host edge terminal, and the host edge terminal updates the global parameter list.
[0090] Since the first edge terminal no longer accesses the target video stream, the first edge terminal deletes the IP of the camera that captures the target video stream from the local parameter list, and uploads the updated local parameter list to the host edge terminal. The host edge terminal updates the global parameter list according to the local parameter list uploaded by the first edge terminal. When the host edge terminal is the second edge terminal, the host edge terminal also updates its own local parameter list. When the second edge terminal is not the host edge terminal, the second edge terminal also updates its local parameter list and uploads it to the host edge terminal.
[0091] S314. The first edge terminal determines a second edge terminal that meets the resource allocation conditions according to the global parameter list, and sends the ID of the camera and the parameters of the sandbox of the target video stream to the second edge terminal. The second edge terminal creates a sandbox according to the parameters of the sandbox and sends a resource release request to the first edge terminal.
[0092] If the first edge terminal is the host edge terminal, the first edge terminal can determine, through the global parameter list, a second edge terminal whose idle resource amount is greater than the resource amount required by the target video stream and whose total resource utilization rate is less than the second threshold (80%) after accessing the target video stream, and send the camera IP for collecting the target video stream and the parameters of the sandbox for processing the target video stream to the second edge terminal. The second edge terminal creates a sandbox according to the parameters of the sandbox and sends a resource release request to the first edge terminal.
[0093] S315. The second edge terminal updates the local parameter list and uploads it to the first edge terminal, and the first edge terminal updates the global parameter list and the local parameter list.
[0094] Since the second edge terminal accesses the target video stream, the second edge terminal adds the IP of the camera for collecting the target video stream to the local parameter list and uploads the updated local parameter list to the first edge terminal (the first edge terminal is the host). The first edge terminal updates the global parameter list according to the local parameter list uploaded by the second edge terminal, and deletes the IP of the camera for collecting the target video stream from the local parameter list.
[0095] S316. Access the target video stream into the sandbox created by the second edge terminal.
[0096] After determining the second edge terminal and the second edge terminal creates a sandbox, the target video stream is accessed into the sandbox created by the second edge terminal.
[0097] As Figure 4 and Figure 5 shown, the system includes a host edge terminal C and a slave edge terminal A. When the sandbox 2 in the edge terminal A processes the video stream of the camera A2, if the resource utilization rate of the sandbox A2 in the slave edge terminal A is greater than 80%, and if the slave edge terminal A meets the resource internal allocation condition, resources are directly added to the sandbox A2 inside the slave edge terminal A. If the slave edge terminal A cannot meet the resource internal allocation condition, the slave edge terminal A generates a resource allocation request including the IP of the camera A2 and the parameters of the sandbox 2 and sends it to the host edge terminal C. The host edge terminal C determines that it meets the resource allocation condition according to its own global parameter list. As Figure 5 shown, the host edge terminal C creates a sandbox 4 to access the video stream of the camera A2 and notifies the edge terminal A to release the resources occupied by the sandbox 2.
[0098] In this embodiment, if there is no second edge terminal that meets the resource allocation condition, the edge terminal closest to the first edge terminal can be determined as the second edge terminal, or the edge terminal with the largest resource idle amount can be determined as the second edge terminal.
[0099] In an alternative embodiment, when a first edge terminal fails or drops the line, it is determined whether the first edge terminal is a slave edge terminal. If so, it is determined that the slave edge terminal has dropped the line or failed. The master edge terminal determines the target camera connected to the first edge terminal according to the global parameter list, and returns to S314. The master edge terminal determines a second edge terminal. If not, it is determined that the master edge terminal has dropped the line or failed. The slave edge terminal determines the master edge terminal according to the edge terminal list, and returns to S314. The newly determined master edge terminal determines the second edge terminal. Thus, when any edge terminal drops the line or fails, the camera connected to the edge terminal that has dropped the line or failed is allocated to other edge terminals, enabling the analysis and processing of the video stream collected by the camera even when an edge terminal fails or drops the line, and improving the reliability of the security management system.
[0100] In this embodiment, by setting a master edge terminal and a slave edge terminal, when any edge terminal fails to meet the internal resource allocation condition, the master edge terminal can determine the edge terminal that meets the resource allocation according to the global parameter list, and connect the video stream to this edge terminal, realizing the dynamic allocation of video stream resources between edge terminals through the master edge terminal, solving the problem that the fixed binding of edge terminals to cameras leads to too high resource utilization rate of some edge terminals and insufficient resources for analyzing the video stream, resulting in a decrease in the detection speed of security events, enabling sufficient resources for processing the video streams collected by each camera, improving the speed of obtaining the security event detection result through video analysis, and balancing the resources of each edge terminal and improving the resource utilization rate of the edge terminal.
[0101] Embodiment III
[0102] Figure 6 is a schematic structural diagram of an edge terminal resource allocation device provided in Embodiment III of the present invention. As Figure 6 shown, the edge terminal resource allocation device includes:
[0103] A utilization rate acquisition module 601, configured to acquire the resource utilization rate of each video stream of the cameras accessed by a first edge terminal;
[0104] A target video stream determination module 602, configured to determine the video stream with the resource utilization rate greater than a preset first threshold as the target video stream when the resource utilization rate of any video stream is greater than the first threshold;
[0105] An internal allocation condition judgment module 603, configured to judge whether the first edge terminal meets the resource internal allocation condition. If so, execute the internal resource allocation module 604. If not, execute the second edge terminal determination module 605;
[0106] The internal resource allocation module 604 is used to increase the resource usage of the target video stream within the first edge terminal;
[0107] The second edge terminal determination module 605 is used to determine a second edge terminal that meets the resource allocation conditions;
[0108] The inter-terminal resource allocation module 606 is used to allocate the target video stream to the second edge terminal for access.
[0109] Optionally, it further includes:
[0110] The master-slave edge terminal determination module is used to determine a master edge terminal and multiple slave edge terminals from multiple edge terminals, and load the edge terminal list and camera list on the master edge terminal;
[0111] The camera connection module is used for the master edge terminal and the slave edge terminals to connect cameras, create a sandbox for video processing for the video stream of each camera in the master edge terminal and the slave edge terminals, and detect the resource usage rate of each sandbox as the resource usage rate of each video stream;
[0112] The parameter list generation module is used for the master edge terminal to generate a global parameter list and a local parameter list, the slave edge terminals to generate local parameter lists, and the slave edge terminals to synchronize the edge terminal list, camera list, global parameter list and local parameter list from the master edge terminal according to a preset period, and upload the local parameter list to the master edge terminal;
[0113] The global parameter list records the cameras connected to each edge terminal and the total resource usage rate of each edge terminal, the local parameter list of the master edge terminal records the cameras connected to the master edge terminal and the total resource usage rate of the master edge terminal, and the local parameter list of the slave edge terminals records the cameras connected to the slave edge terminals and the total resource usage rate of the slave edge terminals.
[0114] Optionally, the usage rate acquisition module 601 includes:
[0115] The sandbox detection unit is used for the first edge terminal to monitor each sandbox on the first edge terminal to obtain the resource usage rate of each video stream.
[0116] Optionally, the internal allocation condition judgment module 603 includes:
[0117] The resource calculation unit is used to calculate the resource deficit of the target video stream and determine the idle resource amount of the first edge terminal, and calculate the total resource usage rate of the first edge terminal according to the resource deficit;
[0118] A condition judgment unit, configured to judge whether the amount of idle resources is greater than the resource deficit and whether the total resource utilization rate is less than a second threshold; if so, execute a condition satisfaction determination unit, and if not, execute a condition non - satisfaction determination unit;
[0119] A condition satisfaction determination unit, configured to determine that the first edge terminal meets the resource internal allocation condition;
[0120] A condition non - satisfaction determination unit, configured to determine that the first edge terminal does not meet the resource internal allocation condition.
[0121] Optionally, the internal resource allocation module 604 includes:
[0122] A resource increase unit, configured to add resources with an amount equal to the resource deficit to the sandbox of the target video stream within the first edge terminal;
[0123] A local parameter list update unit, configured to update the total resource utilization rate in the local parameter list of the first edge terminal.
[0124] Optionally, the second edge terminal determination module 605 includes:
[0125] A slave judgment unit, configured to judge whether the first edge terminal is a slave edge terminal; if so, execute a resource allocation request unit, and if not, execute a second edge terminal determination unit;
[0126] A resource allocation request unit, configured to generate a resource allocation request for the first edge terminal and send it to the host edge terminal. The resource allocation request includes the ID of the camera that captures the target video stream and the parameters of the sandbox of the target video stream. After receiving the resource allocation request, the host edge terminal determines a second edge terminal that meets the resource allocation condition according to the global parameter list, and sends the ID of the camera and the parameters of the sandbox of the target video stream to the second edge terminal. The second edge terminal creates a sandbox according to the parameters of the sandbox and sends a resource release request to the host edge terminal;
[0127] A first parameter list update unit, configured to update the local parameter list of the first edge terminal and upload it to the host edge terminal, and the host edge terminal updates the global parameter list;
[0128] A second edge terminal determination unit, configured to determine a second edge terminal that meets the resource allocation condition according to the global parameter list for the first edge terminal, and send the ID of the camera and the parameters of the sandbox of the target video stream to the second edge terminal. The second edge terminal creates a sandbox according to the parameters of the sandbox and sends a resource release request to the first edge terminal;
[0129] A second parameter list update unit is used for the second edge terminal to update the local parameter list and upload it to the host edge terminal, and the first edge terminal updates the global parameter list and the local parameter list;
[0130] The inter-terminal resource allocation module 606 includes:
[0131] A target video stream transfer and access unit is used for accessing the target video stream into the sandbox created by the second edge terminal.
[0132] Optionally, it further includes:
[0133] A master-slave machine determination unit is used for determining whether the first edge terminal is a slave edge terminal when the first edge terminal fails or disconnects; if so, execute the target camera determination unit, if not, execute the host determination unit;
[0134] A target camera determination unit is used for the host edge terminal to determine the target camera connected to the first edge terminal according to the global parameter list and return to execute the second edge terminal determination module 605;
[0135] A host determination unit is used for the slave edge terminal to determine the host edge terminal according to the edge terminal list and return to the target camera determination unit.
[0136] The edge terminal resource allocation device provided by the embodiments of the present invention can execute the edge terminal resource allocation method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0137] Embodiment 4
[0138] Figure 7 FIG. shows a schematic structural diagram of an edge terminal 70 that can be used to implement the embodiments of the present invention. The edge terminal is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The edge terminal can also represent various forms of mobile devices, such as, personal digital processing and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0139] As Figure 7As shown, the edge terminal 70 includes at least one processor 71 and a memory communicatively connected to the at least one processor 71, such as a read-only memory (ROM) 72, a random access memory (RAM) 73, etc. The memory stores a computer program executable by the at least one processor. The processor 71 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 72 or the computer program loaded from the storage unit 78 into the random access memory (RAM) 73. In the RAM 73, various programs and data required for the operation of the edge terminal 70 can also be stored. The processor 71, the ROM 72, and the RAM 73 are connected to each other via a bus 74. An input / output (I / O) interface 75 is also connected to the bus 74.
[0140] Multiple components in the edge terminal 70 are connected to the I / O interface 75, including: an input unit 76, such as a keyboard, a mouse, etc.; an output unit 77, such as various types of displays, speakers, etc.; a storage unit 78, such as a disk, an optical disc, etc.; and a communication unit 79, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 79 allows the edge terminal 70 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0141] The processor 71 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 71 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 71 executes the various methods and processes described above, such as the edge terminal resource allocation method.
[0142] In some embodiments, the edge terminal resource allocation method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 78. In some embodiments, part or all of the computer program can be loaded and / or installed onto the edge terminal 70 via the ROM 72 and / or the communication unit 79. When the computer program is loaded into the RAM 73 and executed by the processor 71, one or more steps of the edge terminal resource allocation method described above can be executed. Alternatively, in other embodiments, the processor 71 can be configured to execute the edge terminal resource allocation method by any other appropriate means (e.g., by means of firmware).
[0143] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from, and transmits data and instructions to, a storage system, at least one input device, and at least one output device.
[0144] The computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer programs can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
[0145] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0146] To provide interaction with a user, the systems and techniques described herein can be implemented on an edge terminal having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the edge terminal. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0147] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
[0148] A computing system can include a client and a server. The client and the server are generally far from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0149] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.
[0150] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for allocating edge terminal resources, characterized in that: Applied to an edge terminal, the edge terminal is connected to a camera, and includes: The first edge terminal obtains the resource usage rate of each video stream of the connected camera; When the resource usage rate of any video stream is greater than a preset first threshold, determining the video stream whose resource usage rate is greater than the first threshold as a target video stream; Determining whether the first edge terminal meets the internal resource allocation conditions; If so, increasing resource usage of the target video stream in the first edge terminal; If not, determining a second edge terminal that meets the resource allocation conditions; Access the target video stream at the second edge terminal.
2. The edge terminal resource allocation method according to claim 1, characterized in that: Before the first edge terminal obtains the resource usage rate of each video stream of the connected camera, it also includes: Determine a host edge terminal and a plurality of slave edge terminals from the plurality of edge terminals, and load an edge terminal list and a camera list into the host edge terminal; The host edge terminal and the slave edge terminal are connected to the camera, a video processing sandbox is created in the host edge terminal and the slave edge terminal for the video stream of each camera, and the resource usage rate of each sandbox is detected as the resource usage rate of each video stream; The host edge terminal generates a global parameter list and a local parameter list, the slave edge terminal generates a local parameter list, the slave edge terminal synchronizes an edge terminal list, a camera list, a global parameter list and a local parameter list from the host edge terminal according to a preset period, and uploads the local parameter list to the host edge terminal; The global parameter list records the cameras connected to each edge terminal and the total resource usage of each edge terminal, the local parameter list of the host edge terminal records the cameras connected to the host edge terminal and the total resource usage of the host edge terminal, and the local parameter list of the slave edge terminal records the cameras connected to the slave edge terminal and the total resource usage of the slave edge terminal.
3. The edge terminal resource allocation method according to claim 2, characterized in that: The first edge terminal obtains the resource usage rate of each video stream of the connected camera, including: The first edge terminal monitors each sandbox on the first edge terminal to obtain the resource usage rate of each video stream.
4. The edge terminal resource allocation method according to claim 2, characterized in that: Determining whether the first edge terminal meets the internal resource allocation condition includes: Calculating the resource deficit of the target video stream and determining the amount of idle resources of the first edge terminal, and calculating the total resource usage rate of the first edge terminal according to the resource deficit; Determine whether the idle resource amount is greater than the resource shortage and whether the total resource usage rate is less than a second threshold; If so, determining that the first edge terminal meets the resource internal allocation condition; If not, it is determined that the first edge terminal does not meet the internal resource allocation condition.
5. The edge terminal resource allocation method according to claim 4, characterized in that: Increasing the resource usage of the target video stream in the first edge terminal includes: In the first edge terminal, adding resources equal to the resource deficit to the sandbox of the target video stream; The total resource usage is updated in the local parameter list of the first edge terminal.
6. The edge terminal resource allocation method according to any one of claims 2 to 5, characterized in that: Determining a second edge terminal that meets the resource allocation conditions includes: Determine whether the first edge terminal is a slave edge terminal; If so, it is determined that the first edge terminal is a slave edge terminal, the first edge terminal generates a resource allocation request and sends it to the host edge terminal, the resource allocation request includes the ID of the camera that collects the target video stream and the parameters of the sandbox of the target video stream. After receiving the resource allocation request, the host edge terminal determines a second edge terminal that meets the resource allocation conditions according to the global parameter list, and sends the ID of the camera and the parameters of the sandbox of the target video stream to the second edge terminal. The second edge terminal creates a sandbox according to the parameters of the sandbox and sends a resource release request to the host edge terminal; The first edge terminal updates the local parameter list and uploads it to the host edge terminal, and the host edge terminal updates the global parameter list; If not, determine that the first edge terminal is the host edge terminal, the first edge terminal determines a second edge terminal that meets the resource allocation conditions according to the global parameter list, and sends the ID of the camera and the parameters of the sandbox of the target video stream to the second edge terminal, the second edge terminal creates a sandbox according to the parameters of the sandbox, and sends a resource release request to the first edge terminal; The second edge terminal updates the local parameter list and uploads it to the first edge terminal, and the first edge terminal updates the global parameter list and the local parameter list; Accessing the target video stream at the second edge terminal includes: The target video stream is connected to the sandbox created by the second edge terminal.
7. The edge terminal resource allocation method according to any one of claims 2 to 5, characterized in that: Also includes: When the first edge terminal fails or is offline, determining whether the first edge terminal is a slave edge terminal; If so, the host edge terminal determines the target camera to which the first edge terminal is connected according to the global parameter list, and returns to the step of determining the second edge terminal that meets the resource allocation condition; If not, each slave edge terminal determines the host edge terminal according to the edge terminal list, and returns to the step in which the host edge terminal determines the target camera connected to the first edge terminal according to the global parameter list.
8. An edge terminal resource allocation device, characterized in that: Applied to an edge terminal, the edge terminal is connected to a camera, and includes: A usage rate acquisition module, used for the first edge terminal to obtain the resource usage rate of each video stream of the connected camera; A target video stream determination module, configured to, when a resource usage rate of any video stream is greater than a preset first threshold, determine the video stream whose resource usage rate is greater than the first threshold as a target video stream; An internal allocation condition judgment module, used to judge whether the first edge terminal meets the resource internal allocation condition, if so, execute the internal resource allocation module, if not, execute the second edge terminal determination module; An internal resource allocation module, configured to increase resource usage of the target video stream in the first edge terminal; A second edge terminal determination module, used to determine a second edge terminal that meets the resource allocation conditions; The inter-terminal resource allocation module is used to allocate the target video stream to the second edge terminal.
9. An edge terminal, characterized in that: The edge terminal comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the edge terminal resource allocation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the edge terminal resource allocation method according to any one of claims 1 to 7 when executed.