Transfer learning, pedestrian re-identification methods and related equipment

Through the transfer learning method, the global branch network and local branch network are used to extract features and update the model parameters, which solves the problem of poor recognition effect of pedestrian re-identification under different equipment and appearance conditions, and improves the recognition performance and generalization ability.

CN114463552BActive Publication Date: 2025-03-25ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111619619.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2025-03-25
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

In the prior art, the recognition effect of pedestrian re-identification is poor, especially when the differences between different camera equipment and changes in pedestrian appearance, the recognition performance is degraded.

Method used

Transfer learning method is adopted to obtain source domain images and target domain images, and features are extracted using global branch networks and local branch networks, and the loss update model parameters are calculated to align the feature distribution of source domain and target domain.

Benefits of technology

The recognition performance of the target recognition model is improved, the generalization ability of the model is enhanced, and the performance of pedestrian re-identification is more stable under different conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114463552B_ABST
    Figure CN114463552B_ABST
Patent Text Reader

Abstract

The present invention discloses a transfer learning, pedestrian re-identification method and related equipment. The transfer learning method includes: inputting a source domain image and a target domain image into a target recognition model, obtaining global features of the source domain image, global features of the target domain image, and local features of the target domain image; wherein the target recognition model includes at least a global branch network and a local branch network, extracting global features of the source domain image and global features of the target domain image using the global branch network, and extracting local features of the target domain image using the local branch network; calculating the loss of the target recognition model using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image; and updating the model parameters of the target recognition model based on the loss of the target recognition model. In the above manner, the present invention can align the feature distributions of the source domain image and the target domain image, so as to improve the recognition performance of the target recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a transfer learning method, a pedestrian re-identification method, an electronic device, and a computer-readable storage medium. Background Art

[0002] Person re-identification is a sub-solution of image retrieval. It uses computer vision technology to determine whether a specific pedestrian exists in an image or video sequence. Due to the differences between different camera devices and the fact that pedestrians' appearance is easily affected by clothing, size, and viewing angle, person re-identification is difficult to implement. In addition, due to differences in fields, when a trained target recognition model is generalized to another data set, poor recognition results may occur, which seriously affects the recognition effect. Summary of the invention

[0003] In view of this, the main technical problem solved by the present invention is to provide a transfer learning method, a pedestrian re-identification method, an electronic device and a computer-readable storage medium, which can align the feature distribution of the source domain image and the target domain image, so as to improve the recognition performance of the target recognition model.

[0004] To solve the above technical problems, a technical solution adopted by the present invention is: providing a transfer learning method, which includes: obtaining a source domain image and a target domain image, the source domain image contains annotation information; inputting the source domain image and the target domain image into a target recognition model to obtain the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image; wherein the target recognition model at least includes a global branch network and a local branch network, the global features of the source domain image and the global features of the target domain image are extracted using the global branch network, and the local features of the target domain image are extracted using the local branch network; the loss of the target recognition model is calculated using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image; based on the loss of the target recognition model, the model parameters of the target recognition model are updated.

[0005] In one embodiment of the present invention, calculating the loss of the target recognition model using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image includes: calculating a first loss using the global features of the target domain image and the local features of the target domain image, and calculating a second loss using the global features of the target domain image and the global features of the source domain image; fusing the first loss and the second loss to obtain a first fused loss; and updating the model parameters of the target recognition model based on the first fused loss.

[0006] In one embodiment of the present invention, calculating the first loss using the global features of the target domain image and the local features of the target domain image includes: calculating the similarity between the global features of the target domain image and the target domain global feature template to obtain a global similarity vector, where the target domain global feature template is a weighted feature of the global features of the target domain image extracted in the previous training; calculating the similarity between each local feature of the target domain image and the corresponding local feature template to obtain multiple local similarity vectors, where the local feature template is a weighted feature of the local features of the target domain image extracted in the previous training; calculating the divergence loss of each local similarity vector and the global similarity vector to obtain multiple divergence losses; and performing weighted averaging on the multiple divergence losses to obtain the first loss.

