A pedestrian re-identification model training method and device, a storage medium, and a terminal

By combining a hierarchical self-attention network model with multiple loss functions, the problem of being unable to extract global human features in existing technologies is solved, and the ability of the pedestrian re-identification model to effectively identify and represent multimodal data is improved.

CN114782979BActive Publication Date: 2026-11-03TERMINUSBEIJING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210204501.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-02
Publication Date
2026-11-03
Estimated Expiration
2042-03-02

AI Technical Summary

Technical Problem

Existing technologies struggle to directly acquire global human features, and CNN networks have limitations in processing multimodal data, failing to effectively utilize temporal information and other modal data.

Method used

A hierarchical self-attention network model is used as the backbone model. By combining local loss function, global loss function, free Euclidean space representation loss function and hyperspherical representation loss function, the pedestrian re-identification model is iteratively trained to extract global and local human features.

Benefits of technology

It achieves effective recognition of global and local human features, improves the recognition capability of pedestrian re-identification models, and can process multimodal data and improve the efficiency of representation learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114782979B_ABST
    Figure CN114782979B_ABST
Patent Text Reader

Abstract

The application relates to a pedestrian re-identification model training method and device, a storage medium and a terminal. The method comprises the following steps: collecting a human data sample set; inputting the human data sample set into a hierarchical self-attention network model in a pedestrian re-identification model to output human global features of the pedestrian re-identification model; obtaining human local features of the pedestrian re-identification model according to the human global features; obtaining a local loss function and a global loss function of the pedestrian re-identification model according to the human global features, the human local features, a classifier in the pedestrian re-identification model, a triple loss function, a class center loss function, a batch normalization algorithm and an angle interval-based loss function; and iteratively training the pedestrian re-identification model according to the local loss function and the global loss function in a back propagation mode. The pedestrian re-identification model comprises a hierarchical self-attention network model, can identify human global features and human local features, and can further identify a person.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and more specifically, to a training method, apparatus, storage medium, and terminal for a pedestrian re-identification model. Background Technology

[0002] Person re-identification, also known as pedestrian re-identification, is a technique that uses computer vision to determine the presence of a specific pedestrian in an image or video sequence. It is widely considered a sub-problem of image retrieval. Given a surveillance image of a pedestrian, it retrieves images of that pedestrian across different devices. It aims to overcome the visual limitations of fixed cameras and can be combined with pedestrian detection / tracking technologies, finding wide application in fields such as intelligent video surveillance and intelligent security.

[0003] This application proposes a training method, device, storage medium, and terminal for a pedestrian re-identification model. It uses a hierarchical self-attention network model as the backbone model, which can directly obtain global human body features. It can iteratively train the pedestrian re-identification model based on the obtained local loss function and global loss function, so that the pedestrian re-identification model can identify global human body features and local human body features, and thus identify pedestrians. Summary of the Invention

[0004] This application provides a training method, apparatus, storage medium, and terminal for a pedestrian re-identification model. To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general description, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its sole purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.

[0005] In a first aspect, embodiments of this application provide a method for training a pedestrian re-identification model, the method comprising:

[0006] Collect a human body data sample set for the pedestrian re-identification model;

[0007] The human body data sample set is input into the hierarchical self-attention network model in the pedestrian re-identification model, and the global human body features of the pedestrian re-identification model are output.

[0008] Based on the global human body features, the local human body features of the pedestrian re-identification model are obtained;

[0009] Based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model, the local loss function and global loss function of the pedestrian re-identification model are obtained.

[0010] The pedestrian re-identification model is iteratively trained using backpropagation based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model.

[0011] Optionally, the human data sample set for the pedestrian re-identification model includes:

[0012] Obtain an RGB image that includes human scale and aspect ratio features;

[0013] The RGB image is enhanced to obtain the human data sample set of the pedestrian re-identification model.

[0014] Optionally, obtaining the local human body features of the pedestrian re-identification model based on the global human body features includes:

[0015] The global human body features are input into the adaptive global average pooling layer of the pedestrian re-identification model;

[0016] The global human body features output by the adaptive global average pooling layer are cut into local human body features along the depth direction.

[0017] Optionally, the classifier includes a local classifier and an angular classifier;

[0018] The step of obtaining the local and global loss functions of the pedestrian re-identification model based on the global and local features of the human body, as well as the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle-interval-based loss function in the pedestrian re-identification model, includes:

[0019] The local human body features are input into the local classifier corresponding to the local human body features, and the local feature category probability of the pedestrian re-identification model is output.

[0020] The local loss function of the pedestrian re-identification model is calculated based on the local feature category probabilities and the corresponding real labels.

[0021] Optionally, obtaining the local and global loss functions of the person re-identification model based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle-interval-based loss function in the person re-identification model includes:

[0022] Based on the global human body features, the triplet loss function, and the class center loss function, the free Euclidean space representation loss function of the pedestrian re-identification model is obtained.

[0023] Based on the global human body features, the batch normalization algorithm, the angle classifier, and the angle-interval-based loss function, the hyperspherical representation loss function of the pedestrian re-identification model is obtained.

[0024] The global loss function of the pedestrian re-identification model is obtained based on the local loss function, the free Euclidean space representation loss function, and the hyperspherical representation loss function.

[0025] Optionally, obtaining the free Euclidean space representation loss function of the person re-identification model based on the global human body features, the triplet loss function, and the class center loss function includes:

[0026] Based on the global human body features, anchor samples are extracted from the pedestrian re-identification model;

[0027] Based on the anchor sample, similar samples of the anchor sample, dissimilar samples of the anchor sample, and the triplet loss function, the category loss function of the pedestrian re-identification model is obtained.

[0028] Based on the anchor sample, the class center of the category to which the anchor sample belongs, and the class center loss function, the distance loss function of the pedestrian re-identification model is obtained;

[0029] Based on the category loss function and the distance loss function, the free Euclidean space representation loss function of the pedestrian re-identification model is obtained.

[0030] Optionally, obtaining the hyperspherical representation loss function of the person re-identification model based on the global human body features, the batch normalization algorithm, the angle classifier, and the angle-interval-based loss function includes:

[0031] The batch normalization algorithm is used to normalize the dimensional distribution of each feature channel of the global human body features;

[0032] The normalized global human body features are input into the angle classifier to obtain the final sample representation of the pedestrian re-identification model.

[0033] The hyperspherical representation loss function of the pedestrian re-identification model is calculated based on the final sample representation and the angle-interval-based loss function.

[0034] Secondly, embodiments of this application provide a training apparatus for a pedestrian re-identification model, the apparatus comprising:

[0035] The data sample acquisition module is used to collect human body data sample sets for the pedestrian re-identification model;

[0036] The global feature acquisition module is used to input the human data sample set into the hierarchical self-attention network model in the pedestrian re-identification model and output the global human features of the pedestrian re-identification model.

