Pedestrian re-identification model training method and device, electronic equipment and storage medium

Through knowledge distillation and random intensity occlusion technology, the pedestrian re-identification model is trained, which solves the problem of low accuracy of the pedestrian re-identification model in the existing technology in the case of occlusion, and improves the robustness and generalization ability of the model.

CN119516577APending Publication Date: 2025-02-25BEIJING ZHIDA TIANJIE COMMERCIAL OPERATION MANAGEMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411533778.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing pedestrian recognition model has low accuracy when processing pedestrian images with occlusion, making it difficult to fully learn feature representations in occlusion.

Method used

Train the teacher model and student model through knowledge distillation, obtain the pedestrian re-identification training set and perform feature extraction, random intensity occlusion enhances feature vectors, use feature prediction network to predict occlusion intensity, and supervise student model updates through stable signals provided by the teacher model parameter.

Benefits of technology

It improves the robustness and generalization ability of the model in occlusion situations, and enhances the accuracy and performance of the pedestrian re-identification model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119516577A_ABST
    Figure CN119516577A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision, and provides a pedestrian re-recognition model training method and device, electronic equipment and a storage medium. The method comprises the following steps: inputting a training image into a student model, performing feature extraction on the training image, and performing random intensity shielding on a local feature vector obtained by feature extraction to obtain an enhanced feature vector; inputting the enhanced feature vector and the first initial category feature vector into a feature prediction network of a student model to obtain a first feature vector and predicted shielding intensity of the sub-image; inputting the training image into a teacher model to obtain a second feature vector; and monitoring the first feature vector by using the second feature vector, predicting the shielding intensity by using the random shielding intensity monitoring sub-image, updating the parameter of the student model and the parameter of the teacher model, and determining the trained teacher model as the pedestrian re-identification model, thereby improving the performance of the pedestrian re-identification model under the shielding condition. And the robustness and generalization ability of the pedestrian re-identification model are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer vision technology, and in particular to a training method, device, electronic device and storage medium for a pedestrian re-identification model. Background Art

[0002] Person re-identification is an important branch of computer vision, which aims to identify the same pedestrian under different camera perspectives. This technology is widely used in security monitoring, intelligent transportation, human-computer interaction and other fields. The current person re-identification model has become mature, but person re-identification with occlusion is still very challenging. The existing method relies on a large amount of data or data enhancement methods to simulate occlusion to improve robustness. However, the number of occluded images in the current dataset is small and the occlusion quality is uneven, which may make it difficult for the model to fully learn the feature representation under occlusion during training. The data enhancement method relies on manually designed enhancement blocks, such as rotation and cropping. Although the obtained enhancement blocks can simulate some occlusion situations, they may not fully cover all occlusion scenarios in actual applications. In addition, the manually designed enhancement blocks may be too simple or too complex, resulting in the inability to learn effective feature representations from them. Since the neural network has a strong learning ability, it may learn the patterns in the data enhancement method instead of learning the real occlusion features, resulting in poor performance of the model in the face of new occlusion situations, thereby reducing the robustness of the model. Summary of the invention

[0003] In view of this, the embodiments of the present disclosure provide a training method, device, electronic device and storage medium for a pedestrian re-identification model to solve the problem in the prior art that the pedestrian re-identification model has low accuracy in processing pedestrian images with occlusions.

[0004] According to a first aspect of an embodiment of the present disclosure, a method for training a person re-identification model is provided, comprising:

[0005] Obtain a person re-identification training set, where the person re-identification training set includes multiple training images;

[0006] Input each training image into the feature embedding layer of the student model, perform feature extraction on each training image, and obtain a first initial local feature vector of multiple sub-images of each training image and a first initial category feature vector of each training image;

[0007] Inputting the first initial local feature vector of each sub-image of each training image into the feature enhancement layer of the student model, performing random intensity masking on the first initial local feature vector of each sub-image of each training image, and obtaining the enhanced feature vector of each sub-image of each training image;

[0008] Inputting the enhanced feature vectors of the multiple sub-images of each training image and the first initial category feature vector of each training image into the feature prediction network of the student model to obtain the first feature vector of each training image and the predicted occlusion strength of each sub-image of each training image;

[0009] Input each training image into the teacher model, perform feature processing on each training image for re-identification, and obtain a second feature vector of each training image;

[0010] The first eigenvectors of each training image output by the teacher model are used to supervise the first eigenvectors of each training image output by the student model to obtain a first loss value, and the predicted occlusion intensity of each sub-image of each training image is supervised by the random occlusion intensity of the first initial local eigenvector of each sub-image of each training image to obtain a second loss value, and the parameters of the student model are updated according to the first loss value and the second loss value, and the parameters of the teacher model are updated according to the student model, and the trained teacher model is determined as the pedestrian re-identification model.

[0011] According to a second aspect of the embodiments of the present disclosure, a training device for a person re-identification model is provided, comprising:

[0012] An acquisition module is configured to acquire a person re-identification training set, where the person re-identification training set includes a plurality of training images;

[0013] A feature extraction module is configured to input each training image into a feature embedding layer of a student model, perform feature extraction on each training image, and obtain a first initial local feature vector of a plurality of sub-images of each training image and a first initial category feature vector of each training image;

[0014] A feature enhancement module is configured to input the first initial local feature vector of each sub-image of each training image into the feature enhancement layer of the student model, and perform random intensity masking on the first initial local feature vector of each sub-image of each training image to obtain an enhanced feature vector of each sub-image of each training image;

[0015] A feature prediction module is configured to input the enhanced feature vectors of the multiple sub-images of each training image and the first initial category feature vector of each training image into the feature prediction network of the student model to obtain the first feature vector of each training image and the predicted occlusion strength of each sub-image of each training image;

[0016] The teacher model feature processing module is configured to input each training image into the teacher model, perform feature processing on each training image for re-identification, and obtain a second feature vector of each training image;

[0017] The updating module is configured to supervise the first eigenvector of each training image output by the student model using the second eigenvector of each training image output by the teacher model to obtain a first loss value, and supervise the predicted occlusion intensity of each sub-image of each training image using the random occlusion intensity of the first initial local eigenvector of each sub-image of each training image to obtain a second loss value, and update the parameters of the student model according to the first loss value and the second loss value, update the parameters of the teacher model according to the student model, and determine the trained teacher model as the pedestrian re-identification model.