[0007] In one embodiment of the present invention, calculating the second loss using the global features of the target domain image and the global features of the source domain image includes: calculating the similarity between the global features of the target domain image and the global features of the source domain image to obtain the second loss.

[0008] In one embodiment of the present invention, a third loss is calculated using global features of the target domain image; the third loss and the first fusion loss are fused to obtain a second fusion loss; and based on the second fusion loss, the model parameters of the target recognition model are updated.

[0009] In one embodiment of the present invention, calculating the third loss using the global features of the target domain image includes: obtaining a target domain global feature template, clustering the target domain global feature template to obtain a number of category clusters, the target domain global feature template is a weighted feature of the global features of the target domain image extracted in the previous training; obtaining the category center feature of each category cluster, the category center feature is the average feature of the global features of the category cluster; calculating the similarity between the global features of the target domain image and the category center feature to obtain the third loss.

[0010] In one embodiment of the present invention, the fourth loss is calculated using the global features of the source domain image; the fourth loss and the second fusion loss are fused to obtain a third fusion loss; and based on the third fusion loss, the model parameters of the target recognition model are updated.

[0011] In one embodiment of the present invention, calculating the fourth loss using the global features of the source domain image includes: performing classification processing on the global features of the source domain image to obtain category prediction probabilities; performing label smoothing processing on the annotation information of the source domain image to obtain smoothed labels; and calculating the cross entropy loss between the category prediction probabilities and the smoothed labels to obtain the fourth loss.

[0012] In one embodiment of the present invention, a test image is obtained; the test image is input into a target recognition model after parameter update to extract features of the test image; the similarities between the features of the test image and the features of each target image in the base library are calculated respectively; in response to the number of similarities greater than a first threshold being greater than a second threshold, training of the target recognition model is stopped.

[0013] In one embodiment of the present invention, the target recognition model also includes a backbone network; the backbone network connects the global branch network and the local branch network; the backbone network is used to process the source domain image and the target domain image, and input the processed source domain image and target domain image into the global branch network, and input the processed target domain image into the local branch network.

[0014] To solve the above technical problems, another technical solution adopted by the present invention is: to provide a pedestrian re-identification method, which includes: obtaining an image to be identified; using a target recognition model to identify the image to be identified, and outputting a recognition result; the target recognition model is trained using the transfer learning method described in any of the above embodiments.

[0015] To solve the above technical problems, another technical solution adopted by the present invention is: to provide an electronic device, which includes: a processor, used to execute the transfer learning method described in any of the above embodiments, and / or, used to execute the pedestrian re-identification method described in the above embodiments.

[0016] To solve the above technical problems, another technical solution adopted by the present invention is: providing a computer-readable storage medium, which is used to store instructions / program data, and the instructions / program data can be executed to implement the transfer learning method described in any of the above embodiments, and / or the pedestrian re-identification method described in the above embodiments.

[0017] The beneficial effect of the present invention is: different from the prior art, in the transfer learning method of the present invention, the global branch network of the target recognition model is used to obtain the global features of the source domain image and the global features of the target domain image, and the local branch network is used to obtain the local features of the target domain image, that is, the global features of the source domain image and the global features of the target domain image are obtained through the same branch network, that is, the source domain image and the target domain image can be associated through the global branch network, so that when the global features of the source domain image and the global features of the target domain image are obtained, the two can be aligned, thereby improving the attribute association between the source domain image and the target domain image, so as to improve the generalization of transfer learning, which is beneficial to improving the recognition performance of the target recognition model. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. In addition, these drawings and text descriptions are not intended to limit the scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by reference to specific embodiments.

[0019] Figure 1 It is a structural schematic diagram of an embodiment of a target recognition model of the present invention;

[0020] Figure 2 It is a flow chart of an embodiment of a transfer learning method of the present invention;

[0021] Figure 3 It is a flow chart of an embodiment of a test target recognition model of the present invention;

