Person Re-ID Model Training Method and Device Based on Semi-Supervised Knowledge Distillation

By using the semi-supervised knowledge distillation method to train the pedestrian re-identification model using labeled and unlabeled data, the problem of poor generalization ability of the model is solved, and the accuracy and generalization ability of the model in different scenarios are improved.

CN115546840BActive Publication Date: 2025-09-16SHENZHEN XUMI YUNTU SPACE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211302270.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-24
Publication Date
2025-09-16
Estimated Expiration
2042-10-24

AI Technical Summary

Technical Problem

The data distribution differences between different scenes in existing person re-identification models lead to poor model generalization ability, low precision and poor training effect.

Method used

A semi-supervised knowledge distillation-based method is adopted to train the pedestrian re-identification model using labeled data and unlabeled data. Pseudo labels are generated by aligning the predicted values ​​and feature maps of the teacher model and the student model, and the distillation method is optimized to improve the model's generalization ability and accuracy.

Benefits of technology

The generalization ability and accuracy of the pedestrian re-identification model in unknown domains are improved, and the distillation effect of the model is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115546840B_ABST
    Figure CN115546840B_ABST
Patent Text Reader

Abstract

The present application provides a method and device for training a person re-identification model based on semi-supervised knowledge distillation. The method includes: pre-training a teacher model and a student model respectively, inputting labeled data into the trained teacher model and student model, using the teacher model's predicted value and the true label to supervise the student model's predicted value respectively, and obtaining a first loss function and a second loss function; using the teacher model's predicted value to supervise the predicted value output by the unlabeled data classifier in the student model, and obtaining a third loss function; using the aligned feature map of the student feature extraction network and the feature map of the teacher feature extraction network to calculate a fourth loss function; calculating the total loss function based on the first loss function, the second loss function, the third loss function and the fourth loss function; and using the total loss function to update and train the person re-identification model. The present application improves the generalization ability, accuracy and recognition effect of the person re-identification model.
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 and device for training a pedestrian re-identification model based on semi-supervised knowledge distillation. Background Art

[0002] Pedestrian detection uses computer vision to identify and accurately locate pedestrians in images or video streams. This technology has a wide range of applications and can be combined with technologies such as pedestrian tracking and re-identification. It is well-suited for use in real-world scenarios such as artificial intelligence systems, assisted driving systems, intelligent video surveillance, human behavior analysis, and intelligent transportation.

[0003] Currently, the field of person re-identification has achieved very high performance in specific training scenarios. However, due to differences in data distribution between different scenarios, the model's performance degrades significantly in new test scenarios. Most commonly used unsupervised person re-identification methods are based on pseudo-labeling. The main idea is to generate high-quality pseudo-labels for unlabeled data to train and update neural networks. This method is simple and clear, and has good performance. However, existing methods for training person re-identification models based on pseudo-labeling still suffer from poor model generalization, low model accuracy, and poor training results. Summary of the Invention

[0004] In view of this, an embodiment of the present application provides a pedestrian re-identification model training method and device based on semi-supervised knowledge distillation to solve the problems of poor model generalization ability, low model accuracy and poor training effect in the existing technology.

[0005] According to a first aspect of an embodiment of the present application, a method for training a person re-identification model based on semi-supervised knowledge distillation is provided, comprising: obtaining labeled data and unlabeled data in a preset scenario, pre-training a teacher model and a student model using the labeled data to obtain a trained teacher model and a student model; inputting the labeled data into the trained teacher model and the student model, and using the predicted value of the teacher model and the true label to supervise the predicted value of the student model, respectively, to obtain a first loss function and a second loss function; inputting the unlabeled data into the trained teacher model and the student model, and using the predicted value of the teacher model to supervise the predicted value output by the unlabeled data classifier in the student model, to obtain a third loss function; aligning the feature map of the student feature extraction network with the feature map of the teacher feature extraction network, and calculating a fourth loss function using the aligned feature map of the student feature extraction network and the feature map of the teacher feature extraction network; calculating a total loss function based on the first loss function, the second loss function, the third loss function, and the fourth loss function; updating the original loss function of the person re-identification model using the total loss function, and training the person re-identification model after the updated loss function using the training set.