[0018] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0019] According to a fourth aspect of an embodiment of the present disclosure, a readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0020] Compared with the prior art, the disclosed embodiment has the following beneficial effects: the teacher model and the student model are trained by knowledge distillation, the pedestrian re-identification training set is input into the student model, the feature extraction is performed on each training image, the feature information of the image is preliminarily extracted, and the basis for subsequent feature enhancement and prediction is provided, and the first initial local feature vectors of multiple sub-images of each training image and the first initial category feature vectors of each training image are obtained. The first initial local feature vectors of each sub-image of each training image are input into the feature enhancement layer, random intensity occlusion is performed to simulate the occlusion situation, and the robustness of the model to occlusion is enhanced to obtain the enhanced feature vectors of each sub-image of each training image. The enhanced feature vectors of each sub-image of each training image and the first initial category feature vectors of each training image are input into the feature prediction network of the student model, and by predicting the occlusion strength, it is possible to learn how to extract useful features under occlusion, and integrate local and global information to obtain the first feature vectors of each training image and the predicted occlusion strength of each sub-image of each training image. The training image is input into the teacher model to obtain the second feature vector of each training image, and the teacher model provides a stable guidance signal to help the student model learn a more robust feature representation. The first eigenvector output by the student model is supervised by the second eigenvector output by the teacher model to obtain a first loss value, the actual occlusion intensity is supervised by the predicted occlusion intensity to obtain a second loss value, and the parameters of the student model are updated according to the first loss value and the second loss value, and the parameters of the teacher model are updated according to the student model. The performance and robustness of the model are improved through the knowledge distillation of the teacher-student model, and the trained teacher model is determined as the final pedestrian re-identification model. The method proposed in the present disclosure can learn more complex and diverse occlusion situations and improve the robustness of the model through random intensity occlusion and feature prediction network. At the same time, the knowledge distillation process of the teacher-student model helps to learn more generalized and robust feature representations, solve the problem of low accuracy of pedestrian re-identification models in the prior art in processing pedestrian images with occlusion, improve the performance of the pedestrian re-identification model under occlusion, and enhance the robustness and generalization ability of the pedestrian re-identification model. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0022] Figure 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure;

[0023] Figure 2It is a flowchart of a method for training a pedestrian re-identification model provided by an embodiment of the present disclosure;

[0024] Figure 3 is a structural diagram of a feature prediction network of a student model provided by an embodiment of the present disclosure;

[0025] Figure 4 is a structural schematic diagram corresponding to a training method of a pedestrian re-identification model provided in an embodiment of the present disclosure;

[0026] Figure 5 is a structural schematic diagram of a training device for a pedestrian re-identification model provided by an embodiment of the present disclosure;

[0027] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure 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 obstructing the description of the present disclosure with unnecessary details.

[0029] A method and device for training a pedestrian re-identification model according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0030] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.

[0031] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the above electronic devices. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0032] The server 4 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 4 may be a single server, or a server cluster composed of several servers, or a cloud computing service center, which is not limited in the embodiments of the present disclosure.

[0033] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present disclosure are not limited to this.

[0034] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present disclosure.

[0035] The user can establish a communication connection with the server 4 via the network 5 through the terminal devices 1, 2 and 3 to receive or send information, etc. Specifically, the server 4 obtains a pedestrian re-identification training set, which includes multiple training images; each training image is input into the feature embedding layer of the student model, and features are extracted for each training image to obtain the first initial local feature vectors of multiple sub-images of each training image and the first initial category feature vectors of each training image; the first initial local feature vectors of each sub-image of each training image are input into the feature enhancement layer of the student model, and the first initial local feature vectors of each sub-image of each training image are randomly intensity masked to obtain enhanced feature vectors of each sub-image of each training image; the enhanced feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image are input into the feature prediction network of the student model to obtain to the first eigenvector of each training image and the predicted occlusion strength of each sub-image of each training image; input each training image into the teacher model, perform feature processing for re-identification of each training image, and obtain the second eigenvector of each training image; use the second eigenvector of each training image output by the teacher model to supervise the first eigenvector of each training image output by the student model, and obtain a first loss value; and use the random occlusion strength of the first initial local eigenvector of each sub-image of each training image to supervise the predicted occlusion strength of each sub-image of each training image, and obtain a second loss value; update the parameters of the student model according to the first loss value and the second loss value, update the parameters of the teacher model according to the student model, and determine the trained teacher model as the pedestrian re-identification model.

[0036] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present disclosure are not limited to this.

[0037] Figure 2 It is a flowchart of a method for training a pedestrian re-identification model provided in an embodiment of the present disclosure. Figure 2 The training method of the pedestrian re-identification model can be obtained by Figure 1 Server 4 executes. Figure 2 As shown, the training method of the pedestrian re-identification model includes:

[0038] Step 201: Obtain a person re-identification training set, where the person re-identification training set includes a plurality of training images.

[0039] Specifically, obtaining a person re-identification training set is the first step in building and training a person re-identification model. The person re-identification training set contains multiple training images. The training images can be pedestrian images taken from multiple camera perspectives. Each image contains the visual features of the pedestrian, such as clothing, posture, color, etc. These features are very important for matching pedestrians across cameras for pedestrian re-identification. The person re-identification training set provides a learning basis for the model, which learns how to distinguish different pedestrians by analyzing and processing the features in these training images. In addition, the training images in the above-mentioned person re-identification training set are all unobstructed images.

[0040] Step 202, input each training image into the feature embedding layer of the student model, perform feature extraction on each training image, and obtain a first initial local feature vector of multiple sub-images of each training image and a first initial category feature vector of each training image.