[0022] Figure 4 It is a flowchart of an embodiment of a pedestrian re-identification method of the present invention;

[0023] Figure 5 It is a structural schematic diagram of an embodiment of an electronic device of the present invention;

[0024] Figure 6 It is a schematic diagram of the structure of an embodiment of a computer-readable storage medium of the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0026] In order to solve the technical problem of poor recognition effect of pedestrian re-identification in the prior art, the present invention provides a transfer learning method and a pedestrian re-identification method. The transfer learning method includes: obtaining a source domain image and a target domain image, wherein the source domain image contains annotation information; inputting the source domain image and the target domain image into a target recognition model to obtain global features of the source domain image, global features of the target domain image, and local features of the target domain image; wherein the target recognition model includes at least a global branch network and a local branch network, the global features of the source domain image and the global features of the target domain image are extracted using the global branch network, and the local features of the target domain image are extracted using the local branch network; the loss of the target recognition model is calculated using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image; based on the loss of the target recognition model, the model parameters of the target recognition model are updated. The pedestrian re-identification method is implemented using the target recognition model obtained by the transfer learning method, and the pedestrian re-identification method includes: obtaining an image to be recognized; using the recognition model to recognize the image to be recognized, and outputting the recognition result; the recognition model is trained using the transfer learning method described in any of the above embodiments. The present invention is described in detail below.

[0027] See also Figure 1 , Figure 1 It is a schematic diagram of the structure of an embodiment of the target recognition model of the present invention. It should be noted that the target recognition model of the present invention can be used for transfer learning, and can be specifically applied to pedestrian re-identification, semantic recognition, image segmentation, target recognition, etc. For ease of understanding, the following is an example of applying the target recognition model of the present invention to a pedestrian re-identification method.

[0028] In one embodiment, the source domain image and the target domain image are input into the target recognition model, that is, the target recognition model can obtain the source domain image and the target domain image; wherein the target domain image refers to an image containing the object to be recognized, and the source domain image is an image that does not contain the object to be recognized, for example, the target domain image is an image containing the target person, and the source domain image is an image containing other pedestrians. In addition, the source domain image contains annotation information, for example, the annotation information can be the identity information of the pedestrian in the source domain image.

[0029] The target recognition model includes at least a global branch network and a local branch network; wherein the global branch network can extract global features of the source domain image and global features of the target domain, and the local branch network can extract local features of the target domain image.

[0030] That is, by inputting the source domain image and the target domain image into the target recognition model, the global features of the source domain image, the global features of the target domain image, and the local features of the target domain can be obtained from the global branch network and the local branch network, so that the loss of the target recognition model can be calculated using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image, and based on the obtained loss of the target recognition model, the model parameters of the target recognition model are updated to optimize the target recognition model. The specific calculation of the loss of the target recognition model will be explained below.

[0031] Optionally, the global branch network can input the input source domain image and target domain image into the GAP (Global Average Pooling) layer, and for each feature Figure 1 The whole image is globally mean pooled, and each feature map can get an output, which can reduce network parameters, simplify the convolution structure, reduce the required parameter optimization, and reduce the risk of overfitting of the target recognition model. In addition, each feature map is equivalent to an output feature, which can represent the characteristics of the output class. By strengthening the consistency between the feature map and the category and summing the spatial information, the spatial transformation is more stable.

[0032] The local branch network can also uniformly slice the input target domain image in the vertical direction to obtain P parts; the P parts are input to the GAP layer, and global average pooling is performed on each part to obtain local features of the P target domain images.

[0033] Furthermore, the target recognition model also includes a backbone network, which is connected to a global branch network and a local branch network. The backbone network is used to process source domain images and target domain images, and input the processed source domain images and target domain images into the global branch network, and input the processed target domain images into the local branch network. Among them, the "inputting the source domain images and target domain images into the target recognition model" mentioned above, the source domain images and target domain images can be the source domain images and target domain images input into the target recognition model, that is, images that have not been processed by the backbone network, and can also be feature maps of the source domain images and target domain images processed by the backbone network, which are not limited here. The following is an example of the feature map of the source domain image and the feature map of the target domain image output after being processed by the backbone network, which are input into the global branch network and the local branch network.

