Modularized face attribute structure analysis method and device, equipment and medium

By setting up multiple single-task modules and feature extraction modules in the face attribute analysis model, and combining the task modules in a modular way, the problems of low face attribute analysis accuracy and high computing resource consumption in the existing technology are solved, and efficient and customized face attribute analysis is achieved.

CN119580318AActive Publication Date: 2025-03-07GUANGZHOU PIXEL SOLUTIONS CO LTD
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202411512156.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-03-07
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

When existing facial attribute analysis methods use multi-attribute classification models for detection, it is easy to lead to low recognition detection accuracy and high computing resources, making it difficult to take into account both accuracy and efficiency.

Method used

By setting up multiple single-task modules and feature extraction modules in the attribute analysis model, combining different task modules in a modular way, selecting target task modules based on the detection task for attribute analysis, and achieving efficient face attribute analysis.

Benefits of technology

This method effectively reduces the consumption of computing resources, improves model recognition efficiency, solves the problems of low detection accuracy and high computing resources in the prior art, and realizes efficient and customized facial attribute analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119580318A_ABST
    Figure CN119580318A_ABST
Patent Text Reader

Abstract

The invention relates to a modularized face attribute structure analysis method and device, equipment and a medium, and relates to the technical field of image recognition processing, and the method comprises the steps: carrying out the face detection alignment of a to-be-analyzed face image according to a preset detection task, and obtaining an aligned face image, selecting a target task module from the attribute structure analysis model according to the detection task, performing attribute analysis extraction on the aligned face image through the target task module to obtain a single attribute analysis result set, and extracting features from the aligned face image through feature extraction modules in the trunk model to obtain a single attribute analysis result set; according to the face attribute detection method and the face attribute detection system, different task modules are combined, diversified face attribute detection tasks can be flexibly completed, the detection efficiency is improved, and the detection efficiency is improved. Therefore, efficient face attribute analysis is realized, and the model recognition precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition and processing technology, and in particular to a modular facial attribute structure analysis method, device, equipment and medium. Background Art

[0002] Facial attribute detection is a complex computer vision task with wide applications in multiple fields such as security monitoring. It usually requires algorithms to accurately identify and classify multiple attributes in facial images. The complexity lies in the fact that facial attribute detection not only requires the model to accurately identify multiple characteristics of an individual, but also needs to maintain stable performance under different environments and conditions.

[0003] Existing facial attribute analysis solutions primarily focus on building multi-attribute classification models to simultaneously predict all attributes. However, facial attributes vary, and facial attribute detection involves multiple classification tasks. These tasks typically require models with high complexity and a large number of parameters to capture the subtle differences in facial features. Multi-attribute classification models must simultaneously learn multiple complex tasks within a limited parameter space, which can easily lead to overfitting or under-learning, resulting in low model recognition accuracy. Summary of the Invention

[0004] The present application provides a modular facial attribute structure analysis method, device, equipment and medium. By combining different task modules, it is possible to flexibly complete a variety of facial attribute detection tasks, select and combine the required detection items in a modular manner, and then select the task modules required to process the detection items, thereby achieving efficient facial attribute analysis, reducing computing resource consumption, and solving the problem of low recognition and detection accuracy that exists in existing facial attribute analysis methods when using multi-attribute classification models for detection.

[0005] In a first aspect, the present application provides a modular facial attribute structure analysis method, comprising:

[0006] Obtaining the face image to be analyzed;

[0007] Performing face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image;

[0008] According to the detection task, selecting at least one corresponding target task module from a preset attribute structure analysis model, and inputting the aligned face image into the target task module and the backbone model in the attribute structure analysis model;

[0009] Performing attribute analysis and extraction on the aligned face images through each target task module to obtain a single attribute analysis result set corresponding to the detection task, and performing feature extraction on the aligned face images through each feature extraction module in the backbone model to obtain a face feature set;

[0010] Gradient propagation is performed based on the single attribute analysis result set and the facial feature set to obtain a facial attribute analysis result corresponding to the facial image to be analyzed.

[0011] Optionally, performing face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image includes:

[0012] Obtaining a preset detection task and preset background feature key points corresponding to the detection task;

[0013] Performing face detection on the image to be analyzed, and selecting key alignment positions from the face detection results according to the detection task;

[0014] Aligning the image to be analyzed by combining the background feature key points with the key alignment positions to obtain an aligned face image;

[0015] The background feature key points are key points of objects surrounding the face, and the aligned face image includes face features and face background features.

[0016] Optionally, performing attribute analysis and extraction on the aligned face images by each target task module to obtain a single attribute analysis result set corresponding to the detection task, and performing feature extraction on the aligned face images by each feature extraction module in the backbone model to obtain a facial feature set, include:

[0017] Determining a first arrangement structure of modules in the attribute structure analysis model, wherein the first arrangement structure is an arrangement order between the target task modules, and the target task modules correspond one to one to the feature extraction modules;

[0018] According to the first arrangement structure, the target task module is used in turn to perform attribute analysis and extraction on the aligned face images to obtain a single attribute analysis result set, and the feature extraction module is used in turn to perform feature recognition and extraction on the aligned face images to obtain a face feature set.

[0019] Optionally, performing gradient propagation based on the single attribute analysis result set and the facial feature set to obtain a facial attribute analysis result corresponding to the facial image to be analyzed includes:

[0020] According to the arrangement structure, forward propagation is performed using the single attribute analysis results in the single attribute analysis result set and the facial features in the facial feature set to obtain the facial attribute analysis result.

[0021] Optionally, before selecting at least one corresponding target task module from the preset attribute structure analysis model, the method further includes:

[0022] Acquire a facial attribute dataset and construct an initial analysis model, wherein the initial analysis model includes a single-task model and a backbone model, wherein the single-task model includes task modules corresponding one-to-one to each feature extraction module in the backbone model, and the feature extraction modules and the task modules call each other;

[0023] Performing face detection and face alignment based on sample face images in the face attribute dataset according to preset background feature key points to obtain aligned face image samples;

[0024] Selecting a task module corresponding to a preset attribute detection item from the single-task model as a task module to be trained, and inputting the aligned face image sample into the task module to be trained and the backbone model;

[0025] Performing attribute analysis training on the task module to be trained using the aligned face image samples to obtain a single prediction result output by the task module to be trained, and obtaining a feature prediction result output by the backbone model for the aligned face image samples;

