Face detection method and device for dynamically scheduling resources, equipment and storage medium

Through the face detection method of dynamically scheduling resources, the problem of unreasonable allocation of face detection resources in large-scale and high-concurrency scenarios is solved, and efficient resource utilization and improvement of face detection accuracy and real-time performance are achieved.

CN120148087APending Publication Date: 2025-06-13CISDI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510291832.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

In large-scale and high-concurrency scenarios, it is difficult for the prior art to perform face detection quickly and stably, resulting in computing resource contention and system throughput decay.

Method used

Through the face detection method of dynamically scheduling resources, we receive face detection service call requests, verify access permissions, obtain resource demand, and select target resource nodes based on the current computing resources of each resource node for allocation, issue face detection tasks, and recycle resource nodes after the task is completed.

Benefits of technology

It improves the system's efficiency in using computing resources, significantly improves the accuracy and real-time nature of face detection and attribute recognition, and improves the overall performance and user experience of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120148087A_ABST
    Figure CN120148087A_ABST
Patent Text Reader

Abstract

The invention provides a face detection method and device for dynamically scheduling resources, equipment and a storage medium, and the method comprises the steps: receiving a face detection service calling request, and verifying the access authority of the face detection service calling request; if the verification is passed, obtaining the resource demand quantity of the face detection service calling request, selecting one or more resource nodes from the resource nodes as target resource nodes according to the current computing power resources of the resource nodes and the resource demand quantity, and allocating the target resource nodes to the face detection service calling request, the face detection task is issued according to the target resource node, and the target resource node is recycled after the face detection task is completed, so that the resource node is dynamically scheduled, and the technical problem that face detection is difficult to quickly and stably perform in a large-scale and high-concurrency scene is solved through the method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a face detection method, device, equipment and storage medium for dynamically scheduling resources. Background Art

[0002] In recent years, with the breakthrough progress of artificial intelligence and computer vision technologies, face recognition technology has been deeply integrated into the social basic services and digital governance system, and has become an indispensable core technology in scenarios such as smart city security, financial payment verification, and intelligent terminal interaction. As the front-end support link of this technology, the accuracy and efficiency of face detection and attribute recognition (including feature analysis such as gender, age, and expression) directly affect the overall performance of the system.

[0003] Currently, most mainstream technical solutions are implemented based on cascade classifiers or convolutional neural network models, and their algorithm architectures have significant limitations at the design level: on the one hand, the fixed computing resource allocation strategy is difficult to dynamically adapt to the differences in image complexity in different scenarios. For example, in dense crowd monitoring, the parallel detection of multiple targets in high-resolution images is likely to cause competition for computing resources, resulting in delays in processing key frames; on the other hand, traditional systems generally adopt a tightly coupled vertical expansion mode. When facing sudden high-concurrency requests (such as large-scale event security inspections and cross-regional identity verification), due to the single-node computing power bottleneck and the inefficiency of distributed task scheduling, the system throughput decays non-linearly. In addition, related methods lack an adaptive mechanism in aspects such as multi-attribute joint optimization and cross-platform lightweight deployment, resulting in the long-term utilization rate of hardware resources being lower than the theoretical peak. Summary of the Invention

[0004] In view of the above-mentioned disadvantages of the related technologies, this application provides a face detection method, device, equipment and storage medium for dynamically scheduling resources, so as to solve the technical problem of difficult to quickly and stably perform face detection in large-scale and high-concurrency scenarios.

[0005] The present application provides a face detection method, device, equipment and storage medium for dynamically scheduling resources. The method includes: receiving a face detection service call request and verifying the access permission of the face detection service call request; if the verification passes, obtaining the resource requirement of the face detection service call request, selecting one or more resource nodes from the various resource nodes as target resource nodes according to the current computing power resources of the various resource nodes and the resource requirement, and allocating the target resource nodes to the face detection service call request. If there is one target resource node, the current computing power resource of one target resource node is greater than the resource requirement. If there are multiple target resource nodes, the sum of the current computing power resources of the multiple target resource nodes is greater than the resource requirement; issuing a face detection task according to the target resource nodes, and recycling the target resource nodes after the face detection task is completed to dynamically schedule the resource nodes.