[0041] In some embodiments, the teacher-student framework composed of the student model and the teacher model can also be called knowledge distillation, which has been widely used in various computer vision and machine learning tasks, such as model compression, knowledge transfer, etc. In general, the common feature of the teacher-student framework is to transfer knowledge from one network, namely the teacher model, to another network, namely the student model. The difference lies in what is transferred between them. The present disclosure trains the student model and the teacher model in a knowledge distillation-based manner, and imitates the human learning process by extracting the second feature vector of the training image output by the teacher model and the first feature vector of the training image output by the student model. The student model includes a feature embedding layer, a feature enhancement layer, and a feature prediction network. Each training image is input into the feature embedding layer of the student model, and features are extracted from the input training image, and the original input image is converted into a set of meaningful feature vectors. The obtained feature vector can better capture the key information in the training image, which is convenient for subsequent processing, and the first initial local feature vector (patch token) of multiple sub-images of each training image output from the feature embedding layer and the first initial category feature vector (CLS token) of each training image are obtained. The first initial local feature vector of a sub-image refers to a feature vector extracted from a sub-image of a training image (usually a segmented region of an image). This feature vector can capture information about the local region of the training image and help the model understand the details in the image. The first initial category feature vector of a training image is CLS token (Classification Token), which is an image-level global feature vector used to represent the information of the entire training image. The first initial category feature vector of a training image can help the model understand the image as a whole and perform classification or recognition tasks.

[0042] Through the feature embedding layer, the original image data can be converted into a more compact and representative form, namely the feature vector, which helps the model to process and understand the image data more efficiently. The local feature vector can provide detailed information on different parts of the training image, while the global feature vector (the first initial category feature vector) can provide an overall understanding of the entire training image.

[0043] Step 203, input the first initial local feature vector of each sub-image of each training image into the feature enhancement layer of the student model, perform random intensity masking on the first initial local feature vector of each sub-image of each training image, and obtain the enhanced feature vector of each sub-image of each training image.

[0044] In some embodiments, the feature enhancement layer is a specific structure of the student model, and the teacher model does not have this structure. The first initial local feature vector of each sub-image of each training image is input into the feature enhancement layer of the student model, and the first initial local feature vector of each sub-image of each training image is randomly intensity occluded, that is, the intensity of the occlusion of the first initial local feature vector of the sub-image of each training image is random, simulating the situation where pedestrians are partially occluded in the real world. After random intensity occlusion, the first initial local feature vector of the sub-image of each training image is converted into an enhanced feature vector of the sub-image of the training image, and the enhanced feature vector contains richer information about the characteristics of pedestrians under occlusion. Through random intensity occlusion, simulating the occlusion situation in reality, it helps the model learn how to extract useful features when some information is missing and blurred during the training process, which helps the model to re-identify more accurately when encountering occluded pedestrians in the real world. At the same time, random intensity occlusion makes the position and intensity of the occlusion not fixed, thereby avoiding the model from learning only a specific occlusion pattern, which helps to improve the generalization ability of the model. In addition, by occluding different sub-images, feature representations at different scales can be learned, which is very important for handling different types of occlusion. By inputting the first initial local feature vectors of each sub-image of the training image into the feature enhancement layer of the student model and performing random intensity occlusion on them, the robustness and generalization ability of the model in the case of occlusion can be significantly improved. This avoids the model only learning a specific occlusion pattern, but instead learns a more generalized feature representation, which shows better performance in practical applications.

[0045] Step 204, inputting the enhanced feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image into the feature prediction network of the student model to obtain the first feature vector of each training image and the predicted occlusion strength of each sub-image of each training image.

[0046] In some embodiments, the enhanced feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image are input into the feature prediction network of the student model, the enhanced feature vectors of the sub-images of the training images are patch tokens, and the first initial category feature vectors of the training images are CLS tokens. The local feature vectors and the category feature vectors are integrated through the feature prediction network to obtain the first feature vectors of each training image. The first feature vectors of the training images contain local details and global information, which helps to understand the content of the training images from multiple angles. The occlusion strength of each sub-image of each training image is predicted through the feature prediction network, and the first feature vector of the training image is the output vector corresponding to the CLStoken. By predicting the occlusion strength of each sub-image, it is possible to learn which areas are more affected by occlusion, so that useful features can still be extracted under occlusion conditions, thereby improving the robustness and generalization ability of the model under occlusion conditions.

[0047] Step 205: input each training image into the teacher model, perform feature processing for re-identification on each training image, and obtain a second feature vector for each training image.

[0048] In some embodiments, the teacher model includes a feature embedding layer and a feature prediction network. At this time, the teacher model can be regarded as a trained model, and the feature vector output by it is considered to be a high-quality feature vector, which can provide a more stable and reliable feature representation benchmark for the student model. Each training image is input into the teacher model, and feature extraction, feature fusion, intensity prediction and other processing steps are performed to extract feature information important for pedestrian re-identification from the input training image, such as posture, clothing, and color, to obtain the second feature vector of each training image. The second feature vector of each subsequent training image can be used as supervision information to update the student model. The knowledge of the teacher model is transferred to the student model through the distillation process, which helps the student model achieve performance similar to that of the teacher model at a smaller scale. Through knowledge distillation, the student model can learn the feature processing capabilities of the teacher model under occlusion, thereby improving the performance of the student model under occlusion.

[0049] Step 206, using the second eigenvector of each training image output by the teacher model to supervise the first eigenvector of each training image output by the student model to obtain a first loss value, and using the random occlusion intensity of the first initial local eigenvector of each sub-image of each training image to supervise the predicted occlusion intensity of each sub-image of each training image to obtain a second loss value, and updating the parameters of the student model according to the first loss value and the second loss value, updating the parameters of the teacher model according to the student model, and determining the trained teacher model as the pedestrian re-identification model.

[0050] In some embodiments, the teacher model is a relatively mature model with good performance, which can output high-quality feature vectors (second feature vectors of training images), and the student model is a model being trained. The output feature vector (first feature vector of training images) needs to be compared with the feature vector output by the teacher model. The first loss value is obtained by calculating the difference between the second feature vector of the training image and the first feature vector of the training image. The first loss value reflects the performance gap between the student model and the teacher model in extracting features for pedestrian re-identification, and the first loss value can be calculated by the DINOLoss function. The random occlusion strength of the first initial local feature vector of the sub-image of the training image is the actual occlusion strength of the first initial local feature vector of the sub-image of the training image during the random strength occlusion process, and the predicted occlusion strength of the sub-image of the training image is the occlusion strength of each sub-image of the training image predicted by the prediction network. By constraining the difference between the random occlusion strength of the first initial local feature vector of the sub-image of the training image and the corresponding predicted occlusion strength of the sub-image of the training image (i.e., the second loss value), it is avoided that the student model only learns a specific occlusion mode, and the robustness of the model in the case of occlusion is improved. According to the first loss value and the second loss value, we use the back propagation algorithm to update the parameters of the student model, so that its feature extraction and occlusion processing capabilities are gradually improved. Through the comprehensive supervision of the first loss value and the second loss value, the student model can not only learn global features and learn more effective feature representations, but also perform well under various local occlusion conditions. According to the update of the student model, the parameters of the teacher model can be updated through the exponential moving average (EMA), and finally the trained teacher model is determined as the pedestrian re-identification model.