[0034] Optionally, the backbone network can be a ResNet-50 neural network, etc. In this embodiment, the first five convolutional layer modules conv1-conv5 of ResNet-50 can be used as the backbone network, wherein the convolutional layer modules conv1-conv5 include convolutional layers, activation layers, etc. The backbone network is used to adjust the size, clarity, etc. of the source domain image and the target domain image, and can also enrich the semantic information of the source domain image and the target domain by downsampling the source domain image and the target domain image through the convolutional layer modules conv1-conv5. Alternatively, the downsampling operation in the convolutional layer module conv5 can be removed to increase the size of the feature map of the source domain image and enrich the granularity of the features. It is easy to understand that based on the loss of the target recognition model obtained, when the model parameters of the target recognition model are updated, the target recognition model will be trained multiple times, and each training will update the model parameters of the target recognition model based on the loss obtained from the adjacent previous training.

[0035] In one embodiment, one training is to input the target domain image and the source domain image into the target recognition model, obtain the global features of the target domain image, the local features of the target domain image and the global features of the source domain through the backbone network, the global branch network and the local branch network, store the obtained global features of the target domain image as the target domain global feature template, and store the obtained local features of P target domain images as P local feature templates. When each training is completed, the target domain global feature template and the local feature template are updated, which can be the weighted features of the global features and local features of the target domain image extracted in the previous training, as shown in the following formula:

[0036]

[0037] Among them, g represents the local feature template, f represents the local feature of the target domain image, and α is the momentum coefficient, which can be set to 0.2.

[0038] The following is an example of an implementation method of calculating the target recognition model loss and using the loss to update the model parameters of the target recognition model in the present invention.

[0039] The first loss is calculated using the global features of the target domain image and the local features of the target domain image; wherein the global features of the target domain image are extracted using a global branch network, and the local features of the target domain image are extracted using a local branch network. The first loss can constrain the global features of the target domain image and the local features of the target domain image, that is, the local features of the target domain image are used to constrain the global features of the target domain image, so that the global and local similarity relationships of the target domain image match or even are consistent, which is beneficial for the target recognition model to learn the feature distribution information of the target domain image.

[0040] Optionally, the similarity between the global features of the target domain image and the target domain global feature template may be calculated to obtain a global similarity vector; the target domain global feature template is a weighted feature of the global features of the target domain image extracted in the previous training.

[0041] The similarity between each local feature of the target domain image and the corresponding local feature template is calculated respectively to obtain multiple local similarity vectors. The local feature template is the weighted feature of the local feature of the target domain image extracted in the previous training.

[0042] The divergence loss between each local similarity vector and the global similarity vector is calculated respectively to obtain multiple divergence losses, and the multiple divergence losses are weighted averaged to obtain a first loss to constrain the global features of the target domain image and the local features of the target domain image. The divergence may be KL divergence, etc., and the first loss may be equivalent to the consistency loss.

[0043] The second loss is calculated using the global features of the target domain image and the global features of the source domain image, and the style difference between the source domain image and the target domain image is learned through the second loss. The feature distribution of the source domain image and the target domain image is aligned using the second loss, so that the target recognition model can learn domain-invariant features and has good generalization ability. When the target recognition model is used to recognize other target domains, it can still have good recognition performance, thereby improving the reliability of the target recognition model and helping to improve the recognition performance of the target recognition model.

[0044] Optionally, the similarity between the global features of the target domain image and the global features of the source domain image is calculated to obtain a second loss to learn the style difference between the source domain image and the target domain image and improve the generalization ability of the target recognition model. The similarity calculation may be to calculate the MMD (Maximum mean discrepancy) distance between the global features of the target domain image and the global features of the source domain image, and the second loss may be equivalent to the domain adaptation loss. By reducing the domain adaptation loss, the feature distribution of the source domain image and the target domain image may be aligned.