[0006] According to a second aspect of an embodiment of the present application, a person re-identification model training device based on semi-supervised knowledge distillation is provided, comprising: a pre-training module, configured to obtain labeled data and unlabeled data in a preset scenario, and pre-train a teacher model and a student model using the labeled data to obtain a trained teacher model and a student model; a first supervision module, configured to input the labeled data into the trained teacher model and the student model, and use the predicted value of the teacher model and the true label to supervise the predicted value of the student model, to obtain a first loss function and a second loss function; a second supervision module, configured to input the unlabeled data into the trained teacher model and the student model, and use the teacher model to supervise the predicted value of the student model, to obtain a first loss function and a second loss function; The predicted value of the model is used to supervise the predicted value output by the unlabeled data classifier in the student model to obtain a third loss function; the third supervision module is configured to align the feature map of the student feature extraction network with the feature map of the teacher feature extraction network, and use the aligned feature map of the student feature extraction network and the feature map of the teacher feature extraction network to calculate the fourth loss function; the calculation module is configured to calculate the total loss function based on the first loss function, the second loss function, the third loss function and the fourth loss function; the training module is configured to use the total loss function to update the original loss function of the pedestrian re-identification model, and use the training set to train the pedestrian re-identification model after the updated loss function.

[0007] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the processor executes the program.

[0008] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:

[0009] By obtaining labeled data and unlabeled data in a preset scenario, the labeled data is used to pre-train the teacher model and student model respectively to obtain the trained teacher model and student model; the labeled data is input into the trained teacher model and student model, and the predicted value of the teacher model and the true label are used to supervise the predicted value of the student model respectively to obtain the first loss function and the second loss function; the unlabeled data is input into the trained teacher model and student model, and the predicted value of the teacher model is used to supervise the predicted value output by the unlabeled data classifier in the student model to obtain the third loss function; the feature map of the student feature extraction network is aligned with the feature map of the teacher feature extraction network, and the fourth loss function is calculated using the feature map of the aligned student feature extraction network and the feature map of the teacher feature extraction network; the total loss function is calculated based on the first loss function, the second loss function, the third loss function and the fourth loss function; the original loss function of the pedestrian re-identification model is updated using the total loss function, and the pedestrian re-identification model after the updated loss function is trained using the training set. This application improves the generalization ability of the pedestrian re-identification model for unknown domains, improves the accuracy of the pedestrian re-identification model, and improves the distillation effect of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. 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 any creative work.

[0011] Figure 1 This is a schematic diagram of generating a loss function based on semi-supervised knowledge distillation provided in an embodiment of the present application;

[0012] Figure 2 Schematic diagram of the process of the pedestrian re-identification model training method based on semi-supervised knowledge distillation provided in an embodiment of the present application;

[0013] Figure 3 Schematic diagram of the structure of a person re-identification model training device based on semi-supervised knowledge distillation provided in an embodiment of the present application;

[0014] Figure 4 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0015] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0016] As described in the background technology, the field of pedestrian re-identification has achieved very high performance in specific training scenarios. However, due to the differences in data distribution between different scenarios, the performance of the model in new test scenarios has dropped significantly. Most of the currently commonly used unsupervised pedestrian re-identification methods are based on pseudo-labeling methods. The main idea is to generate high-quality pseudo-labels for unlabeled data to train and update neural networks. This method is simple and clear and has good performance. However, the existing methods of training pedestrian re-identification models based on pseudo-labeling still have problems such as poor model generalization ability, low model accuracy, and poor training effect. Therefore, how to effectively utilize unlabeled data in new scenarios to train pedestrian re-identification models suitable for new scenarios is one of the problems that need to be solved urgently in the field of pedestrian re-identification.

[0017] In view of this, the embodiments of the present application provide a person re-identification model training method based on semi-supervised knowledge distillation to solve the above problems. By using labeled data and unlabeled data to train a ReID model (pedestrian re-identification model) with better generalization performance, to further improve the generalization ability of the model, the present application uses a distillation-based method to generate pseudo labels and optimizes the distillation method to further improve the model accuracy. The content of the technical solution of this application is described in detail below with reference to the accompanying drawings and specific embodiments.

[0018] Figure 1 This is a schematic diagram of the loss function generation based on semi-supervised knowledge distillation provided in the embodiment of the present application, such as Figure 1 As shown, the loss function generation process based on semi-supervised knowledge distillation can specifically include:

[0019] First, the teacher model and student model are trained on labeled data. The teacher model corresponds to Figure 1 The dotted box on the right side of the figure corresponds to the student model. Figure 1 In the left dotted box, the labeled data and unlabeled data are input into the student model on the left and the teacher model on the right, respectively. The feature extraction network in the student model and the feature extraction network in the teacher model are used to extract features, and the feature map f is obtained. s and f tHere, the student model uses Resnet18 as the backbone (feature extraction network), and the teacher model uses Resnet101 as the backbone (feature extraction network).

[0020] Furthermore, during the logits distillation phase (prediction distillation), for labeled data, the student model simultaneously learns and optimizes on both the soft labels predicted by the teacher model and the ground truth hard labels. Output distillation uses the logits_t (prediction value) output by the teacher model as the ground truth (real label) to supervise the logits_s (prediction value) output by the student model, calculating the loss function Loss1. Loss1 uses the JS divergence loss function. At the same time, the groundtruth hard labels also supervise the logits_s output by the student model, resulting in the loss function Loss2, which uses the cross-entropy loss function.

[0021] For unlabeled data, a classifier classfier_s' with the same dimension as the labeled data classifier is generated in the student network, and then the predicted logit_t' of the teacher network is used to supervise the predicted logits_s' output by the classifier to obtain the loss function Loss3. The loss function Loss3 adopts the JS divergence loss function.

[0022] Furthermore, in the features distillation stage (feature distillation), due to the difference in the structure of the Teacher model and the Student model, when distilling the feature layer, the receptive fields of the corresponding layers of the Student model and the Teacher model are different. If the pixel-wise similarity in the feature map is directly compared, there will be a problem of semantic misalignment. Therefore, this application develops a semantic alignment module (SAM), which reconstructs the corresponding components of the student features and generates student features that are aligned with the target teacher features. Finally, according to the reconstructed student features f s ′ and teacher characteristics f t The loss function Loss4 is obtained, and the loss function Loss4 uses the L2 function for distance measurement.

[0023] The following is based on Figure 1 The loss function generation process based on semi-supervised knowledge distillation shown in the figure describes in detail the implementation process of the pedestrian re-identification model training method based on semi-supervised knowledge distillation in this application.

[0024] Figure 2 This is a flow chart of the pedestrian re-identification model training method based on semi-supervised knowledge distillation provided in an embodiment of the present application. Figure 2The pedestrian re-identification model training method based on semi-supervised knowledge distillation can be executed by the server. Figure 2 As shown, the pedestrian re-identification model training method based on semi-supervised knowledge distillation may specifically include:

[0025] S201, obtaining labeled data and unlabeled data in a preset scenario, and pre-training a teacher model and a student model using the labeled data to obtain a trained teacher model and a trained student model;

[0026] S202, inputting the labeled data into the trained teacher model and student model, using the teacher model's predicted value and the true label to supervise the student model's predicted value, and obtaining a first loss function and a second loss function;

[0027] S203, inputting the unlabeled data into the trained teacher model and student model, using the predicted value of the teacher model to supervise the predicted value output by the unlabeled data classifier in the student model, and obtaining a third loss function;

[0028] S204, aligning the feature graph of the student feature extraction network with the feature graph of the teacher feature extraction network, and calculating a fourth loss function using the aligned feature graph of the student feature extraction network and the feature graph of the teacher feature extraction network;

[0029] S205, calculating a total loss function based on the first loss function, the second loss function, the third loss function, and the fourth loss function;

[0030] S206 , using the total loss function to update the original loss function of the person re-identification model, and using the training set to train the person re-identification model after the updated loss function.

[0031] Specifically, this embodiment uses a semi-supervised distillation method to train a student model using both labeled and unlabeled data, adding soft-labeled data. The teacher model's parameters are frozen, and the student model is trained and optimized solely through predictions from the teacher model. During this process, the student model's parameters are backpropagated.

[0032] In some embodiments, after obtaining the trained teacher model and student model, the method further includes: inputting labeled data and unlabeled data into the trained teacher model and student model respectively, extracting feature maps using the teacher feature extraction network in the trained teacher model, and extracting feature maps using the student feature extraction network in the trained student model.

[0033] Specifically, the teacher model contains a feature extraction network for extracting feature maps, and the student model also contains a feature extraction network for extracting feature maps. After the labeled data and unlabeled data are input into the trained teacher model and student model respectively, the feature extraction network in the teacher model is used to extract the feature map f t , and use the feature extraction network in the student model to extract the feature map f s In practical applications, the feature extraction network in the student model can use Resnet18, that is, Resnet18 is used as the backbone of the student model, and the feature extraction network in the teacher model can use Resnet101, that is, Resnet101 is used as the backbone of the teacher model.