[0006] In an embodiment of the present application, verifying the access permission of the face detection service call request includes: parsing the identity field of the face detection service call request, and obtaining the user identity based on the identity field; comparing the user identity with a preset user database. If the comparison is successful, the user identity is determined to be a legal identity; querying the service permission of the legal identity based on the preset database. If the service permission includes the face detection service, the access permission verification of the face detection service call request passes.

[0007] In an embodiment of the present application, selecting one or more resource nodes from the various resource nodes as target resource nodes according to the current computing power resources of the various resource nodes and the resource requirement includes: if there is a resource node among the various resource nodes whose current computing power resource is greater than the resource requirement, selecting a resource node whose current computing power resource is closest to the resource requirement among the resource nodes whose current computing power resource is greater than the resource requirement as the target resource node; if there is no resource node among the various resource nodes whose current computing power resource is greater than the resource requirement, selecting a resource node whose current computing power resource is closest to the resource requirement from the various resource nodes as the target resource node, and selecting one or more other target resource nodes from the other resource nodes based on the difference between the current computing power resource of the selected resource node and the resource requirement.

[0008] In an embodiment of the present application, obtaining the resource requirement of the face detection service call request and allocating a target resource node for the face detection service call request according to the current computing power resources of each resource node and the resource requirement includes: obtaining the resource requirement and request priority of the face detection service call request according to the detection time limit and detection accuracy of the face detection service call request; obtaining the resource information of each resource node, where the resource information at least includes node type, node health, node computing power, and node weight; screening candidate resource nodes from all the resource nodes based on the request priority and the resource situation, and obtaining the current computing power resources of each node based on the resource situation of the candidate resource nodes; selecting a target resource node from the candidate resource nodes according to the resource requirement, so that the sum of the current computing power resources of the target resource nodes is greater than the resource requirement.

[0009] In an embodiment of the present application, after issuing a face detection task according to the target resource node, it further includes: obtaining face image data, and matching and loading a target recognition model of the target resource node from a pre-set model library according to the current computing power resources and node type of the target resource node; migrating the face image data to the target resource node, and obtaining and outputting a recognition result based on the target recognition model.

[0010] In an embodiment of the present application, before receiving a face detection service call request, it further includes: obtaining a face training data set, where the face training data set includes face training images and face training annotations; inputting the face training data set into a preset model for training to obtain a face recognition model; converting the face recognition model into an offline inference model adapted to multiple node types and storing it in the model library.

[0011] In an embodiment of the present application, before receiving a face detection service call request, it further includes: if a resource node is added to the resource cluster, obtaining the resource information of the resource node; constructing a resource cluster view based on the resource information of each resource node to visualize the resource information of each resource node in the resource cluster; if it is detected that a resource node is offline, synchronously updating the resource information of the offline resource node to the resource cluster view.

[0012] Advantages of the present application: The embodiments of the present application provide a face detection method, device, equipment, and storage medium for dynamically scheduling resources. The method includes receiving a face detection service call request, verifying the access permission of the face detection service call request. If the verification passes, obtaining the resource demand of the face detection service call request, selecting one or more resource nodes from each resource node as target resource nodes according to the current computing power resources and resource demands of each resource node, and allocating the target resource nodes for the face detection service call request. If there is one target resource node, the current computing power resource of one target resource node is greater than the resource demand. If there are multiple target resource nodes, the sum of the current computing power resources of multiple target resource nodes is greater than the resource demand. Sending the face detection task according to the target resource node, and recycling the target resource node after the face detection task is completed to dynamically schedule the resource node. By the present application, problems such as unreasonable allocation of computing power resources and poor system scalability in traditional methods are overcome, the utilization efficiency of the system for computing power resources is improved, the accuracy and real-time performance of face detection and attribute recognition are significantly improved, and the overall performance and user experience of the system are enhanced.

[0013] It should be understood that the above general description and subsequent detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 is a schematic diagram of the system architecture of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application;

[0015] Figure 2 is a flowchart of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application;

[0016] Figure 3 is an overall flowchart of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application;

[0017] Figure 4 is a flowchart of the resource scheduling module of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application;

[0018] Figure 5 is a block diagram of a face detection device for dynamically scheduling resources shown in an exemplary embodiment of the present application;

[0019] Figure 6 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] The following describes the implementation manners of the present application through specific examples. Those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in this specification. The present application can also be implemented or applied through other different specific implementation manners. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.

