Pre-training method and device of pedestrian re-identification model

CN117542073BActive Publication Date: 2026-10-30SINOVISION (JURONG) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311256649.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2026-10-30
Estimated Expiration
2043-09-26

AI Technical Summary

Technical Problem

[0002]行人重识别(Personre-identification,简称Re-ID)也称行人再识别,旨在从多个摄像头捕捉到的图像中寻找同一个目标人物,一大难点是外观相似的不同行人之间差异小,相同人物在不同视角和场景下外表差异可能很大,导致难以找到正确的目标人物

Benefits of technology

[0044]本发明提供的行人重识别模型的预训练方法及装置,通过对行人样本图像的全局图像以及分割后的局部图像标记对应的全局令牌以及局部令牌,使得预训练过程中,行人重识别模型既关注行人的全局特征,又关注行人的局部特征,从而可以提取到更加具有判别力的局部特征,提高行人重识别模型对行人识别的准确度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117542073B_ABST
    Figure CN117542073B_ABST
Patent Text Reader

Abstract

The application provides a pre-training method and device of a pedestrian re-identification model, wherein the method comprises: obtaining a global view and a local view of a target pedestrian to be identified; determining first and second training samples based on a global token corresponding to the global view, a local token corresponding to the local view, and a belonging relationship between the local view and the global view; obtaining third training samples by randomly masking part of image blocks included in the first training samples; training the pedestrian re-identification model based on the first, second, and third training samples, determining optimal network parameters corresponding to a student network of the model, and synchronizing the optimal network parameters to a teacher network to complete pre-training. The global image and the segmented local image are marked with corresponding global tokens and local tokens, so that the pedestrian re-identification model pays attention to the global features and the local features of the pedestrian during the pre-training process, extracts more discriminative local features, and improves the accuracy of the pedestrian re-identification model in pedestrian identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to a pre-training method and apparatus for a pedestrian re-identification model. Background Technology

[0002] Person re-identification (Re-ID), also known as pedestrian re-identification, aims to find the same target person from images captured by multiple cameras. A major challenge is that different pedestrians with similar appearances have small differences, while the same person may have a large difference in appearance under different perspectives and scenes, making it difficult to find the correct target person.

[0003] Current mainstream pedestrian re-identification methods use pre-training methods that only focus on the differentiated features between object categories. This results in existing methods producing pre-trained pedestrian re-identification models that focus more on coarse-grained features of the global image, while ignoring fine-grained local features that are crucial for pedestrian re-identification, such as pedestrians' clothing and backpacks.

[0004] Therefore, how to make full use of the fine-grained local features of pedestrians in pedestrian re-identification has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] To address the problems existing in the prior art, the present invention provides a pre-training method and apparatus for a pedestrian re-identification model.

[0006] In a first aspect, the present invention provides a pre-training method for a pedestrian re-identification model, comprising:

[0007] Obtain a global view and a local view of the target pedestrian to be identified; the local view is a rectangular view obtained by dividing the global view into multiple overlapping local regions and randomly cropping the local regions.

[0008] Based on the global token corresponding to the global view, the local token corresponding to the local view, and the relationship between the local view and the global view, a first training sample and a second training sample are determined. The first training sample is the global view of the target pedestrian to be identified, and the global token corresponding to the global view and the local tokens corresponding to all the local views belonging to the global view have been marked. The second training sample is all the local views belonging to the global view of the target pedestrian to be identified, and the local tokens corresponding to the local views have been marked.

[0009] Randomly mask a portion of the global view in the first training sample to obtain a third training sample;

[0010] Based on the first training sample, the second training sample, and the third training sample, the pedestrian re-identification model is trained to determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0011] Optionally, the step of training the pedestrian re-identification model based on the first training sample, the second training sample, and the third training sample to determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronizing them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model, includes:

[0012] Based on the teacher network of the pedestrian re-identification model, the prediction result corresponding to the global token of the first training sample and the prediction result corresponding to each local token of the first training sample are determined and used as the first prediction result and the second prediction result, respectively.

[0013] Based on the student network of the pedestrian re-identification model, the prediction results corresponding to the global token of the third training sample, the prediction results corresponding to each local token of the third training sample, the prediction results corresponding to the global token of the second training sample, and the prediction results corresponding to the local tokens of the second training sample are determined as the third prediction result, the fourth prediction result, the fifth prediction result, and the sixth prediction result, respectively.

[0014] Based on the second prediction result, the fourth prediction result, and the sixth prediction result, a first loss function is determined; the first loss function is the local token corresponding loss function for all target local regions belonging to the same target pedestrian to be identified; the target local region is one of multiple overlapping different local regions into which the global view of the target pedestrian to be identified is segmented;

[0015] Based on the first prediction result, the third prediction result, and the fifth prediction result, a second loss function is determined; the second loss function is the loss function corresponding to the global tokens belonging to the same target pedestrian to be identified.

[0016] Based on gradient descent, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are obtained when the total loss function is minimized or convergence is satisfied; the total loss function is determined based on the first loss function and the second loss function.

[0017] By employing an exponential moving average, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0018] Optionally, determining the first loss function based on the second prediction result, the fourth prediction result, and the sixth prediction result includes:

[0019] Using the local tokens corresponding to the target local area of ​​the pedestrian to be identified as the unit, the first loss function is determined based on the cross-entropy loss function, the second prediction result, the fourth prediction result, and the sixth prediction result;

[0020] The formula satisfied by the first loss function is expressed as:

[0021]

[0022] Where m1≠m2, the cross entropy loss function H(a,b)=-alogb, θ s This represents the parameters of the student network in the pedestrian re-identification model; Represents the global view in the second prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is the local token l i The probability of; This represents a partial view in the fourth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is the local token l i The probability of; Represents the global view in the second prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is local token l i The probability value; This represents the global view in the sixth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is local token l i The probability of the target pedestrian in the first sample image is M; the total number of global views of the target pedestrian in the first sample image is J; and the total number of local views cropped from any local region is J.