[0026] Perform gradient propagation based on the single prediction result and the feature prediction result to obtain a model prediction result;

[0027] Loss calculation is performed using the real label corresponding to the sample face image and the model prediction result, and the parameters of the task module to be trained are optimized according to the loss calculation result until the single-task model training is completed to obtain a trained attribute structure analysis model.

[0028] Optionally, before inputting the aligned face image samples into the task module to be trained and the backbone model, the method further includes:

[0029] Get face recognition dataset;

[0030] Using the face recognition dataset to perform feature extraction training on each feature extraction module in the backbone model, and using a preset loss function to perform parameter optimization on the feature extraction results output by the feature extraction module until the loss converges, thereby obtaining a trained backbone model;

[0031] Among them, the parameters of the backbone model are fixed after the pre-training is completed, and the backbone model does not participate in the attribute analysis training of the task module to be trained.

[0032] Optionally, the task module to be trained includes a first matrix and a second matrix, and performing attribute analysis training on the task module to be trained using the aligned face image samples includes:

[0033] Performing matrix multiplication using the first matrix and the second matrix to obtain a model update bias;

[0034] Attribute analysis training is performed based on the model update deviation, the aligned face image samples and the model initial parameters to obtain a single prediction result output by the task module to be trained.

[0035] Optionally, performing attribute analysis training based on the model update deviation, the aligned face image sample, and the model initial parameters includes:

[0036] according to Determine the individual prediction results;

[0037] Among them, Predict is the model prediction value, f is the model function, X is the input aligned face image sample, W is the model parameter, W0 is the original untrained model parameter, It is the parameter change of model training fitting and is represented by the multiplication of two low-rank matrices A and B. W0X is the parameter of the forward propagation of the feature extraction module of the backbone model, and ABX is the parameter of the forward propagation of the task module to be trained.

[0038] Optionally, performing gradient propagation according to the single prediction result and the feature prediction result to obtain a model prediction result includes:

[0039] according to Perform gradient propagation;

[0040] Among them, the backbone model includes an input feature extraction module and at least four residual feature extraction modules, the single-task model includes at least five task modules to be trained corresponding to the feature extraction modules of the backbone model, FA0(X), FA0(P0), FA0(P1), FA0(P2) and FA0(P3) are all forward propagations of the feature extraction modules of the backbone model, FB0(X), FB0(P0), FB0(P1), FB0(P2) and FB0(P3) are all forward propagations of the task modules to be trained of the single-task model, and Predict is the model prediction result.

[0041] In a second aspect, the present application provides a modular facial attribute structure analysis device, comprising:

[0042] An image acquisition module is used to acquire the face image to be analyzed;

[0043] A face detection and alignment module is used to perform face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image;

[0044] An input module, configured to select at least one corresponding target task module from a preset attribute structure analysis model according to the detection task, and input the aligned face image into the target task module and the backbone model in the attribute structure analysis model;

[0045] a feature extraction module configured to perform attribute analysis and extraction on the aligned face images through each of the target task modules to obtain a single attribute analysis result set corresponding to the detection task, and to perform feature extraction on the aligned face images through each of the feature extraction modules in the backbone model to obtain a facial feature set;

[0046] The gradient propagation module is used to perform gradient propagation based on the single attribute analysis result set and the facial feature set to obtain the facial attribute analysis result corresponding to the facial image to be analyzed.

[0047] In a third aspect, the present application provides an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0048] Memory for storing computer programs;

[0049] The processor is configured to implement the steps of the modular facial attribute structure analysis method as described in any one of the embodiments of the first aspect when executing the program stored in the memory.

[0050] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the modular facial attribute structure analysis method as described in any embodiment of the first aspect.

[0051] In summary, the embodiment of the present application obtains a face image to be analyzed, performs face detection and alignment on the face image to be analyzed according to a preset detection task, and obtains an aligned face image. Then, according to the detection task, at least one corresponding target task module is selected from a preset attribute structure analysis model, and the aligned face image is input into the target task module and the backbone model in the attribute structure analysis model. Subsequently, attribute analysis and extraction are performed on the aligned face image through each target task module to obtain a single attribute analysis result set corresponding to the detection task, and feature extraction is performed on the aligned face image through each feature extraction module in the backbone model to obtain a face feature set. Gradient propagation is performed based on the single attribute analysis result set and the face feature set to obtain a face attribute analysis result corresponding to the face image to be analyzed. It can be seen that the embodiment of the present application sets up multiple task modules and feature extraction modules corresponding to detection tasks in the attribute analysis model. By combining with different task modules, it can flexibly complete various face attribute detection tasks, and can select and combine the required detection items in a modular manner according to different business needs, thereby realizing efficient and customized face attribute analysis, improving model recognition accuracy, and solving the problem of low recognition and detection accuracy when the existing face attribute analysis method uses a multi-attribute classification model for detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0054] Figure 1 A schematic flow chart of a modular facial attribute structure analysis method provided in an embodiment of the present application;

[0055] Figure 2 This is a schematic diagram of face alignment image comparison provided by an optional example of this application;

[0056] Figure 3 This is a facial attribute structure analysis flow chart provided as an optional example of this application;

[0057] Figure 4 This is a flowchart of the steps of model training for a modular facial attribute structure analysis method provided by an optional embodiment of the present application.

[0058] Figure 5This is a structural composition diagram of a multi-modular attribute structure analysis model provided by an optional embodiment of the present application;

[0059] Figure 6 A structural block diagram of a modular facial attribute structure analysis device provided in an embodiment of the present application;

[0060] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0061] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0062] To facilitate understanding of the embodiments of the present application, further explanation will be given below in conjunction with the drawings and specific embodiments. The embodiments do not constitute a limitation on the embodiments of the present application.

[0063] Figure 1 This is a flow chart of a modular facial attribute structure analysis method provided in an embodiment of the present application. Figure 1 As shown, the modular facial attribute structure analysis method provided in the embodiment of the present application may specifically include the following steps:

[0064] Step 110: Obtain a facial image to be analyzed.

[0065] Step 120 : performing face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image.

[0066] A unified description of steps 110 to 120 is provided:

[0067] Specifically, the face image to be analyzed refers to an image containing a face. Preferably, the face image to be analyzed may contain a complete face and part of the background, so as to retain more facial details and the characteristic details of objects around the face contained in the background, thereby improving the accuracy of face alignment. The detection task refers to the detection item. In the face attribute analysis, the detection items may include but are not limited to: gender, age, wearing a mask, wearing a hat or headscarf, wearing glasses or sunglasses, whether to wear makeup, and expression detection. The detection items that need to be analyzed and detected can be freely selected according to actual needs to form the detection task for the face image to be analyzed, so that the items that need to be detected can be freely selected according to different business needs to realize customized face attribute analysis. This embodiment does not limit the specific combination selection of detection items and the specific number of detection items.

[0068] In related technologies, the existing facial attribute analysis process can be roughly understood as: face detection-attribute classification / analysis, that is, directly inputting the facial image into the model for attribute classification. This attribute classification method is usually affected by the deflection and tilt of the face due to shooting reasons, resulting in low attribute classification accuracy.

[0069] In this embodiment, the facial attribute analysis process may include but is not limited to: face detection - key point detection - face alignment - attribute classification / analysis, that is, before performing facial attribute classification, this embodiment first performs face alignment on the face image to be analyzed according to the detection items, so that the face image can be aligned to the template, thereby preventing the model from being affected by posture during training or application.

[0070] In an optional embodiment, the embodiment of the present application performs face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image, which may specifically include: obtaining a preset detection task and preset background feature key points corresponding to the detection task; performing face detection on the image to be analyzed, and selecting a key alignment position from the face detection result according to the detection task; aligning the image to be analyzed through the background feature key points in combination with the key alignment position to obtain an aligned face image; wherein the background feature key points are key points containing objects around the face, and the aligned face image contains facial features and facial background features.

[0071] In specific implementation, existing face alignment solutions usually use facial key points or standard template faces to form five key points E0 commonly used in the industry, such as key point E0 = [[38.2946,51.6963],

[0072] [73.5318,51.5014],[56.0252,71.7366],[41.5493,92.3655],[70.7299,92.2041]]. However, in reality, facial images not only contain faces but also background information. The key point template commonly used in the industry is mainly adapted for feature extraction for face recognition and comparison, focusing more on facial features and failing to consider the diversity of facial images and image backgrounds, resulting in the cropping of key features.

[0073] In order to solve the problems existing in the existing face alignment solutions, this embodiment fully considers the background features contained in the face image, and pre-constructs key points for the detection items, fully considers the detection item data such as hats, headscarves, and expressions, adjusts the key points, and forms a background feature key point set corresponding to the detection item. For example, the background feature key point set can be E = [[43.2946, 56.6963], [68.5318, 56.5014], [56.0252, 71.7366], [46.5493, 87.3655], [65.7299, 87.2041]], refer to Figure 2 , Figure 2 Image a in the middle is the face image obtained after alignment using existing key points. Figure 2 Image b in the middle is the face image obtained after alignment using the key points of this solution. Since the background factors are fully considered, the face alignment is more accurate, which can effectively improve the accuracy of attribute analysis detection in subsequent attribute analysis detection.

[0074] Reference Figure 3 As shown in the facial attribute analysis flow chart, this embodiment first selects the key points for face alignment according to the detection task, that is, the background feature key points, and selects the alignment position corresponding to the detection task in the face detection result according to the detection task to obtain the key alignment position. Then, the background feature key points are used in combination with the facial key points (including 5 key points, namely the eyes, the tip of the nose, and the left and right corners of the mouth) to perform affine transformation on the image to be analyzed to obtain an aligned face image.

[0075] Step 130 : According to the detection task, select at least one corresponding target task module from a preset attribute structure analysis model, and input the aligned face image into the target task module and the backbone model in the attribute structure analysis model.

[0076] In this embodiment, the attribute structure analysis model may include a task model and a backbone model, wherein the task model may include at least one task module. In this embodiment, each task module can be understood as a single-task module, which mainly implements a single detection task in facial attribute analysis. The backbone model may include a feature extraction module corresponding one-to-one to the task module, which is used to implement facial feature extraction. This embodiment does not impose any restrictions on this. Preferably, the task model in this embodiment may be a LoRA (Low-Order Adaptation of Large Language Models) single-task model; the backbone model may be a Resnet model built using the Restnet framework. Preferably, this embodiment uses the Resnet50 model as the backbone model for feature extraction.

[0077] In a specific implementation, this embodiment can input the aligned face image into the attribute structure analysis model. The attribute structure analysis model selects the task module corresponding to the detection item from each task model according to the detection item as the target task module, and selects the corresponding feature extraction module for the target task module for feature extraction.

[0078] In related technologies, facial attribute detection is complex because it requires models to not only accurately identify multiple individual features but also maintain stable performance across diverse environments and conditions. Facial attribute detection involves multiple classification tasks, including but not limited to age estimation, gender recognition, eye state (open or closed), lip state (open or closed), ear visibility, the presence of glasses or sunglasses, the presence of hats or headscarves, and the presence of makeup. These tasks typically require models with high complexity and a large number of parameters to capture the nuances of a face. However, this complexity often comes with increased computational resource consumption, which is particularly problematic on resource-constrained devices. Existing facial attribute analysis methods not only build multi-attribute classification models to simultaneously predict all attributes, but also employ multiple single-attribute classification models for detection. However, facial attributes are complex and diverse, and building a corresponding model for each attribute classification for recognition and classification typically requires multiple models with high complexity and a large number of parameters, significantly increasing computational costs, both during model training and inference. Consequently, existing facial attribute analysis methods fail to balance accuracy and computational complexity, resulting in low computational efficiency for recognition and detection.

[0079] To address this technical issue, this embodiment incorporates multiple single-task modules and corresponding feature extraction modules into the attribute analysis model, utilizing a modular approach to construct the model. By combining different task modules and selecting a target task module for attribute analysis based on the detection task, facial attribute detection tasks are more diverse and can be completed flexibly. Each task module only needs to complete a single task, effectively reducing computing resource consumption and improving model recognition efficiency.

[0080] Step 140: Perform attribute analysis and extraction on the aligned face image through each target task module to obtain a single attribute analysis result set corresponding to the detection task, and perform feature extraction on the aligned face image through each feature extraction module in the backbone model to obtain a face feature set.

