Character attribute classification method and device, storage medium and computer equipment

By using the target attribute classification model of feature recognition network and classifier combination in character attribute classification, the interval softmax loss function and classification loss function is used to solve the problem of insufficient character attribute classification ability in complex scenarios, and high accuracy is achieved attribute classification.

CN118918388AActive Publication Date: 2024-11-08ZKTECO CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411174465.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-11-08
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

The existing technology has poor ability to classify character attributes in complex scenarios, mainly due to the diversity of human attributes and large differences within categories and small differences between classes, resulting in unsatisfactory recognition effects.

Method used

A character attribute classification method is adopted to obtain the character images to be classified and determine their attributes to be classified, and a target attribute classification model is used to classify using a target attribute classification model composed of a feature recognition network and a classifier. Set a spacing softmax loss function in the feature recognition network, and set a classification loss function in the classifier to reduce the difference in sample characteristics within the class and increase the difference in sample characteristics between classes, dynamically adjust the weight of category samples, and improve the classification ability of the model.

Benefits of technology

Through this method, high-precision predicted classification results can be obtained under the attributes to be classified, and the accuracy and ability of character attribute classification can be improved, especially pay more attention to types that are difficult to identify, thereby improving the overall classification ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918388A_ABST
    Figure CN118918388A_ABST
Patent Text Reader

Abstract

According to the character attribute classification method and device, the storage medium and the computer equipment provided by the invention, during character attribute classification, the to-be-classified attributes of the character image are determined firstly, and then the target attribute classification model corresponding to the to-be-classified attributes is determined, so that the attribute classification capability is improved through a single-attribute model. The model is obtained by combining a feature recognition network provided with a softmax loss function with intervals and a classifier provided with a classification loss function. Wherein the softmax loss function with intervals improves the classification capability of the model by reducing the angle difference between intra-class sample features and increasing the angle difference between inter-class sample features; and the classification loss function is dynamically adjusted through the weight to balance different types of samples in the attributes so as to further improve the classification capability of the model. Therefore, the character image is input into the target attribute classification model, and a high-precision prediction classification result output by the target attribute classification model can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, storage medium and computer equipment for classifying character attributes. Background Art

[0002] With the rapid development of computer vision technology, human attribute classification is gradually becoming a core component of intelligent video surveillance systems. This technology uses advanced algorithms such as deep learning to achieve automatic extraction and high-level semantic conversion of pedestrian information in surveillance videos, such as accurate identification of attribute features such as gender, age and clothing style, and has broad application potential in various fields.

[0003] Although human attribute classification technology has made significant progress in recent years, its classification ability still faces many challenges, resulting in unsatisfactory recognition results in some complex scenarios. For example, human attributes are diverse, and each attribute itself has large intra-class differences and small inter-class differences, such as the dressing habits of different age groups and the ambiguity of certain clothing in terms of gender, which leads to poor classification ability of existing technologies. Summary of the invention

[0004] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defect that the prior art has poor classification ability due to the diversity of human attributes and the large intra-class differences and small inter-class differences of each attribute.

[0005] The present application provides a method for classifying character attributes, the method comprising:

[0006] Acquire a person image to be classified, and determine the attribute to be classified of the person image;

[0007] Determine a target attribute classification model corresponding to the attribute to be classified; the target attribute classification model is obtained by combining a feature recognition network and a classifier; wherein a softmax loss function with an interval is pre-set in the feature recognition network, and a classification loss function is pre-set in the classifier;

[0008] The person image is input into the target attribute classification model to obtain a predicted classification result of the person image under the attribute to be classified output by the target attribute classification model.

[0009] Optionally, determining a target attribute classification model corresponding to the attribute to be classified includes:

[0010] Acquire sample image data corresponding to the attribute to be classified, wherein the sample image data includes a real classification result annotated based on the attribute to be classified;

[0011] Inputting the sample image data into a preset initial attribute classification model to obtain a predicted classification result of the sample image data output by the initial attribute classification model under the attribute to be classified;

[0012] The predicted classification result is close to the true classification result, and the initial attribute classification model is trained using an interval softmax loss function and a classification loss function;

[0013] When the initial attribute classification model meets the preset training end condition, the trained initial attribute classification model is used as the target attribute classification model.

[0014] Optionally, the acquiring sample image data corresponding to the attribute to be classified includes:

[0015] Determine multiple classification types under the attribute to be classified, and obtain sample person images corresponding to each classification type in equal proportion;