[0045] After obtaining the first loss and the second loss, the first loss and the second loss can be fused to obtain a first fused loss, and the first fused loss is back-propagated, that is, based on the first fused loss, the model parameters of the target recognition model are updated. Furthermore, the model parameters of the target recognition model can be updated using an optimization algorithm to reduce the loss, so that the target recognition model learns better domain-invariant feature expressions during the training process, thereby improving the reliability of the target recognition model and improving the recognition performance of the target recognition model.

[0046] In an alternative embodiment, the model parameters of the target recognition model may be updated using the first loss, or the model parameters of the target recognition model may be updated using the second loss, which is not limited here.

[0047] Furthermore, the global features of the target domain image can be used to calculate the third loss, so that the third loss can be used to improve the feature extraction performance of the target recognition model, thereby improving the feature retrieval performance of the target recognition model.

[0048] Optionally, a target domain global feature template can be obtained, and the target domain global feature template can be clustered to obtain several category clusters. Pseudo-labels can also be estimated to provide supervised learning for feature learning of the target domain image. Each category cluster obtained is used to represent a category, and a category represents a person. That is to say, the global features belonging to different people form different category clusters. The reason why multiple category clusters are formed is that in addition to the target person to be identified, the target domain image also contains other pedestrians, so several category clusters representing different people will be formed.

[0049] It is easy to understand that in this embodiment, other pedestrians who are not the target person and appear in the target domain image are also identified, and the identity features of other pedestrians in the target domain image are learned to further improve the classification performance and recognition performance of the target recognition model. Among them, clustering algorithms such as DBSCAN (Density-Based Spatial Clustering of Applications with Noise) can be used to cluster the target domain global feature template.

[0050] The category center feature of each category cluster is obtained. The category center feature is the average feature of the global feature of the category cluster. The similarity between the global feature of the target domain image and the category center feature is calculated to obtain the third loss, as shown in the following formula:

[0051]

[0052] Among them, f i is the global feature of the i-th target domain image, C yi is the central feature of the cluster to which it belongs, N is the number of categories of the global template cluster; τ is the temperature coefficient, which is used to balance the feature distribution and can be set to 0.05; <f i , C yi > represents f i , C yi The inner product of two feature vectors. Among them, the third loss can be equivalent to the target domain image classification loss.

[0053] The third loss and the first fusion loss are fused to obtain the second fusion loss, that is, the second fusion loss can be obtained by fusion of the first loss, the second loss and the third loss. Based on the second fusion loss, the model parameters of the target recognition model are updated. Furthermore, the model parameters of the target recognition model can also be updated using an optimization algorithm to reduce the loss, so that the target recognition model learns better domain-invariant feature expressions during the training process, thereby improving the reliability of the target recognition model and improving the recognition performance of the target recognition model.

[0054] Furthermore, the fourth loss can be calculated using the global features of the source domain image to improve the feature extraction and feature recognition performance of the target recognition model, thereby optimizing the classification ability of the target recognition model.

[0055] Optionally, the source domain image may be input into a fully connected layer and a softmax activation function, and the global features of the source domain image may be classified, that is, the identity of the pedestrian may be classified, and the corresponding category prediction probability may be obtained. At the same time, the label smoothing process is performed on the annotation information of the source domain image to obtain a smoothed label, and the cross entropy loss between the category prediction probability and the smoothed label calculation is calculated to obtain a fourth loss, that is, the fourth loss is equivalent to the source domain classification loss. Since the number of target domain images is usually less than the number of source domain images, using the source domain images to train the target recognition model can enable the target recognition model to be adequately trained, thereby improving the classification performance of the target recognition model, and further improving the recognition performance of the target recognition model.