[0037] The local feature acquisition module is used to acquire the local human features of the pedestrian re-identification model based on the global human features.

[0038] The loss function acquisition module is used to acquire the local loss function and global loss function of the pedestrian re-identification model based on the global features of the human body, the local features of the human body, and the classifier, triplet loss function, class center loss function, batch normalization algorithm and angle interval-based loss function in the pedestrian re-identification model.

[0039] The model training module is used to iteratively train the pedestrian re-identification model using backpropagation based on the local loss function and the global loss function, so as to obtain the trained pedestrian re-identification model.

[0040] Thirdly, embodiments of this application provide a computer storage medium storing multiple instructions adapted for loading and execution of the above-described method steps by a processor.

[0041] Fourthly, embodiments of this application provide a terminal that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed by the above-described method steps.

[0042] The technical solutions provided in this application embodiment may include the following beneficial effects:

[0043] In this embodiment, the training method for the pedestrian re-identification model first collects a human body data sample set for the pedestrian re-identification model; then, the human body data sample set is input into the hierarchical self-attention network model in the pedestrian re-identification model, and the global human body features of the pedestrian re-identification model are output; then, based on the global human body features, the local human body features of the pedestrian re-identification model are obtained; next, based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model, the local loss function and global loss function of the pedestrian re-identification model are obtained; finally, the pedestrian re-identification model is iteratively trained using backpropagation based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model. The method described in this application embodiment employs a technical approach that differs from existing technologies. It uses a hierarchical self-attention network model as the backbone model, which can solve the problem that existing technologies cannot directly obtain global human body features. It can iteratively train the pedestrian re-identification model based on the obtained local loss function and global loss function, so that the pedestrian re-identification model can identify global human body features and local human body features, and thus identify pedestrians.

[0044] In the embodiments of this application, the training method of the pedestrian re-identification model not only introduces the attribute loss function included in the local loss function, but also introduces the free Euclidean space representation loss function and the hyperspherical representation loss function. The free Euclidean space representation loss function and the hyperspherical representation loss function can directly perform metric learning on the global human features obtained from the hierarchical self-attention network model. During backpropagation, the gradient can be directly applied to the parameters of the last layer of the hierarchical self-attention network model, so that the pedestrian re-identification model can be trained more efficiently, obtain better representation ability, and achieve better recognition effect.

[0045] In the embodiments of this application, the training method of the pedestrian re-identification model introduces appearance (attribute) feature information, which is included in the local features of the human body. Through the PAC classifier corresponding to the appearance (attribute) feature information and the feature fusion unit between local blocks, multiple feature information can be fully integrated and utilized, thereby improving the richness of the representation information.

[0046] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0047] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0048] Figure 1 This is a flowchart illustrating a training method for a pedestrian re-identification model provided in an embodiment of this application;

[0049] Figure 2 This is a schematic diagram of the structure of a training method for a pedestrian re-identification model provided in an embodiment of this application;

[0050] Figure 3 This is another structural schematic diagram of a training method for a pedestrian re-identification model provided in an embodiment of this application;

[0051] Figure 4 This is a flowchart illustrating another method for training a pedestrian re-identification model provided in an embodiment of this application;

[0052] Figure 5 This is a schematic diagram of a training device for a pedestrian re-identification model provided in an embodiment of this application;

[0053] Figure 6 This is a schematic diagram of a terminal provided in an embodiment of this application. Detailed Implementation

[0054] The following description and accompanying drawings fully illustrate specific embodiments of the invention to enable those skilled in the art to practice them.

[0055] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0056] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of systems and methods consistent with some aspects of the invention as detailed in the appended claims.

[0057] In the description of this invention, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of these terms in this invention based on the specific circumstances. Furthermore, in the description of this invention, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0058] Pedestrian re-identification, or ReID for short, is a crucial alternative technology in surveillance videos. Due to limitations in camera resolution and shooting angle, high-quality facial images are often unavailable, making it impossible to track specific targets across different shots when facial recognition fails.

[0059] With the development of deep learning in recent years, ReID technology has also made significant breakthroughs. From a technical perspective, ReID technology can be mainly divided into representation-based learning, metric-based learning, and local feature-based technologies. In terms of algorithm model structure, most ReID technologies employ the traditional and mature CNN network technology. CNN networks use local sliding window filtering operations from traditional digital image processing. While this can effectively extract local features, it also suffers from a limited receptive field: a lack of global features with a larger receptive field. To expand the receptive area of ​​CNN networks and obtain features with a larger receptive field, the mainstream approach is to construct a feature pyramid from local to global using a multi-layered "convolution-pooling-stacking" structure. Furthermore, CNN networks are only adept at parsing image information and are not good at processing other modalities, especially temporal information (such as text, speech, and long videos). The use of CNN networks in ReID technology largely limits it to spatial information and image modality data, hindering the utilization of multimodal data.

[0060] This invention proposes a training method, apparatus, storage medium, and terminal for a pedestrian re-identification model. It employs a technical approach distinct from existing technologies, using a hierarchical self-attention network model as the backbone model. This addresses the problem in existing technologies where global human body features cannot be directly obtained. Furthermore, it allows for iterative training of the pedestrian re-identification model based on the acquired local and global loss functions, enabling the model to recognize both global and local human body features, thereby identifying pedestrians.

[0061] The following will be combined with the appendix Figure 1 -Appendix Figure 4 This paper provides a detailed description of a training method for a pedestrian re-identification model provided in the embodiments of this application.

[0062] Please see Figure 1-3 This is a flowchart illustrating a training method for a pedestrian re-identification model, as provided in an embodiment of this application. Figure 1-3 As shown, the method in this application embodiment may include the following steps:

[0063] S110, collects human body data sample set for pedestrian re-identification model.

[0064] S110 includes: acquiring an RGB image containing human body scale and aspect ratio features.

[0065] In this embodiment, based on human body scale and aspect ratio characteristics, while ensuring the accuracy of the hierarchical self-attention network model, the RGB images input to the hierarchical self-attention network model can be designed as two types of RGB images: [B, 3, 224, 224] and [B, 3, 224, 112]. Both of these RGB images are RGB images with an input shape of ([B, C, H, W]), where B represents the data volume of the batch of RGB images, C represents the number of channels, H represents the height, and W represents the width. The aspect ratios of these two input shape RGB images are... The aspect ratios are 1:1 and 1:2, respectively. When the aspect ratio of an RGB image is 1:1, the RGB image can be directly input into the hierarchical self-attention network model, and the RGB image can better adapt to the hierarchical self-attention network model, allowing the model to extract more complete local human features within the RGB image. Since the body shape features of pedestrians (i.e., human scale and aspect ratio features) are destroyed when the RGB image is resized to a 1:1 aspect ratio, and in reality, the body ratio of pedestrians is no higher than 1:2, considering the body ratio of pedestrians, the input to the hierarchical self-attention network model can be an RGB image with the shape [B,3,224,112].