[0051] By using the second eigenvector output by the teacher model to supervise the first eigenvector output by the student model, and using random occlusion intensity supervision to predict the occlusion intensity, the robustness and generalization ability of the model in the case of occlusion can be significantly improved, avoiding the model only learning specific occlusion patterns, but instead learning more generalized feature representations, thereby showing better performance in practical applications.

[0052] Based on the training method of the pedestrian re-identification model proposed in the present disclosure, the teacher model and the student model are trained by knowledge distillation, the pedestrian re-identification training set is input into the student model, and the feature extraction is performed on each training image, and the feature information of the image is preliminarily extracted to provide a basis for subsequent feature enhancement and prediction, and the first initial local feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image are obtained. The first initial local feature vector of each sub-image of each training image is input into the feature enhancement layer, and random intensity occlusion is performed to simulate the occlusion situation, enhance the robustness of the model to occlusion, and obtain the enhanced feature vector of each sub-image of each training image. The enhanced feature vector of each sub-image of each training image and the first initial category feature vector of each training image are input into the feature prediction network of the student model. By predicting the occlusion intensity, it is possible to learn how to extract useful features under occlusion, and integrate local and global information to obtain the first feature vector of each training image and the predicted occlusion intensity of each sub-image of each training image. The training image is input into the teacher model to obtain the second feature vector of each training image, and the teacher model provides a stable guidance signal to help the student model learn a more robust feature representation. The first eigenvector output by the student model is supervised by the second eigenvector output by the teacher model to obtain a first loss value, the actual occlusion intensity is supervised by the predicted occlusion intensity to obtain a second loss value, and the parameters of the student model are updated according to the first loss value and the second loss value, and the parameters of the teacher model are updated according to the student model. The performance and robustness of the model are improved through the knowledge distillation of the teacher-student model, and the trained teacher model is determined as the final pedestrian re-identification model. The method proposed in the present disclosure can learn more complex and diverse occlusion situations and improve the robustness of the model through random intensity occlusion and feature prediction network. At the same time, the knowledge distillation process of the teacher-student model helps to learn more generalized and robust feature representations, solve the problem of low accuracy of pedestrian re-identification models in the prior art in processing pedestrian images with occlusion, improve the performance of the pedestrian re-identification model under occlusion, and enhance the robustness and generalization ability of the pedestrian re-identification model.

[0053] In some embodiments, performing feature extraction on each training image to obtain a first initial local feature vector of a plurality of sub-images of each training image and a first initial category feature vector of each training image includes:

[0054] Segment each training image to obtain multiple sub-images of each training image;

[0055] Obtaining a category feature representation of each training image, vectorizing each sub-image of each training image and the category feature representation of each training image, and obtaining a semantic feature vector of each sub-image of each training image and a semantic category feature vector of each training image;

[0056] Performing position encoding on each sub-image of each training image and the category feature representation of each training image to obtain a position feature vector of each sub-image of each training image and a position category feature vector of each training image;

[0057] The semantic feature vector of each sub-image of each training image is fused with the position feature vector of each sub-image of each training image to obtain a first initial local feature vector of each sub-image of each training image;

[0058] The semantic category feature vector of each training image and the position category feature vector of each training image are fused to obtain a first initial category feature vector of each training image.

[0059] In some embodiments, each training image is segmented to divide the original image into smaller parts (sub-images) so that each sub-image can be subsequently subjected to more detailed feature extraction, thereby obtaining multiple sub-images of each training image, which helps to capture local details and texture information in the training image later. The category feature representation of each training image is obtained, and each sub-image of each training image and the category feature representation of each training image are vectorized to convert the category information of the sub-image and the overall image into a vector form. The vectorization processing means may be convolution to obtain the semantic feature vector of each sub-image of each training image and the semantic category feature vector of each training image. Each sub-image of each training image and the category feature representation of each training image are positionally encoded respectively, and the position information is introduced into the feature vector to obtain the position feature vector of each sub-image of each training image and the position category feature vector of each training image, so as to understand the spatial relationship and structural features in the image. The semantic feature vectors of each sub-image of each training image and the position feature vectors of each sub-image of each training image are added, and the semantic feature vectors and the position feature vectors are fused to obtain the first initial local feature vectors of each sub-image of each training image, so as to more comprehensively describe the features of the sub-image. The semantic category feature vectors of each training image and the position category feature vectors of each training image are added, and the category information and spatial position information of the image are combined to more accurately characterize the features of the overall training image, and obtain the first initial category feature vectors of each training image.

[0060] In some embodiments, performing random intensity masking on the first initial local feature vectors of each sub-image of each training image to obtain enhanced feature vectors of each sub-image of each training image includes:

[0061] Random intensity occlusion is given by the following formula:

[0062] x'=mi* x+(1-m i )x mask

[0063] Among them, x' is the enhanced feature vector of the sub-image of the training image, m i is the random occlusion strength, x is the first initial local feature vector of the sub-image of the training image, x mask is the learnable feature vector, x mask Same dimension as x.

[0064] In some embodiments, the above x mask is a learnable feature vector, representing a learnable occlusion pattern or noise vector, which is used to mix with the first initial local feature vector of the sub-image of the training image during the training process. i is the random occlusion strength, which is a random number or parameter between 0 and 1, which determines the degree to which x is occluded. i The value of can control the intensity of occlusion. i As it approaches 0, more x mask will be introduced, resulting in a stronger occlusion effect; when m i When it is close to 1, the occlusion effect is weakened, more original features x will be retained, and x mask The learnability of means that it can be optimized during training to produce an occlusion effect that is beneficial to model training. i The first initial local feature vector of the sub-image of the training image is weighted mixed to simulate the occlusion situation, and the random occlusion intensity m is used to i The change enables the model to learn how to extract useful features under different occlusion intensities during the training process. By inputting the first initial local feature vector of each sub-image of each training image into the feature enhancement layer of the student model and performing random intensity occlusion, the enhanced feature vector x' of the sub-image of the training image is obtained, which can significantly improve the robustness and generalization ability of the model under occlusion, avoid the model only learning a specific occlusion pattern, but learn a more generalized feature representation, so as to show better performance in practical applications.

