Computing power management method, computing power management device, video management equipment and storage medium
By calculating the computing power occupation of each channel of NVR equipment, the problem of how to effectively grasp the busyness of video management equipment is solved, and the full utilization of computing power resources and stable improvement of performance is achieved.
Patent Information
- Application Number
- CN202210529912.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-16
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2042-05-16
Smart Images

Figure CN114936129B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of equipment management technology, and in particular, relates to a computing power management method, a computing power management device, a video management device, and a computer-readable storage medium. Background Art
[0002] A network video recorder (NVR) can connect to multiple IP cameras (IP cameras, IPCs), and each connected IPC occupies a channel of the NVR. For an NVR that supports artificial intelligence (AI), it can enable AI functions for each channel according to user needs, that is, enable the AI function of each channel to perform corresponding AI processing on the video stream in each channel in real time.
[0003] However, the computing power of NVR is limited. Therefore, how to grasp the real busyness of NVR has become a problem that needs to be solved urgently. Summary of the invention
[0004] The present application provides a computing power management method, a computing power management device, a video management device and a storage medium, which can grasp the actual busyness of the video management device so that the computing power resources of the video management device can be fully utilized.
[0005] In a first aspect, the present application provides a computing power management method, which is applied to a video management device, and the computing power management method includes:
[0006] Determine whether each channel of the video management device is performing artificial intelligence AI processing;
[0007] In the case where a first channel exists, for each first channel, the real-time computing power occupation of the first channel is calculated, wherein the first channel is: a channel that is performing AI processing;
[0008] In the case where a second channel exists, for each second channel, the initial computing power occupation of the second channel is calculated, wherein the second channel is: a channel that is not performing AI processing;
[0009] The currently available computing power of the video management device is calculated according to the real-time computing power occupancy of each first channel and / or the initial computing power occupancy of each second channel.
[0010] In a second aspect, the present application provides a computing power management device, which is applied to a video management device, and the computing power management device includes:
[0011] The first judgment module is used to judge whether each channel of the video management device is performing artificial intelligence AI processing;
[0012] A first calculation module is used to calculate the real-time computing power occupation of the first channel for each first channel when the first channel exists, wherein the first channel is: a channel that is performing AI processing;
[0013] A second calculation module is used to calculate the initial computing power occupation of the second channel for each second channel when the second channel exists, wherein the second channel is: a channel that is not performing AI processing;
[0014] The third calculation module is used to calculate the current available computing power of the video management device according to the real-time computing power occupancy of each first channel and / or the initial computing power occupancy of each second channel.
[0015] In a third aspect, the present application provides a video management device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which implements the steps of the method of the first aspect when executed by a processor.
[0017] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by one or more processors, it implements the steps of the method of the first aspect.
[0018] Compared with the prior art, the beneficial effects of the present application are as follows: for video management devices such as NVR, the working status of each channel will be monitored during operation. For those channels that are undergoing AI processing, the video management device will calculate the real-time computing power occupancy of these channels. For those channels that are not undergoing AI processing, the video management device will calculate the initial computing power occupancy of these channels. Based on the computing power occupancy of each channel (which may be real-time computing power occupancy or initial computing power occupancy), the video management device can calculate its currently available computing power. Through the above process, the currently available computing power of the video management device is quantified, so that the video management device can grasp its actual busyness and ensure that its computing power resources can be fully utilized.
[0019] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 It is a schematic diagram of the implementation process of the computing power management method provided in the embodiment of the present application;
[0022] Figure 2 is a structural block diagram of a computing power management device provided in an embodiment of the present application;
[0023] Figure 3 It is a structural diagram of the video management device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0025] In order to illustrate the technical solution proposed in this application, a specific embodiment is provided below for illustration.
[0026] The computing power management method provided in the embodiment of the present application is applied to a video management device that can support AI functions. As an example only, the video management device may be an NVR; or, the video management device may also be an electronic device equipped with a video management system, and the specific type of the video management device is not limited here. For ease of understanding, the embodiment of the present application takes the application of the computing power management method to an NVR as an example to provide a specific explanation and description of the computing power management method.
[0027] In order to better implement various AI processing operations, the NVR may include the following two processors: a central processing unit (CPU) and a neural-network processing unit (NPU). It can be understood that the implementation of each AI function usually depends not only on the processing of the CPU, but also on the processing of the NPU. Based on this, the computing power of the NVR (that is, the computing power that the NVR can provide) includes the CPU computing power and the NPU computing power.
[0028] In one application scenario, the CPU and NPU of the NVR can run at the same time, and the working mode of this processor is called parallel working mode. It can be understood that in the parallel working mode, the CPU computing power and the NPU computing power need to be considered separately. In another working mode, the CPU and NPU of the NVR cannot run at the same time, and the working mode of this processor is called serial working mode. It can be understood that in the serial working mode, the CPU computing power and the NPU computing power need to be considered together. At present, the serial working mode is the mainstream working mode of the current NVR processor. For ease of understanding, the operational differences that may be involved in these two working modes will be described in the specific description of the computing power management method below, and will not be repeated here.
[0029] See also Figure 1 , the implementation process of the computing power management method is described in detail as follows:
[0030] Step 101, determine whether each channel of the NVR is performing AI processing.
[0031] In the embodiment of the present application, the NVR may determine in turn whether each channel is performing AI processing. Specifically, the NVR may make the determination according to the following criteria:
[0032] For channels that are not connected to IPC, the NVR can directly determine that the channel is not performing AI processing;
[0033] For a channel that is connected to an IPC, if the channel does not have a video stream transmitted by the IPC, the NVR can also directly determine that the channel is not performing AI processing;
[0034] For a channel that is connected to an IPC, if the channel already has a video stream transmitted by the IPC, but the channel has not enabled any AI function, the NVR can also directly determine that the channel is not performing AI processing;
[0035] For a channel that is connected to an IPC, if the channel already has a video stream transmitted by the IPC and the channel has at least one AI function enabled, the NVR can directly determine that the channel is performing AI processing.
[0036] Through this step, the NVR has the following possible situations: all channels are undergoing AI processing; all channels are not undergoing AI processing; some channels are undergoing AI processing, and the remaining channels are not undergoing AI processing.
[0037] Step 102: When a first channel exists, for each first channel, calculate the real-time computing power usage of the first channel.
[0038] In the embodiment of the present application, the first channel refers to: a channel that is undergoing AI processing. Since the first channel is undergoing AI processing, the first channel must be occupying the computing power resources of the NVR. Based on this, the NVR needs to calculate the real-time computing power occupancy of each first channel.
[0039] It can be understood that as long as there are first channels, the execution of step 102 can be triggered regardless of the number of first channels to obtain the real-time computing power occupancy of each first channel.
[0040] In the application scenario of serial working mode, for any first channel, the real-time computing power of the first channel occupies S s-rt , refers to the real-time total computing power occupied by the first channel, specifically: the real-time CPU computing power occupied by the first channel S cpu-s-rt And real-time NPU computing power usage S npu-s-rt That is, S s-rt =S cpu-s-rt +S npu-s-rt .
[0041] In the application scenario of the parallel working mode, for any first channel, the real-time computing power of the first channel occupies S p-rt It includes two parts of data, and the two parts of data are independent of each other. The two parts of data are: the real-time CPU computing power of the first channel occupies S cpu-p-rt , and the real-time NPU computing power of the first channel S npu-p-rt .
[0042] Step 103: If a second channel exists, for each second channel, calculate the initial computing power occupied by the second channel.
[0043] In the embodiment of the present application, the second channel refers to: a channel that is not undergoing AI processing. Since the second channel is not undergoing AI processing, the second channel must not currently be occupying the computing power resources of the NVR; however, in order to ensure the subsequent normal operation of each second channel, the NVR also needs to reserve the computing power resources that may be needed for these second channels. For example, a channel is already connected to an IPC, and a certain AI function has been enabled on the channel, but the IPC has not yet started transmitting the video stream, then the channel will be determined as the second channel; although the current real-time computing power occupancy of the channel is 0, after the IPC transmits the video stream, the NVR will start AI processing on the video stream, and therefore, a certain amount of computing power resources needs to be reserved for the second channel. Based on this, the NVR needs to calculate the initial computing power occupancy of each second channel.
[0044] It can be understood that as long as there are second channels, the execution of step 103 can be triggered regardless of the number of second channels to obtain the initial computing power occupancy of each second channel.
[0045] In the application scenario of serial working mode, for any second channel, the initial computing power of the second channel occupies S s-st , refers to the initial total computing power occupied by the second channel, specifically: the initial CPU computing power occupied by the second channel S cpu-s-st And the initial NPU computing power usage S npu-s-st That is, S s-st =S cpu-s-st +S npu-s-st .
[0046] In the application scenario of parallel working mode, for any second channel, the initial computing power of the second channel occupies S p-st It includes two parts of data, and the two parts of data are independent of each other. The two parts of data are: the initial CPU computing power of the second channel occupies S cpu-p-st , and the initial NPU computing power of the second channel occupies S npu-p-st .
[0047] Step 104: Calculate the current available computing power of the NVR according to the real-time computing power occupancy of each first channel and / or the initial computing power occupancy of each second channel.
[0048] In the embodiment of the present application, the current available computing power of the NVR can be calculated by referring to the following formula (1):
[0049] S available =1-S use (1)
[0050] Among them, S use It is the sum of the real-time computing power occupied by all first channels and the initial computing power occupied by all second channels. Obviously, if the NVR currently does not have a second channel, the initial computing power occupied by all second channels must be 0. At this time, the NVR only needs to calculate its current available computing power based on the real-time computing power occupied by each first channel; if the NVR currently does not have a first channel, the real-time computing power occupied by all first channels must also be 0. At this time, the NVR only needs to calculate its current available computing power based on the initial computing power occupied by each second channel. Only when both the first channel and the second channel exist, the NVR needs to calculate its current available computing power based on the real-time computing power occupied by each first channel and the initial computing power occupied by each second channel.
[0051] In the application scenario of serial working mode, since both the real-time computing power occupancy and the initial computing power occupancy are only considered from the perspective of total computing power occupancy (that is, the sum of CPU computing power occupancy and NPU computing power occupancy), this step ultimately calculates only the currently available computing power, that is, the currently available total computing power.
[0052] In the application scenario of the parallel working mode, since both the real-time computing power occupancy and the initial computing power occupancy are considered independently from the two aspects of CPU computing power occupancy and NPU computing power occupancy, this step can ultimately calculate two currently available computing powers, namely: the currently available CPU computing power and the currently available NPU computing power.
[0053] The following is a brief description of the calculation process of real-time computing power usage, initial computing power usage, and current available computing power in these two different application scenarios using specific examples:
[0054] Just as an example, assume that the NVR has four channels, namely channels 1, 2, 3 and 4. Among them, channel 1 and channel 2 are the first channel, the real-time CPU computing power usage of channel 1 is 0.15, and the real-time NPU computing power usage is 0.05; the real-time CPU computing power usage of channel 2 is 0.1, and the real-time NPU computing power usage is 0.05; channel 3 and channel 4 are the second channel, the initial CPU computing power usage of channel 3 is 0.05, and the initial NPU computing power usage is 0.15; the initial CPU computing power usage of channel 4 is 0.05, and the initial NPU computing power usage is 0.05.
[0055] In the application scenario of serial working mode, from the perspective of the current available total computing power, it can be seen that: the real-time computing power occupied by channel 1 is 0.2 (obtained from 0.15+0.05), the real-time computing power occupied by channel 2 is 0.15 (obtained from 0.1+0.05), the initial computing power occupied by channel 3 is 0.2 (obtained from 0.05+0.15), and the initial computing power occupied by channel 4 is 0.1 (obtained from 0.05+0.05). The current available total computing power of NVR is 0.35 (obtained from 1-0.2-0.15-0.2-0.1).
[0056] In the application scenario of the parallel working mode, the CPU computing power occupancy and the NPU computing power occupancy are considered independently. It can be known that the currently available computing power of the NVR includes the currently available CPU computing power and the currently available NPU computing power, among which the currently available CPU computing power is 0.65 (obtained from 1-0.15-0.1-0.05-0.05), and the currently available NPU computing power is 0.7 (obtained from 1-0.05-0.05-0.15-0.05).
[0057] In some embodiments, the currently available computing power calculated in step 104 may be displayed on the user interface of the NVR. It is understandable that the NVR may repeatedly execute steps 101-104, so that the user interface can keep displaying the latest currently available computing power. The user only needs to consult the user interface to quickly learn about the latest currently available computing power of the NVR and understand the real busyness of the NVR. Subsequent users may consider whether to turn on / off certain AI functions of certain channels according to the currently available computing power, so that the computing power of the NVR can be fully utilized while maintaining its performance. Of course, the currently available computing power can also be recorded only in the background of the NVR (that is, not displayed), which is not limited here.
[0058] Specifically, to meet the user's reading habits, the NVR can convert the current available computing power into a percentage and then display it on the user interface.
[0059] In some embodiments, considering that the calculation process of the real-time computing power occupancy of each first channel is the same, the calculation process of the real-time computing power occupancy of the first channel is introduced below by taking any first channel as an example:
[0060] A1. Calculate the actual computing power occupied by the first channel at the current moment.
[0061] Since the first channel is undergoing AI processing, the NVR can obtain the actual computing power occupied by the first channel at the current moment according to the specific situation of the AI processing. Specifically, the NVR can obtain the AI processing time of the first channel for the video frame at the current moment by calling the specified interface (Application Programming Interface, API), including the AI processing CPU time and the AI processing NPU time; then, the NVR can calculate the actual computing power occupied by the first channel according to the AI processing time and the preset channel minimum frame rate.
[0062] In the application scenario of the serial working mode, only one type of actual computing power occupancy is considered, namely, the actual total computing power occupancy. The actual total computing power occupancy is specifically the sum of the actual CPU computing power occupancy and the actual NPU computing power occupancy of the first channel, wherein the actual CPU computing power occupancy can be calculated by the NVR based on the CPU time consumed by AI processing and the minimum frame rate of the channel, and the actual NPU computing power occupancy can be calculated by the NVR based on the NPU time consumed by AI processing and the minimum frame rate of the channel. The general calculation formula for the actual CPU computing power occupancy and the actual NPU computing power occupancy is as follows (2):
[0063]
[0064] Among them, FR min is the preset minimum frame rate of the channel; processWhen the CPU time consumed by the AI processing of the first channel on the video frame at the current moment is S real is the actual CPU computing power occupied by the first channel at the current moment; process When the NPU consumes time for AI processing of the video frame at the current moment in the first channel, S real It is the actual NPU computing power occupied by the first channel at the current moment.
[0065] In the application scenario of parallel working mode, two types of actual computing power usage can be considered, namely actual CPU computing power usage and actual NPU computing power usage. The calculation process has been described in the previous article and will not be repeated here.
[0066] A2. Obtain the real-time computing power usage of the first channel at the previous moment.
[0067] NVR can divide a designated storage area in its cache space to store the latest real-time computing power usage of each channel. That is, each time NVR calculates the real-time computing power usage of a first channel, it can store the real-time computing power usage in the designated storage area. In this way, when NVR needs to calculate the real-time computing power usage at the current moment, it can obtain the real-time computing power usage of the first channel at the previous moment (that is, the latest real-time computing power usage currently stored) by accessing the designated storage area.
[0068] In the application scenario of the serial working mode, the real-time computing power occupied by the first channel at the previous moment specifically refers to the real-time total computing power occupied by the first channel at the previous moment.
[0069] In the application scenario of the parallel working mode, the real-time computing power occupancy of the first channel at the previous moment includes the real-time CPU computing power occupancy and the real-time NPU computing power occupancy of the first channel at the previous moment.
[0070] A3. According to the actual computing power occupied by the first channel at the current moment and the real-time computing power occupied by the first channel at the previous moment, a sliding average strategy is used to calculate the real-time computing power occupied by the first channel at the current moment.
[0071] The sliding average strategy can be implemented using the following formula (3):
[0072] S t rt =(1-α)*S t real+ α*S t-1 rt (3)
[0073] Among them, S t rtrepresents the real-time computing power occupied by the first channel at the current time (i.e., time t); α represents the preset sliding average coefficient; S t real Indicates the actual computing power occupied by the first channel at the current time (i.e., time t); S t-1 rt Indicates the real-time computing power occupied by the first channel at the previous moment (i.e., moment t-1). As an example only, in a typical application scenario, the sliding average coefficient can be taken as 0.96 to focus on the real-time computing power occupied at the previous moment.
[0074] In the application scenario of the serial working mode, the NVR can substitute the actual total computing power occupied by the first channel at the current moment and the real-time total computing power occupied by the first channel at the previous moment into the above formula (3), and the real-time total computing power occupied by the first channel at the current moment can be obtained. The real-time total computing power occupied is the real-time computing power occupied by the first channel at the current moment in the application scenario of the serial working mode.
[0075] In the application scenario of the parallel working mode, the NVR can substitute the actual CPU computing power occupancy of the first channel at the current moment and the real-time CPU computing power occupancy of the first channel at the previous moment into the above formula (3) to obtain the real-time CPU computing power occupancy of the first channel at the current moment; the actual NPU computing power occupancy of the first channel at the current moment and the real-time NPU computing power occupancy of the first channel at the previous moment can also be substituted into the above formula (3) to obtain the real-time NPU computing power occupancy of the first channel at the current moment; the real-time CPU computing power occupancy and the real-time NPU computing power occupancy are the real-time computing power occupancy of the first channel at the current moment in the application scenario of the parallel working mode.
[0076] In some embodiments, considering that the calculation process of the initial computing power occupied by each second channel is the same, the calculation process of the initial computing power occupied by any second channel is introduced below by taking any second channel as an example:
[0077] B1. Get the AI function that has been enabled on the second channel.
[0078] As described above, there may be several reasons why the second channel is not performing AI processing: the channel is not connected to the IPC; the channel is connected to the IPC, but there is no video stream transmitted by the IPC; the channel is connected to the IPC, and the channel has a video stream transmitted by the IPC, but the channel has not enabled any AI function. It can be understood that for channels that are not connected to the IPC, or channels that are connected to the IPC but have no video stream transmitted by the IPC, the user may have enabled certain AI functions of the channel, but the channel is not performing AI processing only because the IPC is not connected or the video stream is not transmitted. It can be imagined that once these channels are connected to the corresponding IPC and the IPC transmits the video stream, these channels will immediately start corresponding AI processing based on the enabled AI function. Based on this, the NVR needs to obtain the AI function that has been enabled on the second channel.
[0079] B2, obtaining the union of AI sub-functions of the AI function enabled in the second channel;
[0080] Each AI function is specifically composed of AI sub-functions; that is, each AI function can be disassembled into one or more AI sub-functions. Moreover, different AI functions may also contain the same AI sub-functions, that is, more than two AI functions may share the same AI sub-function.
[0081] For example, the AI function of face capture includes the following AI sub-functions: face / human shape detection sub-function, face feature extraction sub-function, face / human shape trajectory tracking sub-function, etc.; the AI function of passenger flow statistics includes the following AI sub-functions: face / human shape detection sub-function, passenger flow statistics calculation sub-function, face / human shape trajectory tracking sub-function, etc.
[0082] In a channel, after the AI processing corresponding to a certain AI sub-function is completed, the corresponding processing result will be updated to all AI functions in the channel that contain the AI sub-function. That is, if two or more AI functions share the same AI sub-function, the AI processing corresponding to the AI sub-function does not need to be executed multiple times, but only needs to be executed once. For example, the two AI functions of face capture and passenger flow statistics share the face / human shape detection sub-function and the face / human shape trajectory tracking sub-function. If these two AI functions are turned on in a channel, when performing face capture AI processing and passenger flow statistics AI processing on a video frame of the channel, only one face / human shape detection operation and one face / human shape trajectory tracking operation need to be performed on the video frame. That is, in the same channel, if more than two AI functions share the same AI sub-function, the computing power occupied by the AI sub-function only needs to be calculated once.
[0083] Based on this, in order to avoid NVR from repeatedly calculating the initial computing power occupied by some AI sub-functions, NVR can obtain the union of AI sub-functions of the AI functions that have been enabled in the second channel. As an example, the union of AI sub-functions of the two AI functions of face capture and passenger flow statistics includes the following AI sub-functions: face / human shape detection sub-function, face feature extraction sub-function, face / human shape trajectory tracking sub-function and passenger flow statistics calculation sub-function.
[0084] B3. Calculate the initial computing power occupied by each AI sub-function in the AI sub-function collection.
[0085] It is understandable that each AI sub-function may occupy only the CPU computing power, or may occupy only the NPU computing power, or may occupy both the CPU computing power and the NPU computing power. Based on this, the initial computing power occupied by the AI sub-function calculated by the NVR includes the initial CPU computing power occupied and the initial NPU computing power occupied by the AI sub-function.
[0086] For any AI sub-function i, its initial CPU computing power usage can be calculated by the following formula (4):
[0087]
[0088] Among them, S cpu-st-i is the initial CPU computing power occupied by AI sub-function i; FR min The preset minimum frame rate of the channel is used to indicate the minimum frame rate that the channel of the NVR that currently applies the computing power management method can accept; T i-cpu-clasic is the preset CPU processing time of the AI sub-function i, which can be obtained in advance on the specified test NVR. That is, for the NVR currently applying the computing power management method, the T i-cpu-clasic The value of is a known fixed value.
[0089] For any AI sub-function i, its initial NPU computing power usage can be calculated by the following formula (5):
[0090]
[0091] Among them, S npu-st-i is the initial NPU computing power occupied by AI sub-function i; FR min This has been described in the previous article and will not be repeated here; i-npu-clasic is the preset NPU processing time of the AI sub-function i, which can be obtained in advance on the specified test NVR. That is, for the NVR currently applying the computing power management method, the T i-npu-clasic The value of is a known fixed value.
[0092] In the application scenario of serial operation, for any AI sub-function in the AI sub-function set, the initial computing power occupancy of the AI sub-function is specifically the initial total computing power occupancy, which can be obtained by NVR by calculating the initial CPU computing power occupancy and the initial NPU computing power occupancy of the AI sub-function through the above formulas (4) and (5) and then summing them up.
[0093] In the application scenario of parallel work, for any AI sub-function in the AI sub-function set, the initial computing power occupancy of the AI sub-function includes the initial NPU computing power occupancy and the initial CPU computing power occupancy, which can be directly calculated by the NVR through the above formulas (4) and (5) respectively.
[0094] It can be understood that for the NVR that currently applies the computing power management method, the initial computing power occupied by each AI sub-function is unchanged. Therefore, the NVR can save the initial computing power occupied by each AI sub-function in the local database after calculating the initial computing power occupied by each AI sub-function for the first time, so as to avoid the subsequent repeated calculation of the initial computing power occupied by each AI sub-function.
[0095] B4. Determine the sum of the initial computing power occupied by each AI sub-function in the AI sub-function set as the initial computing power occupied by the second channel.
[0096] In the application scenario of serial work, the initial computing power occupied by the second channel is specifically: the sum of the initial total computing power occupied by each AI sub-function in the AI sub-function set.
[0097] In the application scenario of parallel work, the initial computing power occupancy of the second channel includes: the initial CPU computing power occupancy of the second channel and the initial NPU computing power occupancy of the second channel, wherein the initial CPU computing power occupancy of the second channel is specifically: the sum of the initial CPU computing power occupancy of each AI sub-function in the AI sub-function set; the initial NPU computing power occupancy of the second channel is specifically: the sum of the initial NPU computing power occupancy of each AI sub-function in the AI sub-function set.
[0098] In some embodiments, users may enable new AI functions on some channels during the use of the NVR according to their own usage needs. However, if users are not restrained when enabling new AI functions, the computing power that the NVR can provide may be insufficient to support these new AI functions, thereby causing the overall performance of the NVR to decline. Based on this, when the NVR has learned the current available computing power, the computing power management method may also include:
[0099] C1. For any channel of the NVR, when there is a need to enable a new AI function on the channel, obtain the intersection of the new AI function and the first AI sub-function of the AI function that has been enabled on the channel.
[0100] As described above, the AI sub-functions shared by two or more AI functions in a channel only need to calculate the computing power usage once. Based on this, when there is a need to enable a new AI function, the NVR can first find the intersection of the new AI function and the AI sub-functions of each AI function that has been enabled in the channel, and then find the union of the obtained AI sub-functions to obtain the first AI sub-function intersection; or, the NVR can first find the union of the AI sub-functions of each AI function that has been enabled in the channel, and then find the intersection of the new AI function and the union of the AI sub-functions to obtain the first AI sub-function intersection.
[0101] As an example only, assume that channel 1 has enabled AI functions 1, 2, and 3. Among them, AI function 1 includes AI sub-functions a, b, and c, AI function 2 includes AI sub-functions a, c, and d, and AI function 3 includes AI sub-functions b, c, and e. Assuming that channel 1 has a need to enable AI function 4, and AI function 4 includes AI sub-functions c, d, e, and f, the first AI sub-function intersection obtained includes: AI sub-functions c, d, and e.
[0102] C2. Calculate the initial computing power occupied by each first target AI sub-function.
[0103] The first target AI sub-function here refers to: an AI sub-function of a new AI function that is not in the intersection of the first AI sub-function. It can be understood that the first target AI sub-function is a unique AI sub-function of the new AI function compared to the various AI functions that have been opened in the channel, that is, a non-shared AI sub-function. Still using the previous example to illustrate: AI function 4 includes AI sub-functions c, d, e and f, and the first AI sub-function intersection obtained includes: AI sub-functions c, d and e, then the first target AI sub-function is: AI sub-function f.
[0104] The calculation process of the initial computing power occupied by the AI sub-function has been described above and will not be repeated here.
[0105] In the application scenario of serial work, for any first target sub-AI function, the initial computing power occupancy of the first target AI sub-function is specifically: the initial total computing power occupancy of the first target AI sub-function.
[0106] In the application scenario of parallel work, for any first target sub-AI function, the initial computing power occupancy of the first target AI sub-function includes: the initial CPU computing power occupancy of the first target AI sub-function and the initial NPU computing power occupancy of the first target AI sub-function.
[0107] C3. Determine whether to approve the request to enable the new AI function based on the sum of the initial computing power occupied by all first-target AI sub-functions and the current available computing power.
[0108] The currently available computing power is the computing power that the NVR can currently provide, which can be understood as the computing power supply; the sum of the initial computing power occupied by all first-target AI sub-functions is the computing power required to enable the new AI function, which can be understood as the computing power demand. Obviously, only when the computing power supply is greater than or equal to the computing power demand, the computing power of the NVR is not over-occupied. Based on this, when the sum of the initial computing power occupied by all first-target AI sub-functions is less than or equal to the currently available computing power, the NVR can agree to the demand to enable the new AI function; conversely, when the sum of the initial computing power occupied by all first-target AI sub-functions is greater than the currently available computing power, the NVR can reject the demand to enable the new AI function.
[0109] In the application scenario of serial operation, step C2 obtains the initial total computing power occupied by each first target AI sub-function, and step 104 obtains the current available total computing power of the NVR. Therefore, in this application scenario, if the sum of the initial total computing power occupied by all first target AI sub-functions is less than or equal to the current available total computing power, the NVR can agree to the activation request of the new AI function; conversely, if the sum of the initial total computing power occupied by all first target AI sub-functions is greater than the current available total computing power, the NVR can reject the activation request of the new AI function.
[0110] In the application scenario of parallel work, step C2 obtains the initial CPU computing power occupancy and initial NPU computing power occupancy of each first target AI sub-function, and step 104 obtains the current available CPU computing power and current available NPU computing power of the NVR. Obviously, only when the CPU computing power supply is greater than or equal to the CPU computing power demand, and the NPU computing power supply is greater than or equal to the NPU computing power demand, the NVR computing power is not over-occupied. Therefore, in this application scenario, the sum of the initial CPU computing power occupancy of all first target AI sub-functions is less than or equal to the currently available CPU computing power, and the sum of the initial NPU computing power occupancy of all first target AI sub-functions is less than or equal to the currently available NPU computing power, the NVR can only agree to the activation requirement of the new AI function; on the contrary, when the sum of the initial CPU computing power occupancy of all first target AI sub-functions is greater than the currently available CPU computing power, and / or, the sum of the initial NPU computing power occupancy of all first target AI sub-functions is greater than the currently available NPU computing power, the NVR can reject the activation requirement of the new AI function.
[0111] In some embodiments, the NVR may also display two new parameters on its user interface: the current minimum channel specification and maximum channel specification of the AI function. The current minimum channel specification of the AI function refers to the number of channels on which the NVR can currently enable the AI function without dragging down the performance of the NVR; the current maximum channel specification of the AI function refers to the number of channels on which the NVR can currently enable the AI function without dragging down the performance of the NVR. Considering that the calculation process of the current minimum channel specification and maximum channel specification of each AI function is the same, the following takes any AI function as an example to introduce the calculation process of the current minimum channel specification and maximum channel specification of the AI function:
[0112] D1. Traverse all channels of NVR.
[0113] D2. Determine whether the currently traversed channel has been enabled or pre-selected to enable the AI function.
[0114] Among them, pre-selecting and enabling a certain AI function means that the user has checked the AI function on the user interface of the NVR, but has not yet formally submitted the requirement to enable the AI function. It can be imagined that when the user needs to adjust the AI function enabled for a certain channel, the user interface will first jump to display a function adjustment page, in which the user can check each unenabled AI function of the channel. Obviously, in this process, the user can add or uncheck according to their own requirements, and the checked AI function is the pre-selected AI function. After the user has finished checking, he can click the virtual button for confirmation or submission, so that the NVR receives the requirement to enable the checked AI function (that is, the pre-selected AI function) for the channel. The pre-selected AI function can be understood as an AI function that is not currently enabled but is expected to be enabled in a short time.
[0115] It is understandable that when the user does not make any check operation, the AI function enabled by the channel pre-selection is empty by default.
[0116] D3. When the currently traversed channel is not enabled and the AI function is not pre-selected, the pre-calculated power usage of the currently traversed channel for the AI function is calculated.
[0117] If the AI function is already enabled or pre-selected for the currently traversed channel, the NVR cannot enable the AI function again on the channel; that is, the channel cannot count the channel in this case. Therefore, if the currently traversed channel is already enabled or pre-selected for the AI function, no operation is required, and the currently traversed channel is directly updated to the next channel to determine whether the next channel has already enabled or pre-selected for the AI function.
[0118] If the AI function is not enabled or not pre-selected for the channel currently being traversed, the channel is eligible for counting. As described above, the AI sub-functions shared by two or more AI functions in a channel only need to be calculated once for computing power usage, so the NVR can use this as a basis for calculating the pre-computational power usage of the AI function for the channel currently being traversed.
[0119] Specifically, when the currently traversed channel is not enabled and a certain AI function is not pre-selected, the AI function is recorded as the target AI function for easy distinction. The calculation process of the pre-calculated power occupancy of the currently traversed channel for the target AI function is as follows:
[0120] First, the NVR can obtain the intersection of the second AI sub-function of the target AI function and the AI function that has been enabled in the currently traversed channel; at the same time, the NVR can also obtain the intersection of the third AI sub-function of the target AI function and the AI function pre-selected and enabled in the currently traversed channel. It can be understood that the method for obtaining the intersection of the second AI sub-function and the third AI sub-function is similar to the method for obtaining the intersection of the first AI sub-function described above, and will not be repeated here.
[0121] Then, the NVR can calculate the initial computing power occupied by each second target AI sub-function. Among them, the second target AI sub-function refers to the AI sub-function of the target AI function that is not in the intersection of the second AI sub-function and is not in the intersection of the third AI sub-function. Similar to the first target AI sub-function described above, the second target AI sub-function can be understood as: the target AI function is a unique AI sub-function compared to the various AI functions that have been turned on in the currently traversed channel and the various AI functions that have been pre-selected to be turned on, that is, a non-shared AI sub-function.
[0122] Finally, the NVR may determine the sum of the initial computing power occupancy of all second target AI sub-functions as the pre-computational power occupancy of the currently traversed channel for the target AI function.
[0123] In the application scenario of serial work, the estimated computing power occupied by the currently traversed channel for the AI function specifically refers to the estimated total computing power occupied by the currently traversed channel for the AI function, that is, the sum of the initial total computing power occupied by all second-target AI sub-functions.
[0124] In the application scenario of parallel work, the estimated computing power occupied by the currently traversed channel for the AI function includes the estimated CPU computing power occupied by the currently traversed channel for the AI function and the estimated NPU computing power occupied by the currently traversed channel for the AI function. Among them, the estimated CPU computing power occupied by the currently traversed channel for the AI function is the sum of the initial CPU computing power occupied by all second target AI sub-functions, and the estimated NPU computing power occupied by the currently traversed channel for the AI function is the sum of the initial NPU computing power occupied by all second target AI sub-functions.
[0125] For the convenience of description, for any AI function, channels that are not enabled and not pre-selected to enable the AI function can be recorded as candidate channels. It can be understood that these candidate channels are channels that are currently qualified for counting.
[0126] D4. After all channels are traversed, the minimum channel specification and maximum channel specification of the AI function are determined based on the pre-calculation power occupied by each candidate channel for the AI function and the current available computing power.
[0127] For any candidate channel, the pre-computational power usage of the candidate channel for the AI function describes the computing power that may be required when the candidate channel turns on the AI function in a short period of time. Obviously, since different candidate channels have different AI functions that have been turned on and pre-selected to be turned on, the pre-computational power usage of each candidate channel for the same AI function will also be different.
[0128] In order to determine the current minimum and maximum channel specifications of the AI function, the NVR may sort the pre-calculated capacity of each candidate channel for the AI function. As an example only, the NVR may sort them in order from small to large; or, the NVR may also sort them in order from large to small, which is not limited here.
[0129] Since only the impact of the enabled AI function on the computing power is considered when calculating the current available computing power of the NVR, and the impact of the pre-selected AI function on the computing power is not considered, the NVR can subtract the pre-selected AI function of all channels from the current available computing power to obtain the future available computing power of the NVR. It can be understood that the future available computing power takes into account both the impact of the enabled AI function on the computing power and the impact of the pre-selected AI function on the computing power. For example, if the current available computing power is x, and the sum of the pre-selected AI functions of all channels is y, then the future available computing power is xy. Among them, the calculation process of the pre-calculated power occupied by the pre-selected and enabled AI function of any channel is similar to the calculation process of the pre-calculated power occupied by the AI function of the currently traversed channel described in step D3, which refers to the sum of the initial computing power occupied by the pre-selected and enabled AI function of the channel compared with the AI sub-function unique to the enabled AI function of the channel (that is, non-shared AI sub-function). For details, please refer to the description of step D3, which will not be repeated here.
[0130] So far, the sorting results and future available computing power have been obtained. NVR can filter the sorting results by the future available computing power to obtain the current minimum channel specification and maximum channel specification of the AI function. Specifically, NVR can create new parameters N and M, where N and M are both initially 1. NVR can then increase N when the sum of the first N pre-computing power occupied in the sorting results is less than or equal to the future available computing power, and stop increasing N until the sum of the first N pre-computing power occupied is greater than the future available computing power; at the same time, when the sum of the last M pre-computing power occupied in the sorting results is less than or equal to the future available computing power, increase M until the sum of the last M pre-computing power occupied is greater than the future available computing power. Through this process, when N and M are stopped increasing, the obtained N and M are both the number of channels near the critical point, specifically: the number of channels when the computing power supply just cannot meet the computing power demand. Then obviously, N-1 and NM are also the number of channels near the critical point, specifically: the number of channels when the computing power supply is just enough to meet the computing power demand.
[0131] In the application scenario of the serial working mode, the pre-computing power occupied by each candidate channel for the AI function is specifically the estimated total computing power occupied by each candidate channel for the AI function, and the current available computing power is specifically the current available total computing power. The unique N and M can be determined in the above way. The smaller value of N-1 and M-1 is the current minimum channel specification of the AI function, and the larger value of N-1 and M-1 is the current maximum channel specification of the AI function.
[0132] As an example, in the application scenario of serial working mode, for AI function 1, there are currently 5 candidate channels, namely channels 1, 2, 3, 4 and 5, among which the estimated total computing power occupancy of channel 1 is 0.02, the estimated total computing power occupancy of channel 2 is 0.05, the estimated total computing power occupancy of channel 3 is 0.03, the estimated total computing power occupancy of channel 4 is 0.08, and the estimated total computing power occupancy of channel 1 is 0.1. The current available total computing power of NVR is 0.15. The estimated total computing power occupancy of each candidate channel is sorted in order from small to large, and the following sorting results are obtained: 0.02, 0.03, 0.05, 0.08, 0.12. Through calculation, we know that when N increases from 1 to 4, the total estimated computing power usage of 0.18 is greater than the current available total computing power of 0.15, then we stop increasing N and determine N to be 4; when M increases from 1 to 2, the total estimated computing power usage of 0.2 is greater than the current available total computing power of 0.15, then we stop increasing M and determine M to be 2. The current maximum channel specification of AI function 1 is 3 (obtained from N-1, N=4), and the minimum channel specification is 1 (obtained from M-1, M=2).
[0133] In the application scenario of parallel work, the pre-computing power occupation of each candidate channel for the AI function includes the estimated CPU computing power occupation and the estimated NPU computing power occupation of each candidate channel for the AI function, and the future available computing power includes the future available CPU computing power and the future available NPU computing power. Then, two Ns and two Ms can be determined by the above method, namely: N1 and M1 obtained according to the estimated CPU computing power and the future available CPU computing power of each candidate channel for the AI function, and N2 and M2 obtained according to the estimated NPU computing power and the future available NPU computing power of each candidate channel for the AI function. Then: NVR needs to compare the smaller value of N1-1 and M1-1, recorded as the first value; at the same time, compare the smaller value of N2-1 and M2-1, recorded as the second value, and determine the smaller value of the first value and the second value as the minimum channel specification of the AI function. Similarly, the NVR also needs to compare the larger value between N1-1 and M1-1, recorded as the third value; at the same time, compare the larger value between N2-1 and M2-1, recorded as the fourth value, and determine the smaller value between the third value and the fourth value as the maximum channel specification of the AI function.
[0134] As an example only, in the application scenario of parallel working mode, for AI function 1, assuming that N1 is 3 and M1 is 9 from the perspective of CPU computing power; N2 is 4 and M2 is 7 from the perspective of NPU computing power, it can be determined that the current maximum channel specification of AI function 1 is 7 and the current minimum channel specification is 3.
[0135] It can be understood that if the pre-selected AI function of a channel is adjusted, and / or if the AI function that has been turned on in a channel is adjusted, the NVR can be triggered to re-execute steps D1 to D4 to update the current maximum channel specification and minimum channel specification of each AI function according to the latest status of the AI function that has been turned on in each channel and the latest status of the AI function that is expected to be turned on.
[0136] In some embodiments, the NVR may also display a new parameter on its user interface: the typical channel specification of the AI function. The typical channel specification of the AI function refers to the number of channels on which the NVR can enable the AI function without dragging down the performance of the NVR and without enabling other AI functions, where the video stream of each channel is a video stream of a typical scene. Considering that the calculation process of the typical channel specification of each AI function is the same, the following takes any AI function as an example to introduce the calculation process of the typical channel specification of the AI function:
[0137] E1. Calculate the typical computing power used by this AI function.
[0138] E2. Calculate the typical channel specifications of the AI function based on the typical computing power usage.
[0139] The above calculation process can be expressed by the following formula (6):
[0140]
[0141] Among them, Channel_clasic_num is the typical channel specification of an AI function; S0 is the typical computing power occupied by the AI function; in order to make the obtained typical channel specification an integer, the floor function is used in the above formula (6) to round down.
[0142] In the application scenario of serial working mode, the typical computing power occupancy S0 is: the sum of the typical CPU computing power occupancy of AI functions and the typical NPU computing power occupancy.
[0143] In the application scenario of the parallel working mode, the typical computing power occupancy S0 is: the larger value of the typical CPU computing power occupancy of the AI function and the typical NPU computing power occupancy. That is, if the typical CPU computing power occupancy of the AI function is greater than its typical NPU computing power occupancy, then the typical computing power occupancy S0 of the AI function is specifically the typical CPU computing power occupancy of the AI function; if the typical CPU computing power occupancy of the AI function is greater than its typical NPU computing power occupancy, then the typical computing power occupancy S0 of the AI function is specifically the typical CPU computing power occupancy of the AI function;
[0144] Among them, the typical CPU computing power usage of the AI function is specifically: the sum of the initial CPU computing power usage of each AI sub-function contained in the AI function. The typical NPU computing power usage of the AI function is specifically: the sum of the initial NPU computing power usage of each AI sub-function contained in the AI function. It can be understood that the initial NPU computing power usage and initial CPU computing power usage of the AI sub-function have been introduced in the previous article, and the calculation process will not be repeated here.
[0145] From the above calculation process, it can be seen that for any NVR, the typical channel specifications of each AI function of the NVR will not change according to the actual usage of the NVR; that is, for the NVR, the typical channel specifications of each AI function are fixed values. Therefore, for any NVR, after calculating the typical channel specifications of each AI function, the typical channel specifications of each AI function can be stored in the local database to avoid repeated calculation of the typical channel specifications of each AI function.
[0146] As can be seen from the above, in the embodiments of the present application, for video management devices such as NVR, they will monitor the working status of each channel during operation. For those channels that are undergoing AI processing, the video management device will calculate the real-time computing power occupancy of these channels. For those channels that are not undergoing AI processing, the video management device will calculate the initial computing power occupancy of these channels. Based on the computing power occupancy of each channel (which may be real-time computing power occupancy or initial computing power occupancy), the video management device can calculate its currently available computing power. Through the above process, the currently available computing power of the video management device is quantified, so that the video management device can grasp its actual busyness and ensure that its computing power resources can be fully utilized.
[0147] Corresponding to the computing power management method provided above, the present application embodiment also provides a computing power management device. The computing power management device can be integrated into the video management device. Figure 2 , the computing power management device 200 includes:
[0148] The first determination module 201 is used to determine whether each channel of the video management device is performing artificial intelligence AI processing;
[0149] The first calculation module 202 is used to calculate the real-time computing power occupation of the first channel for each first channel when there is a first channel, wherein the first channel is: a channel that is performing AI processing;
[0150] The second calculation module 203 is used to calculate the initial computing power occupation of the second channel for each second channel when there is a second channel, wherein the second channel is: a channel that is not performing AI processing;
[0151] The third calculation module 204 is used to calculate the current available computing power of the video management device according to the real-time computing power occupancy of each first channel and / or the initial computing power occupancy of each second channel.
[0152] In some embodiments, the first computing module 202 includes:
[0153] A first calculation unit, used to calculate the actual computing power occupied by the first channel at the current moment;
[0154] A first acquisition unit, used to acquire the real-time computing power usage of the first channel at a previous moment;
[0155] The second calculation unit is used to calculate the real-time computing power occupancy of the first channel at the current moment by adopting a sliding average strategy according to the actual computing power occupancy of the first channel at the current moment and the real-time computing power occupancy of the first channel at the previous moment.
[0156] In some embodiments, the first computing unit includes:
[0157] A first acquisition subunit is used to obtain the AI processing time consumed by the first channel for the video frame at the current moment;
[0158] The first computing subunit is used to calculate the actual computing power occupied by the first channel at the current moment according to the AI processing time of the first channel on the video frame at the current moment and the preset channel minimum frame rate.
[0159] In some embodiments, the second computing module includes:
[0160] A second acquisition unit, used to acquire the enabled AI function of the second channel;
[0161] A first obtaining unit, used for obtaining a union of AI sub-functions of the AI function enabled on the second channel;
[0162] A third computing unit is used to calculate the initial computing power usage of each AI sub-function in the AI sub-function set;
[0163] The first determining unit is used to determine the sum of the initial computing power occupancy of each AI sub-function in the AI sub-function set as the initial computing power occupancy of the second channel.
[0164] In some embodiments, the computing power management device 200 further includes:
[0165] An obtaining module, for any channel of the video management device, when there is a need to enable a new AI function in the channel, to obtain the intersection of the new AI function and the first AI sub-function of the AI function that has been enabled in the channel;
[0166] a fourth calculation module, configured to calculate the initial computing power occupation of each first target AI sub-function, wherein the first target AI sub-function refers to an AI sub-function of a new AI function that is not in the intersection of the first AI sub-functions;
[0167] The first determination module is used to determine whether to approve the activation requirement of a new AI function based on the sum of the initial computing power occupied by all first target AI sub-functions and the current available computing power.
[0168] In some embodiments, the first determination module is specifically used to approve the request to enable a new AI function when the sum of the initial computing power occupied by all first target AI sub-functions is less than or equal to the current available computing power; and to reject the request to enable a new AI function when the sum of the initial computing power occupied by all first target AI sub-functions is greater than the current available computing power.
[0169] In some embodiments, the computing power management device 200 further includes:
[0170] A traversal module, used to traverse all channels of the video management device for each AI function;
[0171] The second judgment module is used to judge whether the currently traversed channel has been turned on or pre-selected to turn on the AI function;
[0172] A fifth calculation module, used for calculating the pre-calculation power occupation of the currently traversed channel for the AI function when the currently traversed channel is not enabled and the AI function is not pre-selected to be enabled;
[0173] The second determination module is used to determine the current minimum channel specification and maximum channel specification of the AI function according to the pre-computing power occupied by the AI function and the current available computing power of each channel that has not been enabled and has not been pre-selected to enable the AI function after all channels have been traversed.
[0174] In some embodiments, the fifth computing module includes:
[0175] A second obtaining unit, used for obtaining the intersection of the AI function and the second AI sub-function of the AI function that has been enabled in the currently traversed channel;
[0176] A third obtaining unit, used for obtaining the intersection of the AI function and the third AI sub-function of the AI function pre-selected and enabled in the currently traversed channel;
[0177] a fourth calculation unit, configured to calculate an initial computing power occupation of each second target AI sub-function, wherein the second target AI sub-function refers to an AI sub-function that is not in the intersection of the second AI sub-function and is not in the intersection of the third AI sub-function;
[0178] The second determining unit is used to determine the sum of the initial computing power occupations of all second target AI sub-functions as the pre-computing power occupation of the currently traversed channel for the AI function.
[0179] In some embodiments, the second determining module includes:
[0180] A fifth computing unit, configured to calculate the future available computing power of the video management device according to the currently available computing power and the pre-computing power occupied by the pre-selected enabled AI functions of all channels;
[0181] A sorting unit, used for sorting the pre-calculated power usage of the AI function for each channel that is not enabled and has not been pre-selected to enable the AI function;
[0182] The third determination unit is used to determine the current minimum channel specification and maximum channel specification of the AI function according to the sorting result and the future available computing power.
[0183] In some embodiments, the sorting is performed in an ascending order or a descending order, and the third determining unit includes:
[0184] A first incrementing subunit is used to increment N when the sum of the first N pre-computing powers occupied in the sorting result is less than or equal to the future available computing power, and to stop incrementing N when the sum of the first N pre-computing powers occupied is greater than the future available computing power, wherein N is initially 1;
[0185] The second incrementing subunit increments M when the sum of the last M pre-computing powers in the sorting result is less than or equal to the future available computing power, and stops incrementing M when the sum of the last M pre-computing powers is greater than the future available computing power, wherein M is initially 1;
[0186] The specification determination subunit is used to determine N-1 and M-1 as the current minimum channel specification and maximum channel specification of the AI function respectively when stopping increasing M and N.
[0187] In some embodiments, the computing power management device 200 further includes:
[0188] A sixth calculation module, used to calculate the typical computing power occupied by each AI function;
[0189] The seventh computing module is used to calculate the typical channel specifications of the AI function based on the typical computing power occupancy.
[0190] In some embodiments, the video management device includes a central processing unit CPU and a network processor NPU, and the computing power that the video management device can provide includes CPU computing power and NPU computing power, wherein the working mode of the CPU and the NPU is a serial working mode or a parallel working mode.
[0191] As can be seen from the above, in the embodiments of the present application, for video management devices such as NVR, they will monitor the working status of each channel during operation. For those channels that are undergoing AI processing, the video management device will calculate the real-time computing power occupancy of these channels. For those channels that are not undergoing AI processing, the video management device will calculate the initial computing power occupancy of these channels. Based on the computing power occupancy of each channel (which may be real-time computing power occupancy or initial computing power occupancy), the video management device can calculate its currently available computing power. Through the above process, the currently available computing power of the video management device is quantified, so that the video management device can grasp its actual busyness and ensure that its computing power resources can be fully utilized.
[0192] Corresponding to the computing power management method provided above, the embodiment of the present application further provides a video management device, which can be an NVR or an electronic device equipped with a video management system, which is not limited here. Figure 3 The video management device 3 in the embodiment of the present application includes: a memory 301, one or more processors 302 ( Figure 3 Only one is shown) and a computer program stored in the memory 301 and executable on the processor. Among them: the memory 301 is used to store software programs and units, and the processor 302 executes various functional applications and data processing by running the software programs and units stored in the memory 301 to obtain the resources corresponding to the above-mentioned preset events. Specifically, the processor 302 implements each step in the above-mentioned method embodiment by running the above-mentioned computer program stored in the memory 301, which will not be repeated here.
[0193] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0194] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0195] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the associated hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The above-mentioned computer-readable storage medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer-readable memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media does not include electrical carrier signals and telecommunication signals.
[0196] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A computing power management method, characterized in that: The computing power management method is applied to a video management device, and the computing power management method includes: Determine whether each channel of the video management device is performing artificial intelligence AI processing; In the case where a first channel exists, for each of the first channels, the real-time computing power occupation of the first channel is calculated, wherein the first channel is: a channel that is performing AI processing; In the case where a second channel exists, for each of the second channels, the initial computing power occupation of the second channel is calculated, wherein the second channel is: a channel that is not performing AI processing; Calculate the current available computing power of the video management device according to the real-time computing power occupation of each of the first channels and / or the initial computing power occupation of each of the second channels; For any channel of the video management device, when there is a need to enable a new AI function on the channel, obtain the intersection of the new AI function and the first AI sub-function of the AI function that has been enabled on the channel; Calculate the initial computing power occupation of each first target AI sub-function, wherein the first target AI sub-function refers to: an AI sub-function of the new AI function that is not in the intersection of the first AI sub-functions; Determine whether to approve the request to enable the new AI function based on the sum of the initial computing power occupied by all the first target AI sub-functions and the currently available computing power.
2. The computing power management method according to claim 1, characterized in that: The calculating the real-time computing power usage of the first channel includes: Calculate the actual computing power occupied by the first channel at the current moment; Obtaining the real-time computing power usage of the first channel at the previous moment; According to the actual computing power occupancy of the first channel at the current moment and the real-time computing power occupancy of the first channel at the previous moment, the real-time computing power occupancy of the first channel at the current moment is calculated using a sliding average strategy.
3. The computing power management method according to claim 2, characterized in that: The calculating the actual computing power occupied by the first channel at the current moment includes: Obtaining the AI processing time of the first channel on the video frame at the current moment; The actual computing power occupied by the first channel at the current moment is calculated based on the AI processing time of the first channel on the video frame at the current moment and the preset channel minimum frame rate.
4. The computing power management method according to claim 1, characterized in that: The calculating the initial computing power occupation of the second channel includes: Get the AI function enabled on the second channel; Obtaining the union of AI sub-functions of the AI function enabled on the second channel; Calculate the initial computing power occupied by each AI sub-function in the AI sub-function set; The sum of the initial computing power occupancy of each AI sub-function in the AI sub-function set is determined as the initial computing power occupancy of the second channel.
5. The computing power management method according to claim 1, characterized in that: The determining whether to approve the activation requirement of the new AI function according to the sum of the initial computing power occupied by all the first target AI sub-functions and the currently available computing power includes: When the sum of the initial computing power occupied by all the first target AI sub-functions is less than or equal to the currently available computing power, the activation requirement of the new AI function is approved; When the sum of the initial computing power occupied by all the first target AI sub-functions is greater than the currently available computing power, the request to enable the new AI function is rejected.
6. The computing power management method according to claim 1, characterized in that: After calculating the current available computing power of the video management device, the computing power management method further includes: For each AI function, traverse all channels of the video management device; Determine whether the currently traversed channel has been enabled or pre-selected to enable the AI function; When the currently traversed channel is not enabled and the AI function is not pre-selected to be enabled, calculating the pre-calculated force occupancy of the currently traversed channel for the AI function; After all channels are traversed, the current minimum channel specification and maximum channel specification of the AI function are determined according to the pre-computing power occupied by the AI function and the current available computing power of each channel that is not enabled and not pre-selected to enable the AI function.
7. The computing power management method according to claim 6, characterized in that: The calculating the pre-calculated force occupancy of the currently traversed channel for the AI function includes: Obtain an intersection of the AI function and a second AI sub-function of the AI function that is enabled in the currently traversed channel; Obtaining the intersection of the AI function and the third AI sub-function of the AI function pre-selected and enabled in the currently traversed channel; Calculate the initial computing power occupation of each second target AI sub-function, wherein the second target AI sub-function refers to: an AI sub-function of the AI function that is not in the intersection of the second AI sub-function and is not in the intersection of the third AI sub-function; The sum of the initial computing power occupations of all the second target AI sub-functions is determined as the pre-computational power occupation of the currently traversed channel for the AI function.
8. The computing power management method according to claim 6, characterized in that: The determining of the current minimum channel specification and maximum channel specification of the AI function according to the pre-computing power occupation of the AI function and the current available computing power of each channel that is not enabled and is not pre-selected to enable the AI function includes: Calculate the future available computing power of the video management device according to the currently available computing power and the pre-computing power occupied by the pre-selected enabled AI functions of all channels; Sort the channels that are not enabled and not pre-selected to enable the AI function according to the pre-calculated power usage of the AI function; The current minimum channel specification and maximum channel specification of the AI function are determined according to the sorting result and the future available computing power.
9. The computing power management method according to claim 8, characterized in that: The sorting is performed in an ascending order or a descending order, and the current minimum channel specification and the maximum channel specification of the AI function are determined according to the sorting result and the future available computing power, including: When the sum of the first N pre-computing powers in the sorting result is less than or equal to the future available computing power, N is incremented until the sum of the first N pre-computing powers is greater than the future available computing power, and N is stopped incrementing, wherein N is initially 1; When the sum of the last M pre-computing powers in the sorting result is less than or equal to the future available computing power, M is incremented until the sum of the last M pre-computing powers is greater than the future available computing power, and M is stopped from being incremented, wherein M is initially 1; When the increment of M and N stops, N-1 and M-1 are respectively determined as the current minimum channel specification and maximum channel specification of the AI function.
10. The computing power management method according to claim 1, characterized in that: The computing power management method further includes: For each AI function, calculate the typical computing power occupied by the AI function; Based on the typical computing power usage, calculate the typical channel specifications of the AI function.
11. The computing power management method according to any one of claims 1 to 10, characterized in that: The video management device includes a central processing unit (CPU) and a network processor (NPU). The computing power that the video management device can provide includes CPU computing power and NPU computing power. The working modes of the CPU and the NPU are serial working mode or parallel working mode.
12. A computing power management device, characterized in that: The computing power management device is applied to a video management device, and the computing power management device includes: A first determination module is used to determine whether each channel of the video management device is performing artificial intelligence AI processing; A first calculation module is used to calculate the real-time computing power occupation of the first channel for each first channel when the first channel exists, wherein the first channel is: a channel that is performing AI processing; A second calculation module is used to calculate the initial computing power occupation of the second channel for each second channel when the second channel exists, wherein the second channel is: a channel that is not performing AI processing; a third computing module, configured to calculate the current available computing power of the video management device according to the real-time computing power occupation of each of the first channels and / or the initial computing power occupation of each of the second channels; an obtaining module, configured to obtain, for any channel of the video management device, when there is a need to enable a new AI function on the channel, an intersection of the new AI function and a first AI sub-function of the AI function enabled on the channel; A fourth calculation module, configured to calculate the initial computing power occupation of each first target AI sub-function, wherein the first target AI sub-function refers to: an AI sub-function of the new AI function that is not in the intersection of the first AI sub-functions; The first determination module is used to determine whether to approve the activation requirement of the new AI function according to the sum of the initial computing power occupied by all the first target AI sub-functions and the currently available computing power.
13. A video management device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 11 is implemented.
14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Data processing method, computer equipment and readable storage medium
CN113434294A