[0021] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present application in a schematic manner. Therefore, only the components related to the present application are shown in the diagrams, rather than being drawn according to the number, shape, and size of the components in actual implementation. The type, quantity, and proportion of each component in actual implementation can be arbitrarily changed, and the component layout type may also be more complex.

[0022] It should be noted that in the present application, "first", "second", etc. are only used to distinguish similar objects, and are not used to limit the order or sequence of similar objects. The described "including", "having", etc. are deformed, indicating that the scope covered by the subject of the word does not exclude other examples except the examples shown by the word.

[0023] It can be understood that the various digital numbers, step numbers, etc. recorded in the present application are for the convenience of description and are not used to limit the scope of the present application. The size of the reference numbers in the present application does not mean the sequence of execution order. The execution order of each process should be determined according to its function and internal logic.

[0024] In the following description, a large number of details are explored to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.

[0025] In the present application, the computing power resource dynamic scheduling mechanism can dynamically adjust resource allocation according to the actual needs of computing tasks to adapt to task changes. It can significantly improve the resource utilization rate and system performance in the case of rich types and large quantities of computing power node resources, and is particularly suitable for application scenarios such as face detection and attribute recognition with large fluctuations in computing power resource requirements. The microservices architecture, as an architectural style that splits a large application into a group of independent small services, each service has independent business functions and data storage. This architectural style has advantages such as high cohesion, low coupling, independent deployment, flexible technology stack, elastic expansion, fault isolation, easy migration and reconstruction, etc., and can well solve problems such as unreasonable computing power resource allocation and poor system scalability in traditional architectures.

[0026] Embodiments of the present application respectively propose a face detection method for dynamically scheduling resources, a face detection device for dynamically scheduling resources, an electronic device, a computer-readable storage medium, and a computer program product. The following will describe these embodiments in detail.

[0027] Please refer to Figure 1 , Figure 1 which is a schematic diagram of the system architecture of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application.

[0028] As Figure 1 shown, Figure 1 it includes a gateway module, a resource scheduling module, a data management module, a face detection module, and a face attribute recognition module. Among them, the gateway module uniformly receives requests sent by users or other microservices, forwards them to different service instances, plays the role of load balancing, and at the same time completes the authentication process to verify the identity and permissions of users; the resource scheduling module maintains and manages the nodes in the computing power resource cluster, and schedules resource nodes to analysis tasks through service demand parsing, candidate resource screening, and computing power resource allocation; the data management module obtains image data from the data source according to the request; the face detection module takes the image data as input, calls the face detection model to perform face detection, and identifies the faces in the image. If no face exists, it returns an empty result; the face attribute recognition module takes the face area as input, calls the face attribute recognition model, identifies the attributes possessed by the face, and returns the recognition result.

[0029] Exemplarily, the working process of the service module is encapsulated as a RESTful interface through Flask and Gunicorn components and registered in Nacos to form a microservice; the system is encapsulated as an independent backend service using Docker for users or other microservices to call.

[0030] Please refer to Figure 2 , Figure 2 which is a flowchart of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application.

[0031] As Figure 2 shown, in an exemplary embodiment, the face detection method for dynamically scheduling resources at least includes steps S210 to S230, which are introduced in detail as follows:

[0032] Step S210, receive a face detection service call request and verify the access permission of the face detection service call request.

[0033] In one embodiment of the present application, verifying the access permission for a face detection service call request includes: parsing the identity field of the face detection service call request to obtain the user identity based on the identity field; comparing the user identity with a preset user database, and if the comparison is successful, determining the user identity as a legal identity; querying the service permissions of the legal identity based on a preset database, and if the service permissions include the face detection service, the access permission verification of the face detection service call request passes.

[0034] Exemplarily, the face detection service call request is sent by a user or other microservices, and is uniformly received and verified by the gateway module to obtain the user identity of the face detection service call request, and verify the access permission of the user identity.

[0035] Exemplarily, the face detection service call request being sent by a user or other microservices includes that the user logs in to the application platform, and on the face detection and attribute recognition page, provides face image data in the form of uploading a picture, and sends the face detection service call request to the gateway module in the form of HTTP / HTTPS to call the face detection service interface. Other microservices are in the same microservice cluster as the face detection service, and send the face detection service call request in the form of a remote call to call the face detection service interface.