[0034] In some embodiments, the predicted value of the teacher model is used to supervise the predicted value of the student model to obtain a first loss function, including: using the predicted value output by the teacher model as a label, and using the label and the predicted value output by the student model to calculate the first loss function, wherein the first loss function adopts the JS divergence loss function.

[0035] Specifically, in logits distillation, for labeled data, output distillation uses the teacher model's logits_t (predicted value) for labeled data as the ground truth to supervise the student model's output of logits_s (predicted value) for labeled data to calculate the first loss function Loss1. In practical applications, the first loss function Loss1 can use the JS divergence loss function.

[0036] Furthermore, in the embodiment of the present application, the classification layer outputs of the teacher model and the student model are both set to logits, and after the softmax function (normalization), it can be obtained:

[0037]

[0038] Among them, k is the current sample category, K is the total number of categories, and τ is the temperature coefficient (set to 16 here).

[0039] In a specific example, the JS divergence loss Loss1 formula for labeled data is as follows:

[0040]

[0041] Among them, logits_t represents the predicted value of the teacher model for the labeled data, and logits_s represents the predicted value of the student model for the labeled data.

[0042] In some embodiments, the true labels corresponding to the labeled data are used to supervise the predicted values ​​of the student model to obtain a second loss function, including: calculating the second loss function by combining the true labels of the labeled data with the predicted values ​​output by the student model, wherein the second loss function adopts a cross entropy loss function.

[0043] Specifically, in addition to calculating the first loss function based on the predicted value output by the teacher model and the predicted value output by the student model, the true label Ground truth of the labeled data in the embodiment of the present application also needs to supervise the predicted value logits_s output by the student model, thereby constructing the second loss function Loss2. In actual applications, the second loss function Loss2 adopts the cross entropy loss function.

[0044] Furthermore, the true label here refers to the label corresponding to the labeled data, and the predicted value output by the student model is the value predicted by the student model for the labeled data. The formula of the second loss function Loss2 is as follows:

[0045]

[0046] Among them, y i is the category of sample i, and logits_s represents the predicted value of the student model for labeled data.

[0047] In some embodiments, the predicted value of the teacher model is used to supervise the predicted value output by the unlabeled data classifier in the student model to obtain a third loss function, including: generating an unlabeled data classifier with the same dimension as the labeled data classifier in the student model, using the predicted value output by the teacher model as the label, and using the label and the predicted value output by the unlabeled data classifier to calculate the third loss function, wherein the third loss function adopts the JS divergence loss function.

[0048] Specifically, for unlabeled data, first generate an unlabeled data classifier classfier_s' with the same dimension as the labeled data classifier in the student model, and then use the teacher model's predicted value logit_t' for the unlabeled data to supervise the output of the student model, that is, supervise the predicted value logits_s' output by the unlabeled data classifier, thereby obtaining the third loss function Loss3. In practical applications, the third loss function Loss3 can use the JS divergence loss function.

[0049] Furthermore, the JS divergence loss Loss3 formula for unlabeled data is as follows:

[0050]

[0051] Among them, logits_t′ represents the predicted value of the teacher model for unlabeled data, and logits_s′ represents the predicted value of the student model for unlabeled data.

[0052] In some embodiments, the feature map of the student feature extraction network is aligned with the feature map of the teacher feature extraction network, including: using a predetermined semantic alignment module to calculate the similarity weight between the feature map of the student feature extraction network and the feature map of the teacher feature extraction network, and reconstructing the feature map of the student feature extraction network based on the similarity weight so that the feature map of the reconstructed student feature extraction network is aligned with the feature map of the teacher feature extraction network.

[0053] Specifically, since the student model is a lightweight model with fewer convolutional layers, while the teacher model has more convolutional layers, the teacher model has a larger receptive field. As a result, the receptive fields of the feature maps extracted by the feature extraction network of the teacher model and the feature maps extracted by the feature extraction network of the student model are different, that is, the semantic information between the two is different. If distillation is performed directly, the distillation effect will be poor due to the misalignment of the semantic information. Therefore, the embodiment of the present application uses a semantic alignment model to align the semantics of the two feature maps before performing the distillation algorithm.