[0016] Based on each classification type, the true classification result is marked in each sample person image, and each marked sample person image is mixed to form sample image data.

[0017] Optionally, the training of the initial attribute classification model with the goal of making the predicted classification result close to the true classification result and using an interval softmax loss function and a classification loss function includes:

[0018] The predicted classification result is calculated using an interval softmax loss function to obtain a recognition loss value, and the classification loss value between the predicted classification result and the true classification result is calculated using a classification loss function;

[0019] A total loss value of the initial attribute classification model is determined according to the recognition loss value and the classification loss value, and parameters in the initial attribute classification model are updated based on the total loss value.

[0020] Optionally, the calculation expression of the total loss value includes:

[0021]

[0022] In the formula, Loss represents the total loss value; Loss1 represents the recognition loss value of the softmax loss function with interval; Loss2 represents the classification loss value of the classification loss function; a represents the adjustment weight of the recognition loss value; b represents the adjustment weight of the classification loss value.

[0023] Optionally, the step of inputting the person image into the target attribute classification model to obtain a predicted classification result of the person image under the attribute to be classified output by the target attribute classification model includes:

[0024] Inputting the person image into the feature recognition network to obtain a person feature vector obtained by the feature recognition network performing feature recognition on the person image;

[0025] The classifier is used to perform feature classification on the character feature vector to obtain a predicted classification result of the character image under the attribute to be classified.

[0026] Optionally, the using the classifier to perform feature classification on the character feature vector to obtain a predicted classification result of the character image under the attribute to be classified includes:

[0027] Inputting the character feature vector into the classifier, so that the classifier performs probability prediction on the character feature vector based on the attribute to be classified, and obtains the prediction probability of each classification type under the attribute to be classified;

[0028] The predicted probabilities are sorted by the classifier, and the classification type with the largest predicted probability in the sorting result is used as the predicted classification result output by the classifier.

[0029] The present application also provides a device for classifying character attributes, comprising:

[0030] An image acquisition module, used to acquire a person image to be classified and determine the attributes of the person image to be classified;

[0031] A model determination module, used to determine a target attribute classification model corresponding to the attribute to be classified; the target attribute classification model is obtained by combining a feature recognition network and a classifier; wherein a softmax loss function with an interval is pre-set in the feature recognition network, and a classification loss function is pre-set in the classifier;

[0032] The model classification module is used to input the person image into the target attribute classification model to obtain the predicted classification result of the person image under the attribute to be classified output by the target attribute classification model.

[0033] The present application also provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the character attribute classification method described in any one of the above embodiments.

[0034] The present application also provides a computer device, comprising: one or more processors, and a memory;

[0035] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the character attribute classification method described in any one of the above embodiments are performed.

[0036] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0037] The character attribute classification method, device, storage medium and computer equipment provided by the present application can first determine the attribute to be classified of the character image when it is necessary to classify the attributes of the character image, and then determine the target attribute classification model corresponding to the attribute to be classified, so as to improve the attribute classification ability through the single attribute model. Since the model is obtained by combining a feature recognition network and a classifier, a softmax loss function with an interval is pre-set in the feature recognition network, and a classification loss function is pre-set in the classifier. Among them, the softmax loss function with an interval can make the representation of samples belonging to the same category in the feature space more compact by reducing the angle difference between the sample features within the class and increasing the angle difference between the sample features between the classes, and make the representation of samples of different categories in the feature space more dispersed, thereby improving the classification ability of the model; in addition, the classification loss function can make the model pay more attention to those types that are difficult to identify by dynamically adjusting the weights of samples of different categories in the attributes, thereby further improving the classification ability of the model. Therefore, the present application inputs the character image into the target attribute classification model, and can obtain the prediction classification result with high accuracy output by the target attribute classification model under the attribute to be classified. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0039] Figure 1 A flowchart of a method for classifying character attributes provided in an embodiment of the present application;

[0040] Figure 2 A schematic diagram of a process for determining a target attribute classification model provided in an embodiment of the present application;

[0041] Figure 3 A schematic diagram of the structure of a device for classifying character attributes provided in an embodiment of the present application;

[0042] Figure 4A schematic diagram of the internal results of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0044] Although human attribute classification technology has made significant progress in recent years, its classification ability still faces many challenges, resulting in unsatisfactory recognition results in some complex scenarios. For example, human attributes are diverse, and each attribute itself has large intra-class differences and small inter-class differences, such as the dressing habits of different age groups and the ambiguity of certain clothing in terms of gender, which leads to poor classification ability of existing technologies.