[0036] Exemplarily, verifying the face detection service call request through the gateway module includes, after receiving the face detection service call request, parsing the Token field uniformly defined in the request header, obtaining the original string (i.e., the user identity) in a specified decryption manner, querying the user database, and comparing the user identity with the information in the user database to verify whether the user identity is legal. If the user identity is legal, then query the user role and role permissions corresponding to the user identity to verify whether the user identity has the permission to call the face detection service, and at the same time perform compliance verification on the URL, method, and request body of the face detection service call request.

[0037] Exemplarily, verifying whether the user identity is legal includes verifying whether the user identity exists in the user database and verifying whether the user identity is within the valid time period.

[0038] Exemplarily, if the verification of the face detection service call request passes, a corresponding successful response is generated and the subsequent process is entered, and if the verification fails, a corresponding error response is returned.

[0039] Exemplarily, the Token field is usually used to provide an identifier for the user in scenarios such as user login, registration, authorization, etc., so that the system can identify and verify the user's identity. The Token field can store various types of data, for example: randomly generated characters by the user, used to identify the user identity.

[0040] Step S220, if the verification is passed, obtain the resource demand of the face detection service call request, select one or more resource nodes from each resource node as target resource nodes according to the current computing power resources and resource demands of each resource node, and allocate the target resource nodes for the face detection service call request. If there is one target resource node, the current computing power resource of one target resource node is greater than the resource demand. If there are multiple target resource nodes, the sum of the current computing power resources of multiple target resource nodes is greater than the resource demand.

[0041] In an embodiment of the present application, selecting one or more resource nodes from each resource node as target resource nodes according to the current computing power resources and resource demands of each resource node includes: if there is a resource node among each resource node whose current computing power resource is greater than the resource demand, select a resource node with the current computing power resource closest to the resource demand among the resource nodes whose current computing power resource is greater than the resource demand as the target resource node; if there is no resource node among each resource node whose current computing power resource is greater than the resource demand, select a resource node with the current computing power resource closest to the resource demand from each resource node as the target resource node, and select one or more other target resource nodes from other resource nodes based on the difference between the current computing power resource of the selected resource node and the resource demand.

[0042] In an embodiment of the present application, obtaining the resource demand of the face detection service call request and allocating target resource nodes for the face detection service call request according to the current computing power resources and resource demands of each resource node includes: obtaining the resource demand and request priority of the face detection service call request according to the detection time limit and detection accuracy of the face detection service call request; obtaining the resource information of each resource node, where the resource information at least includes node type, node health, node computing power, and node weight; screening candidate resource nodes from all resource nodes based on the request priority and resource situation, and obtaining the current computing power resources of each node based on the resource situation of the candidate resource nodes; selecting target resource nodes from the candidate resource nodes according to the resource demand, so that the sum of the current computing power resources of the target resource nodes is equal to the resource demand.

[0043] Exemplarily, if there is a single candidate resource node that meets the resource demand (there is one candidate node whose current computing power resource is slightly greater than the resource demand), single-node matching is adopted, including calculating the matching degree between each candidate resource node that meets the resource demand and the resource demand based on cosine similarity or Euclidean distance, and using the candidate resource node with the highest matching degree as the target resource node.

[0044] Exemplarily, if there is no single candidate resource node that meets the resource demand (i.e., the current computing power resource of a single candidate node is slightly greater than the resource demand), then multi-node combination matching is adopted, including using greedy algorithms or dynamic programming methods to select the optimal multi-node combination from the candidate resource nodes to meet the resource demand.

[0045] Exemplarily, the resource demand and request priority are obtained based on the detection time limit and detection accuracy rate of the face detection service call request, where the detection time limit includes the detection time limit requirement for face detection, and the detection accuracy rate includes the requirement for the detection accuracy rate of face detection. The shorter the detection time limit requirement and the higher the detection accuracy rate, the more resources are required for the request, and the higher the required request priority. The resource demand depends on the detection time limit and detection accuracy rate, and is specifically designed according to business requirements.

[0046] Exemplarily, obtain the resource status of all resource nodes. The resource status includes node type, node health, node computing power, and node weight. The node type includes CPU, GPU, Huawei Ascend NPU, SOPHON TPU, etc., as well as specific models and configurations. The node health includes a unified evaluation of node load (real-time load and average load) and node performance. The node weight is a comprehensive evaluation based on factors such as node performance, stability, and priority.