[0081] In the specific implementation, each target task module can perform attribute analysis and extraction based on the input aligned face image to obtain a single attribute analysis result, and aggregate the single attribute analysis results to obtain a single attribute analysis result set. The single attribute analysis result is the prediction result obtained by the target task module based on the input data through single attribute analysis.

[0082] Similar to attribute analysis and extraction, since feature extraction modules correspond one-to-one with target task modules, this embodiment also selects at least one feature extraction module. This embodiment utilizes the feature extraction module corresponding to the target task module to analyze and extract facial features from the aligned facial images to obtain facial features. Each feature extraction module extracts features based on the input data, thereby obtaining a facial feature set. Depending on the correspondence between feature extraction modules and target task modules, facial features can also correspond one-to-one with the results of individual attribute analysis.

[0083] Therefore, each target task module selected in this embodiment only needs to process the corresponding single detection task, and the unselected task module does not need to perform a single detection task, or only needs to perform data propagation during subsequent gradient propagation. This achieves a reasonable allocation of computing resources, effectively reduces resource consumption, and can select and combine the required detection items in a modular manner, flexibly completing a variety of face attribute detection tasks.

[0084] In an optional embodiment, the embodiment of the present application performs attribute analysis and extraction on the aligned facial images through each of the target task modules to obtain a single attribute analysis result set corresponding to the detection task, and performs feature extraction on the aligned facial images through each feature extraction module in the backbone model to obtain a facial feature set. Specifically, it may include: determining a first arrangement structure of each module in the attribute structure analysis model, the first arrangement structure being the arrangement order between each of the target task modules, and each of the target task modules corresponds one-to-one to each of the feature extraction modules; according to the first arrangement structure, performing attribute analysis and extraction on the aligned facial images through the target task modules in turn to obtain a single attribute analysis result set, and, performing feature recognition and extraction on the aligned facial images using the feature extraction modules in turn to obtain a facial feature set.

[0085] In a specific implementation, there is a certain structural arrangement between feature extraction modules and task modules. Based on this arrangement, the aligned facial image can be input into the feature module and the target task module for processing. In this case, data input processing can be performed in at least two ways, including but not limited to: sequential input processing and parallel input processing.

[0086] Specifically, for the sequential execution processing method, this embodiment can first input the aligned face image into the target task module and the corresponding feature extraction module in the first place in the sorting structure according to the sorting structure. At this time, the first target task module and the corresponding feature extraction module can process the aligned face image respectively to obtain the corresponding prediction results. Subsequently, the prediction results of the attribute analysis, the prediction results of the feature extraction and the aligned face image output by the two modules are input to the target task module and the feature extraction module in the second place in the sorting structure for processing. Similarly, after each character module and feature extraction module completes the current detection task according to the sorting structure, the prediction results and image data are input to the next module for processing until the detection task is completed and the gradient propagation data is realized, that is, step 150 is executed. Each time the target task module and the feature extraction module complete the corresponding detection task, the module that performs the detection task next time can obtain the facial features output by the previous module, thereby aggregating and obtaining a single attribute analysis result set and a facial feature set.

[0087] For the parallel execution processing method, the embodiment of the present application can directly input the aligned facial images into each target task module and the corresponding feature extraction module in sequence according to the sorting order. Through the parallel execution method, each target task module and the corresponding feature extraction module directly perform feature extraction processing on the aligned facial images to obtain a single attribute analysis result set and a facial feature set. Subsequently, each module will perform gradient propagation on the extracted facial features, that is, execute step 150.

[0088] Step 150 , performing gradient propagation based on the single attribute analysis result set and the facial feature set to obtain a facial attribute analysis result corresponding to the facial image to be analyzed.

[0089] In a specific implementation, gradient propagation can be understood as forward propagation. In this embodiment, the single attribute analysis results extracted by each target task module and the facial features extracted by the feature extraction module corresponding to the target task module are forward propagated in a forward propagation manner. Finally, the target task module that executes the detection task completes the attribute analysis, and the final prediction result of the facial attribute analysis can be obtained. After the feature extraction module that executes the detection task completes the feature extraction, the final prediction result of the feature extraction can be obtained. The two final prediction results are combined for splicing / merging and other processing to obtain the facial attribute analysis result corresponding to the facial image to be analyzed.

[0090] In an optional embodiment, the embodiment of the present application performs gradient propagation based on the single attribute analysis result set and the facial feature set to obtain the facial attribute analysis result corresponding to the facial image to be analyzed, which may specifically include: according to the arrangement structure, using the single attribute analysis results in the single attribute analysis result set and the facial features in the facial feature set to perform forward propagation to obtain the facial attribute analysis result.

[0091] It can be seen that the embodiment of the present application obtains a face image to be analyzed, performs face detection alignment on the face image to be analyzed according to a preset detection task, obtains an aligned face image, and then selects at least one corresponding target task module from a preset attribute structure analysis model according to the detection task, and inputs the aligned face image into the target task module and the backbone model in the attribute structure analysis model, and then performs attribute analysis and extraction on the aligned face image through each target task module to obtain a single attribute analysis result set corresponding to the detection task, and performs feature extraction on the aligned face image through each feature extraction module in the backbone model to obtain a face feature set, and performs gradient propagation based on the single attribute analysis result set and the face feature set to obtain a face attribute analysis result corresponding to the face image to be analyzed. Therefore, the face attribute structure analysis method provided in this embodiment uses a single task module to perform a single detection task, combined with the gradient propagation method to obtain a face attribute analysis result, and innovatively integrates the LoRA fine-tuning technology and the fine-grained classification model. Since each task module runs independently, it only needs to perform a single detection task and does not need to learn multiple complex tasks simultaneously within a limited parameter space. It can be widely used in multiple fields such as security monitoring, personalized recommendation, human-computer interaction, etc., to achieve the goal of balancing detection accuracy and computational efficiency, thereby solving the problems of existing facial attribute analysis methods such as large computing resource consumption, insufficient detection accuracy and low detection efficiency.

[0092] Reference Figure 4, shows a schematic flow chart of the steps of model training for a modular facial attribute structure analysis method provided by an optional embodiment of the present application. In a specific implementation, the modular facial attribute structure analysis method provided by the embodiment of the present application may include the following steps in the model training stage:

[0093] Step 410: Acquire a facial attribute dataset and construct an initial analysis model.

[0094] The initial analysis model includes a single-task model and a backbone model. The single-task model includes task modules corresponding to each feature extraction module in the backbone model. The feature extraction module and the task module call each other.

