Face recognition method, related equipment and device
By dynamically matching the face recognition frequency, the actual resource occupancy rate of the face recognition device is close to the preset resource occupancy rate, solving the problems of low recognition efficiency and idle resources caused by changes in people's flow, and achieving efficient resource utilization and universal recognition functions.
Patent Information
- Application Number
- CN202210344246.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2042-03-31
AI Technical Summary
Existing facial recognition technology is difficult to keep up with the recognition demand when the traffic is large, resulting in low recognition efficiency. However, when the traffic is small, the equipment resources are idle and lack universality.
By obtaining the preset resource occupancy rate and actual resource occupancy rate of face recognition devices, dynamically match the face recognition frequency, so that the actual resource occupancy rate is close to the preset resource occupancy rate, thereby balancing resource use.
It improves the efficiency of face recognition, alleviates the resource pressure of the device, makes face recognition devices suitable for a variety of face recognition situations, and improves the universality of recognition functions.
Smart Images

Figure CN114743242B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition, and in particular to a face recognition method, related equipment and devices. Background Art
[0002] Face recognition technology is a biometric technology that identifies people based on their facial features. It uses a camera or camcorder to collect images or video streams containing faces, automatically detects and tracks faces in images, and then compares the detected faces. This is also commonly known as portrait recognition or facial recognition.
[0003] Current face recognition often uses a fixed time interval recognition scheme to perform face recognition on crowds. However, when the flow of people is large, the fixed time interval recognition scheme often cannot keep up with the face recognition demand and has low recognition efficiency. When the flow of people is small, equipment resources will be idle.
[0004] Therefore, fixed time intervals are not universally applicable. Summary of the invention
[0005] The present invention provides a face recognition method, related equipment and device to solve the problem that it is difficult to strike a balance between recognition efficiency and resource utilization in face recognition.
[0006] To solve the above technical problems, the present invention provides a face recognition method, including: obtaining a preset resource occupancy rate and a current actual resource occupancy rate of a face recognition device for face recognition; and matching a face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate.
[0007] Among them, the resources of the face recognition device include multiple device resources; obtaining the preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition, including: obtaining the current occupancy rate of each device resource; summing the product of the current occupancy rate of each device resource and their corresponding weight coefficients to obtain the actual resource occupancy rate.
[0008] Among them, matching the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate includes: in response to the actual resource occupancy rate being not within the preset range and the actual resource occupancy rate being greater than the preset resource occupancy rate, reducing the current face recognition frequency of the face recognition device; in response to the actual resource occupancy rate being not within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, increasing the current face recognition frequency of the face recognition device; in response to the actual resource occupancy rate being within the preset range, maintaining the current face recognition frequency of the face recognition device.
[0009] The preset range is between the difference between the preset resource occupancy rate and the buffer threshold and the sum of the preset resource occupancy rate and the buffer threshold.
[0010] In which, in response to the actual resource occupancy rate not being within a preset range and the actual resource occupancy rate being greater than the preset resource occupancy rate, reducing the current face recognition frequency of the face recognition device, including: in response to the actual resource occupancy rate not being within a preset range and the actual resource occupancy rate being greater than the preset resource occupancy rate, determining a first parameter based on the actual resource occupancy rate, and determining a second parameter based on the preset resource occupancy rate; using the negative value of the difference between the first parameter and the second parameter and the first set value to perform quotient processing to obtain a reduction value of the current face recognition frequency; matching the face recognition frequency corresponding to the face recognition device based on the reduction value of the current face recognition frequency; wherein the first parameter represents the amount of resources used by the face recognition device, and the second parameter represents the amount of resources corresponding to the preset resource occupancy rate.
[0011] In which, in response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, increasing the current face recognition frequency of the face recognition device includes: in response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, determining a first parameter based on the actual resource occupancy rate; using the difference between the third parameter and the first parameter and the second set value to perform quotient processing to obtain an increase in the current face recognition frequency; matching the face recognition frequency corresponding to the face recognition device based on the increase in the current face recognition frequency; wherein the third parameter represents the available resources of the face recognition device, and the first parameter represents the used resources of the face recognition device.
[0012] Among them, after matching the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate, it also includes: in response to the face recognition frequency failing to match successfully; adjusting the weight coefficient corresponding to each device resource until the face recognition frequency matches successfully.
[0013] Among them, the weight coefficient corresponding to each device resource is adjusted until the face recognition frequency matches successfully, including: determining the device resource with the largest occupancy rate and the device resource with the smallest occupancy rate among the current occupancy rates of each device resource; increasing the weight coefficient corresponding to the device resource with the largest occupancy rate and correspondingly reducing the weight coefficient corresponding to the device resource with the smallest occupancy rate until the face recognition frequency matches successfully.
[0014] Among them, the various device resources include: central processing unit, memory, bandwidth, graphics processor and network processor; when the device resource is bandwidth, the current occupancy rate of each device resource and the product of their corresponding weight coefficients are summed to obtain the actual resource occupancy rate, including: summing the current occupancy rate of the bandwidth, the mapping coefficient and the product of the corresponding weight coefficient, and the current occupancy rate of other device resources and various corresponding weight coefficients to obtain the actual resource occupancy rate; wherein, the mapping coefficient is calculated based on the highest occupancy rate of the bandwidth.
[0015] To solve the above technical problems, the present invention further provides an electronic device, which includes: a memory and a processor coupled to each other, and the processor is used to execute program instructions stored in the memory to implement any of the above face recognition methods.
[0016] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium, which stores program data, and the program data can be executed to implement any of the above-mentioned face recognition methods.
[0017] The beneficial effect of the present invention is as follows: Different from the prior art, the present invention obtains the preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition, and then matches the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate, thereby dynamically matching the face recognition frequency based on the current actual resource occupancy rate and the preset resource occupancy rate, so that the face recognition frequency of the face recognition device can make the actual resource occupancy rate of the face recognition device close to the preset resource occupancy rate, so that the resource usage of the face recognition device reaches a balanced state, which can not only improve the efficiency of face recognition, but also alleviate the resource pressure of the face recognition device, so that the face recognition device can be applicable to a variety of face recognition situations, and improve the universality of the recognition function of the face recognition device. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of an embodiment of a face recognition method provided by the present invention;
[0019] Figure 2 is a flow chart of another embodiment of the face recognition method provided by the present invention;
[0020] Figure 3 is a structural schematic diagram of an embodiment of an electronic device provided by the present invention;
[0021] Figure 4 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] See also Figure 1 , Figure 1 It is a flow chart of an embodiment of a face recognition method provided by the present invention.
[0024] Step S11: obtaining the preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition.
[0025] The preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition are obtained. The face recognition device of this embodiment includes professional equipment for special face recognition and multifunctional equipment equipped with face recognition function and other functions, such as: recognition machine, face recognition attendance machine, mobile terminal, PC terminal and other equipment, which are not specifically limited here.
[0026] Among them, the preset resource occupancy rate of the face recognition device for face recognition can be set based on the device resource situation of the face recognition device or based on manual experience. The preset resource occupancy rate can characterize the balanced state of resource usage of the face recognition device. In the balanced state, the face recognition device can avoid resource load usage while maintaining recognition efficiency. The preset resource occupancy rate can be 70%, 75%, 80%, 86%, etc., which can be specifically set based on the specific face recognition device or actual situation, and is not limited here.
[0027] The actual resource usage rate of the face recognition device for face recognition can be obtained by setting a script command in the face recognition device, or by setting a resource detector in the face recognition device to obtain the actual resource usage rate, etc. The specific method of obtaining the actual resource usage rate is not limited here.
[0028] Step S12: matching the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate.
[0029] After obtaining the preset resource occupancy rate of the face recognition device for face recognition and the current actual resource occupancy rate, the face recognition frequency corresponding to the face recognition device can be matched based on the actual resource occupancy rate and the preset resource occupancy rate.
[0030] This embodiment can match the face recognition frequency corresponding to the face recognition device based on the difference between the actual resource occupancy rate and the preset resource occupancy rate, so that the matched face recognition frequency can make the actual resource occupancy rate of the face recognition device close to the preset resource occupancy rate, thereby making the resource usage of the face recognition device reach a balanced state.
[0031] Among them, this embodiment can obtain the preset resource occupancy rate and the current actual resource occupancy rate according to the preset frequency, and then match the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate; it can also obtain the preset resource occupancy rate and the current actual resource occupancy rate in real time, and then match the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate, so as to dynamically adjust the face recognition frequency to a certain extent according to the current actual resource occupancy, which can not only improve the efficiency of face recognition, but also alleviate the resource pressure of the face recognition device, and can always keep the system under resource control. Among them, the preset frequency can be specifically set based on the actual situation, for example: 1 time / minute, 1 time / 5 minutes, etc., which is not limited here.
[0032] Through the above steps, the face recognition method of this embodiment obtains the preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition, and then matches the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate, thereby dynamically matching the face recognition frequency based on the current actual resource occupancy rate and the preset resource occupancy rate, so that the face recognition frequency of the face recognition device can make the actual resource occupancy rate of the face recognition device close to the preset resource occupancy rate, so that the resource usage of the face recognition device reaches a balanced state, which can not only improve the efficiency of face recognition, but also alleviate the resource pressure of the face recognition device, so that the face recognition device can be applicable to a variety of face recognition situations, and improve the universality of the recognition function of the face recognition device.
[0033] See also Figure 2 , Figure 2 It is a flowchart of another embodiment of the face recognition method provided by the present invention.
[0034] Step S21: Obtain the preset resource occupancy rate of the face recognition device for face recognition and the current occupancy rate of each device resource, and sum the product of the current occupancy rate of each device resource and the corresponding weight coefficient to obtain the actual resource occupancy rate.
[0035] The preset resource occupancy rate of the face recognition device for face recognition and the current occupancy rate of each device resource are obtained. Among them, the various device resources include: central processing unit, memory, bandwidth, graphics processor, network processor and other device resources. Among them, the device resources of the specific face recognition device for face recognition in practice can be one or more of the above-mentioned device resources, which are not limited here.
[0036] In a specific application scenario, the current occupancy rate of each device resource of the face recognition device can be obtained by setting script commands for each device resource of the face recognition device respectively, or by setting a resource detector in the face recognition device to obtain the current occupancy rate of each device resource. The specific method of obtaining the current occupancy rate of each device resource is not limited here.
[0037] The preset resource occupancy rate X in this embodiment r Refers to the preset resource occupancy rate of the overall device resources of the face recognition device. The setting method is the same as that in the above embodiment, please refer to the above text, and will not be repeated here.
[0038] After obtaining the preset resource occupancy rate and the current occupancy rate of each device resource, the product of the current occupancy rate of each device resource and the corresponding weight coefficient is summed to obtain the actual resource occupancy rate. The sum of the weight coefficients corresponding to each device resource is 1.
[0039] In a specific application scenario, the weight coefficients corresponding to the specific device resources can be evenly distributed based on the number of device resources of the face recognition device. For example, when the device resources of the face recognition device are the central processing unit, memory, bandwidth, graphics processor, and network processor, the weight coefficients corresponding to the device resources can be 0.20 respectively. In another specific application scenario, the weight coefficients corresponding to the specific device resources can also be set based on manual experience. For example, in face recognition, the resource occupancy of the central processing unit is generally large, so the weight coefficient corresponding to the central processing unit can be set larger, such as 0.50 or 0.60. The weight coefficients corresponding to other device resources can be set smaller accordingly.
[0040] After obtaining the current occupancy rate of each device resource, multiply the current occupancy rate of each device resource with various corresponding weight coefficients to obtain the product of the current occupancy rate of each device resource and their corresponding weight coefficients, and then sum the products of the current occupancy rate of each device resource and their corresponding weight coefficients to obtain the actual resource occupancy rate of the face recognition device.
[0041] In a specific application scenario, when the face recognition device includes bandwidth device resources, the current bandwidth occupancy rate, the mapping coefficient and the product of the corresponding weight coefficient, as well as the current occupancy rate of other device resources and the product of various corresponding weight coefficients are summed to obtain the actual resource occupancy rate. Among them, since it is difficult for bandwidth resources to occupy 100% of the bandwidth resources during use, the bottleneck of bandwidth resources is reflected by setting the mapping coefficient. Among them, the mapping coefficient is calculated based on the highest bandwidth occupancy rate.
[0042] In a specific application scenario, assuming that the maximum bandwidth occupancy is Xb instead of 100%, the mapping coefficient K may be K=100% / Xb. In other application scenarios, the mapping coefficient K may also be calculated based on the maximum bandwidth occupancy through other linear mapping relationships, which is not limited here.
[0043] In a specific application scenario, when the device resources of the face recognition device are the central processing unit, memory, bandwidth, graphics processor, and network processor, the current occupancy rates of the central processing unit, memory, bandwidth, graphics processor, and network processor are X1, X2, X3, X4, and X5, respectively, and their corresponding weight coefficients are also A1, A2, A3, A4, and A5, respectively. Then the actual resource occupancy rate is X m It can be obtained through the following calculation formula:
[0044] X m =A1*X1+A2*X2+A3*(X3*K)+A4*X4+A5*X5 (1)
[0045] In a specific application scenario, when the device resources of the face recognition device are different from the aforementioned application scenario, its actual resource usage rate is X m The calculation formula of is similar to formula (1) and will not be repeated here.
[0046] Step S22: In response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being greater than the preset resource occupancy rate, reducing the current face recognition frequency of the face recognition device.
[0047] After obtaining the preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition, the current actual resource occupancy rate is compared with the preset resource occupancy rate. When the actual resource occupancy rate is not within the preset range and the actual resource occupancy rate is greater than the preset resource occupancy rate, it means that the device resources of the current face recognition device are overused. In order to reduce the pressure burden of the face recognition device, it is necessary to reduce the current face recognition frequency of the face recognition device. Among them, the preset range is between the difference between the preset resource occupancy rate and the buffer threshold to the sum of the preset resource occupancy rate and the buffer threshold. The buffer threshold can be 5%, 6% or 8%, etc., which can be set based on actual needs and is not limited here.
[0048] In a specific implementation, the first parameter can be determined based on the actual resource occupancy rate, and the second parameter can be determined based on the preset resource occupancy rate. Finally, the negative value of the difference between the first parameter and the second parameter is used to obtain the quotient of the first set value to obtain the reduction value of the current face recognition frequency. Finally, the face recognition frequency corresponding to the face recognition device is matched based on the reduction value of the current face recognition frequency. Among them, the first parameter represents the amount of resources used by the face recognition device, and the second parameter represents the amount of resources corresponding to the preset resource occupancy rate.
[0049] In another specific implementation, the reduction value of the current face recognition frequency may also be calculated in other ways.
[0050] In order to prevent the face recognition device from wasting performance by repeatedly adjusting its face recognition frequency, by adding the buffer threshold and the preset range setting when comparing the actual resource occupancy rate with the preset resource occupancy rate, that is, when the actual resource occupancy rate is not within the preset range, the difference between the actual resource occupancy rate and the preset resource occupancy rate is further judged, and when the actual resource occupancy rate is greater than the preset resource occupancy rate, the face recognition frequency is reduced. For example: when the preset resource occupancy rate is 80%, the buffer threshold can be set to 5%, and the preset range is 75%-85%. When the actual resource occupancy rate is 83%, it is within the preset range, and the face recognition frequency is not adjusted. When the actual resource occupancy rate is 86%, it is not within the preset range and is greater than the preset resource occupancy rate, the face recognition frequency is reduced.
[0051] In a specific implementation, when the actual resource occupancy rate is greater than the preset resource occupancy rate, the face recognition frequency reduction value F s The calculation method can be:
[0052] F s =-(bc) / d (2)
[0053] Where b is the first parameter, and b = X m*100, c is the second parameter, and c=Xr*100, d is the first set value, which is 10 in this embodiment, that is, formula (2) can be expanded to:
[0054] F s =-(X m *100-X r *100) / 10 (3)
[0055] Reduce the face recognition frequency by F s Add it to the current face recognition frequency to get the face recognition frequency that the face recognition device needs to match.
[0056] In a specific application scenario, when the current face recognition frequency is 5 times / s, the actual resource occupancy rate is 90%, and the preset resource occupancy rate is 80%, the face recognition frequency reduction value F can be calculated by formula (3): s If it is -1, the face recognition frequency is reduced by 1 time / s, and the matched face recognition frequency is 4 times / s.
[0057] In other specific implementations, the first parameter b may also be based on the actual resource occupancy rate X r , calculated by other calculation methods, the second parameter c can also be based on the preset resource occupancy rate X m , calculated by other calculation methods, and the first set value d can also adopt other set values based on the specific situation of the face recognition device, which is not limited here.
[0058] The reduced value F of the face recognition frequency obtained in this step s is a negative value, then when the face recognition frequency reduction value F is obtained s Then, the face recognition frequency reduction value F s By adding the current face recognition frequency of the face recognition device, the value of the face recognition frequency that needs to be matched can be obtained.
[0059] Since the first parameter b of this embodiment represents the amount of resources used by the face recognition device, and the second parameter c represents the amount of resources corresponding to the preset resource occupancy rate, when the actual resource occupancy rate is greater than the preset resource occupancy rate, the difference between the first parameter and the second parameter can represent the amount by which the amount of resources used by the face recognition device exceeds the amount of resources corresponding to the preset resource occupancy rate, and the above formulas (2)-(3) can achieve that when the amount of used resources exceeds the amount of resources corresponding to the preset resource occupancy rate more, the amount by which the reduction value of the face recognition frequency needs to be reduced is greater, thereby quickly reducing the face recognition frequency and alleviating the pressure on device resources, and when the amount of used resources exceeds the amount of resources corresponding to the preset resource occupancy rate less, the amount by which the reduction value of the face recognition frequency needs to be reduced is smaller, thereby gradually alleviating the pressure on device resources, thereby matching different face recognition frequencies based on the specific situation of the actual resource occupancy rate to adapt to the current situation of the face recognition device, so that the resource usage of the face recognition device reaches a balanced state as soon as possible to avoid excessive pressure on device resources.
[0060] Step S23: In response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, increasing the current face recognition frequency of the face recognition device.
[0061] In response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, it indicates that some resources of the face recognition device are idle, and the current face recognition frequency of the face recognition device is increased to reduce idle device resources.
[0062] In a specific embodiment, in response to the actual resource occupancy rate not being within a preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, a first parameter can be determined based on the actual resource occupancy rate; the difference between a third parameter and the first parameter and the second set value are used to obtain the increase value of the current face recognition frequency, and the face recognition frequency corresponding to the face recognition device is matched based on the increase value of the current face recognition frequency; wherein the third parameter represents the available resources of the face recognition device, and the first parameter represents the used resources of the face recognition device.
[0063] In another specific implementation, the increase value of the current face recognition frequency may also be calculated in other ways.
[0064] In a specific implementation, in order to prevent the face recognition device from repeatedly adjusting its face recognition frequency and wasting performance, the buffer threshold and the preset range can also be set when comparing the actual resource occupancy rate with the preset resource occupancy rate, that is, when the actual resource occupancy rate is not within the preset range, the difference between the actual resource occupancy rate and the preset resource occupancy rate is further judged, and when the actual resource occupancy rate is less than the preset resource occupancy rate, the face recognition frequency is increased. For example: when the preset resource occupancy rate is 80%, the buffer threshold can be set to 5%, then when the actual resource occupancy rate is 78%, it is within the preset range, and the face recognition frequency is not adjusted, and when the actual resource occupancy rate is 70%, it is not within the preset range and is less than the preset resource occupancy rate, then the face recognition frequency is increased.
[0065] In a specific implementation, when the actual resource occupancy rate is not within the preset range and the actual resource occupancy rate is less than the preset resource occupancy rate, the increase value F of the face recognition frequency is r The calculation method can be:
[0066] F r =(eb) / f (4)
[0067] Wherein, e is the third parameter, and e=100, representing the available resources of the face recognition device, b is the first parameter, and b=X m *100, f is the second set value, which is 20 in this embodiment, that is, formula (4) can be expanded to:
[0068] F r =[100-X m *100] / 20 (5)
[0069] Among them, X m * The 100 in 100 is used to offset the % in the actual resource usage, so that the calculated increase in face recognition frequency F r The range is reasonable.
[0070] Increase the face recognition frequency by F r Add it to the current face recognition frequency to get the face recognition frequency that the face recognition device needs to match.
[0071] In a specific application scenario, when the current face recognition frequency is 5 times / s, the actual resource occupancy rate is 40%, and the preset resource occupancy rate is 80%, the increase value F of the face recognition frequency can be calculated by formula (5): r If it is 3, the face recognition frequency will be increased by 3 times / second, and the face recognition frequency that needs to be matched is 8 times / second.
[0072] In a specific application scenario, when the increase and decrease values of the face recognition frequency calculated in steps S22 and S23 are decimals, the calculation results are rounded down. For example, when the current face recognition frequency is 5 times / s, the actual resource occupancy rate is 50%, and the preset resource occupancy rate is 80%, the increase value F of the face recognition frequency can be calculated by formula (5): r If it is 2.5, then round it down to increase the face recognition frequency by 2 times / second, and the face recognition frequency to be matched is 7 times / second.
[0073] Since the third parameter e of this embodiment represents the available resource amount of the face recognition device, and the first parameter b represents the used resource amount of the face recognition device, when the actual resource occupancy rate is less than the preset resource occupancy rate, the difference between the third parameter and the first parameter can represent the idle resource amount of the face recognition device between the preset resource occupancy rate, and the above formulas (4)-(5) can realize that the farther the actual resource occupancy rate is from the preset resource occupancy rate, the greater the increase value of the face recognition frequency, and the closer the actual resource occupancy rate is to the preset resource occupancy rate, the smaller the increase value of the face recognition frequency, thereby matching the face recognition frequency based on the specific situation of the actual resource occupancy rate to adapt to the current situation of the face recognition device, so that the resource usage of the face recognition device can reach a balanced state as soon as possible to avoid idle device resources.
[0074] In other specific implementations, the first parameter b may also be based on the actual resource occupancy rate X r , calculated by other calculation methods, and the second setting value f can also adopt other setting values based on the specific situation of the face recognition device, which is not limited here.
[0075] The increase value F of the face recognition frequency obtained in this step r is a positive value, then when the increase value F of face recognition frequency is obtained r Then, the increase value F of the face recognition frequency r Adding it to the current face recognition frequency of the face recognition device will give the face recognition frequency that needs to be matched.
[0076] In another specific implementation, the increase value of the current face recognition frequency may also be calculated in other ways.
[0077] Step S24: In response to the actual resource occupancy rate being within a preset range, maintaining the current face recognition frequency of the face recognition device.
[0078] In response to the actual resource occupancy rate being within the preset range, the current face recognition frequency of the face recognition device is maintained. In a specific application scenario, when the preset resource occupancy rate is 80%, the buffer threshold can be set to 5%, and the preset range is 75%-85%. When the actual resource occupancy rate is between 75%-85%, the current face recognition frequency that the face recognition device needs to match does not change.
[0079] Step S25: In response to the face recognition frequency failing to match successfully, the weight coefficients corresponding to the device resources are adjusted until the face recognition frequency matches successfully.
[0080] After matching the face recognition frequency corresponding to the face recognition device, if the face recognition frequency cannot be matched successfully, it means that the weight coefficients corresponding to the device resources are set incorrectly. For example, when the weight coefficient corresponding to the device with large resource usage is set to a small value, when the device resource usage reaches a bottleneck, due to its small weight coefficient, the actual resource usage rate X calculated is m The preset resource utilization rate cannot be reached, and the calculated face recognition frequency that needs to be matched still shows that the recognition frequency needs to be increased, but because the device resource usage has reached a bottleneck, the recognition frequency cannot be increased, and the face recognition frequency cannot be matched successfully. In general, it is rare that the recognition frequency decreases downward but the match fails. Therefore, this step describes the situation where the recognition frequency increases upward but the match fails.
[0081] Therefore, when the face recognition frequency cannot be matched successfully, the weight coefficient corresponding to each device resource is adjusted until the face recognition frequency is matched successfully.
[0082] In a specific application scenario, the method for adjusting the weight coefficients corresponding to each device resource may include: first determining the device resource with the largest occupancy rate and the device resource with the smallest occupancy rate among the current occupancy rates of each device resource, increasing the weight coefficient corresponding to the device resource with the largest occupancy rate and correspondingly reducing the weight coefficient corresponding to the device resource with the smallest occupancy rate, to ensure that the sum of the weight coefficients corresponding to each device resource is still 1, until the face recognition frequency is matched successfully. Among them, the current occupancy rate of each device resource can be obtained by setting a script command, and then the current occupancy rate of each device resource is compared to determine the device resource with the largest occupancy rate and the device resource with the smallest occupancy rate among the current occupancy rates of each device resource. In other embodiments, other methods can also be adopted for determination, which are not limited here.
[0083] In a specific application scenario, a single adjustment step can be set. For example, the single adjustment step is set to 5%. When the weight coefficient corresponding to the device resource with the highest occupancy rate is 0.30, and the weight coefficient corresponding to the device resource with the lowest occupancy rate is 0.15, after a single adjustment, the weight coefficient corresponding to the device resource with the highest occupancy rate is 0.35, and the weight coefficient corresponding to the device resource with the lowest occupancy rate is 0.10. By setting a single adjustment step, it is possible to avoid excessive adjustment of the device resource weight or difficulty in adjusting to a more accurate size, and to facilitate the adjustment of the weight coefficient.
[0084] When the face recognition device after adjusting the weight coefficient matches the face recognition frequency, if the face recognition frequency still cannot be matched successfully, continue to adjust the weight coefficient corresponding to each device resource according to the above weight coefficient adjustment method until the face recognition frequency is matched successfully.
[0085] In a specific application scenario, assuming that the CPU, memory, bandwidth, and graphics processor resources of a face recognition device are sufficient, the respective weight coefficients X1, X2, X3, and X4 are close to 0; the network processor resource is the bottleneck, and X5 is close to 100%; and if the weight coefficients corresponding to the resources of each device are all set to 0.20, the actual resource utilization rate X m If the current occupancy rate of each device resource is approximately equal to 20%, which is much lower than the preset resource occupancy rate of 80%, the calculation result will guide the increase of the recognition frequency; however, because the network processor resource has reached a bottleneck, the recognition frequency cannot be increased. Therefore, through the current occupancy rate of each device resource, find the network processor with the largest occupancy rate and the device resource with the smallest occupancy rate among the current occupancy rates of each device resource, and increase the weight coefficient of the network processor and reduce the weight coefficient of the device resource with the smallest occupancy rate. The adjusted situation may be the actual resource occupancy rate X m =0.15*X1+0.20*X2+0.20*(X3*K)+0.20*X4+0.25*X5. Then the actual resource occupancy rate after adjustment is X m If the weight coefficient after this adjustment still cannot make the face recognition frequency match successful, repeat the above steps until the face recognition frequency matches successfully. At this time, the actual resource occupancy rate X m The calculation method of each device resource can be X m =0.15*X1+0.20*X2+0.20*(X3*K)+0.20*X4+0.25*X5.
[0086] Therefore, after the face recognition device of this embodiment is in operation, it will automatically adjust the weight coefficient of each device resource based on the frequency adjustment situation, so that each weight coefficient can ultimately more accurately reflect the occupancy of each device resource, thereby accurately reflecting the occupancy of each device resource of the face recognition device, improving the accuracy of the increase and decrease values of the face recognition frequency, and helping relevant personnel to promptly discover the resource bottleneck of the face recognition device.
[0087] Through the above steps, the face recognition method of this embodiment obtains the preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition, and then increases or decreases the face recognition frequency of the face recognition device based on the comparison between the actual resource occupancy rate and the preset resource occupancy rate, thereby dynamically matching the face recognition frequency based on the current actual resource occupancy rate and the preset resource occupancy rate, so that the face recognition frequency can make the actual resource occupancy rate of the face recognition device close to the preset resource occupancy rate, so that the resource usage of the face recognition device reaches a balanced state, which can not only improve the efficiency of face recognition, but also alleviate the resource pressure of the face recognition device, so that the face recognition device can be applicable to a variety of face recognition situations, and improve the universality of the recognition function of the face recognition device. In addition, this embodiment also determines the rationality of the weight coefficients corresponding to each device resource by determining the matching situation of the face recognition frequency. When the weight coefficients corresponding to each device resource are unreasonable, the weight coefficients corresponding to each device resource are adjusted until the face recognition frequency can be matched successfully, so that each weight coefficient can more accurately reflect the occupancy of each device resource, thereby accurately reflecting the occupancy of each device resource of the face recognition device, improving the accuracy of the increase and decrease values of the face recognition frequency, further ensuring the rationality of the face recognition frequency adjustment, and ensuring the resource usage and recognition efficiency of the face recognition device.
[0088] Based on the same inventive concept, the present invention also proposes an electronic device, which can be executed to implement the face recognition method of any of the above embodiments, see Figure 3 , Figure 3 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. The electronic device includes a processor 31 and a memory 32 .
[0089] The processor 31 is used to execute the program instructions stored in the memory 32 to implement the steps of any of the above-mentioned face recognition method embodiments. In a specific implementation scenario, the electronic device may include but is not limited to: a microcomputer, a server, and in addition, the electronic device may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.
[0090] Specifically, the processor 31 is used to control itself and the memory 32 to implement the steps of any of the above embodiments. The processor 31 can also be called a CPU (Central Processing Unit). The processor 31 may be an integrated circuit chip with signal processing capabilities. The processor 31 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 31 can be implemented by an integrated circuit chip.
[0091] The above scheme can match the corresponding face recognition frequency based on the current actual resource occupancy rate and the preset resource occupancy rate, and thus make adaptive adjustments, which can not only improve the efficiency of face recognition, but also alleviate the resource pressure of face recognition equipment and improve the universality of face recognition.
[0092] Based on the same inventive concept, the present invention also proposes a computer-readable storage medium, see Figure 4 , Figure 4 4 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention. The computer-readable storage medium 40 stores at least one program data 41, and the program data 41 is used to implement any of the above methods. In one embodiment, the computer-readable storage medium 40 includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0093] In the several embodiments provided by the present invention, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0094] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0095] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0096] If the 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 this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
[0097] The above description is only an implementation mode of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A face recognition method, characterized in that: include: Obtain the preset resource occupancy rate and current actual resource occupancy rate of the face recognition device for face recognition; matching a face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate; In which, in response to the actual resource occupancy rate not being within a preset range and the actual resource occupancy rate being greater than the preset resource occupancy rate, a first parameter is determined based on the actual resource occupancy rate, and a second parameter is determined based on the preset resource occupancy rate; a negative value of the difference between the first parameter and the second parameter is used to obtain a quotient of a first set value to obtain a reduction value of the current face recognition frequency; Based on the reduced value of the current face recognition frequency, the face recognition frequency corresponding to the face recognition device is matched; the first parameter represents the amount of resources used by the face recognition device, and the second parameter represents the amount of resources corresponding to the preset resource occupancy rate.
2. The face recognition method according to claim 1, characterized in that: The resources of the face recognition device include multiple device resources; The obtaining of the preset resource occupancy rate and the current actual resource occupancy rate of the face recognition device for face recognition includes: Obtaining the current occupancy rate of each of the device resources; The current occupancy rate of each of the device resources and the product of the corresponding weight coefficient are summed to obtain the actual resource occupancy rate.
3. The face recognition method according to claim 2, characterized in that: The matching the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate includes: In response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, increasing the current face recognition frequency of the face recognition device; In response to the actual resource occupancy rate being within the preset range, maintaining a current face recognition frequency of the face recognition device.
4. The face recognition method according to claim 3, characterized in that: The preset range is between the difference between the preset resource occupancy rate and the buffer threshold and the sum of the preset resource occupancy rate and the buffer threshold.
5. The face recognition method according to claim 3, characterized in that: In response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, increasing the current face recognition frequency of the face recognition device includes: In response to the actual resource occupancy rate not being within the preset range and the actual resource occupancy rate being less than the preset resource occupancy rate, determining a first parameter based on the actual resource occupancy rate; The difference between the third parameter and the first parameter is used to obtain the increased value of the current face recognition frequency by taking the quotient of the second set value; matching a face recognition frequency corresponding to the face recognition device based on the increased value of the current face recognition frequency; The third parameter represents the available resources of the face recognition device, and the first parameter represents the used resources of the face recognition device.
6. The face recognition method according to claim 1, characterized in that: After matching the face recognition frequency corresponding to the face recognition device based on the actual resource occupancy rate and the preset resource occupancy rate, the method further includes: In response to the facial recognition frequency failing to match successfully; The weight coefficient corresponding to each device resource is adjusted until the face recognition frequency is matched successfully.
7. The face recognition method according to claim 6, characterized in that: The weight coefficients corresponding to the device resources are adjusted until the face recognition frequency is successfully matched, including: Determine the device resource with the largest occupancy rate and the device resource with the smallest occupancy rate among the current occupancy rates of the device resources; The weight coefficient corresponding to the device resource with the largest occupancy rate is increased, and the weight coefficient corresponding to the device resource with the smallest occupancy rate is correspondingly reduced until the face recognition frequency is successfully matched.
8. The face recognition method according to claim 2, characterized in that: The various device resources include: central processing unit, memory, bandwidth, graphics processor and network processor; When the device resource is bandwidth, the summing of the products of the current occupancy rates of the device resources and the corresponding weight coefficients to obtain the actual resource occupancy rate includes: The actual resource occupancy rate is obtained by summing the product of the current occupancy rate of the bandwidth, the mapping coefficient and the corresponding weight coefficient, and the product of the current occupancy rate of other device resources and various corresponding weight coefficients; The mapping coefficient is calculated based on the maximum occupancy rate of the bandwidth.
9. An electronic device, characterized in that: The electronic device comprises: a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the face recognition method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program data, and the program data can be executed to implement the face recognition method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Face identification method and face identification device for Flash online video
CN102567720A
Dynamic load balancing method for distributed file system under cloud environment
CN108200156A
Resource balancing method, device and system based on three-dimensional scanning device
CN111694665A