[0045] Based on this, this application proposes the following technical solutions, see below for details:

[0046] In one embodiment, Figure 1 As shown, Figure 1 A flowchart of a method for classifying character attributes provided in an embodiment of the present application; the present application provides a method for classifying character attributes, which specifically includes the following:

[0047] S110: Acquire a person image to be classified, and determine the attributes of the person image to be classified.

[0048] In this step, in some passenger flow attribute analysis scenarios, if the user needs to classify a certain attribute of a person in the passenger flow, the person attribute classification function can be started in the computer device, so that the computer device can obtain the person image to be classified through the image acquisition device, and then further determine the attribute to be classified of the person image, so as to classify the person image based on the attribute to be classified.

[0049] It is understandable that in the passenger flow attribute analysis scene, multiple cameras are usually set up, and these cameras have stable connectivity and support multiple connection methods such as USB and Wi-Fi to connect to the computer device. Therefore, the computer device can obtain the real-time picture in the passenger flow attribute analysis scene through the camera, and automatically capture the real-time picture when the person to be classified appears in the picture to form the image of the person to be classified.

[0050] Furthermore, after acquiring the character image, the computer device may perform a preprocessing operation on the character image, and the preprocessing operation includes but is not limited to normalization, sharpening, denoising, etc. Among them, normalization refers to mapping the data of each dimension of the data vector to an interval between (0, 1) or (-1, 1), or mapping a norm of the data vector to 1. It can be understood that the pixel value of the character image in the present application is an integer in the range of 0 to 255. Although the pixel data of the original image can be directly used as the training data of the model, it may cause some problems in the training process of the model, such as causing the model training speed to slow down, too many iterations leading to slower convergence, etc. Therefore, the present application can improve the efficiency of model training by normalization.

[0051] The sharpening process here refers to compensating the image contour, enhancing the image edge and grayscale jump part, making the image clear, which can be divided into two categories: spatial domain processing and frequency domain processing. By highlighting the edges and contours of the objects on the image, or the characteristics of certain linear target elements, the contrast between the edge of the person and the surrounding pixels can be improved. De-noising refers to the process of reducing noise in digital images. Generally, the image is often affected by the imaging equipment and external environmental noise interference during digitization and transmission. That is, the image information received generally includes noise, and these noises will become an important cause of image interference. By denoising the image, the noise in the image is removed, and the authenticity and accuracy of the obtained image are further improved.

[0052] By performing the preprocessing operation on the acquired person image, the person image can be scaled to a suitable size and the clarity of the image itself can be effectively improved, which facilitates subsequent processing of the person image.

[0053] In addition, the attributes to be classified refer to the attributes of the various types of characters that need to be classified. For example, when the attribute is gender, the various types after classification may include male and female; when the attribute is age, the various types after classification may include teenagers, middle-aged, and elderly. This application can determine the attributes to be classified of the character image according to the actual needs of the analysis scene. The attributes to be classified here can be one or more, and there is no limitation here.

[0054] S120: Determine a target attribute classification model corresponding to the attribute to be classified.

[0055] In this embodiment, after determining the attribute to be classified of the person image through step S110, the computer device can use a target attribute classification model corresponding to the attribute to be classified to improve the attribute classification ability through a single attribute model, and then use the target attribute classification model to classify the person image attributes to obtain a classification result with higher accuracy.

[0056] It is understandable that a plurality of pre-trained target attribute classification models are pre-stored in the computer device, and each target attribute classification model corresponds to an attribute to be classified, and can classify the person image into a specific type under the corresponding model to be classified. Therefore, after determining the attribute to be classified of the person image, the computer device can directly obtain the target attribute classification model corresponding to the attribute to be classified, so that the target attribute classification model can classify the input person image under the attribute to be classified and obtain the corresponding classification result.

[0057] Among them, when there is only one attribute to be classified in the person image, the computer device can directly obtain a corresponding target attribute classification model to perform the person attribute classification operation; when there are multiple attributes to be classified in the person image, the computer device can respectively obtain the target attribute classification model corresponding to each attribute and perform the person attribute classification operation on each target attribute classification model at the same time, and the operation process of each model is independent of each other and does not affect each other.

[0058] Specifically, the target attribute classification model is obtained by combining a feature recognition network and a classifier; the feature recognition network here can adopt an open source model, which is mainly used to extract features of people in human images; and the classifier is mainly used to assign input data to specific types or labels. It is the core component for solving classification problems and can make classification decisions based on the input features.