[0095] In this embodiment, the facial attribute dataset may include, but is not limited to, facial images and the annotation data corresponding to the facial images (also known as true labels). In this embodiment, the feature extraction modules and the task modules can be independent model modules. The task modules can correspond one-to-one with the feature modules and can call each other.

[0096] For example, the single-task model can use the LoRA model, and the backbone model can use the Resnet50 model as the feature extraction model backbone. Figure 5 As shown in the figure, according to the detection task, the corresponding task module LoRAlayer, also known as the task layer, can be constructed in the LoRA model. The task module corresponds to the feature extraction module. Figure 5 The Resnet model can be mainly composed of the residual stage, that is, the feature extraction module can also be mainly composed of the residual feature extraction module and the input module. In order to facilitate modular calls with LoRA, the Inputstem, stage 1, stage2...stageN models of each module of the Resnet model are split and packaged into independent model modules. The training process is still arranged according to the structure.

[0097] Step 420 , performing face detection and face alignment based on the sample face images in the face attribute dataset according to the preset background feature key points, to obtain aligned face image samples.

[0098] For the description of face detection, face alignment and background feature key points, please refer to the above step 120, which will not be described in detail in this embodiment.

[0099] Step 430 : Select a task module corresponding to a preset attribute detection item from the single-task model as a task module to be trained, and input the aligned face image sample into the task module to be trained and the backbone model.

[0100] In this embodiment, the training direction corresponding to each task module can be determined in advance, that is, it is determined which attribute analysis detection task the task module is used to identify and detect, and then the aligned face image samples and the task modules in the single-task model are divided according to the detection task, the task module to be trained is selected, and the aligned face image samples are input into the corresponding task module to be trained for model training of the module to be trained, and the aligned face image samples can be simultaneously input into the feature extraction module corresponding to the task module to be trained for feature extraction.

[0101] In a specific implementation, before performing model training on each task module in the single-task model, this embodiment can also pre-train each feature extraction module of the backbone model. The training process of each feature extraction module in the backbone model can be as follows: Figure 5 The arrangement structure shown is used for sequential or parallel feature extraction training.

[0102] In an optional embodiment, before the embodiment of the present application inputs the aligned face image samples into the task module to be trained and the backbone model, it may further specifically include: obtaining a face recognition data set; using the face recognition data set to perform feature extraction training on each feature extraction module in the backbone model, and using a preset loss function to perform parameter optimization on the feature extraction results output by the feature extraction module until the loss converges to obtain a trained backbone model; wherein, the parameters of the backbone model are fixed after the pre-training is completed, and the backbone model does not participate in the attribute analysis training of the task module to be trained.

[0103] In this embodiment, the Restnet model is first trained using a face recognition dataset to ensure that the low-level operators learn complete facial detail features. This example uses the public dataset Glint360K as the face recognition dataset to train the Resnet model, using the Cosfaceloss loss function, and training until the loss converges. In this embodiment, the Resnet model is primarily trained using face recognition methods to ensure that the convolution operator learns sufficient facial feature information. The Resnet model is only trained once, and subsequent fixed parameters do not participate in LoRA training.

[0104] Step 440: Use the aligned face image samples to perform attribute analysis training on the task module to be trained, obtain the single prediction result output by the task module to be trained, and obtain the feature prediction result output by the backbone model for the aligned face image samples.

[0105] In its implementation, LoRA designs a corresponding number of layers based on the feature extraction model structure. Through in-depth exploration, LoRA modules can be designed for each linear layer within the module. By training the corresponding LoRA using aligned facial image samples, the individual prediction results output by LoRA during attribute analysis training are obtained, and the feature prediction results output by the corresponding feature extraction module can be obtained.

[0106] Optionally, in an embodiment of the present application, when the task module to be trained includes a first matrix and a second matrix, the above-mentioned attribute analysis training of the task module to be trained using the aligned face image samples can specifically include: performing matrix multiplication using the first matrix and the second matrix to obtain a model update deviation; performing attribute analysis training based on the model update deviation, the aligned face image samples and the initial model parameters to obtain a single prediction result output by the task module to be trained.

[0107] In an optional embodiment, the embodiment of the present application performs attribute analysis training based on the model update deviation, the aligned face image sample and the model initial parameters, which may specifically include: Determine the single prediction result; where Predict is the model prediction value, f is the model function, X is the input aligned face image sample, W is the model parameter, and W0 is the original untrained model parameter. It is the parameter change of model training fitting and is represented by the multiplication of two low-rank matrices A and B. W0X is the parameter of the forward propagation of the feature extraction module of the backbone model, and ABX is the parameter of the forward propagation of the task module to be trained.

[0108] In a specific implementation, in order to ensure that the model can accurately perform attribute analysis on the input image, in this embodiment, LoRA can be composed of two trainable matrices, assuming that they are matrix A and matrix B respectively. Matrix A can be used as the first matrix and matrix B can be used as the second matrix. This example does not limit this. The deviation of the model parameter update can be obtained by multiplying matrix A and matrix B. Therefore, the shape of matrix A is the same as the input size, such as matrix A = (m, rank), and matrix B is the same as the output size, such as matrix B = (rank, n). When training the model, the backbone model parameters can be frozen and not participate in the training. At the same time, when initializing the weights, matrix A is initialized with Gaussian noise, and matrix B is initialized with a 0 matrix to ensure that training starts from the bottom model. Because AB is a 0 matrix, LoRA does not work in the initial state. When the model is training, assuming that X is the input data, the model outputs a predict whose length matches the number of categories. Predict is the model's predicted value, which is obtained by each module through attribute analysis and feature extraction based on the input data. This embodiment uses the A and B matrices to provide a benchmark for model parameter optimization, so that the prediction results of the model input can be close to the true labels corresponding to the samples, thereby improving the model's ability to analyze the input images.

[0109] In this embodiment, it is only necessary to train the corresponding LoRA layer for each stage of resnet50 pre-trained for face recognition, and then input and add them separately in the calculation process to obtain the prediction results of the training model and efficiently utilize the feature extraction capabilities of the backbone network.

[0110] Step 450: Perform gradient propagation based on the single prediction result and the feature prediction result to obtain a model prediction result.