[0023] Optionally, determining the second loss function based on the first prediction result, the third prediction result, and the fifth prediction result includes:

[0024] Using global tokens belonging to the target pedestrian as units, the second loss function is determined based on the cross-entropy loss function, the first prediction result, the third prediction result, and the fifth prediction result;

[0025] The formula satisfied by the second loss function is expressed as follows:

[0026]

[0027] Where m1≠m2, the cross entropy loss function H(a,b)=-alogb, Represents the global view in the first prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a partial view in the fifth prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a global view of the pedestrian to be identified in the first prediction result. The probability that the predicted target identity corresponding to the image patch marked with the global token is the global token; This represents the global view after masking in the third prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; M represents the total number of global views of the target pedestrian to be identified; L represents the total number of local regions included in the global view of the target pedestrian to be identified; J represents the total number of local views cropped from any local region.

[0028] Optionally, obtaining the global and local views of the target pedestrian to be identified includes:

[0029] Obtain any image from the first dataset as the first sample image; the first dataset consists of pedestrian images captured by multiple cameras from different perspectives and positions, and each pedestrian image has been labeled with a different pedestrian tag;

[0030] The smallest rectangular view containing the target pedestrian in the first sample image is determined as the global view;

[0031] The global view is divided into multiple overlapping local regions, and multiple rectangular views are randomly cropped from the local regions to serve as local views of the local regions.

[0032] Optionally, the pedestrian re-identification model is constructed based on a visual Transformer network.

[0033] Optionally, the method further includes:

[0034] Based on the pre-trained pedestrian re-identification model, the seventh prediction result of the second sample image is determined; the second sample image includes the target pedestrian to be identified, and the corresponding global token and all local tokens have been labeled.

[0035] Based on the seventh prediction result, the global token of the second sample image label, and all local tokens, the network parameters of the pedestrian re-identification model are fine-tuned to obtain the pedestrian re-identification model.

[0036] Secondly, the present invention also provides a pre-training device for a pedestrian re-identification model, comprising:

[0037] The acquisition module is used to acquire a global view and a local view of the target pedestrian to be identified; the local view is a plurality of rectangular views obtained by dividing the global view into multiple overlapping local regions and randomly cropping the local regions.

[0038] The determining module is configured to determine a first training sample and a second training sample based on the global token corresponding to the global view, the local token corresponding to the local view, and the relationship between the local view and the global view; the first training sample is the global view of the target pedestrian to be identified, and has been marked with the global token corresponding to the global view and the local tokens corresponding to all the local views belonging to the global view; the second training sample is all the local views belonging to the global view of the target pedestrian to be identified, and has been marked with the local tokens corresponding to the local views;

[0039] The masking module is used to perform random masking on a portion of the image patch of the global view in the first training sample to obtain the third training sample;

[0040] The training module is used to train the pedestrian re-identification model based on the first training sample, the second training sample and the third training sample, determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronize them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0041] Thirdly, the present invention also provides an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the pre-training method for the pedestrian re-identification model as described in the first aspect.

[0042] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the pre-training method for the pedestrian re-identification model as described in the first aspect.

[0043] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the pre-training method for the pedestrian re-identification model as described in the first aspect.

[0044] The pre-training method and apparatus for the pedestrian re-identification model provided by the present invention, by labeling the global image and the segmented local image of the pedestrian sample image with corresponding global tokens and local tokens, enables the pedestrian re-identification model to focus on both the global features and local features of the pedestrian during the pre-training process, thereby extracting more discriminative local features and improving the accuracy of the pedestrian re-identification model in identifying pedestrians. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0046] Figure 1 This is a flowchart illustrating the pre-training method for the pedestrian re-identification model provided in this embodiment of the invention.

[0047] Figure 2 This is a schematic diagram illustrating the implementation process of the pre-training method for the pedestrian re-identification model provided in this embodiment of the invention;

[0048] Figure 3 This is a schematic diagram of the structure of the pre-training device for the pedestrian re-identification model provided in an embodiment of the present invention;

[0049] Figure 4 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0051] Pedestrian re-identification aims to find the same person from images captured by multiple cameras. A major challenge is that while different pedestrians with similar appearances have small differences, the appearance of the same person can vary greatly under different viewpoints and scenes, making it difficult to identify the correct target. Currently, more and more researchers are studying pre-training methods for pedestrian re-identification models.

[0052] However, current mainstream model pre-training methods only focus on the differential features between object categories, neglecting the local differential features used to represent identity within the same category. This results in existing methods producing pre-trained person re-identification models that can only identify and predict coarse-grained global features of the image, but cannot identify and predict fine-grained local features of pedestrians belonging to the same identity. Consequently, the accuracy of the final trained model in person re-identification is low, and it is prone to missed or false identifications. Furthermore, existing masked image modeling methods for pre-training person re-identification models typically use random image patch occlusion, allowing the network to reconstruct the occluded regions after learning. However, this random image patch occlusion method may fail to reconstruct the occluded regions due to insufficient existing information.

[0053] Considering the above problems, this invention fully utilizes the coarse-grained global features and fine-grained local features of pedestrians with the same identity to obtain more comprehensive semantic information for pedestrian identification, thus enabling more accurate identification of pedestrians. In addition, the global image of pedestrians is randomly occluded with image patches, so that after the pedestrian re-identification model network is learned, it can use the unoccluded area to predict the occluded area, further improving the accuracy of the pedestrian re-identification model.