[0059] Furthermore, a softmax loss function with an interval is pre-set in the feature recognition network, and a classification loss function is pre-set in the classifier. The present application can further improve the classification ability of the model through the mutual cooperation of the softmax loss function with an interval and the classification loss function.

[0060] To elaborate, the interval-based softmax loss function refers to the introduction of an interval parameter on the basis of the traditional softmax loss function to enhance the model's discrimination of the correct category. It can be applied to functional models such as face recognition and fine-grained classification, so that the model can more strictly distinguish different categories on the decision boundary. The interval-based softmax loss function can be an ArcFace loss function, a CosFace loss function, or other loss functions with the same function, which are not limited here. In the present application, the interval-based softmax loss function set in the feature recognition network can adopt the ArcFace loss function. The ArcFace loss function can reduce the angular difference between sample features within a class and increase the angular difference between sample features between classes, so that the representation of samples belonging to the same category in the feature space is more compact, and the representation of samples of different categories in the feature space is more dispersed, thereby improving the classification ability of the model.

[0061] In addition, the classification loss function refers to a function used in machine learning to evaluate the performance of a model on classification problems, which aims to quantify the degree of difference between the model prediction results and the true labels. The classification loss function may include Focal loss function, Cross-Entropy loss function, Hinge loss function, Exponential loss function, etc. In this application, the classification loss function pre-set in the classifier may adopt the Focal loss function, which is a dynamically scaled cross entropy loss function, mainly used to solve the problem of class imbalance in tasks such as target detection. It introduces a modulation factor to make the model pay more attention to samples that are more difficult to classify during training, thereby improving its overall classification ability.

[0062] S130: Inputting the person image into the target attribute classification model to obtain the predicted classification result of the person image output by the target attribute classification model under the attribute to be classified.

[0063] In this step, after determining the target attribute classification model through step S120, the computer device can input the person image into the target attribute classification model to classify the attributes of the person image through the target attribute classification model, and obtain a predicted classification result with high accuracy under the attribute to be classified output by the target attribute classification model.

[0064] It can be understood that since the target attribute classification model uses sample image data as training samples, the actual classification results marked in the sample image data as sample labels, and uses the interval-based softmax loss function and classification loss function to train the preset initial attribute classification model, therefore, when the computer device inputs the person image into the target attribute classification model, it can obtain the predicted classification result of the person image output by the target attribute classification model under the attribute to be classified.

[0065] In the above embodiment, when it is necessary to classify the attributes of the person image, the attributes to be classified of the person image can be determined first, and then the target attribute classification model corresponding to the attributes to be classified can be determined, so as to improve the attribute classification ability through the single attribute model. Since the model is obtained by combining the feature recognition network and the classifier, the feature recognition network is pre-set with a softmax loss function with intervals, and the classifier is pre-set with a classification loss function. Among them, the softmax loss function with intervals can make the representation of samples belonging to the same category in the feature space more compact by reducing the angle difference between the sample features within the class and increasing the angle difference between the sample features between the classes, and make the representation of samples of different categories in the feature space more dispersed, thereby improving the classification ability of the model; in addition, the classification loss function can make the model pay more attention to those types that are difficult to identify by dynamically adjusting the weights of samples of different categories in the attributes, and further improve the classification ability of the model. Therefore, the present application inputs the person image into the target attribute classification model, and can obtain the prediction classification result with high accuracy output by the target attribute classification model under the attributes to be classified.

[0066] In one embodiment, Figure 2 As shown, Figure 2 A schematic diagram of a process for determining a target attribute classification model provided in an embodiment of the present application; Figure 2 In step S120, determining the target attribute classification model corresponding to the attribute to be classified may include:

[0067] S121: Acquire sample image data corresponding to the attribute to be classified, where the sample image data includes a real classification result annotated based on the attribute to be classified.

[0068] S122: Input the sample image data into a preset initial attribute classification model to obtain a predicted classification result of the sample image data output by the initial attribute classification model under the attribute to be classified.

[0069] S123: The goal is to make the predicted classification results close to the actual classification results, and use the softmax loss function with intervals and the classification loss function to train the initial attribute classification model.

[0070] S124: When the initial attribute classification model meets the preset training end condition, the trained initial attribute classification model is used as the target attribute classification model.