[0054] Furthermore, due to the difference in the structure of the Teacher model and the Student model, the receptive fields of the corresponding layers of the Student and Teacher are different when distilling the feature layer. If the pixel-wise similarity in the feature map is directly compared, there will be a problem of semantic misalignment. Therefore, the embodiment of the present application develops a semantic alignment module (SAM), which is used to reconstruct the corresponding components of the student features and generate student features that are aligned with the target teacher features. The semantic alignment module uses the following formula to reconstruct the feature map of the student feature extraction network:

[0055] f′ s =sigmoid(F q (f s )·F k (f t ) T )·F v (f s )

[0056] Among them, Fq, Fk, and Fv are linear functions composed of Conv2D+BN layers.

[0057] It should be noted that when using the above formula to calculate the feature map of the reconstructed student model, the similarity weight is first calculated between the feature map of the student model and the feature map of the teacher model to obtain the similarity weight coefficient, and the similarity weight coefficient is multiplied by the feature map extracted by the student model to obtain the reconstructed student model feature map f s ′.

[0058] In some embodiments, a fourth loss function is calculated using the aligned feature graph of the student feature extraction network and the feature graph of the teacher feature extraction network, including: constructing a fourth loss function using the reconstructed feature graph of the student feature extraction network and the feature graph of the teacher feature extraction network.

[0059] Specifically, during feature distillation (i.e., feature distillation), the reconstructed student model feature map f is obtained s ′After that, according to the reconstructed student model feature map f s ′ and the feature map f of the teacher model t The fourth loss function Loss4 is calculated. In practical applications, the fourth loss function Loss4 uses the L2 function for distance measurement. The formula of the feature loss function Loss4 is as follows:

[0060] Loss4=||f s ′-f t ||2

[0061] Among them, f s ′ represents the feature map of the reconstructed student feature extraction network, f t Represents the feature map of the teacher feature extraction network.

[0062] In some embodiments, a total loss function is calculated based on the first loss function, the second loss function, the third loss function, and the fourth loss function, including using the following formula to calculate the total loss function:

[0063] L sum =Loss1+Loss2+Loss3+α*Loss4

[0064] Among them, L sum Represents the total loss function, Loss1 represents the first loss function, Loss2 represents the second loss function, Loss3 represents the third loss function, Loss4 represents the fourth loss function, and α represents the hyperparameter.

[0065] Specifically, after respectively calculating the first loss function Loss1, the second loss function Loss2, the third loss function Loss3 and the fourth loss function Loss4, these four loss functions are added together to obtain the final total loss function L sum .

[0066] Furthermore, the total loss function L is calculated sum Afterwards, the total loss function is used to update the original loss function of the pedestrian re-identification model. For example, the total loss function is used to replace the original loss function (i.e., the original loss function) in the pedestrian re-identification model to update the loss function of the pedestrian re-identification model, and the training set is used to train the pedestrian re-identification model after the updated loss function.

[0067] According to the technical solution provided in the embodiments of the present application, the present application uses labeled data and unlabeled data to train a ReID model (pedestrian re-identification model) with better generalization performance. In order to further improve the generalization ability of the model, the present application uses a distillation-based method to generate pseudo-labels and optimizes the distillation method to further improve the model accuracy. The present application designs a new ReID training framework based on semi-supervised distillation, which can improve the generalization ability of the recognition model for unknown domains by combining labeled data and unlabeled data for joint training; in addition, for feature distillation, the present application develops a semantic alignment module to improve the distillation effect.

[0068] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0069] Figure 3 Schematic diagram of the structure of the pedestrian re-identification model training device based on semi-supervised knowledge distillation provided in the embodiment of the present application. Figure 3 As shown, the pedestrian re-identification model training device based on semi-supervised knowledge distillation includes:

[0070] The pre-training module 301 is configured to obtain labeled data and unlabeled data in a preset scenario, and pre-train the teacher model and the student model using the labeled data to obtain the trained teacher model and the student model;

[0071] A first supervision module 302 is configured to input labeled data into the trained teacher model and student model, and use the teacher model's prediction value and the true label to supervise the student model's prediction value, thereby obtaining a first loss function and a second loss function;

[0072] The second supervision module 303 is configured to input unlabeled data into the trained teacher model and student model, and use the prediction value of the teacher model to supervise the prediction value output by the unlabeled data classifier in the student model to obtain a third loss function;