[0047] Exemplarily, from all resource nodes, candidate nodes that meet the face detection service call request are screened based on the request priority and the resource status of each node. For example, if the request priority of the face detection service call request is high, then nodes with a node computing power higher than a preset first computing power threshold, a node weight higher than a preset first weight threshold, and a node health higher than a preset first health threshold are selected as candidate nodes from each node. In this embodiment, when selecting candidate resource nodes, weight ratios can also be assigned to each screening condition. For example, the node computing power accounts for 40%, the node health accounts for 30%, and the network bandwidth accounts for 30%.

[0048] Exemplarily, a target resource node is determined from candidate resource nodes in combination with the resource demand of a face detection service call request. One candidate resource node can be selected as the target resource node, or multiple candidate resource nodes can be combined as the target resource node. For example, if the resource demand of a face detection service call request is 50 and there is a candidate resource node with a current computing power resource greater than 50, then a candidate resource node with a current computing power resource greater than 50 and closest to 50 is selected from the candidate resource nodes as the target resource node. If the resource demand of a face detection service call request is 50 and there is no candidate resource node with a current computing power resource greater than 50, then a candidate resource node with a current computing power resource less than 50 and closest to 50 is selected from the candidate resource nodes as the target resource node, and target resource nodes are continuously selected from other candidate resource nodes based on the difference between the current computing power resource of the current target resource node and the resource demand, so that the sum of the current computing power resources of all finally selected target resource nodes is equal to the resource demand.

[0049] Step S230: Issue a face detection task according to the target resource node, and recycle the target resource node after the face detection task is completed, so as to perform dynamic scheduling of the resource nodes.

[0050] In an embodiment of the present application, after issuing a face detection task according to the target resource node, it further includes: obtaining face image data, and matching and loading a target recognition model of the target resource node from a pre-set model library according to the current computing power resource and node type of the target resource node; migrating the face image data to the target resource node, and obtaining and outputting a recognition result based on the target recognition model.

[0051] Exemplarily, obtain the face image data of the data acquisition module and use it as an image input. According to the target resource node and node type allocated by the resource scheduling module, select and load an AI model adapted to the target resource node; migrate the image input to the target resource node, perform model inference to obtain an original output, and through a post-processing process, convert the original output into data that meets the business requirements for use by the face attribute recognition module. In this embodiment, it is clear that the post-processing process includes converting the original output into business data, for example: deduplicating, filtering, or fusing the detection results; formatting the results (such as converting to JSON format) and storing them in a database, etc.

[0052] Exemplarily, according to the node type of the allocated target resource node, the corresponding inference toolkit is called to load the corresponding inference engine and offline inference model. In this embodiment, the loading process of the refinement model includes selecting an appropriate model version, model compression or quantization strategy (such as optimizing for resource-constrained nodes) according to the node type (such as CPU, GPU, TPU). Before the inference starts, the inference engine and the model are warmed up to reduce the latency of the first inference. The parameters of the inference engine are adjusted according to the business requirements, such as batch size, number of threads, etc., to balance the inference speed and resource utilization; the obtained face image data is preprocessed, including operations such as color gamut conversion, image scaling, normalization, channel adjustment, etc., to meet the input requirements of the model. When sufficient computing power resources are available, parallel preprocessing technology is introduced to accelerate the data preprocessing speed; the preprocessed face image data is sent into the inference engine to perform the inference calculation of the Retinaface model to obtain the original output; the position, confidence, and position information of facial key points of the face are extracted from the original output, and the faces with low confidence are filtered according to a preset threshold to reduce false alarms, and the face area is segmented according to the result for subsequent use. Exemplarily, the gender, age, ethnicity, and emotion information reflected by the face is extracted from the original output and combined with the detection results of the face detection module, and encapsulated into a unified interface response for return.

[0053] In an embodiment of the present application, before receiving the face detection service call request, it further includes: obtaining a face training data set, where the face training data set includes face training images and face training annotations; inputting the face training data set into a preset model for training to obtain a face recognition model; converting the face recognition model into an offline inference model adapted to multiple node types and storing it in the model library.