[0054] The pedestrian re-identification model pre-training method provided in this embodiment of the invention can be applied to surveillance scenarios or any other scenarios that require pedestrian re-identification. The execution subject of this embodiment of the invention is an electronic device, such as a terminal or server.

[0055] Figure 1 This is a flowchart illustrating the pre-training method for the pedestrian re-identification model provided in this embodiment of the invention, as shown below. Figure 1 As shown, the method includes:

[0056] Step 101: Obtain the global view and local view of the target pedestrian to be identified; the local view is obtained by dividing the global view into multiple overlapping local regions and randomly cropping the local regions into multiple rectangular views;

[0057] Specifically, a rectangular bounding box is drawn within any image x, encompassing the target pedestrian. This bounding box also includes the pedestrian's personal belongings. Multiple bounding boxes may exist at different view levels, and any view within this bounding box is considered a global view of the target pedestrian. Therefore, there may be multiple global views of the target pedestrian, represented as follows: The global view is further divided into multiple overlapping local regions, and multiple rectangular views are randomly cropped from these local regions as local views corresponding to the global view. For example, L×J low-resolution local views are randomly cropped from L local regions of the global view, where the j-th local view of the i-th local region is represented as...

[0058] Step 102: Based on the global token corresponding to the global view, the local token corresponding to the local view, and the relationship between the local view and the global view, determine the first training sample and the second training sample; the first training sample is the global view of the target pedestrian to be identified, and has been marked with the global token corresponding to the global view and the local tokens corresponding to all the local views belonging to the global view; the second training sample is all the local views belonging to the global view of the target pedestrian to be identified, and has been marked with the local tokens corresponding to the local views;

[0059] After obtaining the global and local views of the pedestrian to be identified, each global view has a corresponding global token. This global token represents the identity prototype corresponding to that global view and, during the model pre-training phase, focuses on learning the semantic features of all image patches of that global view; it can be understood as the global token indicating which pedestrian the global view corresponds to. Similarly, each local view also has a corresponding local token, which represents the local category prototype of that local view. This can be understood as the local token further indicating which items of the pedestrian, such as hats, clothes, and backpacks, correspond to the local view.

[0060] To more fully utilize the semantic features included in the global and local views, the global view is labeled with its corresponding global token [CLS] and the local tokens [PART] corresponding to all local views included in the global view, serving as the first training sample. Similarly, the local views are labeled with the global token [CLS] of the global view to which they belong and the local token [PART] corresponding to the local view itself. i , as the second training sample.

[0061] Step 103: Perform random masking on a portion of the global view image blocks in the first training sample to obtain the third training sample;

[0062] Each global view in the first training sample includes multiple image blocks. By randomly masking one or more of these image blocks, a third training sample is obtained. The third training sample is labeled with the same global token and local token as the first training sample. That is, any global view in the third training sample is labeled with the global token corresponding to the global view and the local tokens corresponding to the local views of all local regions included in the global view. The difference from the first training sample is that some image blocks in the global view of the third training sample are randomly masked. That is, the global view in the third training sample includes occluded image blocks. Generally, the proportion of the number of occluded image blocks to the total number of image blocks included in the global view meets a certain threshold. This threshold can be set according to existing empirical values.

[0063] Step 104: Based on the first training sample, the second training sample, and the third training sample, train the pedestrian re-identification model, determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronize them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0064] The pedestrian re-identification model provided by this invention includes a student network and a teacher network. The first training sample is used as the training sample for the teacher network in the pedestrian re-identification model to train the teacher network. The second and third training samples are used as the training samples for the student network in the pedestrian re-identification model to train the student network. When the prediction results of the student network and the teacher network are consistent, the optimal network parameters corresponding to the student network are obtained and synchronized to the teacher network of the pedestrian re-identification model, resulting in the pre-trained pedestrian re-identification model.

[0065] The method for determining text data quality provided in this invention preprocesses text data from any source by performing a first character preprocessing, thoroughly cleaning and filtering the data, and combining it with a neural network model to further analyze the text data, thereby determining its corresponding data quality, improving the quality of text data, and can be applied to provide high-quality text data for large-scale pre-trained models, thereby improving the performance of the pre-trained models, and has good practicality.

[0066] The pre-training method for the pedestrian re-identification model provided in this embodiment of the invention marks the global image and the segmented local image of the pedestrian sample image with corresponding global tokens and local tokens. During the pre-training process, the pedestrian re-identification model pays attention to both the global features and local features of the pedestrian, thereby extracting more discriminative local features and improving the accuracy of the pedestrian re-identification model in identifying pedestrians.

[0067] Optionally, the step of training the pedestrian re-identification model based on the first training sample, the second training sample, and the third training sample to determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronizing them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model, includes:

[0068] Based on the teacher network of the pedestrian re-identification model, the prediction result corresponding to the global token of the first training sample and the prediction result corresponding to each local token of the first training sample are determined and used as the first prediction result and the second prediction result, respectively.

[0069] Based on the student network of the pedestrian re-identification model, the prediction results corresponding to the global token of the third training sample, the prediction results corresponding to each local token of the third training sample, the prediction results corresponding to the global token of the second training sample, and the prediction results corresponding to the local tokens of the second training sample are determined as the third prediction result, the fourth prediction result, the fifth prediction result, and the sixth prediction result, respectively.

[0070] Based on the second prediction result, the fourth prediction result, and the sixth prediction result, a first loss function is determined; the first loss function is the local token corresponding loss function for all target local regions belonging to the same target pedestrian to be identified; the target local region is one of multiple overlapping different local regions into which the global view of the target pedestrian to be identified is segmented;

[0071] Based on the first prediction result, the third prediction result, and the fifth prediction result, a second loss function is determined; the second loss function is the loss function corresponding to the global tokens belonging to the same target pedestrian to be identified.