[0066] The RGB image is enhanced to obtain the human data sample set of the pedestrian re-identification model. The image enhancement operation can be zero padding, i.e., padding with zeros.

[0067] In this embodiment, to adapt to the hierarchical self-attention network model, after a small batch of RGB image input I is adjusted to [B,3,224,112], image enhancement operations can be performed on both the left and right sides of the RGB image in the row direction to obtain a small batch of input RGB image I′ of [B,3,224,112]. At this time, the effective region (original image content region) in the new RGB image I′ is centered in the new RGB image I′. The formula for the image enhancement operation is as follows:

[0068]

[0069] Where padding = (pad left ,pad right ,pad top ,pad down )

[0070] In the formula, ZeroPad refers to the operation of padding with zeros, padding represents the filling, width represents the width W of the RGB image, and padding represents the padding area. left Indicates the quantity to be added to the left, pad right Indicates adding quantity to the right, pad top Indicates the quantity to be added upwards, pad down This indicates the quantity to be added downwards.

[0071] Several new RGB images I′ can be used to form a human body data sample set.

[0072] S120, input the human body data sample set into the hierarchical self-attention network model in the pedestrian re-identification model, and output the global human body features of the pedestrian re-identification model.

[0073] In this embodiment, the backbone model of the pedestrian re-identification model adopts a hierarchical self-attention network model, which is a SwinTransformer network improved from the Transformer network. The hierarchical self-attention network model consists of one local block embedding vectorization and s stages, each stage consisting of one local block feature fusion and t Transformer modules. Here, Transformer represents a network structure based on a self-attention mechanism. Transformer network technology is suitable for Natural Language Processing (NLP) and can be applied to the field of computer vision. Compared to CNN network technology, Transformer network technology directly has the ability to extract long-range global human features without the need for multi-layer stacking, thus solving the problem that CNN network technology cannot directly obtain global human features. Furthermore, the multi-head attention mechanism in the Transformer network allows it to focus on features of multiple important regions. Meanwhile, the Transformer network has better multimodal fusion capabilities and is very good at processing temporal information, which is conducive to the expansion of ReID technology on multimodal data. It can improve ReID technology by fusing data from other modalities. The SwinTransformer refers to a Transformer model designed for the field of computer vision. The Swin Transformer model built based on Transformer has improved the quality of human global features due to its ability to extract long-range human global features, thus making representation learning more effective.

[0074] Local block embedding vectorization, also known as Patch Embedding (PE), can be represented by the following expression:

[0075] PE(I′,psize,edim)=LayerNorm(Conv2D(I′,3,edim,psize,psize))