[0056] The fourth loss and the second fusion loss are fused to obtain the third fusion loss. That is to say, the third fusion loss is obtained by fusion of the first loss, the second loss, the third loss and the fourth loss. Based on the third fusion loss, the model parameters of the target recognition model are updated, thereby improving the classification performance, domain adaptation performance, feature retrieval performance, etc. of the target recognition model, improving the reliability of the target recognition model, and then improving the recognition performance of the target recognition model.

[0057] In an alternative embodiment, the fourth loss can also be fused with the first fusion loss, that is, the fourth loss, the first loss and the second loss are fused, and the model parameters of the target recognition model are updated using the fused loss, thereby improving the recognition performance of the target recognition model.

[0058] It should be noted that, in the present invention, when updating the model parameters of the target recognition model based on the loss of the target recognition model, the loss used can be at least one of the first loss, the second loss, the third loss, and the fourth loss; that is, one of them can be used, or the loss after the fusion of several of them, or the loss after the fusion of four, which will not be repeated here.

[0059] In summary, the target recognition model of the present invention can obtain four losses during the training process, namely the first loss, the second loss, the third loss and the fourth loss. The losses are fused and then back-propagated to update the model parameters of the target recognition model. The parameters of the target recognition model can also be updated using an optimization algorithm to reduce the losses, which is beneficial for the target recognition model to learn domain-invariant features during the training process.

[0060] See also Figure 2 , Figure 2 It is a flow chart of an embodiment of the transfer learning method of the present invention. It should be noted that the transfer learning method described in this embodiment is not limited to the following steps:

[0061] S101: Acquire a source domain image and a target domain image.

[0062] In this embodiment, the source domain is an image that does not contain the target to be identified, and the source domain image contains annotation information, such as pedestrian identity information, etc.; the target domain image is an image that contains the target to be identified, and the target domain image does not contain annotation information.

[0063] S102: Input the source domain image and the target domain image into the target recognition model to obtain the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image.

[0064] In this embodiment, the target recognition model includes at least a global branch network and a local branch network. The global features of the source domain image and the global features of the target domain image are extracted using the global branch network so as to align the feature distribution of the target domain image and the source domain image. The local features of the target domain image are extracted using the local branch network. The specific acquisition process is as described in the above target recognition model and will not be repeated here.

[0065] S103: Calculate the loss of the target recognition model using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image.

[0066] In this embodiment, the specific implementation method of calculating the loss of the target recognition model has been described in the previous text with examples, which will not be repeated here.

[0067] Optionally, when obtaining the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image during each training, a certain number of source domain images and target domain images may be randomly selected for training.

[0068] S104: Based on the loss of the target recognition model, update the model parameters of the target recognition model.

[0069] In this embodiment, the model parameters of the target recognition model are updated using the loss, which can improve the recognition performance of the target recognition model. The specific implementation method of updating the model parameters of the target recognition model based on the loss has been described in the previous article, and will not be repeated here.

[0070] It can be seen that in this embodiment, the global features of the source domain image and the global features of the target domain image are obtained through the same branch network, that is, the source domain image can be associated with the target domain image through the global branch network, so that when the global features of the source domain image and the global features of the target domain image are obtained, the feature distributions of the two can be aligned, the attribute association between the source domain image and the target domain image can be improved, and the domain invariant features can be learned to improve the generalization of transfer learning, which is beneficial to improving the recognition performance of the target recognition model.

[0071] See also Figure 3 , Figure 3 It is a flow chart of an embodiment of the test target recognition model of the present invention. It should be noted that the test target recognition model described in this embodiment is not limited to the following steps:

[0072] S201: Acquire a test image.

[0073] In this embodiment, the target domain image can be divided into a training image, a test image, and a base library set, wherein the training image is used to perform the migration method in the above embodiment, and the test image and the base library set can be used to test the performance of the target recognition model. Optionally, there may be an intersection between the training image, the test image, and the base library set.

[0074] S202: Input the test image into the target recognition model after parameter update to extract features of the test image.