[0072] The optimal network parameters for the student network of the pedestrian re-identification model are obtained when the total loss function is minimized or converged; the total loss function is determined based on the first loss function and the second loss function.

[0073] By employing an exponential moving average, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0074] Specifically, the first training sample is input into the teacher network of the aforementioned person re-identification model. Feature extraction is performed through this teacher network to obtain the semantic features of the global token of the original global view (unmasked global view) and the semantic features of the local token of the original global view. Based on these semantic features, the prediction results corresponding to the global token and the local token of the original global view are determined. Specifically, obtaining the semantic features of the global token of the original global view (unmasked global view) and determining the prediction results corresponding to the global token of the original global view serves as the first prediction result. That is, for the global token, the probability that the identity information represented by the original global view is the global token corresponding to the original global view is predicted. Here, the global token corresponding to the original global view can be understood as the real identity information represented by the original global view. The first prediction result can be expressed as... Represents the global view in the first prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token.

[0075] The semantic features of the local tokens in the original global view are obtained, and the prediction result corresponding to the local tokens in the original global view is determined as the second prediction result. That is, for a local token, based on the semantic features of the local tokens in the original global view, the probability that the local classification result corresponding to the original global view is the local token labeled by the original global view is predicted. The second prediction result can be expressed as follows: Represents the global view in the second prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is the local token l i The probability of.

[0076] The third and second training samples are input into the student network of the pedestrian re-identification model. Feature extraction is performed through the student network to obtain the semantic features of the global token of the masked global view, the semantic features of the local token of the masked global view, the semantic features of the global token of the local view, and the semantic features of the local token of the local view. Based on these semantic features, the prediction results corresponding to the global token of the masked global view, the prediction results corresponding to the local token of the masked global view, the prediction results corresponding to the global token of the labeled local view, and the prediction results corresponding to the local token of the labeled local view are determined.

[0077] In this model, a third training sample, labeled with the global token and all local tokens, is input into the student network of the pedestrian re-identification model. This student network performs feature extraction to obtain the semantic features of the global token and the semantic features of the local tokens in the masked global view. For the global token, based on the obtained semantic features of the global token in the masked global view, a prediction result corresponding to the global token is determined, serving as the third prediction result. This third prediction result represents the probability that the predicted identity corresponding to the masked global view is the global token corresponding to that global view. Here, the global token can be understood as the real identity information, i.e., the probability that the predicted identity is the real identity. The third prediction result can be expressed as... This represents the global view after masking in the third prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token.

[0078] For local tokens, based on the semantic features of the local tokens in the acquired masked global view, the prediction result corresponding to the local tokens in the masked global view is determined as the fourth prediction result. This fourth prediction result represents the probability that the predicted local classification result corresponding to the masked global view is the local token labeled by the masked global view. The local token labeled by the masked global view can be understood as the true local classification prototype corresponding to the local view, i.e., which pedestrian's hat, clothing, backpack, etc., this local view belongs to. The fourth prediction result can be expressed as... This represents a partial view in the fourth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is the local token l i The probability of L; L represents the total number of local regions included in the global view of the pedestrian to be identified.

[0079] Furthermore, a second training sample, labeled with the global token and all local tokens, is input into the student network of the aforementioned person re-identification model. This student network performs feature extraction, obtaining the semantic features of the global token and the semantic features of the local tokens within the local view. For the global token, based on the obtained semantic features of the global token within the local view, the prediction result corresponding to the global token of that local view is determined, serving as the fifth prediction result. This fifth prediction result represents the probability that the predicted identity corresponding to the local view is the global token corresponding to that local view. The global token corresponding to the local view can be understood as the real identity information, i.e., the probability that the predicted identity is the real identity. The fifth prediction result can be expressed as... This represents a partial view in the fifth prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token.

[0080] For local tokens, based on the semantic features of the local tokens of the acquired local view, the prediction result corresponding to the local token of that local view is determined as the sixth prediction result. This sixth prediction result represents the probability that the predicted local classification result for that local view is the local token labeled by that local view. The local token labeled by that local view can be understood as the true local classification prototype corresponding to that local view, that is, which pedestrian's hat, clothing, backpack, etc., this local view belongs to. The sixth prediction result can be expressed as... This represents the global view in the sixth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is local token l i The probability of.

[0081] Based on the second prediction result, the fourth prediction result, and the sixth prediction result, a first loss function is determined, taking into account multiple local regions included in a single global view and local views included in each local region. Specifically, for the same pedestrian to be identified, all global views corresponding to that pedestrian have only one global token, and all local views belonging to the same local region have the same local token. That is, the first loss function is determined based on the prediction results of all local tokens corresponding to the pedestrian in the student network and the prediction results of all local tokens corresponding to the pedestrian in the teacher network.

[0082] Similarly, based on the first prediction result, the third prediction result, and the fifth prediction result, a second loss function is determined according to the multiple local regions included in a single global view and the local views included in each local region; that is, the second loss function is determined according to the prediction result of the global token corresponding to the target pedestrian in the student network and the prediction result of the global token corresponding to the teacher network.

[0083] Based on the first and second loss functions mentioned above, the total loss function is determined; based on the gradient descent method, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are obtained when the total loss function is minimized or convergence is satisfied.

[0084] By employing an exponential moving average, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0085] Optionally, determining the first loss function based on the second prediction result, the fourth prediction result, and the sixth prediction result includes:

[0086] Using the local tokens corresponding to the target local area of ​​the pedestrian to be identified as the unit, the first loss function is determined based on the cross-entropy loss function, the second prediction result, the fourth prediction result, and the sixth prediction result;

[0087] The formula satisfied by the first loss function is expressed as:

[0088]