[0076] Conv2D(x,input channel ,output channel (ksize, stride) represents a 2D convolution operation.

[0077] Where psize represents the size of the cut block, edim represents the size of the output feature channels, Conv2D represents 2D convolution, and LayerNorm represents the normalization layer; input channel The input tensor represents the depth dimension, and the output tensor represents the depth dimension. channel The output tensor represents the depth dimension, ksize represents the size of the convolution kernel, stride represents the downsampling rate when performing the convolution operation; 3 represents the number of channels is 3; x represents the input of the function, which refers to any input, and x can be the RGB image I′ input in the embodiment of this application.

[0078] Local block feature fusion is called PatchMerging, denoted by PM. A Transformer module is called a TransformerBlock, representing a network module based on the Transformer structure, denoted by TB. Assuming an arbitrary feature tensor f is given, and f is used as the input to a function, then local block feature fusion, the Transformer module, and the submodules that make up the Transformer module can be represented by the following expressions:

[0079] PM(f)=Linear(LayerNorm(Downsample(f,2)),4*input dim 2*input dim )

[0080] Linear(x, input) channel ,output channel () is a fully connected layer

[0081] TB(f)=SWMSABlock(WMSABlock(f))

[0082] SWMSABlock(f)=MLP(LayerNorm(G SWMSA (f)))+G SWMSA (f)

[0083] WMSABlock(f)=MLP(LayerNorm(G WMSA (f)))+G WMSA (f)

[0084] G WMSA (f)=WMSA((LayerNorm(f)))+f

[0085] G SWMSA (f)=SWMSA((LayerNorm(f)))+f

[0086] In the formula, Downsample(f,2) represents a downsampling operation with a stride of 2 on f, and 4*input dim This represents a 4x dimension input, 2*input dim The input dimension is 2x. Linear represents a fully connected layer, MLP represents a fully connected layer with activation function and Dropout, WMSABlock represents a window multi-head self-attention module, SWMSABlock represents a moving window multi-head self-attention module, WMSA represents a window multi-head self-attention network, and SWMSA represents a moving window multi-head attention network.

[0087] In this embodiment, a new RGB image I′ (i.e., an RGB image in the human data sample set) obtained by performing a series of image enhancement operations on a given small batch of RGB images I is input into a hierarchical self-attention network model. A normalization layer needs to be added after the last stage of the hierarchical self-attention network model to obtain the final global human feature U. The calculation process after the human data sample is input into the hierarchical self-attention network model can be expressed by the following mathematical formula:

[0088]

[0089]

[0090]

[0091]

[0092]

[0093]

[0094] In the formula, E represents the output of PE, R represents any real number, and B represents the batch size of a certain batch of image data; TB ×2This indicates that this stage consists of two nested TBs. ×6 This indicates that the stage consists of 6 nested TBs; D1 represents the output of the first stage in the hierarchical self-attention network model, D2 represents the output of the second stage in the hierarchical self-attention network model, D3 represents the output of the third stage in the hierarchical self-attention network model, D4 represents the output of the fourth stage in the hierarchical self-attention network model, and U represents the global human features output by the normalization layer after the output of the fourth stage is input into the normalization layer; the values ​​96, 192, 384, and 768 change according to the structural changes of the hierarchical self-attention network model. Since the block size psize of the hierarchical self-attention network model is fixed at 4, that is, the entire RGB image is cut into 4*4=16 small blocks. Since the RGB image has 3 channels, after stacking the 16 small blocks along the feature channels, a tensor with a channel size of 16*3=48 and an RGB image with the shape (B, H / 4, W / 4, 48) can be obtained. Finally, the number of channels is doubled by convolution, becoming 96. These operations can be performed simultaneously by setting the stride of the Conv2D function in the PE module, so these values ​​remain fixed in the later stages. In this embodiment, too few or too many cut blocks will lead to reduced computational efficiency.

[0095] In this embodiment of the application, for real-time considerations, the input of the hierarchical self-attention network model is a fixed size I. shape The RGB image I′ is obtained by adjusting and enhancing the RGB image of [B, 3, 224, 224]. While maintaining the accuracy of the hierarchical self-attention network model, the block size of the local block embedding vectorization (PE) is psize = 4, the output dimension of PE is edim = 96, and the stage is s = 4, indicating a total of 4 stages. The number of Transformer modules (TB) is T = [2, 2, 6, 2] (corresponding to the respective stages). Finally, the output size of the global human features is...

[0096] S130, based on the global human body features, obtain the local human body features of the pedestrian re-identification model. Specifically, S130 includes:

[0097] The global human body features are input into the adaptive global average pooling layer of the person re-identification model. In this embodiment, during the training of the person re-identification model, after obtaining the global human body features U from the hierarchical self-attention network model, U is expanded to form... Will U 2dThe input is fed into an adaptive global average pooling layer (AdaptiveAvgPool) with a window size of (6,1) to obtain the global human feature U′ output by the adaptive global average pooling layer. At this time, U′∈R (B,768,6,1) The global human body feature U′ is subsequently used to segment local human body features and calculate the local loss function of the pedestrian re-identification model.

[0098] In this embodiment, after obtaining the global human feature U from the hierarchical self-attention network model, the global human feature U can be directly input into an adaptive global average pooling layer with a window size of (1) to obtain the global human feature U′. The global human body feature U′ is input into the free Euclidean space representation learning module and the hyperspherical representation learning module respectively to calculate the representation loss in different spaces.

[0099] The global human body features output by the adaptive global average pooling layer are cut into local human body features along the depth direction.

[0100] In this embodiment, the global human body feature U′ output by the adaptive global average pooling layer is divided into six blocks along the depth direction to obtain six local human body features. Each local human body feature can be U′. i ∈R (B,768) The six human body features mentioned may include features related to the head, shoulders, abdomen, thighs, calves, and shoes.

[0101] From the perspective of corresponding appearance and posture labels in local areas, the six local human body features can also include appearance feature information such as backpack color, hat color, upper garment style, upper garment color, lower garment style, and lower garment color; the local human body features can also be labels such as pedestrian behavior; through these attributes, more effective supervisory information can be provided for the feature extraction of local details of pedestrian appearance. The backpack color, hat color, upper garment style, upper garment color, lower garment style, and lower garment color can all be 5 categories, 5 categories, 4 categories, 12 categories, 4 categories, and 12 categories respectively.

[0102] S140, based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model, obtain the local loss function and global loss function of the pedestrian re-identification model; the classifier includes a local classifier and an angle classifier.

[0103] Specifically, S140 includes:

[0104] The local human body features are input into the local classifier corresponding to the local human body features, and the local feature category probability of the pedestrian re-identification model is output; the local classifier includes: a local human body feature classifier and a local human body attribute classifier.

[0105] In this embodiment of the application, when the six human body local features are related features such as the head, shoulders, abdomen, thighs, calves, and shoes, the six human body local features can be input into the corresponding human body local feature classifier to obtain the local feature category probability of each human body local feature. For example... Figure 2 As shown, the six human body local feature classifiers are PFC classifier 1, PFC classifier 2, ..., PFC classifier 6; the PFC classifier is the Part-featured classifier. The following are the relevant definitions of the PFC classifier designed based on human body local features:

[0106] PFC(f)=Linear(FeatureEmbed(f),512,class num )

[0107] Among them, FeatureEmbed(x)

[0108] =DropOut(LeakReLU(BN(Linear(x,input channel ,512))))

[0109] In the formula, BN represents the Batch Normalization layer; LeakReLU represents the activation function; DropOut represents the layer that randomly deletes neurons; FeatureEmbed represents the feature fusion layer for local block features; class num 512 represents the number of categories in the corresponding PFC classifier; in the formula of PFC(f), 512 represents the number of input dimensions; in the DropOut layer of the neuron, 512 represents the number of output dimensions.

[0110] By inputting six local human body features into six PFC classifiers, the predicted local feature class probabilities of the six local human body features can be obtained. The six local feature class probabilities are then weighted and fused to obtain the final predicted local feature class probability O, which is defined as follows:

[0111] o i =PFC i (U′ i ),in

[0112]

[0113] In the formula, i represents the i-th element, and i can be 0, 1, 2, 3, 4, 5, or 6; PFC i Let U′ represent the i-th PFC classifier. i o represents the local human body features within the i-th classifier. i represents the local feature category probability of the local human body feature output by the i-th classifier, and 1 represents the number of output dimensions; Softmax represents an activation function that maps the outputs of multiple neurons to the (0,1) interval, and the sum of the outputs of all neurons after mapping is 1.

[0114] In this embodiment of the application, when the six human body local features are appearance attribute information such as backpack color, hat color, top style, top color, bottom style, and bottom color, these six human body local features can be input into the corresponding human body local attribute classifier to obtain the local feature category probability of each human body local feature. For example... Figure 3 As shown, the six human body local attribute classifiers are PAC classifier 1, PAC classifier 2, ..., PAC classifier 6; the PAC classifier is a Part-Attributed classifier. The following are the relevant definitions of PAC classifiers designed based on human body local attributes:

[0115] PAC1(V)=Linear(FeatureEmbed(V),512,5)

[0116] PAC2(V)=Linear(FeatureEmbed(V),512,5)

[0117] PAC3(V)=Linear(FeatureEmbed(V),512,4)

[0118] PAC4(V)=Linear(FeatureEmbed(V),512,12)

[0119] PAC5(V)=Linear(FeatureEmbed(V),512,4)

[0120] PAC6(V)=Linear(FeatureEmbed(V),512,12)

[0121] Among them, FeatureEmbed(V)

[0122] =DropOut(LeakReLU(BN(Linear(V,input channel ,512))))

[0123] V is a combination of n local block features.

[0124] In the formula PAC1(V), PAC1 represents the backpack color classifier, and 5 indicates that there are 5 categories of backpack colors; in the formula PAC2(V), PAC2 represents the hat color classifier, and 5 indicates that there are 5 categories of hat colors; in the formula PAC3(V), PAC3 represents the top style classifier, and 4 indicates that there are 4 categories of top styles; in the formula PAC4(V), PAC4 represents the top color classifier, and 12 indicates that there are 12 categories of top colors; in the formula PAC5(V), PAC5 represents the bottom style classifier, and 4 indicates that there are 4 categories of bottom styles; in the formula PAC6(V), PAC6 represents the hat color classifier, and 12 indicates that there are 12 categories of hat colors.

[0125] By inputting each local human body feature into the corresponding PAC classifier, the local feature category probability of the local human body feature can be obtained, which is defined as follows:

[0126]

[0127] Where i represents the i-th PAC i U′ represents the i-th PAC classifier. i o represents the local human body features within the i-th classifier. i This represents the local feature category probability of the local human body feature output by the i-th classifier.

[0128] In this embodiment, FeatureEmbed represents a specially designed feature fusion unit for fusing features from multiple local blocks. Feature fusion of local blocks is based on the probability of human body features appearing in each local block. For example, if the appearance information of the backpack is likely to appear in the first three local blocks, then V is composed of the features from the first three local blocks, which are then fused by FeatureEmbed and sent to the fully connected Linear layer for classification.

[0129] The local loss function of the pedestrian re-identification model is calculated based on the local feature category probabilities and the corresponding real labels.

[0130] In this embodiment of the application, during the training of the pedestrian re-identification model, when the six local human body features are related features such as the head, shoulders, abdomen, thighs, calves, and shoes, the local feature category probability of the output local human body features can be predicted by each PFC classifier. i The local loss function for local human body features is calculated using the corresponding true label K. The definition of the local loss function is as follows:

[0131] L total =CrossEntropy(softmax(o1),K)

[0132] +CrossEntropy(softmax(o2),K)+…

[0133] +CrossEntropy(softmax(o6),K)

[0134] In the formula, L total This refers to the local loss function, CrossEntropy, where K represents a pedestrian ID and the image is associated with that pedestrian ID.

[0135] In this embodiment of the application, during the training of the pedestrian re-identification model, when the six local human body features are appearance features such as backpack color, hat color, top style, top color, bottom style, and bottom color, the local feature category probability of the output local human body features can be predicted by each PAC classifier. i and the corresponding real label Y i To calculate the local loss function for local features of the human body, the definition of the local loss function is as follows:

[0136] L attribute =CrossEntropy(o1,Y1)+CrossEntropy(o2,Y2)+…

[0137] +CrossEntropy(o6,Y6)

[0138] At this point, the local loss function is also called the attribute loss function, where L attribute This is the attribute loss function, where Y1 represents the backpack color ID, Y2 represents the hat color ID, Y3 represents the top style ID, Y4 represents the top color ID, Y5 represents the bottom style ID, and Y6 represents the bottom color ID.

[0139] In this embodiment of the application, in order to solve the representation learning problem of pedestrian re-identification, RGB images and ID tag information are fully utilized. Based on the use of ID tag information, appearance attribute information is introduced, and a PAC classifier and a feature fusion unit between local blocks are designed for appearance attribute information to improve the richness of representation information.

[0140] In this embodiment, an ID representation learning module (IDEmbedding Module, or IDEM) is designed to address the issue of global human body features. This module includes a free Euclidean space-based representation learning module and a hyperspherical representation learning module. By calculating the representation loss of global human body features in different spaces and then combining them, the module can better utilize these two loss functions and provide more effective supervised learning of the representation. The free Euclidean space-based representation learning module calculates the free Euclidean space representation loss function for global human body features in free Euclidean space. The hyperspherical representation learning module normalizes and constrains global human body features using a batch normalization algorithm and maps them onto a hypersphere. The hyperspherical representation loss function is obtained through an angle classifier and an angle penalty mechanism, including an angle-interval-based loss function. The design of the ID representation learning module enables the pedestrian re-identification model to separate the global human body features of different pedestrians, resulting in superior performance.

[0141] In this embodiment of the application, S140 includes:

[0142] In the free Euclidean space-based representation learning module, the free Euclidean space representation loss function of the person re-identification model is obtained based on the global human body features, the triplet loss function, and the center loss function. The free Euclidean space-based representation learning module consists of a triplet loss function and a center loss function. Specifically, it includes:

[0143] Based on the global human body features, anchor samples for the pedestrian re-identification model are extracted. In this embodiment, before calculating the category loss function of the pedestrian re-identification model, anchor samples a1 need to be selected from the global human body features of the small batch training data based on the real ID labels.

[0144] The category loss function of the pedestrian re-identification model is obtained based on the anchor sample, similar samples of the anchor sample, dissimilar samples of the anchor sample, and the triplet loss function. In this embodiment, anchor sample a1, similar sample a2 of anchor sample a1, and dissimilar sample a3 of anchor sample a1 can be combined into a triplet (a1, a2, a3); the category loss function of the pedestrian re-identification model is obtained based on the triplet (a1, a2, a3) and the triplet loss function: L triplet (a1,a2,a3).

[0145] The distance loss function of the pedestrian re-identification model is obtained based on the anchor sample, the class center of the category to which the anchor sample belongs, and the class center loss function. In this embodiment, the distance loss function of the anchor sample a is calculated based on the class center loss function.i With anchor sample a i The distance to the class center C of the corresponding category is used to obtain the distance loss function of the pedestrian re-identification model: L. center (a1,C).

[0146] Based on the ternary loss function and the distance loss function, the free Euclidean space representation loss function of the person re-identification model is obtained. In this embodiment, the category loss function (a1, a2, a3) and the distance loss function L are... center Adding (a1, C) together yields the free Euclidean space representation loss function, expressed as:

[0147] L FreeEuc =L triplet (a a ,a2,a3)+L center (a1,C).

[0148] In the hyperspherical representation learning module, the hyperspherical representation loss function of the pedestrian re-identification model is obtained based on the global human body features, the batch normalization algorithm, the angle classifier, and the angle-interval-based loss function. The hyperspherical representation learning module consists of the batch normalization algorithm, the angle classifier, and the angle-interval-based loss function. Specifically, it includes:

[0149] The batch normalization algorithm is used to normalize the dimensional distribution of each feature channel of the global human body feature; the normalized global human body feature is input into the angle classifier to obtain the final sample representation of the pedestrian re-identification model; the hyperspherical representation loss function of the pedestrian re-identification model is calculated based on the final sample representation and the angle interval-based loss function.

[0150] In this embodiment, the global human body feature U′ is input into a batch normalization algorithm to normalize the dimensional distribution of each feature channel of the global human body feature U′. After normalization, the global human body feature U′ is input into an angle classifier whose weights W are constrained to a hypersphere (i.e., W is constrained to ||W|| = 1). Then, the output of the angle classifier is calculated using a loss function based on angle intervals to obtain the hypersphere representation loss function. The calculation expression in the hypersphere representation learning module can be:

[0151] L Sphere =L angular (AC(BN(U′)))

[0152] In the formula, L SphereLet L represent the hyperspherical representation loss function, BN represent the batch normalization algorithm BatchNorm, AC represent the Angular classifier, and L represent the hyperspherical representation loss function. angular This indicates that the ArcFace loss function is selected based on the Angular Margin Loss function, which is used for angular interval loss.

[0153] The global loss function of the pedestrian re-identification model is obtained based on the local loss function, the free Euclidean space representation loss function, and the hyperspherical representation loss function.

[0154] In this embodiment of the application, when the local loss function is an attribute loss function, according to the attribute loss function L attribute Free Euclidean space representation loss function L FreeEuc The hyperspherical representation loss function L Sphere The global loss function L is obtained. total The expression is as follows:

[0155] L total =L attribute +L FreeEuc +L Sphere

[0156] S150, using backpropagation, the pedestrian re-identification model is iteratively trained based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model. In this embodiment, when the six local human body features are features related to the head, shoulders, abdomen, thighs, calves, and shoes, the pedestrian re-identification model can consist of a hierarchical self-attention network model, an adaptive global average pooling layer, and six PFC classifiers. The pedestrian re-identification model can be iteratively trained according to the local loss function until the value of the local loss function no longer decreases, at which point training can be stopped. When the six local human body features are appearance features such as backpack color, hat color, top style, top color, bottom style, and bottom color, the pedestrian re-identification model can consist of a hierarchical self-attention network model, an adaptive global average pooling layer, six PAC classifiers, and an ID representation learning module. The pedestrian re-identification model can be iteratively trained according to the global loss function until the value of the global loss function no longer decreases, at which point training can be stopped.

[0157] In the embodiments of this application, the introduced free Euclidean space representation loss function and hyperspherical representation loss function can directly perform metric learning on the global human features obtained from the hierarchical self-attention network model, thereby obtaining a better global loss function. During backpropagation, the gradient can be directly applied to the parameters of the last layer of the hierarchical self-attention network model (i.e., the last stage of the hierarchical self-attention network model), enabling the pedestrian re-identification model to be trained more efficiently and have better representation capabilities.

[0158] In this embodiment, the trained pedestrian re-identification model can directly identify pedestrians. Alternatively, the trained pedestrian re-identification model can obtain global human body features of pedestrians through a hierarchical self-attention network model, obtain local human body features from the global human body features, and perform feature matching between the global human body features and the local human body features and a pedestrian image registration database to obtain images and / or pedestrian IDs with similar features.

[0159] In this embodiment, the training method for the pedestrian re-identification model first collects a human body data sample set for the pedestrian re-identification model; then, the human body data sample set is input into the hierarchical self-attention network model in the pedestrian re-identification model, and the global human body features of the pedestrian re-identification model are output; then, based on the global human body features, the local human body features of the pedestrian re-identification model are obtained; next, based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model, the local loss function and global loss function of the pedestrian re-identification model are obtained; finally, the pedestrian re-identification model is iteratively trained using backpropagation based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model. The method described in this application embodiment employs a technical approach that differs from existing technologies. It uses a hierarchical self-attention network model as the backbone model, which can solve the problem that existing technologies cannot directly obtain global human body features. It can iteratively train the pedestrian re-identification model based on the obtained local loss function and global loss function, so that the pedestrian re-identification model can identify global human body features and local human body features, and thus identify pedestrians.

[0160] Please see Figure 4 This document provides a flowchart illustrating a training method for a pedestrian re-identification model, as illustrated in an embodiment of this application. Figure 4 As shown, the method in this application embodiment may include the following steps:

[0161] S210, acquire an RGB image containing human body scale and aspect ratio features;

[0162] S211, Perform image enhancement operation on the RGB image to obtain the human body data sample set of the pedestrian re-identification model;

[0163] S212, Input the human body data sample set into the hierarchical self-attention network model in the pedestrian re-identification model, and output the global human body features of the pedestrian re-identification model;

[0164] S213, input the global human body features into the adaptive global average pooling layer of the pedestrian re-identification model;

[0165] S214, The global human body features output by the adaptive global average pooling layer are cut into local human body features along the depth direction;

[0166] S215, Input the local human body features into the local classifier corresponding to the local human body features, and output the local feature category probability of the pedestrian re-identification model;

[0167] S216, Calculate the local loss function of the pedestrian re-identification model based on the local feature category probabilities and the real labels corresponding to the local feature category probabilities;

[0168] S217, Based on the global human body features, extract the anchor samples of the pedestrian re-identification model;

[0169] S218, Based on the anchor sample, similar samples of the anchor sample, dissimilar samples of the anchor sample, and the triplet loss function, obtain the category loss function of the pedestrian re-identification model;

[0170] S219, Based on the anchor sample, the class center of the category to which the anchor sample belongs, and the class center loss function, obtain the distance loss function of the pedestrian re-identification model;

[0171] S220, Based on the category loss function and the distance loss function, obtain the free Euclidean space representation loss function of the pedestrian re-identification model;

[0172] S221, The distribution of each feature channel dimension of the global human body feature is normalized by the batch normalization algorithm;

[0173] S222, Input the normalized global human body features into the angle classifier to obtain the final sample representation of the pedestrian re-identification model;

[0174] S223, Calculate the hyperspherical representation loss function of the pedestrian re-identification model based on the final sample representation and the loss function based on the angle interval;

[0175] S224, Based on the local loss function, the free Euclidean space representation loss function, and the hyperspherical representation loss function, obtain the global loss function of the pedestrian re-identification model;

[0176] S225, using backpropagation, the pedestrian re-identification model is iteratively trained based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model;

[0177] In this embodiment, the training method for the pedestrian re-identification model first collects a human body data sample set for the pedestrian re-identification model; then, the human body data sample set is input into the hierarchical self-attention network model in the pedestrian re-identification model, and the global human body features of the pedestrian re-identification model are output; then, based on the global human body features, the local human body features of the pedestrian re-identification model are obtained; next, based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model, the local loss function and global loss function of the pedestrian re-identification model are obtained; finally, the pedestrian re-identification model is iteratively trained using backpropagation based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model. The method described in this application embodiment employs a technical approach that differs from existing technologies. It uses a hierarchical self-attention network model as the backbone model, which can solve the problem that existing technologies cannot directly obtain global human body features. It can iteratively train the pedestrian re-identification model based on the obtained local loss function and global loss function, so that the pedestrian re-identification model can identify global human body features and local human body features, and thus identify pedestrians.

[0178] The following are embodiments of the apparatus of the present invention, which can be used to execute embodiments of the method of the present invention. For details not disclosed in the embodiments of the apparatus of the present invention, please refer to the embodiments of the method of the present invention.

[0179] Please see Figure 5 The diagram illustrates a structural schematic of a training device for a pedestrian re-identification model according to an exemplary embodiment of the present invention. The device 1 includes: a data sample acquisition module 10, a global feature acquisition module 20, a local feature acquisition module 30, a loss function acquisition module 40, and a model training module 50.

[0180] The data sample acquisition module 10 is used to collect human body data sample sets for the pedestrian re-identification model;

[0181] The global feature acquisition module 20 is used to input the human data sample set into the hierarchical self-attention network model in the pedestrian re-identification model and output the human global features of the pedestrian re-identification model.

[0182] The local feature acquisition module 30 is used to acquire the local human features of the pedestrian re-identification model based on the global human features.

[0183] The loss function acquisition module 40 is used to acquire the local loss function and global loss function of the pedestrian re-identification model based on the global features of the human body, the local features of the human body, and the classifier, triplet loss function, class center loss function, batch normalization algorithm and angle interval-based loss function in the pedestrian re-identification model.

[0184] The model training module 50 is used to iteratively train the pedestrian re-identification model using backpropagation based on the local loss function and the global loss function, so as to obtain the trained pedestrian re-identification model.

[0185] It should be noted that the pedestrian re-identification model training device provided in the above embodiments is only illustrated by the division of the above functional modules when executing a pedestrian re-identification model training method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the pedestrian re-identification model training device and the pedestrian re-identification model training method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0186] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0187] In this embodiment, the training device for the pedestrian re-identification model first collects a human body data sample set for the pedestrian re-identification model; then, it inputs the human body data sample set into the hierarchical self-attention network model in the pedestrian re-identification model, and outputs the global human body features of the pedestrian re-identification model; then, based on the global human body features, it obtains the local human body features of the pedestrian re-identification model; next, based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model, it obtains the local loss function and global loss function of the pedestrian re-identification model; finally, it uses backpropagation to iteratively train the pedestrian re-identification model based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model. The method described in this application embodiment employs a technical approach that differs from existing technologies. It uses a hierarchical self-attention network model as the backbone model, which can solve the problem that existing technologies cannot directly obtain global human body features. It can iteratively train the pedestrian re-identification model based on the obtained local loss function and global loss function, so that the pedestrian re-identification model can identify global human body features and local human body features, and thus identify pedestrians.