[0075] In this embodiment, a target recognition model is obtained by training a training image using source domain images and annotation information as well as target domain images, i.e., a target recognition model after parameter update, and a test image is input into the target recognition model to extract features of the test image; wherein the features of the test image include global features of the test image and local features of the test image.

[0076] S203: Calculate the similarity between the features of the test image and the features of each target image in the database set.

[0077] In this embodiment, for each test image, the extracted features are used to calculate its similarity with all target images in the base library, such as Euclidean distance, that is, the similarity between the features of the test image and the features of each target image in the base library is calculated respectively.

[0078] S204: In response to the number of similarities greater than the first threshold being greater than the second threshold, stopping the training of the target recognition model.

[0079] In this embodiment, the search results in the base database are sorted and returned according to a preset sorting order (for example, similarity from small to large). In response to the number of similarities greater than the first threshold being greater than the second threshold, the target recognition model training is considered to be completed, and the training of the target recognition model is terminated.

[0080] See also Figure 4 , Figure 4 It is a flow chart of an embodiment of a pedestrian re-identification method of the present invention. It should be noted that the pedestrian re-identification method described in this embodiment is not limited to the following steps:

[0081] S301: Acquire an image to be recognized.

[0082] In this embodiment, the image to be identified is an image that needs to be identified to see whether it contains a target person, and currently it is not known whether the image to be identified contains the target person.

[0083] S302: Using the target recognition model to recognize the image to be recognized, and outputting the recognition result.

[0084] In this embodiment, the target recognition model is trained using the transfer learning method described in the above embodiment. When the target recognition model is used to recognize the model to be recognized, the reliability of the output recognition result can be improved. The output recognition result can indicate whether the image to be recognized contains the target person, or the output recognition result is an image containing the target person.

[0085] See also Figure 5 , Figure 5 It is a schematic structural diagram of an embodiment of an electronic device of the present invention.

[0086] In one embodiment, the electronic device 10 includes a processor 11, which may also be referred to as a CPU (Central Processing Unit). The processor 11 may be an integrated circuit chip having a signal processing capability. The processor 11 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 11 may also be any conventional processor, etc.

[0087] The electronic device 10 may further include a memory (not shown) for storing instructions and data required for the processor 11 to run.

[0088] The processor 11 is used to execute the transfer learning method described in any of the above embodiments, and / or to execute the pedestrian re-identification method described in the above embodiments.

[0089] See also Figure 6 , Figure 6 It is a schematic diagram of the structure of an embodiment of a computer-readable storage medium of the present invention.

[0090] In one embodiment, a computer-readable storage medium 20 is used to store instruction / program data 21, and the instruction / program data 21 can be executed to implement the transfer learning method as described in any of the above embodiments, and / or the pedestrian re-identification method described in the above embodiments, which will not be repeated here.

[0091] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device implementation described above is schematic, for example, the division of modules or units is a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

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

[0093] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0094] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium 20, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned computer-readable storage medium 20 includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, server and other media that can store program codes.

[0095] In addition, in the present invention, unless otherwise clearly specified and limited, the terms "connected", "connected", "stacked" and the like should be understood in a broad sense, for example, it can be fixedly connected, detachably connected, or integrated; it can be directly connected, or indirectly connected through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A transfer learning method, characterized in that: include: Acquire a source domain image and a target domain image, wherein the source domain image includes annotation information; Inputting the source domain image and the target domain image into a target recognition model to obtain global features of the source domain image, global features of the target domain image, and local features of the target domain image; wherein the target recognition model at least includes a global branch network and a local branch network, the global features of the source domain image and the global features of the target domain image are extracted using the global branch network, and the local features of the target domain image are extracted using the local branch network; Calculating the loss of the object recognition model using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image; Based on the loss of the target recognition model, updating the model parameters of the target recognition model; The step of calculating the loss of the target recognition model by using the global features of the source domain image, the global features of the target domain image, and the local features of the target domain image includes: Calculating a first loss using the global features of the target domain image and the local features of the target domain image, and calculating a second loss using the global features of the target domain image and the global features of the source domain image; fusing the first loss and the second loss to obtain a first fused loss; Based on the first fusion loss, model parameters of the object recognition model are updated.

