A cross-domain unsupervised pedestrian re-identification method, device and medium
By introducing neighborhood adversarial loss function and neighborhood continuity loss function, the cross-domain unsupervised pedestrian re-identification model is optimized, which solves the problem of low recognition accuracy caused by the difference between source domain and target domain data and achieves higher recognition accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG SYNTHESIS ELECTRONICS TECH
- Filing Date
- 2022-08-02
- Publication Date
- 2026-04-21
AI Technical Summary
In existing cross-domain unsupervised pedestrian re-identification technologies, the large differences between the source and target domain data lead to poor model performance. The generation method based on GAN networks introduces noise, and the soft label or pseudo-label clustering method introduces pseudo-label noise, which reduces the recognition accuracy.
By employing neighborhood adversarial loss function and neighborhood continuity loss function, positive and negative example sets are generated through feature distance values, thereby optimizing the loss function and improving the model's recognition performance.
This improves the accuracy of pedestrian re-identification by using a neighborhood adversarial loss function to bring high-similarity images closer together and push away low-similarity images, and by using a neighborhood continuity loss function to make similar features converge in the same direction, thereby improving the recognition performance of the network model.
Smart Images

Figure CN115294604B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, specifically to a cross-domain unsupervised pedestrian re-identification method, device, and medium. Background Technology
[0002] Pedestrian re-identification is a type of object classification algorithm. Its purpose is to determine whether people appearing in different camera scenes belong to the same person. It can be regarded as a sub-problem of image retrieval.
[0003] In existing technologies, supervised learning-based person recognition techniques have made significant progress. However, supervised methods rely on large amounts of labeled datasets, which are costly and sometimes difficult to obtain. To address this issue, more and more researchers are focusing on semi-supervised / unsupervised person re-identification (Re-ID). Among unsupervised person re-identification techniques, Unsupervised Domain Adaptive (UDA) is the most common Re-ID scheme. It trains on a labeled source domain and then performs unsupervised learning on an unlabeled target domain based on the pre-trained model.
[0004] However, due to significant differences in imaging conditions and application scenarios between source and target domain data, directly applying a model trained in the source domain to the target domain will result in poor performance. Cross-domain unsupervised learning typically employs two technical solutions: one is based on GAN network generation, which introduces generation noise; the other is soft-label or pseudo-label clustering, which introduces pseudo-label noise. Summary of the Invention
[0005] To address the aforementioned issues, this application proposes a cross-domain unsupervised pedestrian re-identification method, comprising:
[0006] Acquire pedestrian images containing the pedestrians to be identified;
[0007] The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch.
[0008] Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained.
[0009] In one example, the training process of the model includes:
[0010] Determine the feature distance values between each feature in the batch processing group;
[0011] A positive example set and a negative example set are generated based on the feature distance values. The positive example set includes multiple feature distance values with values lower than a preset threshold, and the negative example set includes multiple feature distance values with a degree of change higher than a preset level.
[0012] The neighborhood adversarial loss function is obtained based on the positive example set and the negative example set; and the neighborhood continuity loss function is obtained based on the positive example set.
[0013] In one example, determining the feature distance values between features within a batch group specifically includes:
[0014] Features of each sample in the batch are extracted using a benchmark network;
[0015] For any two features, the cosine distance between the first feature and the second feature is obtained through the transpose matrix of the first feature and the second feature, and the cosine distance is used as the feature distance value between the first feature and the second feature.
[0016] In one example, generating a positive example set and a negative example set based on the feature distance values specifically includes:
[0017] A first determinant is generated based on each of the feature distance values in the batch processing group;
[0018] In the first determinant, the feature distance values are sorted in descending order by row to obtain the second determinant;
[0019] Taking the differential of the second determinant along the row direction, we obtain the third determinant representing the gradient along the row direction;
[0020] In the second determinant, the K largest feature distance values are selected according to the descending order to obtain the positive example set; and according to the third determinant, the K largest cumulative change drastic value combinations are selected to obtain the negative example set.
[0021] In one example, based on the third determinant, the K feature distance values with the largest cumulative changes are selected to obtain the negative example set, specifically including:
[0022] For any K consecutive feature distance values, treat them as a sliding window, and determine the cumulative gradient corresponding to the K consecutive feature distance values in the sliding window based on the gradient corresponding to each feature distance value in the third determinant.
[0023] The sliding window with the largest accumulated gradient is used as the negative example set.
[0024] In one example, the neighborhood adversarial loss function is obtained based on the positive example set and the negative example set, specifically including:
[0025] Based on the second determinant, determine the first average term of each feature distance value in the positive example set and the second average term of each feature distance value in the negative example set;
[0026] The first average term is taken as the positive term, the second average term is taken as the negative term, and the neighborhood adversarial loss function is determined according to the preset regularization hyperparameter and the size of the batch group.
[0027] In one example, the neighborhood continuity loss function is obtained based on the set of positive examples, specifically including:
[0028] Based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated; and the proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value.
[0029] The neighborhood continuity loss function is generated based on the weight term and the probabilistic term, so as to increase the proportion of low similarity loss and reduce the proportion of high similarity loss through the weight term. The low similarity loss and the high similarity loss are relatively determined between the two.
[0030] In one example, a weight term corresponding to each feature distance value is generated based on the proportion of each feature distance value in the positive example set, specifically including:
[0031] Based on the proportion of each feature distance value in the positive example set, determine the opposite term of the proportion, and generate the weight term corresponding to the feature distance value based on the opposite term and the preset constant term.
[0032] The proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value, specifically including:
[0033] Based on the feature distance values and probability coefficients, the adjusted feature distance terms corresponding to each feature distance value are obtained, and the logarithmic term of the proportion of each adjusted feature distance term is probabilized to obtain the probabilized term corresponding to the feature distance value.
[0034] On the other hand, this application also proposes a cross-domain unsupervised pedestrian re-identification device, comprising:
[0035] At least one processor; and,
[0036] A memory communicatively connected to the at least one processor; wherein,
[0037] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform actions such as:
[0038] Acquire pedestrian images containing the pedestrians to be identified;
[0039] The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch.
[0040] Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained.
[0041] On the other hand, this application also proposes a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0042] Acquire pedestrian images containing the pedestrians to be identified;
[0043] The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch.
[0044] Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained.
[0045] The cross-domain unsupervised pedestrian re-identification method proposed in this application can bring the following benefits:
[0046] Introducing a neighborhood adversarial loss function into the loss function, which depends on the distance within the target domain image and does not require pseudo-label support, can bring images with high feature similarity closer together and push away images with low feature similarity. Furthermore, introducing a neighborhood feature continuity loss function further improves the network model's recognition performance by causing similar features to converge in the same direction. This improves the model's accuracy in person re-identification. Attached Figure Description
[0047] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0048] Figure 1 This is a flowchart illustrating the cross-domain unsupervised pedestrian re-identification method in the embodiments of this application;
[0049] Figure 2a This is a flowchart illustrating a traditional cross-domain unsupervised pedestrian re-identification method provided in the embodiments of this application;
[0050] Figure 2b This is a flowchart illustrating a cross-domain unsupervised pedestrian re-identification method provided in the embodiments of this application.
[0051] Figure 3 This is a schematic diagram of the positive and negative example sets in the embodiments of this application;
[0052] Figure 4 This is a schematic diagram of a cross-domain unsupervised pedestrian re-identification device in an embodiment of this application. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0054] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0055] like Figure 1 As shown, this application provides a cross-domain unsupervised pedestrian re-identification method, including:
[0056] S101: Acquire pedestrian images containing the pedestrians to be identified.
[0057] Pedestrian re-identification is a type of object classification algorithm. Its purpose is to determine whether people appearing in different camera scenes belong to the same person. Therefore, in image analysis, it is necessary to analyze pedestrian images containing the pedestrians to be identified.
[0058] S102: The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch.
[0059] Since this involves image processing, the features mentioned in this article can be understood as image features unless otherwise specified.
[0060] During the training process, such as Figure 2aAs shown, a pre-trained model is obtained through supervised training on source domain data. This pre-trained model is then used as a baseline model for unsupervised training on target domain data. During unsupervised training, after embedding features, training is performed using clustering. Predictive classification is then performed by loading unlabeled data, assigning pseudo-labels, and applying triplet loss (PTLLoss) as the loss function to the pseudo-labels. However, this introduces pseudo-label noise, which can easily reduce the accuracy of the final recognition result.
[0061] Based on this, such as Figure 2b As shown, when performing unsupervised training by clustering in the target domain, a Neighbor Adversarial Loss (NAL) and a Neighbor Consistency Loss (NCL) are introduced. The Neighbor Adversarial Loss and the Neighbor Consistency Loss are obtained based on the feature distance between features in the batch.
[0062] In this study, triplet-based probabilistic tagging (PTL) can incorrectly assign pseudo-labels to samples, introducing limitations and uncertainties to the model and creating new pseudo-label noise in the computation. To address the problem of misidentification of similar groups of people, this paper proposes a neighborhood adversarial loss function to explore the neighborhood adversarial relationship of pedestrian targets within the target domain. This function depends on the distance within the target domain image and does not require pseudo-label support. Its aim is to bring images with high feature similarity closer together and push away images with low feature similarity.
[0063] While the neighborhood adversarial loss function can enhance the convergence and divergence of image features, it cannot guarantee the consistency of feature convergence direction. Therefore, a neighborhood feature continuity loss function is used to further improve the recognition performance of the network model by causing similar features to converge in the same direction.
[0064] S103: Based on the output of the model, obtain the pedestrian re-identification result for the pedestrian image.
[0065] Introducing a neighborhood adversarial loss function into the loss function, which depends on the distance within the target domain image and does not require pseudo-label support, can bring images with high feature similarity closer together and push away images with low feature similarity. Furthermore, introducing a neighborhood feature continuity loss function further improves the network model's recognition performance by causing similar features to converge in the same direction. This improves the model's accuracy in person re-identification.
[0066] In one embodiment, during modeling, the feature distance values between features in a batch are determined. Feature distance values can also represent the similarity between features. A positive example set and a negative example set are generated based on the feature distance values. The positive example set includes multiple feature distance values with values below a preset threshold, while the negative example set includes multiple feature distance values with a drastic change exceeding a preset threshold. A neighborhood adversarial loss function is obtained based on the positive and negative example sets; and a neighborhood continuity loss function is obtained based on the positive example set. The final target domain total loss function can be: L target =L PTL +L NAL +αL NCL , where L target Let L be the total loss function. PTL For pseudo-label triplet loss function, L nAL Let L be the neighborhood adversarial loss function. NCL Let α be the neighborhood continuity loss function, and α be a hyperparameter.
[0067] Specifically, when determining the feature distance value, features of each sample in the batch processing group are extracted using a benchmark network. For any two features, the first feature x is used... s,i The transpose matrix and the second characteristic x s,j The cosine distance between the first and second features is obtained, and this cosine distance is used as the feature distance value between the first and second features. The corresponding formula is as follows: d c (x s,i ,x s,j ) = feature(x s,i ) T feature(x s,j ), where d c (x s,i ,x s,j The ) represents the cosine distance (also known as cosine similarity). The more similar the directions of two identical vectors and the smaller the angle between them, the closer the cosine distance is to 1. The feature refers to the feature values extracted from the samples using the baseline network.
[0068] Furthermore, when determining the positive and negative example sets, the first determinant is first generated based on the feature distance values in the batch group (here, its size is set to PK). The first determinant D cosine As shown below:
[0069]
[0070] Where, d c (x s,i ,x s,j ) represents the feature distance value at the position of row i and column j.
[0071] In the first determinant, the feature distance values are sorted in descending order by row to obtain the second determinant D. rank The second determinant D rank As shown below:
[0072]
[0073] Among them, D rank In This represents the feature distance value at the i-th row and j-th column position after sorting by row.
[0074] According to the second determinant D rank Taking the differential along the row direction, we obtain the third determinant ΔD, which represents the gradient along the row direction. rank The formula for the difference derivative is shown below:
[0075]
[0076] Third determinant ΔD rank As shown below:
[0077]
[0078] At this point, in the second determinant, the K largest feature distance values are selected in descending order to obtain the positive example set K. + Based on the third determinant, the K feature distance values with the greatest cumulative change are selected to obtain the negative example set K. - .
[0079] Furthermore, such as Figure 3 As shown, any K consecutive feature distance values are considered as a sliding window. Based on the gradients corresponding to each feature distance value in the third determinant, the cumulative gradient corresponding to the K consecutive feature distance values in the sliding window is determined. Then, the sliding window with the largest cumulative gradient is taken as the negative example set. Here, let K... c This represents the distance value of the central feature of the negative example set.
[0080] At this point, intuitively speaking, for the neighborhood adversarial loss function, in D rank , the positive example set K + The negative example set K represents the distance values of the K most similar features. - The nearest neighbor set K represents the K feature distance values where the similarity changes most drastically, i.e., the set of data with the highest uncertainty in sample similarity. + With K -Adversarial behavior can improve the algorithm's ability to distinguish similar pedestrians. Therefore, based on the second determinant, the first average term of each feature distance value in the positive example set and the second average term of each feature distance value in the negative example set are determined. The first average term is taken as the positive term, and the second average term is taken as the negative term. Based on the preset regularization hyperparameter and the size of the batch processing group, the neighborhood adversarial loss function can be determined. The formula for the neighborhood adversarial loss function is as follows:
[0081]
[0082] Where γ is the regularization hyperparameter.
[0083] As for the neighborhood feature continuity loss, it is still defined based on the second determinant. Although the second determinant has been sorted by similarity, we hope that the feature similarity of the neighboring samples (k-nearest) within the positive example set should be higher. Therefore, the neighbor similarity loss can be probabilistically measured.
[0084] At this point, based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated; and the proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value. A neighborhood continuity loss function is generated based on the weight term and the probabilistic term, in order to increase the proportion of low similarity loss and reduce the proportion of high similarity loss through the weight term. It should be noted that low similarity loss and high similarity loss are relatively determined between the two. Similarity in this paper can also be represented by feature distance values. Among all similarity losses, the higher portion (e.g., the higher 50%) is considered high similarity loss, and the lower portion (e.g., the lower 50%) is considered low similarity loss.
[0085] Specifically, when generating weight terms, the opposite term of each feature distance value is determined based on the proportion of each feature distance value in the positive example set, and the weight term corresponding to the feature distance value is generated based on the opposite term and a preset constant term. When generating probabilistic terms, the adjusted feature distance term corresponding to each feature distance value is obtained based on the feature distance value and probability coefficient, and the logarithmic term of the proportion of each adjusted feature distance term is probabilistically determined to obtain the probabilistic term corresponding to the feature distance value.
[0086] The formula for the weight term is as follows:
[0087]
[0088] The formula for the neighborhood continuity loss function is as follows:
[0089]
[0090]
[0091] Where ε is the probability coefficient, generally used to adjust the steepness of the probability curve. As the feature distance value... The reduction, It also decreases accordingly, while the weight term w i,j This increases accordingly, which is also reflected in the neighborhood continuity loss function. Therefore, adjustments need to be made to the lower feature distance values. When the feature distance is represented by cosine distance, a low feature distance value indicates low similarity between the two pairs, requiring adjustments to the low similarity loss to increase its proportion in the positive example set, thereby achieving w. i,j By increasing the proportion of low-similarity loss in the neighborhood and reducing the proportion of high-similarity loss, the distance between k-neighborhood features can be further reduced, thus achieving consistency in the convergence direction of intra-class image features.
[0092] On the other hand, such as Figure 4 As shown in the illustration, this application also provides a cross-domain unsupervised pedestrian re-identification device, comprising:
[0093] At least one processor; and,
[0094] A memory communicatively connected to the at least one processor; wherein,
[0095] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform actions such as:
[0096] Acquire pedestrian images containing the pedestrians to be identified;
[0097] The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch.
[0098] Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained.
[0099] On the other hand, embodiments of this application also provide a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0100] Acquire pedestrian images containing the pedestrians to be identified;
[0101] The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch.
[0102] Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained.
[0103] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.
[0104] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0105] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0106] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0109] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0110] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0111] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0112] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0113] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.
Claims
1. A cross-domain unsupervised pedestrian re-identification method, characterized in that, include: Acquire pedestrian images containing the pedestrians to be identified; The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch. Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained; The training process of the model includes: Determine the feature distance values between each feature in the batch processing group; A positive example set and a negative example set are generated based on the feature distance values. The positive example set includes multiple feature distance values with values lower than a preset threshold, and the negative example set includes multiple feature distance values with a degree of change higher than a preset level. Based on the positive example set and the negative example set, the neighborhood adversarial loss function is obtained; and based on the positive example set, the neighborhood continuity loss function is obtained. Generating a positive example set and a negative example set based on the feature distance values specifically includes: A first determinant is generated based on each of the feature distance values in the batch processing group; In the first determinant, the feature distance values are sorted in descending order by row to obtain the second determinant; Taking the differential of the second determinant along the row direction, we obtain the third determinant representing the gradient along the row direction; In the second determinant, the K largest feature distance values are selected according to the descending order to obtain the positive example set; and according to the third determinant, the K largest cumulative change drastic value combinations are selected to obtain the negative example set. Based on the third determinant, the K feature distance values with the largest cumulative changes are selected to obtain the negative example set, which specifically includes: For any K consecutive feature distance values, treat them as a sliding window, and determine the cumulative gradient corresponding to the K consecutive feature distance values in the sliding window based on the gradient corresponding to each feature distance value in the third determinant. The sliding window with the largest accumulated gradient is used as the negative instance set; Based on the positive example set and the negative example set, the neighborhood adversarial loss function is obtained, specifically including: Based on the second determinant, determine the first average term of each feature distance value in the positive example set and the second average term of each feature distance value in the negative example set; The first average term is taken as the positive term, the second average term is taken as the negative term, and the neighborhood adversarial loss function is determined according to the preset regularization hyperparameter and the size of the batch group. The neighborhood continuity loss function is obtained based on the set of positive examples, specifically including: Based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated; and the proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value. The neighborhood continuity loss function is generated based on the weight term and the probabilistic term, so as to increase the proportion of low similarity loss and reduce the proportion of high similarity loss through the weight term. The low similarity loss and the high similarity loss are relatively determined between the two. Based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated, specifically including: Based on the proportion of each feature distance value in the positive example set, determine the opposite term of the proportion, and generate the weight term corresponding to the feature distance value based on the opposite term and the preset constant term. The proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value, specifically including: Based on the feature distance values and probability coefficients, the adjusted feature distance terms corresponding to each feature distance value are obtained, and the logarithmic term of the proportion of each adjusted feature distance term is probabilized to obtain the probabilized term corresponding to the feature distance value. The formula for the neighborhood adversarial loss function is as follows: in, For regularization hyperparameters, Let the neighborhood adversarial loss function be used. Indicates the first feature, This represents the row number after sorting. line, number The feature distance values at column positions, where K represents the number of feature distance values selected from the positive example set, and PK represents the size of the batch group. The distance value between the center features of the negative example set; The formula for the neighborhood continuity loss function is as follows: in, This is a probability coefficient used to adjust the steepness of the probability curve. Indicates the weight term. This is the neighborhood continuity loss function.
2. The method according to claim 1, characterized in that, Determine the feature distance values between features within a batch group, specifically including: Features of each sample in the batch are extracted using a benchmark network; For any two features, the cosine distance between the first feature and the second feature is obtained through the transpose matrix of the first feature and the second feature, and the cosine distance is used as the feature distance value between the first feature and the second feature.
3. A cross-domain unsupervised pedestrian re-identification device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform actions such as: Acquire pedestrian images containing the pedestrians to be identified; The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch. Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained; The training process of the model includes: Determine the feature distance values between each feature in the batch processing group; A positive example set and a negative example set are generated based on the feature distance values. The positive example set includes multiple feature distance values with values lower than a preset threshold, and the negative example set includes multiple feature distance values with a degree of change higher than a preset level. Based on the positive example set and the negative example set, the neighborhood adversarial loss function is obtained; and based on the positive example set, the neighborhood continuity loss function is obtained. Generating a positive example set and a negative example set based on the feature distance values specifically includes: A first determinant is generated based on each of the feature distance values in the batch processing group; In the first determinant, the feature distance values are sorted in descending order by row to obtain the second determinant; Taking the differential of the second determinant along the row direction, we obtain the third determinant representing the gradient along the row direction; In the second determinant, the K largest feature distance values are selected according to the descending order to obtain the positive example set; and according to the third determinant, the K largest cumulative change drastic value combinations are selected to obtain the negative example set. Based on the third determinant, the K feature distance values with the largest cumulative changes are selected to obtain the negative example set, which specifically includes: For any K consecutive feature distance values, treat them as a sliding window, and determine the cumulative gradient corresponding to the K consecutive feature distance values in the sliding window based on the gradient corresponding to each feature distance value in the third determinant. The sliding window with the largest accumulated gradient is used as the negative instance set; Based on the positive example set and the negative example set, the neighborhood adversarial loss function is obtained, specifically including: Based on the second determinant, determine the first average term of each feature distance value in the positive example set and the second average term of each feature distance value in the negative example set; The first average term is taken as the positive term, the second average term is taken as the negative term, and the neighborhood adversarial loss function is determined according to the preset regularization hyperparameter and the size of the batch group. The neighborhood continuity loss function is obtained based on the set of positive examples, specifically including: Based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated; and the proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value. The neighborhood continuity loss function is generated based on the weight term and the probabilistic term, so as to increase the proportion of low similarity loss and reduce the proportion of high similarity loss through the weight term. The low similarity loss and the high similarity loss are relatively determined between the two. Based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated, specifically including: Based on the proportion of each feature distance value in the positive example set, determine the opposite term of the proportion, and generate the weight term corresponding to the feature distance value based on the opposite term and the preset constant term. The proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value, specifically including: Based on the feature distance values and probability coefficients, the adjusted feature distance terms corresponding to each feature distance value are obtained, and the logarithmic term of the proportion of each adjusted feature distance term is probabilized to obtain the probabilized term corresponding to the feature distance value. The formula for the neighborhood adversarial loss function is as follows: in, For regularization hyperparameters, Let the neighborhood adversarial loss function be used. Indicates the first feature, This represents the row number after sorting. line, number The feature distance values at column positions, where K represents the number of feature distance values selected from the positive example set, and PK represents the size of the batch group. The distance value between the center features of the negative example set; The formula for the neighborhood continuity loss function is as follows: in, This is a probability coefficient used to adjust the steepness of the probability curve. Indicates the weight term. This is the neighborhood continuity loss function.
4. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are set as follows: Acquire pedestrian images containing the pedestrians to be identified; The pedestrian image is input into a pre-trained model. When the model is trained unsupervised in the target domain, the loss function includes at least one of a neighborhood adversarial loss function and a neighborhood continuity loss function. The neighborhood adversarial loss function and the neighborhood continuity loss function are obtained based on the feature distance between features in the batch. Based on the output of the model, the pedestrian re-identification result of the pedestrian image is obtained; The training process of the model includes: Determine the feature distance values between each feature in the batch processing group; A positive example set and a negative example set are generated based on the feature distance values. The positive example set includes multiple feature distance values with values lower than a preset threshold, and the negative example set includes multiple feature distance values with a degree of change higher than a preset level. Based on the positive example set and the negative example set, the neighborhood adversarial loss function is obtained; and based on the positive example set, the neighborhood continuity loss function is obtained. Generating a positive example set and a negative example set based on the feature distance values specifically includes: A first determinant is generated based on each of the feature distance values in the batch processing group; In the first determinant, the feature distance values are sorted in descending order by row to obtain the second determinant; Taking the differential of the second determinant along the row direction, we obtain the third determinant representing the gradient along the row direction; In the second determinant, the K largest feature distance values are selected according to the descending order to obtain the positive example set; and according to the third determinant, the K largest cumulative change drastic value combinations are selected to obtain the negative example set. Based on the third determinant, the K feature distance values with the largest cumulative changes are selected to obtain the negative example set, which specifically includes: For any K consecutive feature distance values, treat them as a sliding window, and determine the cumulative gradient corresponding to the K consecutive feature distance values in the sliding window based on the gradient corresponding to each feature distance value in the third determinant. The sliding window with the largest accumulated gradient is used as the negative instance set; Based on the positive example set and the negative example set, the neighborhood adversarial loss function is obtained, specifically including: Based on the second determinant, determine the first average term of each feature distance value in the positive example set and the second average term of each feature distance value in the negative example set; The first average term is taken as the positive term, the second average term is taken as the negative term, and the neighborhood adversarial loss function is determined according to the preset regularization hyperparameter and the size of the batch group. The neighborhood continuity loss function is obtained based on the set of positive examples, specifically including: Based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated; and the proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value. The neighborhood continuity loss function is generated based on the weight term and the probabilistic term, so as to increase the proportion of low similarity loss and reduce the proportion of high similarity loss through the weight term. The low similarity loss and the high similarity loss are relatively determined between the two. Based on the proportion of each feature distance value in the positive example set, a weight term corresponding to the feature distance value is generated, specifically including: Based on the proportion of each feature distance value in the positive example set, determine the opposite term of the proportion, and generate the weight term corresponding to the feature distance value based on the opposite term and the preset constant term. The proportion is probabilistically measured to obtain the probabilistic term corresponding to the feature distance value, specifically including: Based on the feature distance values and probability coefficients, the adjusted feature distance terms corresponding to each feature distance value are obtained, and the logarithmic term of the proportion of each adjusted feature distance term is probabilized to obtain the probabilized term corresponding to the feature distance value. The formula for the neighborhood adversarial loss function is as follows: in, For regularization hyperparameters, Let the neighborhood adversarial loss function be used. Indicates the first feature, This represents the row number after sorting. line, number The feature distance values at column positions, where K represents the number of feature distance values selected from the positive example set, and PK represents the size of the batch group. The distance value between the center features of the negative example set; The formula for the neighborhood continuity loss function is as follows: in, This is a probability coefficient used to adjust the steepness of the probability curve. Indicates the weight term. This is the neighborhood continuity loss function.
Citation Information
Patent Citations
Unsupervised cross-domain pedestrian re-identification method
CN111881714A