[0111] Reference Figure 4 As shown in the figure, the feature extraction module and LoRA module of each layer predict the corresponding results from the input data, and then input the predicted results and input data into the next layer for forward propagation. After the feature extraction module and LoRA module of the last layer complete the prediction, the prediction results are merged to obtain the final model prediction result.

[0112] In an optional embodiment, the embodiment of the present application performs gradient propagation based on the single prediction result and the feature prediction result to obtain a model prediction result, which may specifically include:

[0113] according to Perform gradient propagation;

[0114] Among them, the backbone model includes an input feature extraction module and at least four residual feature extraction modules, the single-task model includes at least five task modules to be trained corresponding to the feature extraction modules of the backbone model, FA0(X), FA0(P0), FA0(P1), FA0(P2) and FA0(P3) are all forward propagations of the feature extraction modules of the backbone model, FB0(X), FB0(P0), FB0(P1), FB0(P2) and FB0(P3) are all forward propagations of the task modules to be trained of the single-task model, and Predict is the model prediction result.

[0115] In this embodiment, the Resnet model consists of four residual stages. It is assumed that the forward propagation of each stage is equivalent to the function FA0(X), FA1(X), FA2(X), FA3(X), and FA4(X); the forward propagation of the LoRA model is equivalent to the function FB0(X), FB1(X), FB2(X), FB3(X), and FB4(X). The input data X into the overall model is equivalent to inputting FA n (X) and FB n (X), due to the Resnet model FA n (X) parameters are fixed and do not participate in parameter updates, so what is actually being trained is the LoRA part of the FB n (X) parameters, thus forming a fixed model with Resnet as the main body and LoRA trained with different data as modules. After inputting the same data and merging the outputs, the prediction results of the corresponding attributes can be obtained.

[0116] Step 460 , using the real label corresponding to the sample face image and the model prediction result to perform loss calculation, and optimizing the parameters of the task module to be trained according to the loss calculation result, until the single-task model training is completed, thereby obtaining a trained attribute structure analysis model.

[0117] In this embodiment, after obtaining the prediction results of the model output, the model prediction results can be compared with the true labels for loss calculation, such as cross entropy, focalLoss, etc., and back propagation can be used to minimize the deviation between logits and the true labels. The LoRA parameters are continuously optimized until the training is completed to obtain a trained attribute structure analysis model.

[0118] In the specific implementation, after this embodiment completes the model training of the attribute structure analysis model, the attribute structure analysis model can be used to perform attribute analysis and feature extraction on the aligned face image corresponding to the face image to be analyzed according to the selected detection task, and the data output by each layer module is merged using the forward propagation method to finally obtain the face attribute analysis result corresponding to the face image to be analyzed.

[0119] In summary, in the model training stage of the attribute structure analysis model, the embodiment of the present application obtains a facial attribute data set and constructs an initial analysis model including a single-task model and a backbone model. Subsequently, according to the preset background feature key points, face detection and face alignment are performed based on the sample facial images in the facial attribute data set to obtain aligned facial image samples. The task module corresponding to the preset attribute detection item is selected from the single-task model as the task module to be trained, and the aligned facial image samples are input into the task module to be trained and the backbone model. The attribute analysis training of the task module to be trained is performed using the aligned facial image samples to obtain a single prediction result output by the task module to be trained, and the feature prediction result output by the backbone model for the aligned facial image sample is obtained. Gradient propagation is performed based on the single prediction result and the feature prediction result to obtain the model prediction result. The true label corresponding to the sample facial image and the model prediction result are used to calculate the loss, and the parameters of the task module to be trained are optimized based on the loss calculation result until the single-task model training is completed to obtain a trained attribute structure analysis model. It can be seen that the present embodiment sets a plurality of task modules and feature extraction modules corresponding to detection tasks in the attribute analysis model. During model training, only single task training is required for the detection task corresponding to the task module, and there is no need to perform full task training. This effectively reduces the model learning cost, avoids overfitting and insufficient learning, and reduces the demand for computing resources. At the same time, it ensures the accuracy of detection and recognition, thereby finding the best balance between accuracy and computational complexity. The customizable module options can meet different business needs without redundant detection items. In the actual application stage, the present application can flexibly complete a variety of facial attribute detection tasks by combining with different task modules. It can select and combine the required detection items in a modular manner according to different business needs, thereby achieving efficient and customized facial attribute analysis, improving model recognition accuracy, and solving the problems existing in existing facial attribute analysis methods when using multi-attribute classification models or multiple single-attribute classification models for detection.

[0120] It should be noted that, for the purpose of simple description, the method embodiments are expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the present application are not limited to the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously.

[0121] like Figure 6 As shown, the embodiment of the present application further provides a modular facial attribute structure analysis device 600, comprising:

[0122] Image acquisition module 610, used to acquire a face image to be analyzed;

[0123] A face detection and alignment module 620 is configured to perform face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image;

[0124] An input module 630 is configured to select at least one corresponding target task module from a preset attribute structure analysis model according to the detection task, and input the aligned face image into the target task module and the backbone model in the attribute structure analysis model;

[0125] A feature extraction module 640 is configured to perform attribute analysis and extraction on the aligned facial images using each of the target task modules to obtain a single attribute analysis result set corresponding to the detection task, and to perform feature extraction on the aligned facial images using each of the feature extraction modules in the backbone model to obtain a facial feature set;

[0126] The gradient propagation module 650 is used to perform gradient propagation based on the single attribute analysis result set and the facial feature set to obtain the facial attribute analysis result corresponding to the facial image to be analyzed.

[0127] Optionally, the face detection and alignment module 620 includes:

[0128] A detection task and key point acquisition submodule is used to obtain a preset detection task and a preset background feature key point corresponding to the detection task;

[0129] A face detection submodule, configured to perform face detection on the image to be analyzed and select key alignment positions from the face detection results according to the detection task;

[0130] An alignment submodule is used to align the image to be analyzed using the background feature key points in combination with the key alignment positions to obtain an aligned face image; wherein the background feature key points are key points including objects around the face, and the aligned face image includes facial features and facial background features.

[0131] Optionally, the feature extraction module 640 includes:

[0132] an arrangement structure determination module, configured to determine a first arrangement structure of the modules in the attribute structure analysis model, wherein the first arrangement structure is an arrangement order between the target task modules, and the target task modules correspond one to one with the feature extraction modules;