[0054] Exemplarily, training the preset model includes: preparing a training environment: constructing the software and hardware environment required for model training; constructing a preset model, constructing a preset model based on a deep learning framework and the Retinaface network and setting training parameters; constructing a face training data set based on a public data set and a private data set; inputting the face data set into the preset model for training; after the model training is completed, pruning and quantization operations are performed to reduce the model size and computational amount and improve the inference speed, and the performance of the model is evaluated on a validation set, such as accuracy, recall rate, F1 score, etc., to ensure that the model meets the business requirements. The trained model is converted into an adapted offline inference model according to the node type of each resource node by using a conversion tool.

[0055] Exemplarily, the training environment is EulerOS-2.8-aarch64, the CPU is 24 cores with 96GB of memory, the NPU chip is the Huawei Ascend 910 chip, the heterogeneous computing architecture is CANN 6.0.0, the deep learning frameworks are MindSpore 1.9.0 and Sophon SDK1.7, the main dependencies are Python 3.9.16 and OpenCV 4.9.0.80. The face dataset for training includes images and annotation files, which are organized in the WILD FACE dataset format. The quality of the dataset is improved through data cleaning, and image data augmentation is performed through means such as color gamut transformation and morphological transformation. The main hyperparameters in the training script are: the number of training epochs is 200, the batch size is 8, the initial learning rate is 0.001, the optimizer type is sgd. The conversion tool used for offline model export is determined by the node type of the resource node. If the node type is GPU, onnxruntime is used to convert it into an onnx model. If the node type is the Huawei Ascend NPU, the Ascend Tensor Compiler (ATC) is used. If the node type is the SOPHON TPU of SOPHON, the model conversion script of the SOPHON SDK is used.

[0056] In one embodiment of the present application, before receiving a face detection service call request, it further includes: if a resource node is added to the resource cluster, obtaining the resource information of the resource node; constructing a resource cluster view based on the resource information of each resource node to visualize the resource information of each resource node in the resource cluster; if it is detected that a resource node is offline, synchronously updating the resource information of the offline resource node to the resource cluster view.

[0057] In one embodiment of the present application, the face detection method for dynamically scheduling resources further includes: regularly detecting the health status of each resource node, where the health status at least includes hardware status data, version compatibility data, and network connectivity data, obtaining the node health degree of each resource node based on the health status of each resource node, and updating the resource information of each resource node according to the regularly obtained node health degree.

[0058] Please refer to Figure 3 , Figure 3 which is the overall flowchart of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application, as Figure 3As shown, when a user or other microservices send a face detection service call request, the gateway module uniformly receives the face detection service call request and performs authentication. After successful authentication, the business requirements are forwarded to the resource scheduling module. The resource scheduling module dynamically allocates resources according to the current computing power resources, issues computing power resources and analysis tasks. The data management module obtains image data from the data source according to the request and transmits it to the face detection module. After obtaining the image data, the face detection module completes the loading of the face detection model, calls the face detection model to perform face detection, identifies the faces in the image, and transmits the face region data to the face attribute recognition module. If no face exists, an empty result is returned. After obtaining the face region data, the face attribute recognition module completes the loading of the face attribute recognition model, calls the face attribute recognition model to perform face attribute recognition, identifies the attributes of the face, and returns the recognition result.

[0059] Exemplarily, the sources of the face detection service call requests include the recognition requests initiated by the user after uploading pictures on the front-end page and the recognition requests initiated by other microservices in the form of remote calls during the business process; the data sources for the data acquisition module to obtain image data include files from Minio, local files, network picture links, and pictures uploaded by users. If it is a file from Minio, the image is obtained through the SDK provided by Minio. If it is a local file, the image is opened through the file system library. If it is a network link, the image is downloaded through an asynchronous HTTP / HTTPS request. If it is a picture uploaded by the user, the interface of other business systems is called to obtain the image. After obtaining the image in binary format, the format is converted to the common Mat format using the OpenCV library for subsequent business modules to use.