[0089] Where m1≠m2, the cross entropy loss function H(a,b)=-alogb, θ s This represents the parameters of the student network in the pedestrian re-identification model; Represents the global view in the second prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is the local token l i The probability of; This represents a partial view in the fourth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is the local token l i The probability of; Represents the global view in the second prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is local token l i The probability value; This represents the global view in the sixth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is local token l i The probability of the target pedestrian in the first sample image is M; the total number of global views of the target pedestrian in the first sample image is J; and the total number of local views cropped from any local region is J.

[0090] Optionally, determining the second loss function based on the first prediction result, the third prediction result, and the fifth prediction result includes:

[0091] Using global tokens belonging to the target pedestrian as units, the second loss function is determined based on the cross-entropy loss function, the first prediction result, the third prediction result, and the fifth prediction result;

[0092] The formula satisfied by the second loss function is expressed as follows:

[0093]

[0094] Where m1≠m2, the cross entropy loss function H(a,b)=-alogb, Represents the global view in the first prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a partial view in the fifth prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a global view of the pedestrian to be identified in the first prediction result. The probability that the predicted target identity corresponding to the image patch marked with the global token is the global token; This represents the global view after masking in the third prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; M represents the total number of global views of the target pedestrian to be identified; L represents the total number of local regions included in the global view of the target pedestrian to be identified; J represents the total number of local views cropped from any local region.

[0095] Optionally, obtaining the global and local views of the target pedestrian to be identified includes:

[0096] Obtain any image from the first dataset as the first sample image; the first dataset consists of pedestrian images captured by multiple cameras from different perspectives and positions, and each pedestrian image has been labeled with a different pedestrian tag;

[0097] The smallest rectangular view containing the target pedestrian in the first sample image is determined as the global view;

[0098] The global view is divided into multiple overlapping local regions, and multiple rectangular views are randomly cropped from the local regions to serve as local views of the local regions.

[0099] Specifically, a first dataset is obtained, which consists of pedestrian images captured by multiple cameras from different perspectives and positions, and each pedestrian image is labeled with a different pedestrian tag.

[0100] Select any image from the first dataset as the first sample image; use different layers to obtain the smallest rectangular view including the target pedestrian, which is used as the global view of the target pedestrian. Here, there are multiple global views.

[0101] The global view is further divided into multiple overlapping local regions, and multiple rectangular views are randomly cropped from each local region to serve as local views. These local views include information about the personal belongings of the pedestrian to be identified, such as hats, clothing, and backpacks, to assist in pedestrian re-identification.

[0102] Optionally, the pedestrian re-identification model is constructed based on a visual Transformer network.

[0103] Specifically, the Vision Transformer (ViT) is a deep learning model based on the Transformer architecture, specifically designed for computer vision tasks. It's an innovative approach that extends Transformer models from Natural Language Processing (NLP) to the vision domain. The main advantages of Vision Transformer are:

[0104] Self-attention mechanism: Unlike traditional convolutional neural networks (CNNs), ViT uses the self-attention mechanism from Transformers. This self-attention mechanism enables ViT to establish global dependencies between pixels or image patches at different locations, thereby capturing spatial relationships between different regions in an image, learning contextual relationships between different objects, and relationships between objects at different scales.

[0105] Image Segmentation and Classification: Vision Transformer is primarily used for image classification and image segmentation tasks. In image classification, it takes the entire image as input and outputs the image's class label. In image segmentation, ViT can be modified to classify each pixel or image patch in the image, thus achieving image segmentation.

[0106] Positional encoding: Similar to the Transformer in Natural Language Processing (NLP), ViT introduces positional encoding to take into account the positional information of pixels or image patches. This is crucial for capturing the spatial structure of images.

[0107] Pre-training and Fine-tuning: Similar to models in natural language processing such as Bidirectional Encoder Representations from Transformers (BERT) and Generative Pre-trained Transformer (GPT), ViT can also be pre-trained and fine-tuned. During the pre-training phase, ViT is trained using a large-scale image dataset to learn general image representations. Then, during the fine-tuning phase, it can be fine-tuned based on a small-scale dataset specific to the task at hand to improve performance.

[0108] Scalability: The ViT model can be expanded and adjusted according to different tasks and image sizes. This makes it suitable for a variety of computer vision tasks and image data of different sizes.

[0109] Global visual information: Due to the use of self-attention mechanisms, ViT can capture global image information, not just local features. This makes it perform well in certain tasks, especially those that require global contextual information.

[0110] Alternative to CNNs: While convolutional neural networks have consistently performed well in computer vision, VisionTransformer offers an alternative approach for processing image data, particularly for tasks requiring large-scale, high-resolution images.

[0111] Optionally, the method further includes:

[0112] Based on the pre-trained pedestrian re-identification model, the seventh prediction result of the second sample image is determined; the second sample image includes the target pedestrian to be identified, and the corresponding global token and all local tokens have been labeled.

[0113] Based on the seventh prediction result, the global token of the second sample image label, and all local tokens, the network parameters of the pedestrian re-identification model are fine-tuned to obtain the pedestrian re-identification model.

[0114] Specifically, after pre-training the pedestrian re-identification model using the above method, the second sample image labeled with a global token and all local tokens is input into the teacher network of the pedestrian re-identification model. The prediction result corresponding to the second sample image is output, namely the seventh prediction result. The seventh prediction result includes the predicted identity information of the target pedestrian to be identified included in the second sample image. The labeled global token includes the identity information used to characterize the pedestrian in the second sample image. By comparing the two, the network parameters of the teacher network of the pedestrian re-identification model are fine-tuned so that the prediction result is consistent with the real identity represented by the labeled global token, thus obtaining the trained pedestrian re-identification model.