[0188] The present invention also provides a computer-readable medium having program instructions stored thereon, which, when executed by a processor, implement a training method for a pedestrian re-identification model provided in the above-described method embodiments.

[0189] The present invention also provides a computer program product containing instructions that, when run on a computer, causes the computer to execute a training method for a pedestrian re-identification model according to the above-described method embodiments.

[0190] Please see Figure 6 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. Figure 6 As shown, terminal 1000 may include: at least one processor 1001, at least one network interface 1004, user interface 1003, memory 1005, and at least one communication bus 1002.

[0191] The communication bus 1002 is used to realize the connection and communication between these components.

[0192] The user interface 1003 may include a display screen and a camera. Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.

[0193] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0194] The processor 1001 may include one or more processing cores. The processor 1001 connects to various parts within the electronic device 1000 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and by calling data stored in the memory 1005. Optionally, the processor 1001 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 1001 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 1001.

[0195] The memory 1005 may include random access memory (RAM) or read-only memory. Optionally, the memory 1005 may include a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 6 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for analyzing the availability of vehicle trajectory data.

[0196] exist Figure 6In the terminal 1000 shown, the user interface 1003 is mainly used to provide an input interface for the user and to obtain the user's input data; while the processor 1001 can be used to call the training application of the pedestrian re-identification model stored in the memory 1005, and specifically perform the following operations:

[0197] Collect a human body data sample set for the pedestrian re-identification model;

[0198] The human body data sample set is input into the hierarchical self-attention network model in the pedestrian re-identification model, and the human body global features of the pedestrian re-identification model are output.

[0199] Based on the global human body features, the local human body features of the pedestrian re-identification model are obtained;

[0200] Based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle-interval-based loss function in the pedestrian re-identification model, the local loss function and global loss function of the pedestrian re-identification model are obtained; the classifier includes a local classifier and an angle classifier;

[0201] The pedestrian re-identification model is iteratively trained using backpropagation based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model.

[0202] In one embodiment, when the processor 1001 executes the human data sample set of the pedestrian re-identification model, it specifically performs the following operations:

[0203] Obtain an RGB image that includes human scale and aspect ratio features;

[0204] The RGB image is enhanced to obtain the human data sample set of the pedestrian re-identification model.

[0205] In one embodiment, when the processor 1001 executes the step of obtaining the local human features of the pedestrian re-identification model based on the global human features, it specifically performs the following operations:

[0206] The global human body features are input into the adaptive global average pooling layer of the pedestrian re-identification model;

[0207] The global human body features output by the adaptive global average pooling layer are cut into local human body features along the depth direction.

[0208] In one embodiment, when the processor 1001 executes the step of obtaining the local loss function and global loss function of the person re-identification model based on the global features of the human body, the local features of the human body, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the person re-identification model, the processor 1001 specifically performs the following operations:

[0209] The local human body features are input into the local classifier corresponding to the local human body features, and the local feature category probability of the pedestrian re-identification model is output.

[0210] The local loss function of the pedestrian re-identification model is calculated based on the local feature category probabilities and the corresponding real labels.

[0211] In one embodiment, when the processor 1001 executes the step of obtaining the local loss function and global loss function of the person re-identification model based on the global features of the human body, the local features of the human body, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the person re-identification model, the processor 1001 specifically performs the following operations:

[0212] Based on the global human body features, the triplet loss function, and the class center loss function, the free Euclidean space representation loss function of the pedestrian re-identification model is obtained.

[0213] Based on the global human body features, the batch normalization algorithm, the angle classifier, and the angle-interval-based loss function, the hyperspherical representation loss function of the pedestrian re-identification model is obtained.

[0214] The global loss function of the pedestrian re-identification model is obtained based on the local loss function, the free Euclidean space representation loss function, and the hyperspherical representation loss function.

[0215] In one embodiment, when processor 1001 executes the step of obtaining the free Euclidean space representation loss function of the person re-identification model based on the human global features, the triplet loss function, and the class center loss function, it specifically performs the following operations:

[0216] Based on the global human body features, anchor samples are extracted from the pedestrian re-identification model;

[0217] Based on the anchor sample, similar samples of the anchor sample, dissimilar samples of the anchor sample, and the triplet loss function, the category loss function of the pedestrian re-identification model is obtained.

[0218] Based on the anchor sample, the class center of the category to which the anchor sample belongs, and the class center loss function, the distance loss function of the pedestrian re-identification model is obtained;

[0219] Based on the category loss function and the distance loss function, the free Euclidean space representation loss function of the pedestrian re-identification model is obtained.

[0220] In one embodiment, when the processor 1001 executes the step of obtaining the hyperspherical representation loss function of the person re-identification model based on the human global features, the batch normalization algorithm, the angle classifier, and the angle interval-based loss function, it specifically performs the following operations:

[0221] The batch normalization algorithm is used to normalize the dimensional distribution of each feature channel of the global human body features;

[0222] The normalized global human body features are input into the angle classifier to obtain the final sample representation of the pedestrian re-identification model.

[0223] The hyperspherical representation loss function of the pedestrian re-identification model is calculated based on the final sample representation and the angle-interval-based loss function.