[0060] Please refer to Figure 4 , Figure 4 is the resource scheduling module flowchart of a face detection method for dynamically scheduling resources shown in an exemplary embodiment of the present application. As Figure 4As shown, when a resource node goes online and joins the cluster, it will actively report detailed node information to the computing power resource cluster manager, including network address, node resource type (such as CPU, GPU, Huawei Ascend NPU, SOPHON TPU, etc., as well as specific models and configurations), the current computing power of the node, the node load status (real-time load, average load, peak load, etc.), node weight (comprehensive evaluation based on factors such as performance, stability, and priority), and node heartbeat. After the cluster collects the above information, it aggregates the data and constructs a complete and accurate view of the computing power resource cluster. Subsequently, the cluster optimizes the cluster topology and network configuration, and issues optimization instructions to the resource nodes to reduce communication latency between nodes and improve data transmission efficiency. At the same time, the cluster regularly issues inspection instructions to the resource nodes. After the nodes complete their own health checks, they report the health check results to the cluster. The cluster updates its own situation based on the health check results and synchronizes the changes in computing power resources to the resource scheduling module. When the resource scheduling module sends a computing power resource request to the cluster, the cluster calculates and allocates the most suitable resource node and its corresponding load, and issues the analysis task to the selected resource node. After the analysis task is completed, the resource node reports the task execution status to the cluster, and the cluster reclaims the computing power resources. When a resource node exits the cluster due to its own failure, being under system scheduling control, or the idle time exceeding the threshold, the cluster initiates the logout process, stops all activities of the node within the cluster, and ensures that all ongoing tasks are properly handled. After the node stops all activities, the cluster reclaims the computing power resources released by the node and re-evaluates the computing power metrics of the cluster.

[0061] In an embodiment of the present invention, the computing power resources provided by the resource node include memory, CPU, GPU, Huawei Ascend NPU, and SOPHON TPU. The types of computing power resources include public cloud computing power resources, private cloud computing power resources, central inference servers, personal mobile terminals, and edge inference devices. Synchronizing the computing power status to the resource management module is implemented using a message queue, including Kafka and RabbitMQ.

[0062] Please refer to Figure 5 , Figure 5 is a block diagram of a face detection device for dynamically scheduling resources shown in an exemplary embodiment of the present application.

[0063] As Figure 5 shown, the exemplary face detection device for dynamically scheduling resources includes:

[0064] A permission verification module 501, configured to receive a face detection service call request and verify the access permission of the face detection service call request;

[0065] A node allocation module 502 is configured to, if the verification passes, obtain the resource requirement of the face detection service call request, select one or more resource nodes as target resource nodes from each resource node according to the current computing power resources and resource requirements of each resource node, and allocate the target resource nodes for the face detection service call request. If there is one target resource node, the current computing power resource of the one target resource node is greater than the resource requirement. If there are multiple target resource nodes, the sum of the current computing power resources of the multiple target resource nodes is greater than the resource requirement.

[0066] A face detection module 503 is configured to issue a face detection task according to the target resource node, and recycle the target resource node after the face detection task is completed, so as to perform dynamic scheduling on the resource nodes.

[0067] Figure 6 The figure shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. It should be noted that Figure 6 The shown computer system 600 of the electronic device is only an example, and should not impose any limitation on the functions and usage scope of the embodiments of the present application.

[0068] As Figure 6 shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage section 608 into the random access memory (RAM) 603, such as executing the method described in the above embodiments. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.

[0069] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as required. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 610 as required so that a computer program read therefrom is installed into the storage section 608 as required.

[0070] Specifically, according to an embodiment of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, various functions defined in the system of the present application are executed.

[0071] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may, for example, be a system, device, or apparatus of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, device, or apparatus. The computer program contained on the computer-readable medium may be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0072] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0073] The units involved in the embodiments of this application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not constitute a limitation to the units themselves in some cases.

[0074] Another aspect of this application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer is made to execute the face detection method for dynamically scheduling resources as described above. The computer-readable storage medium can be included in the electronic device described in the above embodiments, or can exist alone without being assembled into the electronic device.

[0075] Another aspect of this application also provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the face detection method for dynamically scheduling resources provided in the above various embodiments.

[0076] The above embodiments only exemplarily illustrate the principles and effects of this application, rather than limiting this application. Any person familiar with this technology can modify or change the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or changes completed by those with ordinary knowledge in the technical field without departing from the spirit and technical ideas disclosed in this application should still be covered by the claims of this application.

Claims