[0073] The third supervision module 304 is configured to align the feature map of the student feature extraction network with the feature map of the teacher feature extraction network, and calculate a fourth loss function using the aligned feature map of the student feature extraction network and the feature map of the teacher feature extraction network;

[0074] A calculation module 305 is configured to calculate a total loss function based on the first loss function, the second loss function, the third loss function, and the fourth loss function;

[0075] The training module 306 is configured to update the original loss function of the person re-identification model using the total loss function, and train the person re-identification model after the updated loss function using the training set.

[0076] In some embodiments, Figure 3 After obtaining the trained teacher model and student model, the pre-training module 301 inputs the labeled data and the unlabeled data into the trained teacher model and the student model respectively, uses the teacher feature extraction network in the trained teacher model to extract the feature map, and uses the student feature extraction network in the trained student model to extract the feature map.

[0077] In some embodiments, Figure 3 The first supervision module 302 uses the prediction value of the teacher model to supervise the prediction value of the student model to obtain a first loss function, including: using the prediction value output by the teacher model as a label, and using the label and the prediction value output by the student model to calculate the first loss function, wherein the first loss function adopts the JS divergence loss function.

[0078] In some embodiments, Figure 3 The first supervision module 302 uses the true label corresponding to the labeled data to supervise the predicted value of the student model to obtain a second loss function, including: calculating the second loss function by combining the true label of the labeled data with the predicted value output by the student model, wherein the second loss function adopts a cross entropy loss function.

[0079] In some embodiments, Figure 3 The second supervision module 303 generates an unlabeled data classifier with the same dimension as the labeled data classifier in the student model, uses the predicted value output by the teacher model as the label, and uses the label and the predicted value output by the unlabeled data classifier to calculate the third loss function, wherein the third loss function adopts the JS divergence loss function.

[0080] In some embodiments, Figure 3The third supervision module 304 uses a predetermined semantic alignment module to calculate the similarity weight between the feature map of the student feature extraction network and the feature map of the teacher feature extraction network, and reconstructs the feature map of the student feature extraction network based on the similarity weight so that the feature map of the reconstructed student feature extraction network is aligned with the feature map of the teacher feature extraction network.

[0081] In some embodiments, Figure 3 The third supervision module 304 constructs a fourth loss function using the reconstructed feature map of the student feature extraction network and the feature map of the teacher feature extraction network.

[0082] In some embodiments, Figure 3 The calculation module 305 uses the following formula to calculate the total loss function:

[0083] L sum =Loss1+Loss2+Loss3+α*Loss4

[0084] Among them, L sum Represents the total loss function, Loss1 represents the first loss function, Loss2 represents the second loss function, Loss3 represents the third loss function, Loss4 represents the fourth loss function, and α represents the hyperparameter.

[0085] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0086] Figure 4 Schematic diagram of the structure of the electronic device 4 provided in the embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps of the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0087] For example, computer program 403 may be divided into one or more modules / units, which are stored in memory 402 and executed by processor 401 to implement the present application. One or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of computer program 403 in electronic device 4.

[0088] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include but is not limited to a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation of the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0089] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0090] Memory 402 can be an internal storage unit of electronic device 4, such as a hard drive or memory of electronic device 4. Memory 402 can also be an external storage device of electronic device 4, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on electronic device 4. Furthermore, memory 402 can include both an internal storage unit of electronic device 4 and an external storage device. Memory 402 is used to store computer programs and other programs and data required by the electronic device. Memory 402 can also be used to temporarily store data that has been output or is about to be output.

[0091] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0092] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0093] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0094] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer equipment and methods can be implemented in other ways. For example, the apparatus / computer equipment embodiments described above are merely schematic. For example, the division of modules or units is merely a logical function division. In actual implementation, there may be other division methods. Multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of the apparatus or unit, which may be electrical, mechanical or other forms.

[0095] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0096] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0097] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0098] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A person re-identification model training method based on semi-supervised knowledge distillation, characterized by: include: Obtaining labeled data and unlabeled data in a preset scenario, and pre-training the teacher model and the student model using the labeled data to obtain the trained teacher model and the student model; Inputting the labeled data into the trained teacher model and the student model, and using the predicted value of the teacher model and the true label to supervise the predicted value of the student model, respectively, to obtain a first loss function and a second loss function; Inputting the unlabeled data into the trained teacher model and the student model, and using the predicted value of the teacher model to supervise the predicted value output by the unlabeled data classifier in the student model to obtain a third loss function; Aligning a feature map of the student feature extraction network with a feature map of the teacher feature extraction network, and calculating a fourth loss function using the aligned feature map of the student feature extraction network and the feature map of the teacher feature extraction network; Calculate a total loss function based on the first loss function, the second loss function, the third loss function, and the fourth loss function; The total loss function is used to update the original loss function of the pedestrian re-identification model, and the pedestrian re-identification model after the updated loss function is trained using the training set.