[0115] The pre-training method for the pedestrian re-identification model provided by this invention marks the global image and the segmented local image of the pedestrian sample image with corresponding global tokens and local tokens. During the pre-training process, the pedestrian re-identification model pays attention to both the global and local features of the pedestrian, thereby extracting more discriminative local features and improving the accuracy of the pedestrian re-identification model in identifying pedestrians.

[0116] Figure 2 This is a schematic diagram illustrating the implementation process of the pre-training method for the pedestrian re-identification model provided in this embodiment of the invention, as shown below. Figure 2 As shown, it specifically includes:

[0117] For any input image, construct views at different levels and perform global transformations to obtain a global view; divide the input image into several local regions and perform local transformations within each local region to obtain a local view.

[0118] The global view is concatenated with the global token and all local tokens, which are used as the first training sample for training the teacher network. The teacher network is then input into the global view and the corresponding prediction results are output.

[0119] The local view is combined with the global token and the local token corresponding to the local region to which the local view belongs, and used as the second training sample for training the student network. A portion of the first training sample is randomly masked and used as the third training sample for training the student network. The student network is then input into the training network and the corresponding prediction results are output.

[0120] For the same global or local token, the prediction results output by the student network and the teacher network are compared and learned. This allows the student network to predict the features of the covered area based on the uncovered area, and compare the prediction results with the prediction results output by the teacher network. This process continues until the loss function of the student network is minimized, thus obtaining the optimal network parameters of the student network. The optimal network parameters of the student network are then synchronized to the teacher network using an exponential moving average method to obtain a pre-trained person re-identification model.

[0121] By utilizing a teacher network, the network parameters of a pre-trained pedestrian re-identification model can be fine-tuned for downstream pedestrian re-identification tasks, resulting in higher performance.

[0122] Figure 3 This is a schematic diagram of the pre-training device for the pedestrian re-identification model provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the pre-training device for the pedestrian re-identification model includes:

[0123] The acquisition module 301 is used to acquire a global view and a local view of the target pedestrian to be identified; the local view is a plurality of rectangular views obtained by dividing the global view into multiple different local regions that overlap, and randomly cropping the local regions.

[0124] The determining module 302 is used to determine a first training sample and a second training sample based on the global token corresponding to the global view, the local token corresponding to the local view, and the relationship between the local view and the global view; the first training sample is the global view of the target pedestrian to be identified, and has been marked with the global token corresponding to the global view and the local tokens corresponding to all the local views belonging to the global view; the second training sample is all the local views belonging to the global view of the target pedestrian to be identified, and has been marked with the local tokens corresponding to the local views;

[0125] Masking module 303 is used to perform random masking on a portion of the image blocks of the global view in the first training sample to obtain a third training sample;

[0126] The training module 304 is used to train the pedestrian re-identification model based on the first training sample, the second training sample and the third training sample, determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronize them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0127] Optionally, the training module 304, in the process of training the pedestrian re-identification model based on the first training sample, the second training sample, and the third training sample, determining the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronizing them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model, is specifically used for:

[0128] Based on the teacher network of the pedestrian re-identification model, the prediction result corresponding to the global token of the first training sample and the prediction result corresponding to each local token of the first training sample are determined and used as the first prediction result and the second prediction result, respectively.

[0129] Based on the student network of the pedestrian re-identification model, the prediction results corresponding to the global token of the third training sample, the prediction results corresponding to each local token of the third training sample, the prediction results corresponding to the global token of the second training sample, and the prediction results corresponding to the local tokens of the second training sample are determined as the third prediction result, the fourth prediction result, the fifth prediction result, and the sixth prediction result, respectively.

[0130] Based on the second prediction result, the fourth prediction result, and the sixth prediction result, a first loss function is determined; the first loss function is the local token corresponding loss function for all target local regions belonging to the same target pedestrian to be identified; the target local region is one of multiple overlapping different local regions into which the global view of the target pedestrian to be identified is segmented;

[0131] Based on the first prediction result, the third prediction result, and the fifth prediction result, a second loss function is determined; the second loss function is the loss function corresponding to the global tokens belonging to the same target pedestrian to be identified.

[0132] Based on gradient descent, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are obtained when the total loss function is minimized or convergence is satisfied; the total loss function is determined based on the first loss function and the second loss function.

[0133] By employing an exponential moving average, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0134] Optionally, based on the second prediction result, the fourth prediction result, and the sixth prediction result, a first loss function is determined, including:

[0135] Using the local tokens corresponding to the target local area of ​​the pedestrian to be identified as the unit, the first loss function is determined based on the cross-entropy loss function, the second prediction result, the fourth prediction result, and the sixth prediction result;

[0136] The formula satisfied by the first loss function is expressed as:

[0137]

[0138] Where m1≠m2, the cross entropy loss function H(a,b)=-alogb, θ s This represents the parameters of the student network in the pedestrian re-identification model; Represents the global view in the second prediction result. Local tokens of the token iThe predicted local classification corresponding to the image patch is the local token l i The probability of; This represents a partial view in the fourth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is the local token l i The probability of; Represents the global view in the second prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is local token l i The probability value; This represents the global view in the sixth prediction result. Local tokens of the token i The predicted local classification corresponding to the image patch is local token l i The probability of the target pedestrian in the first sample image is M; the total number of global views of the target pedestrian in the first sample image is J; and the total number of local views cropped from any local region is J.

[0139] Optionally, determining the second loss function based on the first prediction result, the third prediction result, and the fifth prediction result includes:

[0140] Using global tokens belonging to the target pedestrian as units, the second loss function is determined based on the cross-entropy loss function, the first prediction result, the third prediction result, and the fifth prediction result;

[0141] The formula satisfied by the second loss function is expressed as follows:

[0142]