[0071] In this embodiment, when determining the target attribute classification model, the computer device may first select a corresponding feature recognition network and a classifier combination to obtain an initial attribute classification model, and then improve and train the initial attribute classification model. During the training process, the computer device may first obtain sample image data corresponding to the attribute to be classified, and the sample image data includes a real classification result annotated based on the attribute to be classified, so that after the sample image data is input into the initial attribute classification model, the predicted classification result of the sample image data output by the initial attribute classification model under the attribute to be classified can be obtained; then, the computer device may train the initial attribute classification model with the goal of making the predicted classification result close to the real classification result, and use the interval softmax loss function and the classification loss function. When the initial attribute classification model meets the preset training end condition, the computer device may use the trained initial attribute classification model as the target attribute classification model.

[0072] Specifically, the computer device can use the sample image data as training samples and the actual classification results of the sample image data as sample labels, and then input the training samples with sample labels into a preset initial attribute classification model for forward propagation to train the model, and use the interval-based softmax loss function and classification loss function to tune the model parameters during the back propagation process of the model. When the model meets certain training conditions or parameter convergence conditions, such as the number of iterations reaches the set value, the training is considered completed, and the trained model can be used as the final target attribute classification model.

[0073] In one embodiment, obtaining sample image data corresponding to the attribute to be classified in step S121 may include:

[0074] S1211: Determine multiple classification types under the attribute to be classified, and obtain sample person images corresponding to each classification type in equal proportion.

[0075] S1212: annotating the real classification result in each sample person image based on each classification type, and performing image mixing on each annotated sample person image to form sample image data.

[0076] In this embodiment, when the computer device acquires sample image data, it can first determine multiple classification types under the attribute to be classified. For example, when the attribute is gender, its classification type can be divided into male and female; when the attribute is age, its classification type can be divided into teenagers, middle-aged, and elderly. Then, the computer device can acquire sample person images corresponding to each classification type in equal proportion, and then annotate the true classification results in each sample person image based on each classification type, and perform image mixing on each annotated sample person image to form sample image data, so as to improve the efficiency and generalization ability of the model when using the sample image data for training.

[0077] It can be understood that the present application obtains sample character images corresponding to each classification type in equal proportion, which can ensure that the number of samples of each classification type in the data set is roughly equal, so that the model can learn the feature distribution of each classification type during the training process, rather than being biased towards one or certain categories, thereby improving the generalization ability of the model; in addition, by mixing sample character images of each classification type, the model can be exposed to more diverse data during the training process, and can learn more generalized feature representations, avoiding model overfitting.

[0078] Of course, after the computer device obtains the mixed sample image data input, it can also pre-process the sample image data, such as normalization, sharpening, denoising and other operations, so that the sample image data can be scaled to a suitable size and effectively improve the clarity of the image itself, so as to improve the efficiency of model training.

[0079] In one embodiment, step S123 aims to make the predicted classification result close to the actual classification result, and uses the softmax loss function with intervals and the classification loss function to train the initial attribute classification model, which may include:

[0080] S1231: Calculate the predicted classification result using the interval softmax loss function to obtain the recognition loss value, and calculate the classification loss value between the predicted classification result and the actual classification result using the classification loss function.

[0081] S1232: Determine a total loss value of the initial attribute classification model according to the recognition loss value and the classification loss value, and update parameters in the initial attribute classification model based on the total loss value.

[0082] In this embodiment, when the computer device uses the loss function to train the initial attribute classification model, it can first use the interval softmax loss function to calculate the predicted classification result to obtain the recognition loss value, and use the classification loss function to calculate the classification loss value between the predicted classification result and the actual classification result. Then, the computer device can determine the total loss value of the initial attribute classification model based on the recognition loss value and the classification loss value, and update the parameters in the initial attribute classification model based on the total loss value.

[0083] It can be understood that since the softmax loss function with intervals is a loss function designed specifically for deep face recognition, the softmax loss function with intervals can be used in the feature recognition network to calculate the recognition loss value of the feature recognition network; and the classification loss function, as a dynamically scaled cross entropy loss function, can be used to calculate the classification loss value of the classifier. Finally, the computer device can combine the two loss values ​​to determine the total loss value of the initial attribute classification model, and update the parameters in the initial attribute classification model based on the total loss value.

[0084] In one embodiment, the calculation expression of the total loss value in step S1232 may include:

[0085]

[0086] In the formula, Loss represents the total loss value; Loss1 represents the recognition loss value of the softmax loss function with interval; Loss2 represents the classification loss value of the classification loss function; a represents the adjustment weight of the recognition loss value; b represents the adjustment weight of the classification loss value.