[0065] In some embodiments, the enhanced feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image are input into the feature prediction network of the student model to obtain the first feature vector of each training image and the predicted occlusion strength of each sub-image of each training image, including:

[0066] Performing self-attention encoding on the enhanced feature vectors of the multiple sub-images of each training image and the first initial category feature vector of each training image to obtain the first category feature vector of each training image corresponding to the first initial category feature vector of each training image and the first attention feature vector of the multiple sub-images of each training image corresponding to the enhanced feature vector of the multiple sub-images of each training image;

[0067] Performing nonlinear transformation on the first attention feature vectors of the plurality of sub-images of each training image and the first category feature vector of each training image to obtain the first local feature vector of each sub-image of each training image and the first feature vector of each training image;

[0068] A linear transformation is performed on the first local feature vector of each sub-image of each training image to obtain the predicted occlusion strength of each sub-image of each training image.

[0069] In some embodiments, reference Figure 3 The feature prediction network 300 includes an attention processing network 301, a multi-layer perceptron 302, and a linear layer 303. The enhanced feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image are input into the attention processing network 301 for self-attention encoding. The attention processing network 301 is stacked with multiple multi-head self-attention layers and fully connected layers. When processing each input feature vector, the information of other feature vectors is considered, which helps the model capture the association between different sub-images and the connection between the sub-image and the overall image category feature, and obtains a more accurate and rich feature representation, that is, the first attention feature vector of the sub-image of the training image corresponding to the enhanced feature vector of the sub-image of each training image is generated, and the first category feature vector of the training image corresponding to the first initial category feature vector of each training image is generated. The first attention feature vectors of multiple sub-images of each training image are input into the multi-layer perceptron 302 for nonlinear transformation, and the first category feature vector of each training image is input into the multi-layer perceptron 302 for nonlinear transformation, and the information in the feature vector is further extracted and fused, and a more complex feature representation is learned, so as to obtain the first local feature vector of each sub-image of each training image and the first feature vector of each training image. The first local feature vector of each sub-image of each training image is input into the linear layer 303 for linear transformation, the input vector is compressed into a coefficient, the occlusion strength of each sub-image is predicted, and the predicted occlusion strength of each sub-image of each training image is obtained.

[0070] In some embodiments, updating the parameters of the student model according to the first loss value and the second loss value, and updating the parameters of the teacher model according to the student model include:

[0071] The total loss value is determined according to the first loss value and the second loss value, the parameters of the student model are updated using the back propagation algorithm and the total loss value, and the parameters of the teacher model are updated using the exponential moving average and the parameters of the student model.

[0072] In some embodiments, the first loss value can reflect the gap between the first eigenvector output by the student model and the second eigenvector output by the teacher model, and the second loss value can reflect the gap between the predicted occlusion intensity output by the student model and the actual occlusion intensity. The first loss value and the second loss value are combined to form a comprehensive total loss value. Specifically, L = αL1 + βL2, where L is the total loss value, L1 is the first loss value, L2 is the second loss value, and α and β are weight factors of the loss values. The parameters of the student model are optimized by calculating the gradient of the total loss value relative to the student model parameters and adjusting the parameters in the negative gradient direction. The latest parameters of the student model are smoothly transferred to the teacher model through the exponential moving average (EMA) method, and the parameters of the teacher model are updated through the parameters of the student model to maintain the smoothness of the teacher model. Specifically, θ EMA,t+1 =(1-λ)·θ EMA,t +λ·θ t , where θ t is the parameter of the student model at the moment, θ EMA is the network parameter before the sliding average of the teacher model at time t, θ EMA,t+1 is the network parameter after sliding average of the teacher model at time t, and λ is the sliding factor of EMA. Through the above steps, the parameters of the student model can be effectively updated, and the parameters of the teacher model can be smoothly updated through the EMA method.

[0073] In some embodiments, performing feature processing on each training image to obtain a second feature vector of each training image includes:

[0074] Performing feature extraction on each training image to obtain a second initial local feature vector of a plurality of sub-images of each training image and a second initial category feature vector of each training image;

[0075] Performing self-attention encoding on the second initial local feature vector of each sub-image of each training image and the second initial category feature vector of each training image to obtain the second category feature vector of each training image corresponding to the second initial category feature vector of each training image;

[0076] A nonlinear transformation is performed on the second category feature vector of each training image to obtain the second feature vector of each training image.

[0077] In some embodiments, the teacher model includes a feature prediction network and a feature embedding layer, each training image is input into the feature embedding layer of the teacher model, and features are extracted for each training image, and useful information or features are extracted from the original image data to obtain the second initial local feature vectors of multiple sub-images of each training image and the second initial category feature vectors of each training image. The second initial local feature vectors of the sub-images of the training images obtained are patchtokens, focusing on the detail information of the training images, such as edges, textures, etc. The second initial category feature vectors of the training images obtained are CLS tokens, which can characterize the global features of the entire training image to distinguish different image categories. The second initial local feature vectors of each sub-image of each training image and the second initial category feature vectors of each training image are input into the feature prediction network of the teacher model, and the second initial local feature vectors of each sub-image of each training image and the second initial category feature vectors of each training image are self-attention encoded, and the correlation (or attention) between the input vectors is calculated, and the different parts of the input vectors are dynamically focused on to obtain the second category feature vectors of each training image that pay more attention to the global features. The second category feature vector of each training image is nonlinearly transformed to map the high-dimensional feature vector to a low-dimensional space while retaining sufficient information to distinguish different training images, thereby obtaining the second feature vector of each training image.

