Pedestrian multi-attribute identification method and system based on supervised learning
By adopting an unsupervised + a small amount of supervised training method and a local random data enhancement method in pedestrian attribute recognition, the problem of high labeling costs and insufficient utilization of scale information in the existing technology is solved, and high accuracy and scalability are achieved.
Patent Information
- Application Number
- CN202411234870.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2025-02-07
AI Technical Summary
Existing pedestrian attribute recognition methods are costly when processing large amounts of unlabeled data, and global average pooling and semi-supervised models cannot effectively utilize target information at different scales and provide high-accurate pseudo-labels.
The pedestrian multi-attribute recognition method based on supervised learning is adopted, and the general representation ability of the model is improved through an unsupervised training framework using a large amount of label-free data, and a local random color jitter and local random mask mechanism are introduced in the supervised training stage.
It reduces the cost of data labeling, improves the model's ability to identify targets at different scales and the accuracy of attribute recognition, and realizes the simultaneous identification of multiple attributes and the scalability of subsequent tasks.
Smart Images

Figure CN119399682A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision, and in particular to a method and system for multi-attribute recognition of pedestrians based on supervised learning. Background Art
[0002] Pedestrian attribute recognition refers to the purpose of pedestrian attribute recognition algorithms to identify the predetermined attributes of pedestrians from this image, given a pedestrian image and a list of attributes predetermined for each data set. Attribute information generally includes approximate age, gender, clothing, and behavior. Attribute information not only includes low-level semantics such as long hair and skirt, but also high-level semantics such as age and gender. Unlike low-level semantics, this information is more robust to changes in perspective and imaging conditions. Due to its wide application in public safety and smart security, pedestrian attribute recognition has become a hot topic in the field of computer vision.
[0003] Problems with traditional recognition methods: Currently, they cannot use large amounts of unlabeled data, resulting in high labeling costs; they use global average pooling to classify attributes, lacking scale information for different targets, resulting in suboptimal model performance; pedestrian attribute models output attributes of a single category, which cannot meet the needs of subsequent applications and expansions.
[0004] For example, the Chinese patent with the authorization announcement number CN110569779B discloses a pedestrian attribute recognition method based on the joint learning of the local and overall attributes of pedestrians. By designing a convolutional neural network structure based on the joint learning of the local and overall attributes of pedestrians, the pedestrian's part attributes and the whole body attributes are integrated to perform multi-task learning with correlation, and the discriminative feature representation of the local and overall attributes of pedestrians is jointly learned to obtain more discriminative pedestrian attribute features. This invention can effectively integrate the pedestrian's part attributes and the whole body attributes to perform multi-task learning with correlation, improve the discriminative ability of attribute features, and achieve more accurate recognition of the pedestrian's part attributes in complex scenes, thereby improving the recognition performance of pedestrian attributes.
[0005] For example, a Chinese patent with publication number CN117649678A discloses a training method for a pedestrian attribute recognition model and a pedestrian attribute recognition method, including: obtaining a first sample image set, a second sample image set and a third sample image set; training a semi-supervised model based on the first sample image set and the second sample image set to obtain a trained semi-supervised model; reasoning the third sample image set based on the trained semi-supervised model to generate a first pseudo-label; using a confidence learning method to filter out erroneous labels on the first pseudo-label to obtain a filtered data set; using the filtered data set to train a pedestrian attribute recognition model to obtain a trained pedestrian attribute recognition model, thereby not only reducing time and labor costs, but also improving the stability of the model.
[0006] The defects of the above patents are: 1) Since global average pooling simply eliminates the dimensional information in the feature map, it is not an optimal solution for object recognition of different scales; 2) Semi-supervised models are used for training and reasoning to utilize unlabeled data, but the supervision signal of the semi-supervised method is weak and cannot achieve the effect of supervision. At the same time, pseudo labels are generated for unlabeled data using semi-supervised models, and the accuracy of the labels is low, further reducing the performance of the model. Moreover, after completing the pseudo-label filtering and reasoning, manual screening is still required, and the time and cost required are no less than those of the supervised method. Summary of the invention
[0007] In view of the shortcomings of the prior art, the present invention proposes a pedestrian multi-attribute recognition method and system based on supervised learning. Through the unsupervised training framework, a large amount of unlabeled data can be used to improve the model's general pedestrian representation ability, provide highly adaptable pre-trained weights for subsequent supervised training, and reduce the labeling cost of a large amount of data. In the application of downstream tasks, one model can be used for multiple tasks. For example, by using the helmet category in the pedestrian attributes, it can be determined whether the pedestrian is wearing a helmet; by using the life jacket category, it can be determined whether the pedestrian is wearing a life jacket; by using the fall category in the posture attribute, it can be determined whether the pedestrian has fallen.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] The multi-attribute pedestrian recognition method based on supervised learning includes:
[0010] Collect unsupervised pedestrian data and supervised pedestrian data, including pictures and videos, and pre-process the collected unsupervised pedestrian data and supervised pedestrian data;
[0011] Construct an unsupervised training model, and train the constructed unsupervised training model to obtain an unsupervised training model with general pedestrian representation capabilities;
[0012] Construct a supervised training model, conduct supervised training on the unsupervised training model with general pedestrian representation capabilities, and send the constructed pedestrian multi-attribute dataset to the supervised training model for supervised multi-classification training;
[0013] Identify pedestrian attributes in real time and predict pedestrian attributes.
[0014] Specifically, the construction of the unsupervised training model includes:
[0015] Build an unsupervised training framework and use the SwinTransformer model as the backbone network of the first and second networks.
[0016] Specifically, the training of the constructed unsupervised training model includes:
[0017] The preprocessed unlabeled images are input into the unsupervised training framework, and the input images are randomly cropped. The cropped images are divided into local crops and global crops. All cropped images are input into the first network, and the global cropped images are input into the second network. The final result is output to obtain the feature vector T output by the first network and the feature vector T output by the second network. glo ;
[0018] Using the K-Means clustering method, the feature vector T output by the second network is glo Clustering is performed and the feature vector T glo Divided into foreground and background, in the feature vector of the foreground, the K-Means clustering method is used again to distinguish three semantic parts, and a semantic label y is given according to the clustering result;
[0019] The output feature vector T of the first network glo It is sent to the semantic classification head for semantic prediction, and the semantic prediction result Y(T glo ), and calculate the semantic prediction result Y(T glo ) and the loss of the semantic label, the specific formula is:
[0020]
[0021] Wherein, Lsem represents the semantic prediction result Y(T glo ) and the loss of the semantic label, N represents the number of cropped images, y i represents the semantic label of the i-th cropped image, Y(T glo ) j Represents the prediction result of the i-th cropped image.
[0022] Specifically, the training of the constructed unsupervised training model further includes:
[0023] Add the loss functions of the first network and the second network training as the total loss function L total , L total =L ce +L sem , to optimize and update the unsupervised training model, the specific formula is:
[0024]
[0025] Among them, θ1 represents the parameters of the first network, including all trainable weights and bias parameters in the first network, η represents the learning rate, represents the gradient of the total loss function with respect to the parameters of the first network, θ2 represents the parameters of the second network, including all trainable weights and bias parameters in the second network, ι represents the update rate of the second network, Represents the gradient of the total loss function with respect to the second network parameter.
[0026] Specifically, the supervised training model is constructed, and the unsupervised training model with general pedestrian representation capability is supervised trained, and the constructed pedestrian multi-attribute dataset is sent to the supervised training model for supervised multi-classification training, including:
[0027] Construct a supervised training model, add a multi-classification prediction head based on the attention mechanism to the unsupervised training model, and remove the self-attention mechanism in the unsupervised training model;
[0028] Select the loss function to optimize the supervised training model. The specific formula of the loss function is:
[0029]
[0030] Among them, L cls represents the loss function, C represents the number of categories of the cropped image, and y i,c represents the c-th class true label of the i-th image after cropping, represents the predicted probability of the cth class true label of the i-th image after cropping by the supervised training model;
[0031] The supervised training model is trained in a supervised manner. The constructed pedestrian multi-attribute dataset is input into the supervised training model for supervised classification training. Local random color jitter and local random mask mechanisms are introduced, and the trained supervised training model is evaluated.
[0032] Specifically, the local random color jitter and local random mask mechanism include:
[0033] The specific formula for local random color jitter is:
[0034] I'(w,d)=I(w,d)+ΔS,ΔS∈A(0,σ 2 ),
[0035] Among them, I(w, d) represents the pixel value of the image at position (w, d) in the pedestrian multi-attribute dataset, I'(w, d) represents the pixel value at position (w, d) after local color jittering in the pedestrian multi-attribute dataset, △S represents color perturbation, with a mean of 0 and a variance of σ 2 Normal distribution of
[0036] The specific formula of the local random mask mechanism is:
[0037]
[0038] Among them, I”(w,d) represents the pixel value at position (w,d) after the image in the pedestrian multi-attribute dataset is locally randomly masked, and ζ represents the mask area.
[0039] A pedestrian multi-attribute recognition system based on supervised learning, used to implement the pedestrian multi-attribute recognition method based on supervised learning, comprising: a data acquisition module, an unsupervised module, a supervised module and an attribute recognition module;
[0040] The data collection module is used to collect unsupervised pedestrian data and supervised pedestrian data, including pictures and videos, and pre-process the collected unsupervised pedestrian data and supervised pedestrian data;
[0041] The unsupervised module is used to construct an unsupervised training model and train the constructed unsupervised training model to obtain an unsupervised training model with a general pedestrian representation capability;
[0042] The supervised module is used to construct a supervised training model, perform supervised training on the unsupervised training model with general pedestrian representation capability, and send the constructed pedestrian multi-attribute dataset to the supervised training model for supervised multi-classification training;
[0043] The attribute recognition module is used to recognize pedestrian attributes in real time and predict the attributes of the pedestrian.
[0044] Specifically, the supervised module includes: a supervised training model construction unit and a supervised training model training unit;
[0045] The supervised training model construction unit is used for constructing a supervised training model using an unsupervised training model with general pedestrian representation capability;
[0046] The supervised training model training unit is used to send the constructed pedestrian multi-attribute dataset into the supervised training model for supervised multi-classification training, and introduce local random color jitter and local random mask mechanisms.
[0047] An electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a pedestrian multi-attribute recognition method based on supervised learning when executing the computer program.
[0048] A computer-readable storage medium stores computer instructions, which, when executed, execute the steps of a method for multi-attribute pedestrian recognition based on supervised learning.
[0049] Compared with the prior art, the present invention has the following beneficial effects:
[0050] 1. The present invention proposes a pedestrian multi-attribute recognition method based on supervised learning, which adopts unsupervised + a small amount of supervised training to overcome the problem that other methods cannot use a large number of unlabeled samples and reduce the labeling cost. By learning a large number of common features of unlabeled samples, it can be better transferred to the downstream pedestrian attribute task, and can adapt to different scene changes and lighting changes. For existing attributes, there is no need for repeated training, and the generalization is strong. And the accuracy of its training is guaranteed by a supervised method.
[0051] 2. The present invention proposes a pedestrian multi-attribute recognition method based on supervised learning. In the supervised training stage, local random color jitter and local random mask data enhancement methods are used to significantly enhance the accuracy of the model in color attribute recognition and part attribute recognition.
[0052] 3. The present invention proposes a pedestrian multi-attribute recognition method based on supervised learning. When the present invention is used to perform pedestrian attribute recognition, multiple attributes of pedestrians can be predicted and recognized simultaneously. For subsequent tasks, it has strong scalability. In the application of downstream tasks, one model can be applied to multiple downstream tasks, such as helmet detection, pedestrian clothing recognition and other tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A flow chart of the method for multi-attribute pedestrian recognition based on supervised learning provided by the present invention;
[0054] Figure 2 The unsupervised training framework and training flow chart provided by the present invention;
[0055] Figure 3 The supervised training framework and training flow chart provided by the present invention;
[0056] Figure 4 The architecture diagram of the pedestrian multi-attribute recognition system based on supervised learning provided by the present invention;
[0057] Figure 5 A schematic diagram of an electronic device provided by the present invention;
[0058] Figure 6 A schematic diagram of the computer-readable storage medium structure provided by the present invention. DETAILED DESCRIPTION
[0059] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, in the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate the orientation or position relationship based on the orientation or position relationship shown in the accompanying drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "No. 1", "No. 2" and "No. 3" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The present invention is further explained below in conjunction with specific embodiments.
[0060] Example 1
[0061] See also Figure 1-3 , an embodiment of the present invention provides: a pedestrian multi-attribute recognition method based on supervised learning, comprising the following specific steps:
[0062] Step S1: collecting unsupervised pedestrian data and supervised pedestrian data, including pictures and videos, and preprocessing the collected unsupervised pedestrian data and supervised pedestrian data;
[0063] The unsupervised pedestrian data is obtained by downloading from the Internet or building an environment by yourself. The collected images contain pedestrians, and small images of pedestrians are cut out from them to construct an unsupervised pedestrian dataset.
[0064] Supervised images collect images from actual industrial scenes, cut out small images of pedestrians, and annotate 88 attributes. In this invention, for the five aspects of the whole body, top of the head, face, upper body and lower body, 88 attributes such as standing posture, whether wearing a helmet, whether wearing goggles, whether wearing a seat belt, whether wearing shorts, etc. are designed. The diverse attributes can enable the model to fully learn the intrinsic connection of the attributes and improve the performance of the model. At the same time, it can also provide sufficient convenience for subsequent task expansion;
[0065] Preprocess the image, including image cropping, data augmentation (such as random cropping, flipping, color transformation) and other operations;
[0066] Step S2: constructing an unsupervised training model, and training the constructed unsupervised training model to obtain an unsupervised training model with general pedestrian representation capability;
[0067] The specific steps of step S2 are:
[0068] Step S201: construct an unsupervised training framework, use the SwinTransformer model as the backbone network of the first and second networks, use root mean square normalization on this basis, and put the normalization position before the feedforward neural network, add a GELU activation function to the feedforward neural network, and add a GLU gating mechanism, use a three-layer multilayer perceptron network as a projection layer, and the semantic classification head is composed of three layers of multilayer perceptrons, wherein each layer of the perceptron includes a linear layer, layer normalization and a GELU activation number;
[0069] Step S202: input the preprocessed unlabeled image into the unsupervised training framework, randomly crop the input image, divide the cropped image into local cropping and global cropping, input all cropped images into the first network, input the global cropped image into the second network, and output the final result;
[0070] Set the feature vector output by the first network to T and the feature vector output by the second network to T glo , the feature vectors output by the first network and the second network are activated by the softmax function to obtain the output feature vector P(T) after the first network is activated and the output feature vector P(T) after the second network is activated glo ), calculate the cross entropy loss function, the specific formula of the cross entropy loss function is:
[0071] Among them, L ce represents the cross entropy loss function, i represents the category index of the cropped image classification;
[0072] The feature extraction here is performed through a neural network model, and the neural network model includes but is not limited to CNN, RNN and other models;
[0073] Step S203: Using the K-Means clustering method, the feature vector T output by the second network is glo Clustering is performed, and the feature vector T glo It is divided into foreground and background. In the feature vector of the foreground, the K-Means clustering method is used again to distinguish three semantic parts. According to the clustering results, a semantic label y is given.
[0074]
[0075] The clustering result here may contain multiple semantic parts. In complex scenarios, there may be multiple semantic parts.
[0076] Step S204: Output feature vector T of the first network glo It is sent to the semantic classification head for semantic prediction, and the semantic prediction result Y(T glo), and calculate the semantic prediction result Y(T glo ) and the loss of the semantic label, the specific formula is:
[0077]
[0078] Wherein, Lsem represents the semantic prediction result Y(T glo ) and the loss of the semantic label, N represents the number of cropped images, y i represents the semantic label of the i-th cropped image, Y(T glo ) j Represents the prediction result of the i-th cropped image;
[0079] Step S205: Add the loss functions of the first network and the second network training as the total loss function L total , L total =L ce +L sem , to optimize and update the unsupervised training model, the specific formula is:
[0080]
[0081] Among them, θ1 represents the parameters of the first network, including all trainable weights and bias parameters in the first network, η represents the learning rate, represents the gradient of the total loss function with respect to the parameters of the first network, represents the rate of change of the loss function with respect to each parameter, and is used to indicate how the parameters are adjusted to reduce the loss. θ2 represents the parameters of the second network, including all trainable weights and bias parameters in the second network. ι represents the update rate of the second network. Represents the gradient of the total loss function with respect to the second network parameter, which represents the rate of change of the loss function with respect to each parameter, and is used to indicate how the parameters are adjusted to reduce the loss;
[0082] The update rate ι of the second network is usually between 0 and 1, which is used to control the speed of updating the teacher network parameters. The smaller this value is, the slower the teacher network updates to maintain its stability;
[0083] Step S3: construct a supervised training model, perform supervised training on the unsupervised training model with general pedestrian representation capabilities, and send the constructed pedestrian multi-attribute dataset to the supervised training model for supervised multi-classification training;
[0084] The specific steps of step S3 are:
[0085] Step S301: construct a supervised training model, add a multi-classification prediction head based on the attention mechanism to the unsupervised training model, and remove the self-attention mechanism in the unsupervised training model;
[0086] This module is the decoder part of the transformer model, and removes the self-attention mechanism to reduce the amount of model calculation. At the same time, it introduces a group decoding mechanism to further reduce the amount of attention mechanism calculation.
[0087] Step S302: Select a loss function to optimize the supervised training model. The specific formula of the loss function is:
[0088]
[0089] Among them, L cls represents the loss function, C represents the number of categories of the cropped image, and y i,c represents the c-th class true label of the i-th image after cropping, represents the predicted probability of the cth class true label of the i-th image after cropping by the supervised training model;
[0090] If the i-th image belongs to the c-th category after cropping, then y i,c =1, otherwise y i,c =0;
[0091] Step S303: Perform supervised training on the supervised training model, input the constructed pedestrian multi-attribute dataset into the supervised training model, perform supervised classification training, introduce local random color jitter and local random mask mechanism, and evaluate the trained supervised training model.
[0092] The benefits of this step are: introducing local random color jitter to enhance the model's ability to resist color interference; introducing a local random masking mechanism to simulate the situation where certain parts are blocked, thereby enhancing the generalization of the model.
[0093] The specific formula for local random color jitter is:
[0094] I'(w,d)=I(w,d)+ΔS,ΔS∈A(0,σ 2 ),
[0095] Among them, I(w, d) represents the pixel value of the image at position (w, d) in the pedestrian multi-attribute dataset, I'(w, d) represents the pixel value at position (w, d) after local color jitter in the pedestrian multi-attribute dataset, △S represents color perturbation, random color changes are performed at specific pixel positions in the image, and the mean is 0 and the variance is σ 2 Normal distribution of
[0096] The specific formula of the local random mask mechanism is:
[0097]
[0098] Where, I”(w, d) represents the pixel value at position (w, d) after the image in the pedestrian multi-attribute dataset is locally randomly masked, and ζ represents the mask area, that is, some parts of the image are randomly blocked;
[0099] Step S4: Identify pedestrian attributes in real time and predict the attributes of the pedestrian.
[0100] Exemplarily, pedestrians in the surveillance image are input into the model, and then the output of the model is mapped to the interval of 0-1 using the sigmoid function as the probability value of the attribute. By judging the threshold of each attribute, the attributes of the pedestrian are predicted.
[0101] Example 2
[0102] See also Figure 4 ,Another embodiment provided by the present invention: A pedestrian multi-attribute recognition system based on supervised learning, comprising: a data acquisition module, an unsupervised module, a supervised module and an attribute recognition module;
[0103] The data collection module is used to collect unsupervised pedestrian data and supervised pedestrian data, including pictures and videos, and pre-process the collected unsupervised pedestrian data and supervised pedestrian data;
[0104] The unsupervised module is used to construct an unsupervised training model and train the constructed unsupervised training model to obtain an unsupervised training model with a general pedestrian representation capability;
[0105] The supervised module is used to construct a supervised training model, perform supervised training on the unsupervised training model with general pedestrian representation capability, and send the constructed pedestrian multi-attribute dataset to the supervised training model for supervised multi-classification training;
[0106] The attribute recognition module is used to recognize pedestrian attributes in real time and predict the attributes of the pedestrian.
[0107] The supervised module includes: a supervised training model building unit and a supervised training model training unit;
[0108] The supervised training model construction unit is used for constructing a supervised training model using an unsupervised training model with general pedestrian representation capability;
[0109] The supervised training model training unit is used to send the constructed pedestrian multi-attribute dataset into the supervised training model for supervised multi-classification training, and introduce local random color jitter and local random mask mechanisms.
[0110] Example 3
[0111] Figure 51 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 5 As shown, according to another aspect of the present application, an electronic device 500 is also provided. The electronic device 500 may include one or more processors and one or more memories. The memories store computer-readable codes, and when the computer-readable codes are executed by one or more processors, a method for multi-attribute recognition of pedestrians based on supervised learning may be executed.
[0112] The method or system according to the embodiment of the present application can also be used by Figure 5 The electronic device architecture shown in FIG. Figure 5 As shown, the electronic device 500 may include a bus 501, one or more CPUs 502, ROM 503, RAM 504, a communication port 505 connected to a network, an input / output component 506, a hard disk 507, etc. The storage device in the electronic device 500, such as ROM 503 or hard disk 507, may store the pedestrian multi-attribute recognition method based on supervised learning provided in the present application. The pedestrian multi-attribute recognition method based on supervised learning may, for example, include: collecting unsupervised pedestrian data and supervised pedestrian data, including pictures and videos, and pre-processing the collected unsupervised pedestrian data and supervised pedestrian data, constructing an unsupervised training model, and training the constructed unsupervised training model to obtain an unsupervised training model with a general pedestrian representation capability, constructing a supervised training model, and conducting supervised training on the unsupervised training model with a general pedestrian representation capability, sending the constructed pedestrian multi-attribute data set to the supervised training model for supervised multi-classification training, real-time recognition of pedestrian attributes, and predicting the attributes of pedestrians. Further, the electronic device 500 may also include a user interface 508. certainly, Figure 5 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 5 One or more components of an electronic device are shown.
[0113] Example 4
[0114] Figure 6 Schematic diagram of a computer-readable storage medium structure provided by an embodiment of the present application. Figure 6As shown, a computer-readable storage medium 600 according to an embodiment of the present application is shown. Computer-readable instructions are stored on the computer-readable storage medium 600. When the computer-readable instructions are executed by the processor, the pedestrian multi-attribute recognition method based on supervised learning according to the embodiment of the present application described with reference to the above figures can be executed. The storage medium 600 includes, but is not limited to, for example, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.
[0115] It should be understood that the methods, apparatuses, and devices of the present application can be implemented in many ways. For example, the methods, apparatuses, and devices of the present application can be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is only for illustration, and the steps of the method of the present application are not limited to the order specifically described above unless otherwise specified. In addition, in some embodiments, the present application can also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present application. Therefore, the present application also covers a recording medium storing a program for executing the method according to the present application.
[0116] In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive redundancy.
[0117] The specific implementation modes as described above further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation mode of the present invention and is not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A multi-attribute pedestrian recognition method based on supervised learning, characterized in that: include: Collect unsupervised pedestrian data and supervised pedestrian data, including pictures and videos, and pre-process the collected unsupervised pedestrian data and supervised pedestrian data; Construct an unsupervised training model, and train the constructed unsupervised training model to obtain an unsupervised training model with general pedestrian representation capabilities; Construct a supervised training model, conduct supervised training on the unsupervised training model with general pedestrian representation capabilities, and send the constructed pedestrian multi-attribute dataset to the supervised training model for supervised multi-classification training; Identify pedestrian attributes in real time and predict pedestrian attributes.
2. The method for pedestrian multi-attribute recognition based on supervised learning as claimed in claim 1, characterized in that: The unsupervised training model is constructed, comprising: Build an unsupervised training framework and use the SwinTransformer model as the backbone network of the first and second networks.
3. The method for pedestrian multi-attribute recognition based on supervised learning as claimed in claim 2, characterized in that: The training of the constructed unsupervised training model includes: The preprocessed unlabeled images are input into the unsupervised training framework, and the input images are randomly cropped. The cropped images are divided into local crops and global crops. All cropped images are input into the first network, and the global cropped images are input into the second network. The final result is output to obtain the feature vector T output by the first network and the feature vector T output by the second network. glo ; Using the K-Means clustering method, the feature vector T output by the second network is glo Clustering is performed, and the feature vector T glo Divided into foreground and background, in the feature vector of the foreground, the K-Means clustering method is used again to distinguish three semantic parts, and a semantic label y is given according to the clustering result; The output feature vector T of the first network glo It is sent to the semantic classification head for semantic prediction, and the semantic prediction result Y(T glo ), and calculate the semantic prediction result Y(T glo ) and the loss of the semantic label, the specific formula is: Wherein, Lsem represents the semantic prediction result Y(T glo ) and the loss of the semantic label, N represents the number of cropped images, y i represents the semantic label of the i-th cropped image, Y(T glo ) j Represents the prediction result of the i-th cropped image.
4. The method for pedestrian multi-attribute recognition based on supervised learning as claimed in claim 3, characterized in that: The training of the constructed unsupervised training model further includes: Add the loss functions of the first network and the second network training as the total loss function L total , L total =L ce +L sem , to optimize and update the unsupervised training model, the specific formula is: Among them, θ1 represents the parameters of the first network, including all trainable weights and bias parameters in the first network, η represents the learning rate, represents the gradient of the total loss function with respect to the parameters of the first network, θ2 represents the parameters of the second network, including all trainable weights and bias parameters in the second network, ι represents the update rate of the second network, Represents the gradient of the total loss function with respect to the second network parameter.
5. The method for pedestrian multi-attribute recognition based on supervised learning as claimed in claim 4, characterized in that: The supervised training model is constructed to perform supervised training on the unsupervised training model with general pedestrian representation capability, and the constructed pedestrian multi-attribute dataset is sent to the supervised training model for supervised multi-classification training, including: Construct a supervised training model, add a multi-classification prediction head based on the attention mechanism to the unsupervised training model, and remove the self-attention mechanism in the unsupervised training model; Select the loss function to optimize the supervised training model. The specific formula of the loss function is: Among them, L cls represents the loss function, C represents the number of categories of the cropped image, and y i,c represents the c-th class true label of the i-th image after cropping, represents the predicted probability of the cth class true label of the i-th image after cropping by the supervised training model; The supervised training model is trained in a supervised manner. The constructed pedestrian multi-attribute dataset is input into the supervised training model for supervised classification training. Local random color jitter and local random mask mechanisms are introduced, and the trained supervised training model is evaluated.
6. The method for pedestrian multi-attribute recognition based on supervised learning as claimed in claim 5, characterized in that: The local random color jitter and local random mask mechanism include: The specific formula for local random color jitter is: I’(w,d)=I(w,d)+△S,ΔS∈A(0,σ 2 ), Among them, I(w, d) represents the pixel value of the image at position (w, d) in the pedestrian multi-attribute dataset, I'(w, d) represents the pixel value at position (w, d) after local color jittering in the pedestrian multi-attribute dataset, △S represents color perturbation, with a mean of 0 and a variance of σ 2 Normal distribution of The specific formula of the local random mask mechanism is: Among them, I”(w,d) represents the pixel value at position (w,d) after the image in the pedestrian multi-attribute dataset is locally randomly masked, and ζ represents the mask area.
7. A pedestrian multi-attribute recognition system based on supervised learning, used to implement the pedestrian multi-attribute recognition method based on supervised learning as described in any one of claims 1 to 6, characterized in that: include: Data collection module, unsupervised module, supervised module and attribute recognition module; The data collection module is used to collect unsupervised pedestrian data and supervised pedestrian data, including pictures and videos, and pre-process the collected unsupervised pedestrian data and supervised pedestrian data; The unsupervised module is used to construct an unsupervised training model and train the constructed unsupervised training model to obtain an unsupervised training model with a general pedestrian representation capability; The supervised module is used to construct a supervised training model, perform supervised training on the unsupervised training model with general pedestrian representation capability, and send the constructed pedestrian multi-attribute dataset to the supervised training model for supervised multi-classification training; The attribute recognition module is used to recognize pedestrian attributes in real time and predict the attributes of the pedestrian.
8. The pedestrian multi-attribute recognition system based on supervised learning as claimed in claim 7, characterized in that: The supervised module includes: a supervised training model construction unit and a supervised training model training unit; The supervised training model construction unit is used for constructing a supervised training model using an unsupervised training model with general pedestrian representation capability; The supervised training model training unit is used to send the constructed pedestrian multi-attribute dataset into the supervised training model for supervised multi-classification training, and introduce local random color jitter and local random mask mechanisms.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for multi-attribute pedestrian recognition based on supervised learning described in any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the computer instructions are executed, the steps of the pedestrian multi-attribute recognition method based on supervised learning described in any one of claims 1-6 are executed.
Citation Information
Patent Citations
Pedestrian Attribute Recognition Method Based on Joint Learning of Local and Global Pedestrian Attributes
CN110569779B
Training method of pedestrian attribute recognition model and pedestrian attribute recognition method
CN117649678A