[0087] In this embodiment, when calculating the total loss value of the initial attribute classification model, the computer device can first determine the recognition loss value of the feature recognition network, that is, the output value of the softmax loss function with intervals, and the classification loss value of the classifier, that is, the output value of the classification loss function. In this way, the computer device adjusts the weights of the output values ​​of the two loss functions and adds them together to obtain the total loss value.

[0088] Furthermore, when designing the target loss function of the initial attribute classification model, the present application can use the interval softmax loss function of the feature recognition network and the classification loss function of the classifier to adjust the weights before adding them. In this way, the computer device can directly use the target loss function to tune the parameters of the initial attribute classification model, which can not only reduce the loss between the feature recognition result of the feature recognition network and the real recognition result, but also reduce the loss between the classification result of the classifier and the real classification result, so that the predicted classification result generated by the model can be closer to the real classification result faster and more accurately, so that when the attribute classification of the character image is subsequently performed through the target attribute classification model, a higher precision predicted classification result can be obtained.

[0089] In one embodiment, in step S130, inputting the person image into the target attribute classification model to obtain the predicted classification result of the person image under the attribute to be classified output by the target attribute classification model may include:

[0090] S131: Inputting the person image into a feature recognition network to obtain a person feature vector obtained by the feature recognition network performing feature recognition on the person image.

[0091] S132: Using a classifier to perform feature classification on the character feature vector, and obtaining a predicted classification result of the character image under the attribute to be classified.

[0092] In this embodiment, when the computer device uses the target attribute classification model to classify the attributes of the person image, it can first input the person image into the feature recognition network to obtain the person feature vector obtained by the feature recognition network performing feature recognition on the person image, and then use the classifier to perform feature classification on the person feature vector to obtain the predicted classification result of the person image under the attribute to be classified.

[0093] It can be understood that the target attribute classification model includes a feature recognition network and a classifier. The feature recognition network can recognize the character feature vector of the recognition area corresponding to the attribute to be classified from the input character image, such as the face area, head and shoulder area, body area, etc.; and the classifier has learned the feature distribution of each classification type under the attribute to be classified, so it can directly perform feature classification on the input character feature vector, and then output the predicted classification result of the character image under the attribute to be classified.

[0094] In one embodiment, in step S132, using a classifier to perform feature classification on the character feature vector to obtain a predicted classification result of the character image under the attribute to be classified may include:

[0095] S1321: Inputting the character feature vector into the classifier, so that the classifier performs probability prediction on the character feature vector based on the attribute to be classified, and obtains the prediction probability of each classification type under the attribute to be classified.

[0096] S1322: Sort the predicted probabilities by a classifier, and use the classification type with the largest predicted probability in the sorted results as the predicted classification result output by the classifier.

[0097] In this embodiment, when the computer device uses a classifier to perform feature classification on a character feature vector, the character feature vector can be first input into the classifier so that the classifier performs probability prediction on the character feature vector based on the attribute to be classified, and obtains the predicted probability of each classification type under the attribute to be classified. The predicted probabilities are then sorted by the classifier, and the classification type with the largest predicted probability in the sorting result is used as the predicted classification result output by the classifier.

[0098] For example, when the attribute to be classified corresponding to the target attribute classification model is gender, that is, its classifier learns the feature distribution of each classification type under gender, after the person image is input into the target attribute classification model, the target attribute classification model can input the person feature vector output by the feature recognition network into the classifier, and obtain the predicted probabilities of each classification type output by the classifier, which are: [male, 0.6], [female, 0.4] respectively. At this time, the target attribute classification model can output the classification type with the largest prediction probability, that is, the prediction probability of 0.6, as the final predicted classification result, that is, the predicted classification result of the person image is male.

[0099] The following is a description of a person attribute classification device provided in an embodiment of the present application. The person attribute classification device described below and the person attribute classification method described above can be referenced to each other.

[0100] In one embodiment, Figure 3 As shown, Figure 3 A schematic diagram of the structure of a person attribute classification device provided in an embodiment of the present application; the present application also provides a person attribute classification device, including an image acquisition module 210, a model determination module 220, and a model classification module 230, which specifically includes the following:

[0101] The image acquisition module 210 is used to acquire a person image to be classified and determine the attributes of the person image to be classified.

[0102] The model determination module 220 is used to determine the target attribute classification model corresponding to the attribute to be classified; the target attribute classification model is obtained by combining a feature recognition network and a classifier; wherein a softmax loss function with an interval is pre-set in the feature recognition network, and a classification loss function is pre-set in the classifier.