[0133] The extraction submodule is used to perform attribute analysis and extraction on the aligned face images in accordance with the first arrangement structure through the target task module in sequence to obtain a single attribute analysis result set, and to perform feature recognition and extraction on the aligned face images using the feature extraction module in sequence to obtain a face feature set.

[0134] Optionally, the gradient propagation module 650 includes:

[0135] The forward propagation submodule is used to perform forward propagation according to the arrangement structure using the single attribute analysis results in the single attribute analysis result set and the facial features in the facial feature set to obtain the facial attribute analysis results.

[0136] Optionally, the modular facial attribute structure analysis device 600 further includes:

[0137] An attribute sample acquisition and model construction module is used to obtain a facial attribute dataset and construct an initial analysis model. The initial analysis model includes a single-task model and a backbone model. The single-task model includes task modules that correspond one-to-one to each feature extraction module in the backbone model. The feature extraction modules and the task modules call each other.

[0138] A sample face detection and alignment module is used to perform face detection and face alignment based on the sample face images in the face attribute dataset according to preset background feature key points to obtain aligned face image samples;

[0139] A sample input module is used to select a task module corresponding to a preset attribute detection item from the single-task model as a task module to be trained, and input the aligned face image sample into the task module to be trained and the backbone model;

[0140] A training module, configured to perform attribute analysis training on the task module to be trained using the aligned face image samples, obtain a single prediction result output by the task module to be trained, and obtain a feature prediction result output by the backbone model for the aligned face image samples;

[0141] A prediction result gradient propagation module is used to perform gradient propagation based on the single prediction result and the feature prediction result to obtain a model prediction result;

[0142] A parameter optimization module is used to perform loss calculation using the real label corresponding to the sample face image and the model prediction result, and to optimize the parameters of the task module to be trained according to the loss calculation result until the single-task model training is completed to obtain a trained attribute structure analysis model.

[0143] Optionally, the modular facial attribute structure analysis device 600 further includes:

[0144] Face recognition sample acquisition module, used to obtain face recognition data sets;

[0145] A feature extraction training module is used to perform feature extraction training on each feature extraction module in the backbone model using the face recognition dataset, and to optimize the parameters of the feature extraction results output by the feature extraction module using a preset loss function until the loss converges to obtain a trained backbone model; wherein, the parameters of the backbone model are fixed after the pre-training is completed, and the backbone model does not participate in the attribute analysis training of the task module to be trained.

[0146] Optionally, the task module to be trained includes a first matrix and a second matrix, and the training module includes:

[0147] a model update deviation acquisition submodule, configured to perform matrix multiplication using the first matrix and the second matrix to obtain a model update deviation;

[0148] The attribute analysis training submodule is used to perform attribute analysis training based on the model update deviation, the aligned face image samples and the model initial parameters to obtain a single prediction result output by the task module to be trained.

[0149] Optionally, the attribute analysis training submodule is specifically used to: Determine the single prediction result; where predict is the model prediction value, f is the model function, X is the input aligned face image sample, W is the model parameter, and W0 is the original untrained model parameter. It is the parameter change of model training fitting and is represented by the multiplication of two low-rank matrices A and B. W0X is the parameter of the forward propagation of the feature extraction module of the backbone model, and ABX is the parameter of the forward propagation of the task module to be trained.

[0150] Optionally, the prediction result gradient propagation module is specifically used to:

[0151] according to Perform gradient propagation;

[0152] Among them, the backbone model includes an input feature extraction module and at least four residual feature extraction modules, the single-task model includes at least five task modules to be trained corresponding to the feature extraction modules of the backbone model, FA0(X), FA0(P0), FA0(P1), FA0(P2) and FA0(P3) are all forward propagations of the feature extraction modules of the backbone model, FB0(X), FB0(P0), FB0(P1), FB0(P2) and FB0(P3) are all forward propagations of the task modules to be trained of the single-task model, and Predict is the model prediction result.

[0153] It should be noted that the modular facial attribute structure analysis device provided in the embodiments of the present application can execute the modular facial attribute structure analysis method provided in any embodiment of the present application, and has the corresponding functions and beneficial effects of the execution method.

[0154] In a specific implementation, the modular facial attribute structure analysis device can be integrated into a device, so that the device can select a task module from the attribute analysis model to perform attribute analysis and feature extraction on a facial image according to a customized detection task. As an electronic device, it can flexibly complete a variety of facial attribute detection tasks, thereby achieving efficient facial attribute analysis and improving model recognition accuracy. The electronic device can be composed of two or more physical entities, or it can be composed of one physical entity. For example, the electronic device can be a personal computer (PC), a computer, a server, etc., and the embodiments of the present application do not impose specific restrictions on this.

[0155] like Figure 7 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114; the memory 113 is used to store computer programs; the processor 111 is used to implement the steps of the modular facial attribute structure analysis method provided by any of the aforementioned method embodiments when executing the program stored in the memory 113. Exemplarily, the steps of the modular facial attribute structure analysis method may include the following steps: obtaining a facial image to be analyzed; performing face detection alignment on the facial image to be analyzed according to a preset detection task to obtain an aligned facial image; selecting at least one corresponding target task module from a preset attribute structure analysis model according to the detection task, and inputting the aligned facial image into the target task module and the backbone model in the attribute structure analysis model; performing attribute analysis and extraction on the aligned facial image through each of the target task modules to obtain a single attribute analysis result set corresponding to the detection task, and performing feature extraction on the aligned facial image through each feature extraction module in the backbone model to obtain a facial feature set; performing gradient propagation based on the single attribute analysis result set and the facial feature set to obtain a facial attribute analysis result corresponding to the facial image to be analyzed.

[0156] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the modular facial attribute structure analysis method provided in any of the aforementioned method embodiments are implemented.

[0157] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0158] The foregoing is merely a list of specific embodiments of the present application, intended to enable those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the broadest scope consistent with the principles and novel features of the present application.

Claims

1. A modular facial attribute structure analysis method, characterized in that: include: Obtaining a face image to be analyzed; Performing face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image; According to the detection task, selecting at least one corresponding target task module from a preset attribute structure analysis model, and inputting the aligned face image into the target task module and the backbone model in the attribute structure analysis model; Performing attribute analysis and extraction on the aligned face images through each of the target task modules to obtain a single attribute analysis result set corresponding to the detection task, and performing feature extraction on the aligned face images through each of the feature extraction modules in the backbone model to obtain a face feature set; Gradient propagation is performed based on the single attribute analysis result set and the facial feature set to obtain a facial attribute analysis result corresponding to the facial image to be analyzed.