[0078] refer to Figure 4 , the structure corresponding to the training method of the pedestrian re-identification model is as follows Figure 4As shown, the structure includes a student model 401 and a teacher model 402. The student model includes a feature embedding layer 403, a feature enhancement layer 404 and a feature prediction network 300, and the teacher model 402 includes a feature embedding layer 405 and a feature prediction network 406. Each training image is input into the feature embedding layer 403 of the student model 401, and features are extracted from each training image to obtain a first initial local feature vector of multiple sub-images of each training image and a first initial category feature vector of each training image; the first initial local feature vector of each sub-image of each training image is input into the feature enhancement layer 404 of the student model 401, and random intensity masking is performed on the first initial local feature vector of each sub-image of each training image to obtain an enhanced feature vector of each sub-image of each training image; the enhanced feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image are extracted from ... and the first initial category feature vector of each training image are extracted from each training image; the first initial local feature vector of each sub-image of each training image and the first initial category feature vector of each training image are extracted from each training image; the first initial local feature vector of each sub-image of each training image and the first initial category feature vector of each training image are extracted from each training image; the first initial local feature vector of each sub-image of each training image and the first initial category feature vector of each training image are extracted from each training image; the first initial local feature vector of each sub-image of each training image and the first initial category feature The vector is input into the feature prediction network 300 of the student model 401 to obtain the first feature vector of each training image and the predicted occlusion strength of each sub-image of each training image; each training image is input into the feature embedding layer 405 of the teacher model 402, and features are extracted for each training image to obtain the second initial local feature vectors of multiple sub-images of each training image and the second initial category feature vector of each training image; the second initial local feature vectors of multiple sub-images of each training image and the second initial category feature vector of each training image are input into the feature prediction network 406 of the teacher model 402 to obtain the second feature vector of each training image.

[0079] In some embodiments, after determining the trained teacher model as the person re-identification model, the method further includes:

[0080] Obtaining a pedestrian image to be identified, inputting the pedestrian image to be identified into a pedestrian re-identification model, performing feature processing on the pedestrian image to be identified, and obtaining a feature vector of the pedestrian image to be identified output by the pedestrian re-identification model;

[0081] Obtain all pedestrian images in the query library, input each pedestrian image in the query library into the pedestrian re-identification model for feature processing of re-identification, and obtain the feature vector of each pedestrian image;

[0082] The similarity between the feature vector of the pedestrian image to be identified and the feature vectors of each pedestrian image is calculated, and the pedestrian identity corresponding to the pedestrian image with the highest similarity is used as the identity of the pedestrian to be identified in the pedestrian image to be identified.

[0083] In some embodiments, after obtaining a trained pedestrian re-identification model, an image of a pedestrian to be identified is obtained, and the image of the pedestrian to be identified is input into the pedestrian re-identification model for feature processing, and the image is converted into a feature vector to obtain a feature vector of the image of the pedestrian to be identified. The feature vector of the image of the pedestrian to be identified contains key information of the pedestrian in the image to be identified, which can be used for subsequent similarity calculation. All pedestrian images in the query library are obtained and input into the pedestrian re-identification model for feature processing. Feature processing is performed on each image in the query library (a database containing a large number of pedestrian images) to obtain respective feature vectors, that is, feature vectors of each pedestrian image. The feature vectors of each pedestrian image will be used to compare with the feature vectors of the image of the pedestrian to be identified. The similarity between the feature vector of the image of the pedestrian to be identified and the feature vectors of each pedestrian image in the query library is calculated. By calculating the similarity between each pair, the "distance" or "similarity" between the two is measured. The higher the similarity, the more likely the pedestrians in the two images are the same person. According to the calculation result of the similarity, the pedestrian image with the highest similarity is selected, and the pedestrian identity corresponding to it is used as the identity of the pedestrian image to be identified, so as to achieve the mapping from image to identity.

[0084] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0085] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.

[0086] Figure 5 Schematic diagram of a training device for a pedestrian re-identification model provided by an embodiment of the present disclosure. Figure 5 As shown, the training device of the pedestrian re-identification model includes:

[0087] An acquisition module 501 is configured to acquire a person re-identification training set, where the person re-identification training set includes a plurality of training images;

[0088] The feature extraction module 502 is configured to input each training image into the feature embedding layer of the student model, perform feature extraction on each training image, and obtain a first initial local feature vector of multiple sub-images of each training image and a first initial category feature vector of each training image;

[0089] The feature enhancement module 503 is configured to input the first initial local feature vector of each sub-image of each training image into the feature enhancement layer of the student model, and perform random intensity masking on the first initial local feature vector of each sub-image of each training image to obtain the enhanced feature vector of each sub-image of each training image;

[0090] The feature prediction module 504 is configured to input the enhanced feature vectors of the multiple sub-images of each training image and the first initial category feature vector of each training image into the feature prediction network of the student model to obtain the first feature vector of each training image and the predicted occlusion strength of each sub-image of each training image;

[0091] The teacher model feature processing module 505 is configured to input each training image into the teacher model, perform feature processing on each training image for re-identification, and obtain a second feature vector of each training image;

[0092] The updating module 506 is configured to supervise the first feature vector of each training image output by the student model using the second feature vector of each training image output by the teacher model to obtain a first loss value, and supervise the predicted occlusion intensity of each sub-image of each training image using the random occlusion intensity of the first initial local feature vector of each sub-image of each training image to obtain a second loss value, and update the parameters of the student model according to the first loss value and the second loss value, update the parameters of the teacher model according to the student model, and determine the trained teacher model as the pedestrian re-identification model.

[0093] According to the technical solution provided by the embodiment of the present disclosure, the teacher model and the student model are trained by knowledge distillation, the pedestrian re-identification training set is input into the student model, and the feature extraction is performed on each training image, and the feature information of the image is preliminarily extracted to provide a basis for subsequent feature enhancement and prediction, and the first initial local feature vectors of multiple sub-images of each training image and the first initial category feature vectors of each training image are obtained. The first initial local feature vectors of each sub-image of each training image are input into the feature enhancement layer, and random intensity occlusion is performed to simulate the occlusion situation, enhance the robustness of the model to occlusion, and obtain the enhanced feature vectors of each sub-image of each training image. The enhanced feature vectors of each sub-image of each training image and the first initial category feature vectors of each training image are input into the feature prediction network of the student model. By predicting the occlusion intensity, it is possible to learn how to extract useful features under occlusion, and integrate local and global information to obtain the first feature vectors of each training image and the predicted occlusion intensity of each sub-image of each training image. The training image is input into the teacher model to obtain the second feature vector of each training image, and the teacher model provides a stable guidance signal to help the student model learn a more robust feature representation. The first eigenvector output by the student model is supervised by the second eigenvector output by the teacher model to obtain a first loss value, the actual occlusion intensity is supervised by the predicted occlusion intensity to obtain a second loss value, and the parameters of the student model are updated according to the first loss value and the second loss value, and the parameters of the teacher model are updated according to the student model. The performance and robustness of the model are improved through the knowledge distillation of the teacher-student model, and the trained teacher model is determined as the final pedestrian re-identification model. The method proposed in the present disclosure can learn more complex and diverse occlusion situations and improve the robustness of the model through random intensity occlusion and feature prediction network. At the same time, the knowledge distillation process of the teacher-student model helps to learn more generalized and robust feature representations, solve the problem of low accuracy of pedestrian re-identification models in the prior art in processing pedestrian images with occlusion, improve the performance of the pedestrian re-identification model under occlusion, and enhance the robustness and generalization ability of the pedestrian re-identification model.