[0143] Where m1≠m2, the cross entropy loss function H(a,b)=-alogb, Represents the global view in the first prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a partial view in the fifth prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a global view of the pedestrian to be identified in the first prediction result. The probability that the predicted target identity corresponding to the image patch marked with the global token is the global token; This represents the global view after masking in the third prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; M represents the total number of global views of the target pedestrian to be identified; L represents the total number of local regions included in the global view of the target pedestrian to be identified; J represents the total number of local views cropped from any local region.

[0144] Optionally, the acquisition module 301, in the process of acquiring the global view and local view of the target pedestrian to be identified, is specifically used for:

[0145] Obtain any image from the first dataset as the first sample image; the first dataset consists of pedestrian images captured by multiple cameras from different perspectives and positions, and each pedestrian image has been labeled with a different pedestrian tag;

[0146] The smallest rectangular view containing the target pedestrian in the first sample image is determined as the global view;

[0147] The global view is divided into multiple overlapping local regions, and multiple rectangular views are randomly cropped from the local regions to serve as local views of the local regions.

[0148] Optionally, the pedestrian re-identification model is constructed based on a visual Transformer network.

[0149] Optionally, the device further includes a fine-tuning module for:

[0150] Based on the pre-trained pedestrian re-identification model, the seventh prediction result of the second sample image is determined; the second sample image includes the target pedestrian to be identified, and the corresponding global token and all local tokens have been labeled.

[0151] Based on the seventh prediction result, the global token of the second sample image label, and all local tokens, the network parameters of the pedestrian re-identification model are fine-tuned to obtain the pedestrian re-identification model.

[0152] It should be noted that the pre-training device for the pedestrian re-identification model provided in this embodiment of the invention can implement all the methods implemented in the above-mentioned pre-training method embodiment for the pedestrian re-identification model, and can achieve the same technical effect. Here, the parts and beneficial effects that are the same as or corresponding to the method embodiment will not be described in detail.

[0153] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present invention, such as... Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute the pre-training method of the aforementioned person re-identification model, such as including:

[0154] Obtain a global view and a local view of the target pedestrian to be identified; the local view is a rectangular view obtained by dividing the global view into multiple overlapping local regions and randomly cropping the local regions.

[0155] Based on the global token corresponding to the global view, the local token corresponding to the local view, and the relationship between the local view and the global view, a first training sample and a second training sample are determined. The first training sample is the global view of the target pedestrian to be identified, and the global token corresponding to the global view and the local tokens corresponding to all the local views belonging to the global view have been marked. The second training sample is all the local views belonging to the global view of the target pedestrian to be identified, and the local tokens corresponding to the local views have been marked.

[0156] Randomly mask a portion of the global view in the first training sample to obtain a third training sample;

[0157] Based on the first training sample, the second training sample, and the third training sample, the pedestrian re-identification model is trained to determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

[0158] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0159] It should be noted that the electronic device provided in this embodiment of the invention can implement all the steps of the methods implemented in the above-mentioned pre-training method embodiment of the pedestrian re-identification model, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.

[0160] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer is able to execute the pre-training method of the above-mentioned pedestrian re-identification model.

[0161] Specifically, the computer program product provided in the embodiments of the present invention can implement all the methods implemented in the above method embodiments and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiments and the beneficial effects will not be described in detail.

[0162] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the pre-training method of the pedestrian re-identification model described above.

[0163] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The 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 the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0164] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A pre-training method for a pedestrian re-identification model, characterized in that, include: Obtain the global and local views of the target pedestrian to be identified; The local view is a set of rectangular views obtained by dividing the global view into multiple overlapping local regions and randomly cropping from the local regions. Based on the global token corresponding to the global view, the local token corresponding to the local view, and the relationship between the local view and the global view, the first training sample and the second training sample are determined. The first training sample is a global view of the target pedestrian to be identified, and a global token corresponding to the global view and local tokens corresponding to all the local views belonging to the global view have been marked. The second training sample consists of all the local views belonging to the global view of the target pedestrian to be identified, and the local tokens corresponding to the local views have been marked. Randomly mask a portion of the global view in the first training sample to obtain a third training sample; Based on the first training sample, the second training sample, and the third training sample, the pedestrian re-identification model is trained to determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model. The step of training the pedestrian re-identification model based on the first training sample, the second training sample, and the third training sample, determining the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronizing them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model includes: Based on the teacher network of the pedestrian re-identification model, the prediction result corresponding to the global token of the first training sample and the prediction result corresponding to each local token of the first training sample are determined and used as the first prediction result and the second prediction result, respectively. Based on the student network of the pedestrian re-identification model, the prediction results corresponding to the global token of the third training sample, the prediction results corresponding to each local token of the third training sample, the prediction results corresponding to the global token of the second training sample, and the prediction results corresponding to the local tokens of the second training sample are determined as the third prediction result, the fourth prediction result, the fifth prediction result, and the sixth prediction result, respectively. Based on the second prediction result, the fourth prediction result, and the sixth prediction result, a first loss function is determined; the first loss function is the local token corresponding loss function for all target local regions belonging to the same target pedestrian to be identified; the target local region is one of multiple overlapping different local regions into which the global view of the target pedestrian to be identified is segmented; Based on the first prediction result, the third prediction result, and the fifth prediction result, a second loss function is determined; the second loss function is the loss function corresponding to the global tokens belonging to the same target pedestrian to be identified. Based on gradient descent, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are obtained when the total loss function is minimized or convergence is satisfied; the total loss function is determined based on the first loss function and the second loss function. By employing an exponential moving average, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