2. The method according to claim 1, characterized in that The step of performing face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image includes: Obtaining a preset detection task and preset background feature key points corresponding to the detection task; Performing face detection on the image to be analyzed, and selecting a key alignment position from the face detection result according to the detection task; Aligning the image to be analyzed by combining the background feature key points with the key alignment positions to obtain an aligned face image; The background feature key points are key points including objects around the face, and the aligned face image includes face features and face background features.

3. The method according to claim 1, characterized in that The method of performing attribute analysis and extraction on the aligned face images through each of the target task modules to obtain a single attribute analysis result set corresponding to the detection task, and performing feature extraction on the aligned face images through each of the feature extraction modules in the backbone model to obtain a face feature set includes: Determine a first arrangement structure of each module in the attribute structure analysis model, wherein the first arrangement structure is an arrangement order between the target task modules, and the target task modules correspond to the feature extraction modules one by one; According to the first arrangement structure, the target task module is used in turn to perform attribute analysis and extraction on the aligned face images to obtain a single attribute analysis result set, and the feature extraction module is used in turn to perform feature recognition and extraction on the aligned face images to obtain a face feature set.

4. The method according to claim 3, characterized in that The step of performing gradient propagation according to the single attribute analysis result set and the facial feature set to obtain the facial attribute analysis result corresponding to the facial image to be analyzed includes: According to the arrangement structure, forward propagation is performed using the single attribute analysis results in the single attribute analysis result set and the facial features in the facial feature set to obtain the facial attribute analysis result.

5. The method according to claim 1, characterized in that Before selecting at least one corresponding target task module from the preset attribute structure analysis model, the method further includes: Acquire a face attribute data set, and construct an initial analysis model, wherein the initial analysis model includes a single-task model and a backbone model, wherein the single-task model includes a task module corresponding to each feature extraction module in the backbone model, and the feature extraction module and the task module call each other; According to preset background feature key points, face detection and face alignment are performed based on sample face images in the face attribute data set to obtain aligned face image samples; Selecting a task module corresponding to a preset attribute detection item from the single-task model as a task module to be trained, and inputting the aligned face image sample into the task module to be trained and the backbone model; Using the aligned face image samples to perform attribute analysis training on the task module to be trained, obtaining a single prediction result output by the task module to be trained, and obtaining a feature prediction result output by the backbone model for the aligned face image samples; Perform gradient propagation according to the single prediction result and the feature prediction result to obtain a model prediction result; The loss is calculated using the real label corresponding to the sample face image and the model prediction result, and the parameters of the task module to be trained are optimized according to the loss calculation result until the single-task model training is completed to obtain a trained attribute structure analysis model.

6. The method according to claim 5, characterized in that Before inputting the aligned face image samples into the task module to be trained and the backbone model, the method further includes: Get the face recognition dataset; Using the face recognition data set to perform feature extraction training on each feature extraction module in the backbone model, and using a preset loss function to perform parameter optimization on the feature extraction results output by the feature extraction module until the loss converges to obtain a trained backbone model; Among them, the parameters of the backbone model are fixed after the pre-training is completed, and the backbone model does not participate in the attribute analysis training of the task module to be trained.

7. The method according to claim 5, characterized in that The task module to be trained includes a first matrix and a second matrix, and performing attribute analysis training on the task module to be trained using the aligned face image samples, including: Performing matrix multiplication using the first matrix and the second matrix to obtain a model update deviation; Attribute analysis training is performed based on the model update deviation, the aligned face image samples and the model initial parameters to obtain a single prediction result output by the task module to be trained.

8. The method according to claim 7, characterized in that The performing attribute analysis training based on the model update deviation, the aligned face image sample and the model initial parameters includes: according to Determine the individual forecast results; Among them, predict is the model prediction value, f is the model function, X is the input aligned face image sample, W is the model parameter, w0 is the original untrained model parameter, It is the parameter change of model training fitting and is represented by the multiplication of two low-rank matrices A and B. W0X is the parameter of the forward propagation of the feature extraction module of the backbone model, and ABX is the parameter of the forward propagation of the task module to be trained.

9. The method according to claim 5, characterized in that The step of performing gradient propagation according to the single prediction result and the feature prediction result to obtain a model prediction result includes: according to Perform gradient propagation; Among them, the backbone model includes an input feature extraction module and at least four residual feature extraction modules, the single-task model includes at least five task modules to be trained corresponding to the feature extraction modules of the backbone model, FA0(X), FA0(P0), FA0(P1), FA0(P2) and FA0(P3) are all forward propagations of the feature extraction modules of the backbone model, FB0(X), FB0(P0), FB0(P1), FB0(P2) and FB0(P3) are all forward propagations of the task modules to be trained of the single-task model, and Predict is the model prediction result.

10. A modular facial attribute structure analysis device, characterized in that: include: An image acquisition module, used to acquire a face image to be analyzed; A face detection and alignment module, used to perform face detection and alignment on the face image to be analyzed according to a preset detection task to obtain an aligned face image; An input module, used to select at least one corresponding target task module from a preset attribute structure analysis model according to the detection task, and input the aligned face image into the target task module and the backbone model in the attribute structure analysis model; A feature extraction module, used to perform attribute analysis and extraction on the aligned face images through each of the target task modules to obtain a single attribute analysis result set corresponding to the detection task, and to perform feature extraction on the aligned face images through each of the feature extraction modules in the backbone model to obtain a face feature set; The gradient propagation module is used to perform gradient propagation according to the single attribute analysis result set and the facial feature set to obtain the facial attribute analysis result corresponding to the facial image to be analyzed.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the modular facial attribute structure analysis method described in any one of claims 1 to 9 when executing the program stored in the memory.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the modular facial attribute structure analysis method as described in any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Multi-task learning convolutional neural network-based face attribute analysis method

    CN106529402A

  • Three-dimensional face modeling method and three-dimensional face modeling printing device based on video streaming and face multi-attribute matching

    CN106652025A

  • Multi-task network model, using method and device and storage medium

    CN111325108A

  • Modularized dynamic configurable living body face recognition system

    CN112818722A

  • Lightweight face attribute recognition model training method, recognition method and equipment

    CN115565051A