[0094] In some embodiments, the feature extraction module 502 is configured to segment each training image to obtain multiple sub-images of each training image; obtain the category feature representation of each training image, vectorize each sub-image of each training image and the category feature representation of each training image, and obtain the semantic feature vector of each sub-image of each training image and the semantic category feature vector of each training image; position encode each sub-image of each training image and the category feature representation of each training image to obtain the position feature vector of each sub-image of each training image and the position category feature vector of each training image; fuse the semantic feature vector of each sub-image of each training image with the position feature vector of each sub-image of each training image to obtain the first initial local feature vector of each sub-image of each training image; fuse the semantic category feature vector of each training image with the position category feature vector of each training image to obtain the first initial category feature vector of each training image.

[0095] In some embodiments, the feature enhancement module 503 is configured to perform random intensity occlusion as shown in the following formula: x'=m i* x+(1-m i )x mask Among them, x' is the enhanced feature vector of the sub-image of the training image, m i is the random occlusion strength, x is the first initial local feature vector of the sub-image of the training image, x mask is the learnable feature vector, x mask Same dimension as x.

[0096] In some embodiments, the feature prediction module 504 is configured to perform self-attention encoding on the enhanced feature vectors of multiple sub-images of each training image and the first initial category feature vector of each training image to obtain the first category feature vector of each training image corresponding to the first initial category feature vector of each training image and the first attention feature vector of multiple sub-images of each training image corresponding to the enhanced feature vector of multiple sub-images of each training image; perform nonlinear transformation on the first attention feature vectors of multiple sub-images of each training image and the first category feature vector of each training image to obtain the first local feature vector of each sub-image of each training image and the first feature vector of each training image; perform linear transformation on the first local feature vector of each sub-image of each training image to obtain the predicted occlusion strength of each sub-image of each training image.

[0097] In some embodiments, the update module 506 is configured to determine a total loss value based on the first loss value and the second loss value, update the parameters of the student model using the back propagation algorithm and the total loss value, and update the parameters of the teacher model using the exponential moving average and the parameters of the student model.

[0098] In some embodiments, the teacher model feature processing module 505 is configured to perform feature extraction on each training image to obtain a second initial local feature vector of multiple sub-images of each training image and a second initial category feature vector of each training image; perform self-attention encoding on the second initial local feature vector of each sub-image of each training image and the second initial category feature vector of each training image to obtain a second category feature vector of each training image corresponding to the second initial category feature vector of each training image; perform nonlinear transformation on the second category feature vector of each training image to obtain a second feature vector of each training image.

[0099] In some embodiments, after the trained teacher model is determined as the pedestrian re-identification model, the training device of the pedestrian re-identification model is configured to obtain the pedestrian image to be identified, input the pedestrian image to be identified into the pedestrian re-identification model, perform feature processing on the pedestrian image to be identified, and obtain the feature vector of the pedestrian image to be identified output by the pedestrian re-identification model; obtain all pedestrian images in the query library, input each pedestrian image in the query library into the pedestrian re-identification model for feature processing of re-identification, and obtain the feature vector of each pedestrian image; calculate the similarity between the feature vector of the pedestrian image to be identified and the feature vector of each pedestrian image, and use the pedestrian identity corresponding to the pedestrian image with the highest similarity as the identity of the pedestrian to be identified in the pedestrian image to be identified.

[0100] 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 the present disclosure.

[0101] Figure 6 Schematic diagram of an electronic device 6 provided in an embodiment of the present disclosure. Figure 6 As shown, the electronic device 6 of this embodiment includes: a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. When the processor 601 executes the computer program 603, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 601 executes the computer program 603, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0102] The electronic device 6 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 6 may include, but is not limited to, a processor 601 and a memory 602. Those skilled in the art will appreciate that Figure 6 The electronic device 6 is merely an example and does not limit the electronic device 6 . The electronic device 6 may include more or less components than those shown in the figure, or different components.

[0103] The processor 601 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.

[0104] The memory 602 may be an internal storage unit of the electronic device 6, for example, a hard disk or memory of the electronic device 6. The memory 602 may also be an external storage device of the electronic device 6, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 6. The memory 602 may also include both an internal storage unit of the electronic device 6 and an external storage device. The memory 602 is used to store computer programs and other programs and data required by the electronic device.

[0105] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to 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 embodiments can be integrated into one processing unit, or each unit can exist physically separately, 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.

[0106] 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 readable storage medium (e.g., a computer-readable storage medium). Based on this understanding, the present disclosure implements all or part of the processes 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 the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, 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, etc.

[0107] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure 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 embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.

Claims

1. A method for training a person re-identification model, characterized in that: include: Obtaining a person re-identification training set, wherein the person re-identification training set includes a plurality of training images; Input each of the training images into a feature embedding layer of a student model, perform feature extraction on each of the training images, and obtain a first initial local feature vector of a plurality of sub-images of each of the training images and a first initial category feature vector of each of the training images; Inputting the first initial local feature vector of each sub-image of each training image into the feature enhancement layer of the student model, performing random intensity masking on the first initial local feature vector of each sub-image of each training image, and obtaining the enhanced feature vector of each sub-image of each training image; Inputting the enhanced feature vectors of the multiple sub-images of each of the training images and the first initial category feature vector of each of the training images into the feature prediction network of the student model to obtain the first feature vector of each training image and the predicted occlusion strength of each sub-image of each training image; Inputting each of the training images into a teacher model, performing feature processing for re-identification on each of the training images, and obtaining a second feature vector for each of the training images; The first eigenvectors of the training images output by the teacher model are used to supervise the first eigenvectors of the training images output by the student model to obtain a first loss value, and the predicted occlusion intensity of the sub-images of the training images are supervised by the random occlusion intensity of the first initial local eigenvectors of the sub-images of the training images to obtain a second loss value, and the parameters of the student model are updated according to the first loss value and the second loss value, and the parameters of the teacher model are updated according to the student model, and the trained teacher model is determined as the pedestrian re-identification model.