2. The pre-training method for the pedestrian re-identification model according to claim 1, characterized in that, The step of determining the first loss function based on the second prediction result, the fourth prediction result, and the sixth prediction result includes: Using the local tokens corresponding to the target local area of ​​the pedestrian to be identified as the unit, the first loss function is determined based on the cross-entropy loss function, the second prediction result, the fourth prediction result, and the sixth prediction result; The formula satisfied by the first loss function is expressed as: ; in, Cross-entropy loss function , This represents the parameters of the student network in the pedestrian re-identification model; Represents the global view in the second prediction result. Local tokens of the token The predicted local classification corresponding to the image patch is the local token. The probability of; This represents a partial view in the fourth prediction result. Local tokens of the token The predicted local classification corresponding to the image patch is the local token. The probability of; Represents the global view in the second prediction result. Local tokens of the token The predicted local classification corresponding to the image patch is a local token. The probability of; This represents the global view in the sixth prediction result. Local tokens of the token The predicted local classification corresponding to the image patch is a local token. The probability of the target pedestrian in the first sample image is M; the total number of global views of the target pedestrian in the first sample image is J; and the total number of local views cropped from any local region is J.

3. The pre-training method for the pedestrian re-identification model according to claim 1, characterized in that, The step of determining the second loss function based on the first prediction result, the third prediction result, and the fifth prediction result includes: Using global tokens belonging to the target pedestrian as units, the second loss function is determined based on the cross-entropy loss function, the first prediction result, the third prediction result, and the fifth prediction result; The formula satisfied by the second loss function is expressed as follows: in, Cross-entropy loss function , Represents the global view in the first prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a partial view in the fifth prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; This represents a global view of the pedestrian to be identified in the first prediction result. The probability that the predicted target identity corresponding to the image patch marked with the global token is the global token; This represents the global view after masking in the third prediction result. The probability that the predicted target identity corresponding to the marked global token is the global token; M represents the total number of global views of the target pedestrian to be identified; L represents the total number of local regions included in the global view of the target pedestrian to be identified; J represents the total number of local views cropped from any local region.

4. The pre-training method for the pedestrian re-identification model according to claim 1, characterized in that, The process of obtaining the global and local views of the target pedestrian to be identified includes: Obtain any image from the first dataset as the first sample image; the first dataset consists of pedestrian images captured by multiple cameras from different perspectives and positions, and each pedestrian image has been labeled with a different pedestrian tag; The smallest rectangular view containing the target pedestrian in the first sample image is determined as the global view; The global view is divided into multiple overlapping local regions, and multiple rectangular views are randomly cropped from the local regions to serve as local views of the local regions.

5. The pre-training method for the pedestrian re-identification model according to claim 1, characterized in that, The pedestrian re-identification model is built based on a visual Transformer network.

6. The pre-training method for the pedestrian re-identification model according to claim 1, characterized in that, The method further includes: Based on the pre-trained pedestrian re-identification model, the seventh prediction result of the second sample image is determined; the second sample image includes the target pedestrian to be identified, and the corresponding global token and all local tokens have been labeled. Based on the seventh prediction result, the global token of the second sample image label, and all local tokens, the network parameters of the pedestrian re-identification model are fine-tuned to obtain the pedestrian re-identification model.

7. A pre-training device for a pedestrian re-identification model, characterized in that, include: The acquisition module is used to acquire the global and local views of the target pedestrian to be identified; The local view is a set of rectangular views obtained by dividing the global view into multiple overlapping local regions and randomly cropping from the local regions. The determination module is used to determine the first training sample and the second training sample based on the global token corresponding to the global view, the local token corresponding to the local view, and the relationship between the local view and the global view. The first training sample is a global view of the target pedestrian to be identified, and a global token corresponding to the global view and local tokens corresponding to all the local views belonging to the global view have been marked. The second training sample consists of all the local views belonging to the global view of the target pedestrian to be identified, and the local tokens corresponding to the local views have been marked. The masking module is used to perform random masking on a portion of the global view in the first training sample to obtain a third training sample. The training module is used to train the pedestrian re-identification model based on the first training sample, the second training sample and the third training sample, determine the optimal network parameters corresponding to the student network of the pedestrian re-identification model, and synchronize them to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model. The training module is specifically used for: Based on the teacher network of the pedestrian re-identification model, the prediction result corresponding to the global token of the first training sample and the prediction result corresponding to each local token of the first training sample are determined and used as the first prediction result and the second prediction result, respectively. Based on the student network of the pedestrian re-identification model, the prediction results corresponding to the global token of the third training sample, the prediction results corresponding to each local token of the third training sample, the prediction results corresponding to the global token of the second training sample, and the prediction results corresponding to the local tokens of the second training sample are determined as the third prediction result, the fourth prediction result, the fifth prediction result, and the sixth prediction result, respectively. Based on the second prediction result, the fourth prediction result, and the sixth prediction result, a first loss function is determined; the first loss function is the local token corresponding loss function for all target local regions belonging to the same target pedestrian to be identified; the target local region is one of multiple overlapping different local regions into which the global view of the target pedestrian to be identified is segmented; Based on the first prediction result, the third prediction result, and the fifth prediction result, a second loss function is determined; the second loss function is the loss function corresponding to the global tokens belonging to the same target pedestrian to be identified. Based on gradient descent, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are obtained when the total loss function is minimized or convergence is satisfied; the total loss function is determined based on the first loss function and the second loss function. By employing an exponential moving average, the optimal network parameters corresponding to the student network of the pedestrian re-identification model are synchronized to the teacher network of the pedestrian re-identification model to obtain the pre-trained pedestrian re-identification model.

8. 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 program, it implements the pre-training method for the pedestrian re-identification model as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the pre-training method for the pedestrian re-identification model as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Pedestrian re-identification method based on global-local feature dynamic alignment

    CN113408492A

  • Unsupervised pedestrian re-identification method and device based on multi-branch network

    CN114882521A