2. The transfer learning method according to claim 1, characterized in that: The calculating the first loss by using the global feature of the target domain image and the local feature of the target domain image comprises: Calculating the similarity between the global features of the target domain image and the target domain global feature template to obtain a global similarity vector, wherein the target domain global feature template is a weighted feature of the global features of the target domain image extracted in a previous training; Calculating the similarity between each local feature of the target domain image and the corresponding local feature template respectively to obtain a plurality of local similarity vectors, wherein the local feature template is a weighted feature of the local feature of the target domain image extracted in the previous training; Calculating the divergence loss between each of the local similarity vectors and the global similarity vector respectively to obtain a plurality of divergence losses; The first loss is obtained by performing weighted averaging on the multiple divergence losses.

3. The transfer learning method according to claim 1, characterized in that: The calculating the second loss by using the global features of the target domain image and the global features of the source domain image comprises: The similarity between the global features of the target domain image and the global features of the source domain image is calculated to obtain the second loss.

4. The transfer learning method according to claim 1, characterized in that: include: Calculating a third loss using the global features of the target domain image; Fusing the third loss and the first fused loss to obtain a second fused loss; Based on the second fusion loss, model parameters of the target recognition model are updated.

5. The transfer learning method according to claim 4, characterized in that: The calculating the third loss by using the global feature of the target domain image comprises: Acquire a target domain global feature template, cluster the target domain global feature template to obtain a plurality of category clusters, wherein the target domain global feature template is a weighted feature of the target domain image global feature extracted in the previous training; Obtaining a category center feature of each of the category clusters, wherein the category center feature is an average feature of the global features of the category cluster; The similarity between the global feature of the target domain image and the category center feature is calculated to obtain the third loss.

6. The transfer learning method according to claim 4, characterized in that: Calculating a fourth loss using the global features of the source domain image; Fusing the fourth loss and the second fused loss to obtain a third fused loss; Based on the third fusion loss, model parameters of the target recognition model are updated.

7. The transfer learning method according to claim 6, characterized in that: The calculating the fourth loss by using the global feature of the source domain image comprises: Classify the global features of the source domain image to obtain category prediction probabilities; Performing label smoothing processing on the annotation information of the source domain image to obtain a smoothed label; The cross entropy loss of the category prediction probability and the smoothed label calculation is calculated to obtain the fourth loss.

8. The transfer learning method according to claim 1, characterized in that: Get a test image; Inputting the test image into the target recognition model after parameter update to extract features of the test image; Calculate the similarity between the features of the test image and the features of each target image in the base library respectively; In response to the number of similarities greater than the first threshold being greater than the second threshold, training of the target recognition model is stopped.

9. The transfer learning method according to claim 1, characterized in that: The target recognition model also includes a backbone network; The backbone network connects the global branch network and the local branch network; the backbone network is used to process the source domain image and the target domain image, and input the processed source domain image and the target domain image into the global branch network, and input the processed target domain image into the local branch network.

10. A pedestrian re-identification method, characterized in that: include: Obtain an image to be recognized; Using the target recognition model to recognize the image to be recognized, and outputting the recognition result; The target recognition model is trained using the transfer learning method described in any one of claims 1-9.

11. An electronic device, characterized in that: include: A processor, used to execute the transfer learning method described in any one of claims 1 to 9, and / or used to execute the pedestrian re-identification method described in claim 10.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store instructions / program data, which can be executed to implement the transfer learning method as described in any one of claims 1-9, and / or the pedestrian re-identification method as described in claim 10.

Citation Information

Patent Citations

  • Method and system for training cross-domain facial expression recognition model and facial expression recognition

    CN113128287A

  • Region-based self-adaptive model training method and device, image detection method and device, and apparatus and medium

    WO2021120752A1