2. The method according to claim 1, characterized in that The step of extracting features from each of the training images to obtain a first initial local feature vector of a plurality of sub-images of each of the training images and a first initial category feature vector of each of the training images includes: Segmenting each of the training images to obtain a plurality of sub-images of each of the training images; Acquire the category feature representation of each training image, vectorize each sub-image of each training image and the category feature representation of each training image, and obtain the semantic feature vector of each sub-image of each training image and the semantic category feature vector of each training image; Performing position encoding on each sub-image of each training image and the category feature representation of each training image to obtain a position feature vector of each sub-image of each training image and a position category feature vector of each training image; fusing the semantic feature vector of each sub-image of each training image with the position feature vector of each sub-image of each training image to obtain a first initial local feature vector of each sub-image of each training image; The semantic category feature vector of each of the training images and the position category feature vector of each of the training images are fused to obtain a first initial category feature vector of each of the training images.

3. The method according to claim 1, characterized in that The step of performing random intensity masking on the first initial local feature vectors of each sub-image of each training image to obtain enhanced feature vectors of each sub-image of each training image comprises: Random intensity occlusion is given by the following formula: x’=m i* x+(1-m i )x mask Wherein, x' is the enhanced feature vector of the sub-image of the training image, and m i is the random occlusion strength, x is the first initial local feature vector of the sub-image of the training image, and x mask is a learnable feature vector, the x mask The same dimension as x.

4. The method according to claim 1, characterized in that: The step of inputting the enhanced feature vectors of the plurality of sub-images of each of the training images and the first initial category feature vector of each of the training images into the feature prediction network of the student model to obtain the first feature vector of each of the training images and the predicted occlusion strength of each of the sub-images of each of the training images comprises: Performing self-attention encoding on the enhanced feature vectors of the multiple sub-images of each of the training images and the first initial category feature vectors of each of the training images to obtain the first category feature vectors of each of the training images corresponding to the first initial category feature vectors of each of the training images and the first attention feature vectors of the multiple sub-images of each of the training images corresponding to the enhanced feature vectors of the multiple sub-images of each of the training images; Performing nonlinear transformation on the first attention feature vectors of the plurality of sub-images of each of the training images and the first category feature vector of each of the training images to obtain the first local feature vector of each of the sub-images of each of the training images and the first feature vector of each of the training images; A linear transformation is performed on the first local feature vector of each sub-image of each training image to obtain the predicted occlusion strength of each sub-image of each training image.

5. The method according to claim 1, characterized in that The updating of the parameters of the student model according to the first loss value and the second loss value, and the updating of the parameters of the teacher model according to the student model, comprises: A total loss value is determined according to the first loss value and the second loss value, parameters of the student model are updated using a back propagation algorithm and the total loss value, and parameters of the teacher model are updated using an exponential moving average and the parameters of the student model.

6. The method according to claim 1, characterized in that The re-identifying feature processing of each of the training images to obtain a second feature vector of each training image includes: Performing feature extraction on each of the training images to obtain a second initial local feature vector of a plurality of sub-images of each of the training images and a second initial category feature vector of each of the training images; Performing self-attention encoding on the second initial local feature vector of each sub-image of each training image and the second initial category feature vector of each training image to obtain the second category feature vector of each training image corresponding to the second initial category feature vector of each training image; A nonlinear transformation is performed on the second category feature vector of each of the training images to obtain a second feature vector of each of the training images.

7. The method according to claim 1, characterized in that After determining the trained teacher model as the person re-identification model, the method further includes: Acquire a pedestrian image to be identified, input the pedestrian image to be identified into the pedestrian re-identification model, perform re-identification feature processing on the pedestrian image to be identified, and obtain a feature vector of the pedestrian image to be identified output by the pedestrian re-identification model; Acquire all pedestrian images in a query library, input each pedestrian image in the query library into the pedestrian re-identification model for feature processing of re-identification, and obtain a feature vector of each pedestrian image; The similarity between the feature vector of the pedestrian image to be identified and the feature vectors of each of the pedestrian images is calculated, and the pedestrian identity corresponding to the pedestrian image with the highest similarity is used as the identity of the pedestrian to be identified in the pedestrian image to be identified.

8. A training device for a pedestrian re-identification model, characterized in that: include: An acquisition module is configured to acquire a person re-identification training set, wherein the person re-identification training set includes a plurality of training images; A feature extraction module is configured to input each of the training images into a feature embedding layer of a student model, perform feature extraction on each of the training images, and obtain a first initial local feature vector of a plurality of sub-images of each of the training images and a first initial category feature vector of each of the training images; A feature enhancement module is configured to input the first initial local feature vector of each sub-image of each training image into the feature enhancement layer of the student model, and perform random intensity masking on the first initial local feature vector of each sub-image of each training image to obtain an enhanced feature vector of each sub-image of each training image; A feature prediction module is configured to input the enhanced feature vectors of the multiple sub-images of each of the training images and the first initial category feature vector of each of the training images into a feature prediction network of a student model to obtain a first feature vector of each of the training images and a predicted occlusion strength of each of the sub-images of each of the training images; The teacher model feature processing module is configured to input each of the training images into the teacher model, perform feature processing on each of the training images for re-identification, and obtain a second feature vector of each of the training images; The updating module is configured to supervise the first feature vector of each training image output by the student model using the second feature vector of each training image output by the teacher model to obtain a first loss value, and supervise the predicted occlusion strength of each sub-image of each training image using the random occlusion strength of the first initial local feature vector of each sub-image of each training image to obtain a second loss value, and update the parameters of the student model according to the first loss value and the second loss value, update the parameters of the teacher model according to the student model, and determine the trained teacher model as the pedestrian re-identification model.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.