[0103] The model classification module 230 is used to input the person image into the target attribute classification model to obtain the predicted classification result of the person image output by the target attribute classification model under the attribute to be classified.

[0104] In the above embodiment, when it is necessary to classify the attributes of the person image, the attributes to be classified of the person image can be determined first, and then the target attribute classification model corresponding to the attributes to be classified can be determined, so as to improve the attribute classification ability through the single attribute model. Since the model is obtained by combining the feature recognition network and the classifier, the feature recognition network is pre-set with a softmax loss function with intervals, and the classifier is pre-set with a classification loss function. Among them, the softmax loss function with intervals can make the representation of samples belonging to the same category in the feature space more compact by reducing the angle difference between the sample features within the class and increasing the angle difference between the sample features between the classes, and make the representation of samples of different categories in the feature space more dispersed, thereby improving the classification ability of the model; in addition, the classification loss function can make the model pay more attention to those types that are difficult to identify by dynamically adjusting the weights of samples of different categories in the attributes, and further improve the classification ability of the model. Therefore, the present application inputs the person image into the target attribute classification model, and can obtain the prediction classification result with high accuracy output by the target attribute classification model under the attributes to be classified.

[0105] In one embodiment, the model determination module 220 may include:

[0106] The sample acquisition submodule is used to acquire sample image data corresponding to the attribute to be classified, and the sample image data includes the real classification result marked based on the attribute to be classified.

[0107] The model prediction submodule is used to input the sample image data into a preset initial attribute classification model to obtain the predicted classification result of the sample image data output by the initial attribute classification model under the attribute to be classified.

[0108] The model training submodule is used to train the initial attribute classification model with the goal of making the predicted classification results close to the actual classification results, and using the softmax loss function with intervals and the classification loss function.

[0109] The model generation submodule is used to use the trained initial attribute classification model as the target attribute classification model when the initial attribute classification model meets the preset training end condition.

[0110] In one embodiment, the sample acquisition submodule may include:

[0111] The image acquisition unit is used to determine multiple classification types under the attribute to be classified, and acquire sample person images corresponding to each classification type in equal proportion.

[0112] The image mixing unit is used to mark the real classification result in each sample person image based on each classification type, and to mix the marked sample person images to form sample image data.

[0113] In one embodiment, the model training submodule may include:

[0114] The loss value calculation unit is used to calculate the predicted classification result using the interval softmax loss function to obtain the recognition loss value, and to calculate the classification loss value between the predicted classification result and the actual classification result using the classification loss function.

[0115] The model parameter updating unit is used to determine the total loss value of the initial attribute classification model according to the recognition loss value and the classification loss value, and to update the parameters in the initial attribute classification model based on the total loss value.

[0116] In one embodiment, the model parameter updating unit may include:

[0117]

[0118] In the formula, Loss represents the total loss value; Loss1 represents the recognition loss value of the softmax loss function with interval; Loss2 represents the classification loss value of the classification loss function; a represents the adjustment weight of the recognition loss value; b represents the adjustment weight of the classification loss value.

[0119] In one embodiment, the model classification module 230 may include:

[0120] The feature recognition submodule is used to input the character image into the feature recognition network to obtain the character feature vector obtained by the feature recognition network performing feature recognition on the character image.

[0121] The attribute classification submodule is used to perform feature classification on the character feature vector using a classifier to obtain the predicted classification result of the character image under the attribute to be classified.

[0122] In one embodiment, the step attribute classification submodule may include:

[0123] The probability prediction unit is used to input the character feature vector into the classifier so that the classifier can perform probability prediction on the character feature vector based on the attribute to be classified, and obtain the predicted probability of each classification type under the attribute to be classified.

[0124] The type selection unit is used to sort the prediction probabilities through the classifier, and use the classification type with the largest prediction probability in the sorting results as the prediction classification result output by the classifier.

[0125] In one embodiment, the present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the character attribute classification method as described in any of the above embodiments.

[0126] In one embodiment, the present application also provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the character attribute classification method as described in any one of the above embodiments.

[0127] Indicatively, if Figure 4 As shown, Figure 4 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 may be provided as a server. Figure 4 The computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by a memory 301 for storing instructions executable by the processing component 302, such as an application. The application stored in the memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute instructions to perform the character attribute classification method of any of the above embodiments.

[0128] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