[0224] In this embodiment, the training method for the pedestrian re-identification model first collects a human body data sample set for the pedestrian re-identification model; then, the human body data sample set is input into the hierarchical self-attention network model in the pedestrian re-identification model, and the global human body features of the pedestrian re-identification model are output; then, based on the global human body features, the local human body features of the pedestrian re-identification model are obtained; next, based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model, the local loss function and global loss function of the pedestrian re-identification model are obtained; finally, the pedestrian re-identification model is iteratively trained using backpropagation based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model. The method described in this application embodiment employs a technical approach that differs from existing technologies. It uses a hierarchical self-attention network model as the backbone model, which can solve the problem that existing technologies cannot directly obtain global human body features. It can iteratively train the pedestrian re-identification model based on the obtained local loss function and global loss function, so that the pedestrian re-identification model can identify global human body features and local human body features, and thus identify pedestrians.

[0225] Those skilled in the art will understand that implementing all or part of the processes in the above embodiments can be accomplished by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0226] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A training method for a pedestrian re-identification model, characterized in that, Includes the following steps: Collect a human body data sample set for the pedestrian re-identification model; The human body data sample set is input into the hierarchical self-attention network model in the person re-identification model, and the human body global features of the person re-identification model are output; the hierarchical self-attention network model is a Swing Transformer network; Based on the global human body features, the local human body features of the pedestrian re-identification model are obtained; Based on the global human body features, the local human body features, and the classifiers, triplet loss functions, class center loss functions, batch normalization algorithms, and angle-interval-based loss functions in the pedestrian re-identification model, the local loss function and global loss function of the pedestrian re-identification model are obtained. This includes inputting the local human body features into the local classifier corresponding to the local human body features, and outputting the local feature category probabilities of the pedestrian re-identification model. The classifier includes the local classifier, which includes a local human body feature classifier and a local human body attribute classifier. When multiple local human body features are human body part-related features, each local human body feature is input into the corresponding local human body feature classifier to obtain the local feature category probability of each local human body feature. When multiple local human body features are human body appearance attribute information, each local human body feature is input into the corresponding local human body attribute classifier to obtain the local feature category probability of each local human body feature. Based on the local feature category probabilities output by each classifier and the true labels corresponding to the local feature category probabilities, the local loss function of each local human body feature is calculated. The pedestrian re-identification model is iteratively trained using backpropagation based on the local loss function and the global loss function to obtain the trained pedestrian re-identification model.

2. The training method according to claim 1, characterized in that, The human data sample set for the pedestrian re-identification model includes: Obtain an RGB image that includes human scale and aspect ratio features; The RGB image is enhanced to obtain the human data sample set of the pedestrian re-identification model.

3. The training method according to claim 1, characterized in that, The step of obtaining the local human body features of the pedestrian re-identification model based on the global human body features includes: The global human body features are input into the adaptive global average pooling layer of the pedestrian re-identification model; The global human body features output by the adaptive global average pooling layer are cut into local human body features along the depth direction.

4. The training method according to claim 1, characterized in that, The classifier includes a local classifier and an angular classifier; The step of obtaining the local and global loss functions of the pedestrian re-identification model based on the global and local features of the human body, as well as the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle-interval-based loss function in the pedestrian re-identification model, includes: The local human body features are input into the local classifier corresponding to the local human body features, and the local feature category probability of the pedestrian re-identification model is output. The local loss function of the pedestrian re-identification model is calculated based on the local feature category probabilities and the corresponding real labels.

5. The training method according to claim 4, characterized in that, The step of obtaining the local and global loss functions of the pedestrian re-identification model based on the global and local features of the human body, as well as the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle-interval-based loss function in the pedestrian re-identification model, includes: Based on the global human body features, the triplet loss function, and the class center loss function, the free Euclidean space representation loss function of the pedestrian re-identification model is obtained. Based on the global human body features, the batch normalization algorithm, the angle classifier, and the angle-interval-based loss function, the hyperspherical representation loss function of the pedestrian re-identification model is obtained. The global loss function of the pedestrian re-identification model is obtained based on the local loss function, the free Euclidean space representation loss function, and the hyperspherical representation loss function.

6. The training method according to claim 5, characterized in that, The step of obtaining the free Euclidean space representation loss function of the person re-identification model based on the global human body features, the triplet loss function, and the class center loss function includes: Based on the global human body features, anchor samples are extracted from the pedestrian re-identification model; Based on the anchor sample, similar samples of the anchor sample, dissimilar samples of the anchor sample, and the triplet loss function, the category loss function of the pedestrian re-identification model is obtained. Based on the anchor sample, the class center of the category to which the anchor sample belongs, and the class center loss function, the distance loss function of the pedestrian re-identification model is obtained; Based on the category loss function and the distance loss function, the free Euclidean space representation loss function of the pedestrian re-identification model is obtained.

7. The training method according to claim 5, characterized in that, The step of obtaining the hyperspherical representation loss function of the pedestrian re-identification model based on the global human body features, the batch normalization algorithm, the angle classifier, and the angle interval-based loss function includes: The batch normalization algorithm is used to normalize the dimensional distribution of each feature channel of the global human body features; The normalized global human body features are input into the angle classifier to obtain the final sample representation of the pedestrian re-identification model. The hyperspherical representation loss function of the pedestrian re-identification model is calculated based on the final sample representation and the angle-interval-based loss function.

8. A training device for a pedestrian re-identification model, characterized in that, include: The data sample acquisition module is used to collect human body data sample sets for the pedestrian re-identification model; The global feature acquisition module is used to input the human data sample set into the hierarchical self-attention network model in the person re-identification model and output the global human features of the person re-identification model; the hierarchical self-attention network model is a Swing Transformer network; The local feature acquisition module is used to acquire the local human features of the pedestrian re-identification model based on the global human features. The loss function acquisition module is used to acquire the local loss function and global loss function of the pedestrian re-identification model based on the global human body features, the local human body features, and the classifier, triplet loss function, class center loss function, batch normalization algorithm, and angle interval-based loss function in the pedestrian re-identification model. This includes inputting the local human body features into the local classifier corresponding to the local human body features, and outputting the local feature category probability of the pedestrian re-identification model. The classifier includes the local classifier, which includes a local human body feature classifier and a local human body attribute classifier. When multiple local human body features are human body part-related features, each local human body feature is input to the corresponding local human body feature classifier to acquire the local feature category probability of each local human body feature. When multiple local human body features are human appearance attribute information, each local human body feature is input to the corresponding local human body attribute classifier to acquire the local feature category probability of each local human body feature. Based on the local feature category probability output by each classifier and the corresponding real label, the local loss function of each local human body feature is calculated. The model training module is used to iteratively train the pedestrian re-identification model using backpropagation based on the local loss function and the global loss function, so as to obtain the trained pedestrian re-identification model.

9. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the method steps as claimed in any one of claims 1-7.

10. A terminal, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the method steps as claimed in any one of claims 1-7.