1. A face detection method for dynamically scheduling resources, characterized in that: The face detection method of dynamically scheduling resources includes: Receiving a face detection service call request, and verifying access rights of the face detection service call request; If the verification passes, the resource requirement of the face detection service call request is obtained, one or more resource nodes are selected from the resource nodes as target resource nodes according to the current computing power resources of each resource node and the resource requirement, and the target resource node is allocated to the face detection service call request. If there is one target resource node, the current computing power resources of one target resource node are greater than the resource requirement; if there are multiple target resource nodes, the sum of the current computing power resources of the multiple target resource nodes is greater than the resource requirement; A face detection task is issued according to the target resource node, and the target resource node is recovered after the face detection task is completed, so as to dynamically schedule the resource nodes.

2. The face detection method for dynamically scheduling resources according to claim 1, characterized in that: Verifying the access rights of the face detection service call request includes: Parsing the identity field of the face detection service call request, and obtaining the user identity based on the identity field; The user identity is compared with a preset user database, and if the comparison is successful, the user identity is determined to be a legitimate identity; The service authority of the legal identity is queried based on the preset database. If the service authority includes face detection service, the access authority verification of the face detection service call request is passed.

3. The face detection method for dynamically scheduling resources according to claim 1, characterized in that: Selecting one or more resource nodes as target resource nodes from the resource nodes according to the current computing power resources of the resource nodes and the resource demand includes: If there is a resource node whose current computing power resource is greater than the resource demand among the resource nodes, then select a resource node whose current computing power resource is closest to the resource demand from the resource nodes whose current computing power resources are greater than the resource demand as the target resource node; If there is no resource node among the resource nodes whose current computing power resources are greater than the resource demand, a resource node whose current computing power resources are closest to the resource demand is selected from the resource nodes as the target resource node, and another one or more target resource nodes are selected from other resource nodes based on the difference between the current computing power resources of the selected resource node and the resource demand.

4. The face detection method for dynamically scheduling resources according to claim 1, characterized in that: If the verification is passed, it also includes: Obtaining a resource requirement and a request priority of the face detection service call request according to a detection time limit and a detection accuracy rate of the face detection service call request; Obtain resource information of each resource node, wherein the resource information includes at least node type, node health, node computing power and node weight; Filtering candidate resource nodes from all resource nodes based on the request priority and the resource situation, and obtaining current computing power resources of each node based on the resource situation of the candidate resource nodes; A target resource node is selected from the candidate resource nodes according to the resource demand, so that the sum of the current computing power resources of the target resource nodes is greater than the resource demand.

5. The face detection method according to any one of claims 1 to 3, characterized in that: After the face detection task is issued according to the target resource node, the method further includes: Acquire facial image data, and match and load the target recognition model of the target resource node from a preset model library according to the current computing power resources and node type of the target resource node; The facial image data is migrated to the target resource node, and a recognition result is obtained based on the target recognition model and outputted.

6. The face detection method for dynamically scheduling resources according to claim 4, characterized in that: Before receiving the face detection service call request, the following steps are also included: Acquire a face training data set, wherein the face training data set includes face training images and face training annotations; Inputting the face training data set into a preset model for training to obtain a face recognition model; The face recognition model is converted into an offline reasoning model suitable for multiple node types and stored in the model library.

7. The face detection method for dynamically scheduling resources according to any one of claims 1 to 3, characterized in that: Before receiving the face detection service call request, it also includes: If a resource node is added to the resource cluster, resource information of the resource node is obtained; Building a resource cluster view based on the resource information of each resource node to visualize the resource information of each resource node in the resource cluster; If it is detected that a resource node is offline, the resource information of the offline resource node is synchronously updated to the resource cluster view.

8. A face detection device for dynamically scheduling resources, characterized in that: The face detection device for dynamically scheduling resources comprises: The permission verification module is used to receive a face detection service call request and verify the access rights of the face detection service call request; A node allocation module, used to obtain the resource requirement of the face detection service call request if the verification is passed, select one or more resource nodes from each resource node as the target resource node according to the current computing power resources of each resource node and the resource requirement, and allocate the target resource node to the face detection service call request, if the target resource node is one, the current computing power resources of one target resource node are greater than the resource requirement, if the target resource node is multiple, the sum of the current computing power resources of the multiple target resource nodes is greater than the resource requirement; The face detection module is used to issue a face detection task according to the target resource node and recycle the target resource node after the face detection task is completed, so as to dynamically schedule the resource node.

9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the face detection method for dynamically scheduling resources as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the face detection method for dynamically scheduling resources as described in any one of claims 1-7.