[0129] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0130] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0131] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0132] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be 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 will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for classifying character attributes, characterized in that: The method comprises: Acquire a person image to be classified, and determine the attribute to be classified of the person image; Determine a target attribute classification model corresponding to the attribute to be classified; the target attribute classification model is obtained by combining a feature recognition network and a classifier; wherein a softmax loss function with an interval is pre-set in the feature recognition network, and a classification loss function is pre-set in the classifier; The person image is input into the target attribute classification model to obtain a predicted classification result of the person image under the attribute to be classified output by the target attribute classification model.

2. The character attribute classification method according to claim 1, characterized in that: The step of determining a target attribute classification model corresponding to the attribute to be classified includes: Acquire sample image data corresponding to the attribute to be classified, wherein the sample image data includes a real classification result annotated based on the attribute to be classified; Inputting the sample image data into a preset initial attribute classification model to obtain a predicted classification result of the sample image data output by the initial attribute classification model under the attribute to be classified; The predicted classification result is close to the true classification result, and the initial attribute classification model is trained using an interval Softmax loss function and a classification loss function; When the initial attribute classification model meets the preset training end condition, the trained initial attribute classification model is used as the target attribute classification model.

3. The character attribute classification method according to claim 2, characterized in that: The acquiring of sample image data corresponding to the attribute to be classified includes: Determine multiple classification types under the attribute to be classified, and obtain sample person images corresponding to each classification type in equal proportion; Based on each classification type, the true classification result is marked in each sample person image, and each marked sample person image is mixed to form sample image data.

4. The character attribute classification method according to claim 2, characterized in that: The method aims to make the predicted classification result close to the true classification result and uses an interval softmax loss function and a classification loss function to train the initial attribute classification model, including: The predicted classification result is calculated using an interval softmax loss function to obtain a recognition loss value, and the classification loss value between the predicted classification result and the true classification result is calculated using a classification loss function; A total loss value of the initial attribute classification model is determined according to the recognition loss value and the classification loss value, and parameters in the initial attribute classification model are updated based on the total loss value.

5. The character attribute classification method according to claim 4, characterized in that: The calculation expression of the total loss value includes: In the formula, Loss represents the total loss value; Loss1 represents the recognition loss value of the softmax loss function with interval; Loss2 represents the classification loss value of the classification loss function; a represents the adjustment weight of the recognition loss value; b represents the adjustment weight of the classification loss value.

6. The character attribute classification method according to claim 1, characterized in that: The step of inputting the person image into the target attribute classification model to obtain a predicted classification result of the person image under the attribute to be classified output by the target attribute classification model includes: Inputting the person image into the feature recognition network to obtain a person feature vector obtained by the feature recognition network performing feature recognition on the person image; The classifier is used to perform feature classification on the character feature vector to obtain a predicted classification result of the character image under the attribute to be classified.

7. The method for classifying character attributes according to claim 6, characterized in that: The step of using the classifier to perform feature classification on the character feature vector to obtain a predicted classification result of the character image under the attribute to be classified includes: Inputting the character feature vector into the classifier, so that the classifier performs probability prediction on the character feature vector based on the attribute to be classified, and obtains the prediction probability of each classification type under the attribute to be classified; The predicted probabilities are sorted by the classifier, and the classification type with the largest predicted probability in the sorting result is used as the predicted classification result output by the classifier.

8. A device for classifying character attributes, characterized in that: include: An image acquisition module, used to acquire a person image to be classified and determine the attributes of the person image to be classified; A model determination module, used to determine a target attribute classification model corresponding to the attribute to be classified; the target attribute classification model is obtained by combining a feature recognition network and a classifier; wherein a softmax loss function with an interval is pre-set in the feature recognition network, and a classification loss function is pre-set in the classifier; The model classification module is used to input the person image into the target attribute classification model to obtain the predicted classification result of the person image under the attribute to be classified output by the target attribute classification model.

9. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the character attribute classification method as described in any one of claims 1 to 7.

10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the character attribute classification method as described in any one of claims 1 to 7 are performed.

Citation Information

Patent Citations

  • Training method of target recognition classification model, object recognition method and device, robot and medium

    CN110059734A

  • Image processing method and device, electronic device and storage medium

    CN110570383A

  • Image recognition method and device, computer equipment and storage medium

    CN111178128A

  • Character attribute identification method and device, computer equipment and storage medium

    CN111738213A

  • Bi-directional interaction network (BINET)-based person search method, system, and apparatus

    US20210397828A1