2. The method according to claim 1, characterized in that After obtaining the trained teacher model and student model, the method further includes: The labeled data and the unlabeled data are respectively input into the trained teacher model and the student model, and the feature map is extracted using the teacher feature extraction network in the trained teacher model, and the feature map is extracted using the student feature extraction network in the trained student model.

3. The method according to claim 1, characterized in that The prediction value of the teacher model is used to supervise the prediction value of the student model to obtain a first loss function, including: The predicted value output by the teacher model is used as a label, and the first loss function is calculated using the label and the predicted value output by the student model, wherein the first loss function adopts the JS divergence loss function.

4. The method according to claim 1, wherein The true labels corresponding to the labeled data are used to supervise the predicted values ​​of the student model to obtain a second loss function, including: A second loss function is calculated by combining the true label of the labeled data with the predicted value output by the student model, wherein the second loss function adopts a cross entropy loss function.

5. The method according to claim 1, characterized in that The method uses the predicted value of the teacher model to supervise the predicted value output by the unlabeled data classifier in the student model to obtain a third loss function, including: An unlabeled data classifier with the same dimension as the labeled data classifier is generated in the student model, the predicted value output by the teacher model is used as the label, and the third loss function is calculated using the label and the predicted value output by the unlabeled data classifier, wherein the third loss function adopts the JS divergence loss function.

6. The method according to claim 1, characterized in that The aligning the feature map of the student feature extraction network with the feature map of the teacher feature extraction network includes: A predetermined semantic alignment module is used to calculate the similarity weight between the feature map of the student feature extraction network and the feature map of the teacher feature extraction network, and the feature map of the student feature extraction network is reconstructed based on the similarity weight so that the feature map of the reconstructed student feature extraction network is aligned with the feature map of the teacher feature extraction network.

7. The method according to claim 6, characterized in that The fourth loss function is calculated using the aligned feature graph of the student feature extraction network and the feature graph of the teacher feature extraction network, including: The fourth loss function is constructed using the feature graph of the reconstructed student feature extraction network and the feature graph of the teacher feature extraction network.

8. The method according to claim 1, characterized in that The total loss function is calculated based on the first loss function, the second loss function, the third loss function, and the fourth loss function, including using the following formula to calculate the total loss function: L sum =Loss1+Loss2+Loss3+α*Loss4 Among them, L sum Represents the total loss function, Loss1 represents the first loss function, Loss2 represents the second loss function, Loss3 represents the third loss function, Loss4 represents the fourth loss function, and α represents the hyperparameter.

9. A person re-identification model training device based on semi-supervised knowledge distillation, characterized in that: include: A pre-training module is configured to obtain labeled data and unlabeled data in a preset scenario, and use the labeled data to pre-train the teacher model and the student model respectively to obtain the trained teacher model and the student model; A first supervision module is configured to input the labeled data into the trained teacher model and the student model, and use the predicted value of the teacher model and the true label to supervise the predicted value of the student model to obtain a first loss function and a second loss function; A second supervision module is configured to input the unlabeled data into the trained teacher model and the student model, and use the predicted value of the teacher model to supervise the predicted value output by the unlabeled data classifier in the student model to obtain a third loss function; a third supervision module, configured to align a feature map of the student feature extraction network with a feature map of the teacher feature extraction network, and calculate a fourth loss function using the aligned feature map of the student feature extraction network and the feature map of the teacher feature extraction network; a calculation module configured to calculate a total loss function based on the first loss function, the second loss function, the third loss function, and the fourth loss function; The training module is configured to use the total loss function to update the original loss function of the pedestrian re-identification model, and use the training set to train the pedestrian re-identification model after the updated loss function.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 8 when executing the program.

Citation Information

Patent Citations

  • Face spoofing detection method and system based on meta-pseudo labels and illumination invariant features

    CN114067444A

  • Model compression method, system, terminal, and storage medium

    WO2021197223A1