Target re-identification method, terminal device and computer readable storage medium

By dividing image features into global and local features and fusing them, and by using classification word vectors and positional encoding, the problem of insufficient global feature capture capability of convolutional neural networks is solved, thereby improving the recognition accuracy and precision of target re-identification.

CN114419408BActive Publication Date: 2026-04-17SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
Filing Date
2021-12-30
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In existing target re-identification methods, convolutional neural networks have a weak ability to capture global features of images, which affects the recognition accuracy.

Method used

The image features obtained by the feature extraction model of the image to be processed are divided into global features and local features, and feature fusion is performed. The global feature capture capability is enhanced by using the trained classification word vectors and positional encoding, and the feature extraction accuracy is improved by using a multi-head attention mechanism and a layer normalization module.

Benefits of technology

By fusing global and local features, the accuracy of target re-identification is improved, the ability to capture global information of the image is enhanced, and the accuracy of recognition is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114419408B_ABST
    Figure CN114419408B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of image processing, and provides a target re-identification method and device, terminal equipment and computer readable storage medium, comprising: obtaining a first image feature of a to-be-processed image according to a trained feature extraction model; dividing the first image feature of the to-be-processed image into a first global feature and a plurality of groups of first local features; performing feature fusion on the plurality of groups of first local features respectively and the first global feature to obtain a first fusion feature corresponding to each of the plurality of groups of first local features; splicing the first fusion features to obtain a second image feature of the to-be-processed image; and performing target re-identification on the to-be-processed image according to the second image feature. Through the above method, the identification accuracy of target re-identification can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, and in particular relates to target re-identification methods, apparatus, terminal equipment and computer-readable storage media. Background Technology

[0002] Target re-identification technology refers to techniques for determining the presence of a specific target in an image or video sequence. Unlike other image recognition techniques, target re-identification focuses not only on local features but also on global features. Existing target re-identification methods typically utilize convolutional neural networks (CNNs) to extract feature information from the image to be processed. Because CNNs are more focused on local features, their ability to capture global features is relatively weak. However, for human body re-identification tasks, both global and local features of the human body must be considered comprehensively; otherwise, the accuracy of target re-identification will be affected. Summary of the Invention

[0003] This application provides a target re-identification method, apparatus, terminal device, and computer-readable storage medium, which can effectively improve the identification accuracy of target re-identification.

[0004] In a first aspect, embodiments of this application provide a target re-identification method, including:

[0005] The first image features of the image to be processed are obtained based on the trained feature extraction model.

[0006] The first image features of the image to be processed are divided into first global features and multiple sets of first local features;

[0007] The plurality of first local features are respectively fused with the first global feature to obtain the first fused feature corresponding to each of the plurality of first local features;

[0008] By concatenating the first fusion feature, the second image feature of the image to be processed is obtained;

[0009] The target re-identification is performed on the image to be processed based on the second image features.

[0010] In this embodiment, after obtaining the image features of the image to be processed, the image features are divided into global features and multiple sets of local features. Then, the multiple sets of local features are fused with the global features, which is equivalent to incorporating global features into each set of local features. Finally, target re-identification is performed based on the image features obtained by stitching together the fused features. In the above method, multiple local information is considered for differentiation when performing the target re-identification task, which helps to improve the accuracy of recognition. Furthermore, global features are incorporated into each set of local information to improve the ability to capture global information. Through the above method, the recognition accuracy of target re-identification is effectively improved.

[0011] In one possible implementation of the first aspect, obtaining the first image features of the image to be processed based on the trained feature extraction model includes:

[0012] The image to be processed is divided into multiple image blocks;

[0013] Generate the first word vector corresponding to each of the plurality of image patches;

[0014] Generate a sequence of word vectors based on multiple of the first word vectors;

[0015] The word vector sequence is input into the feature extraction model to obtain the first image features.

[0016] In one possible implementation of the first aspect, generating a word vector sequence based on a plurality of the first word vectors includes:

[0017] Generate the position codes corresponding to each of the multiple image blocks;

[0018] The position is encoded to generate an encoding vector with the same dimension as the first word vector;

[0019] The first word vectors are added to their respective corresponding encoding vectors to obtain the second word vectors corresponding to the first word vectors.

[0020] The trained classification word vectors and multiple second word vectors are concatenated to form the word vector sequence, wherein the classification word vectors correspond to the first global feature.

[0021] In one possible implementation of the first aspect, the feature extraction model includes a plurality of encoders connected in sequence, each encoder including an attention module, a multi-layer fully connected module and a layer normalization module;

[0022] The step of inputting the word vector sequence into the feature extraction model to obtain the first image features includes:

[0023] For each encoder, the word vector sequence is input into the layer normalization module of the encoder, and a first result is output;

[0024] The first result is input into the attention module to obtain the second result;

[0025] The second result is added to the residual of the word vector sequence to obtain the third result;

[0026] The third result is input into the layer normalization module to obtain the fourth result;

[0027] The fourth result is input into the multi-layer fully connected module to obtain the fifth result;

[0028] The fifth result is added to the residual of the third result to obtain the output result of the encoder, wherein the first image feature is the output result of the last encoder.

[0029] In one possible implementation of the first aspect, the step of fusing the plurality of first local features with the first global feature to obtain a first fused feature corresponding to each of the plurality of first local features includes:

[0030] For each group of the first local features, calculate the average feature of the first local features and the first global features;

[0031] The calculated average feature is determined as the first fused feature corresponding to the first local feature.

[0032] In one possible implementation of the first aspect, the step of performing target re-identification on the image to be processed based on the second image features includes:

[0033] Calculate the feature similarity between the second image feature and the feature of each group of sample images in the preset feature library;

[0034] The sample image features are sorted in descending order of feature similarity to obtain a feature sequence;

[0035] The sample images corresponding to the first N sample image features in the feature sequence are determined as target images that match the image to be processed.

[0036] In one possible implementation of the first aspect, before obtaining the first image features of the image to be processed based on the trained feature extraction model, the method further includes:

[0037] The fourth image feature of the training image is obtained based on the feature extraction model;

[0038] The fourth image feature is divided into a second global feature and multiple sets of second local features;

[0039] The multiple sets of second local features are respectively fused with the second global features to obtain the second fused features corresponding to each of the multiple sets of second local features;

[0040] Calculate the loss value for each group of the second fused features;

[0041] The model parameters of the feature extraction model and the classification word vector are updated based on the calculated loss value of the second fusion feature until the trained feature extraction model and the classification word vector are obtained.

[0042] Secondly, embodiments of this application provide a target re-identification device, comprising:

[0043] The feature acquisition unit is used to acquire the first image features of the image to be processed based on the trained feature extraction model.

[0044] The feature segmentation unit is used to divide the first image features of the image to be processed into a first global feature and multiple sets of first local features;

[0045] The feature fusion unit is used to fuse the plurality of first local features with the first global feature respectively to obtain the first fused feature corresponding to each of the plurality of first local features;

[0046] A feature stitching unit is used to stitch together the first fused feature to obtain the second image feature of the image to be processed;

[0047] The target recognition unit is used to perform target re-recognition on the image to be processed based on the second image features.

[0048] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the target re-identification method as described in any one of the first aspects above.

[0049] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the target re-identification method as described in any one of the first aspects above.

[0050] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the target re-identification method described in any one of the first aspects.

[0051] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

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

[0053] Figure 1 This is a flowchart illustrating the target re-identification method provided in the embodiments of this application;

[0054] Figure 2 This is a schematic diagram of the encoder structure of the embodiment of this application;

[0055] Figure 3 This is a schematic diagram of the multi-head attention mechanism provided in an embodiment of this application;

[0056] Figure 4 This is a schematic diagram of the model training process provided in the embodiments of this application;

[0057] Figure 5 This is a structural block diagram of the target re-identification device provided in the embodiments of this application;

[0058] Figure 6 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. Detailed Implementation

[0059] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0060] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0061] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0062] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0063] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0064] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0065] Target re-identification technology refers to the technique of determining whether a specific target exists in an image or video sequence. The target re-identification process includes database construction, model training, and recognition. In the database construction process, a detection model detects images containing target objects from the raw images from the camera and compiles these images into a database. During training, a large number of training images containing target objects are collected (images from the database can be used for training) to train a feature extraction model. In the recognition process, the image to be processed is input into the trained feature extraction model to obtain the image features of the image to be processed. Based on the feature distance between the image features of the image to be processed and the image features of the images in the database (obtained by the trained feature extraction model), the target image that matches the image to be processed is selected from the database.

[0066] As mentioned above, the accuracy of target re-identification is highly correlated with the feature extraction accuracy of the feature extraction model. Existing target re-identification methods typically utilize convolutional neural networks (CNNs) to extract feature information from the image to be processed. While CNNs focus more on local image features, their ability to capture global image features is relatively weak. Therefore, using existing CNNs as the feature extraction model in target re-identification will ignore global image feature information, thus affecting the feature extraction accuracy.

[0067] To address the aforementioned problems, this application provides a target re-identification method. See also... Figure 1 This is a flowchart illustrating the target re-identification method provided in an embodiment of this application. It is intended as an example and not a limitation. The method may include the following steps:

[0068] S101, obtain the first image features of the image to be processed based on the trained feature extraction model.

[0069] Before S101, the feature extraction model needs to be pre-trained. For details on the training process, please refer to [link / reference needed]. Figure 4 The descriptions in the embodiments will not be repeated here.

[0070] In one embodiment, the method for obtaining the first image feature includes:

[0071] S1011, the image to be processed is divided into multiple image blocks.

[0072] For example, assuming the dimensions of the image to be processed are 384×128, the image to be processed is divided into 24×8 image blocks from left to right and from top to bottom, with each image block having a fixed area of ​​16x16, for a total of 192 blocks.

[0073] Since the sizes of the images to be processed may be different, the images to be processed can be resized to a preset size before being segmented.

[0074] S1012, Generate the first word vector corresponding to each of the plurality of image blocks.

[0075] The process of converting image patches into word vectors can be achieved using existing conversion methods, such as projection conversion methods, or by using neural networks.

[0076] S1013, Generate a word vector sequence based on the plurality of the first word vectors.

[0077] Optionally, one way to generate a word vector sequence is to concatenate multiple first word vectors into a word vector sequence.

[0078] Since the first word vector is a word vector of an image patch, and an image patch is a local image of the image to be processed, the first word vector essentially represents the local information of the image to be processed. If concatenated in the above manner, the resulting word vector sequence only includes the local information represented by the first word vector. To consider the global information of the image, a classification word vector representing the global information is added to the word vector sequence. The classification word vectors in this embodiment are also obtained through training; the specific training process can be found in [link to relevant documentation]. Figure 4 Description in the embodiments.

[0079] Furthermore, the image to be processed is actually obtained by sequentially stitching together multiple image blocks. If the arrangement order of the image blocks changes, the image to be processed cannot be restored. In other words, the arrangement order (i.e., position) of the image blocks also contains some feature information. To reflect the positional features of the image blocks, in this embodiment, the positional features of the image blocks are added through positional encoding when generating the word vector sequence.

[0080] Alternatively, another way to generate word vector sequences includes:

[0081] Generate positional codes corresponding to each of the plurality of image patches; generate encoding vectors with the same dimension as the first word vectors from the positional codes; add the plurality of first word vectors to their respective encoding vectors to obtain second word vectors corresponding to the plurality of first word vectors; concatenate the trained classification word vectors and the plurality of second word vectors to form the word vector sequence, wherein the classification word vectors correspond to the first global feature.

[0082] Image blocks can be numbered in a specific order. For example, based on their arrangement from left to right and top to bottom in the image to be processed, image blocks can be assigned position numbers from 1 to N. Existing encoding methods (such as the word2vec algorithm) are used to generate corresponding encoding vectors from these position numbers. These encoding vectors are then added to their corresponding first word vectors. For example, if the first word vector has a dimension of 1×512 and its corresponding position number is 2, the resulting encoding vector will also have a dimension of 1×512, with each element having a value of 2. This 1×512 encoding vector is then added to the 1×512 first word vector to obtain the corresponding second word vector, which also has a dimension of 1×512.

[0083] For categorical word vectors, their dimension is the same as that of the first word vectors. For example, categorical word vectors can be added to the head of the second word vector sequence. There are 192 second word vectors of 1×512 size, and the categorical word vectors also have a dimension of 1×512. The resulting word vector sequence can be viewed as a 193×512 matrix. In this matrix, the first row represents the categorical word vectors, and rows 2 through 193 represent the second word vectors. The word vector sequence is represented as follows:

[0084]

[0085] in, Represents the m-th image patch; x represents the first word vector of the m-th image patch; class P represents the classification word vector; M represents the location encoding; and M is the total number of image patches.

[0086] S1014, Input the word vector sequence into the feature extraction model to obtain the first image features.

[0087] In one embodiment, the feature extraction model may include multiple encoders connected in sequence, each encoder including an attention module, a multi-layer fully connected module, and a layer normalization module. See also Figure 2 This is a schematic diagram of the encoder structure of an embodiment of this application. Figure 2 As shown, the data processing in each encoder includes:

[0088] The word vector sequence ( Figure 2 The image block encoding sequence shown is input into the layer normalization module of the encoder. Figure 2 (After normalizing the layers shown), output the first result;

[0089] The first result is input into the attention module. Figure 2 The multi-head attention mechanism shown yielded the second result;

[0090] Add the second result to the residual of the word vector sequence. Figure 2 (The residual connection shown) yields the third result;

[0091] The third result is input into the layer normalization module to obtain the fourth result;

[0092] The fourth result is input into the multi-layer fully connected module. Figure 2 The aforementioned multi-layer fully connected structure yields the fifth result;

[0093] The output result of the encoder is obtained by adding the residual of the fifth result to the residual of the third result.

[0094] The above process can be expressed by the following formula:

[0095]

[0096] Where b represents the current encoder layer number; MSA represents multi-head attention mechanism; MLA represents multi-layer fully connected layer; LN represents layer normalization.

[0097] Continuing with the example in S101, the image to be processed is divided into 192 image blocks, and the dimension of the first word vector corresponding to each image block is 1×512. Therefore, the dimension of the word vector sequence is 193×512. See [link / reference] Figure 3 This is a schematic diagram of the multi-head attention mechanism provided in an embodiment of this application. Figure 3 As shown, the first result is a feature of 193×512. This feature is input into a multi-head attention module. After passing through multiple sets of Q, K, and V projection parameters, each feature undergoes self-attention operation and is then re-stitched. Finally, it is projected to the same dimension as the input through multiple fully connected layers.

[0098] Self-attention can generate more interpretable models, allowing for the examination of attention distribution within the model, and enabling each attention head to learn to perform different tasks. This multi-head attention mechanism overcomes the limitation of recurrent neural network models not being able to perform parallel computations.

[0099] The number of encoder layers can be set according to actual needs. Preferably, in this embodiment, a 12-layer stacked encoder is used. The output of the first encoder serves as the input of the second encoder, and so on. The output of the last encoder is the first image feature.

[0100] S102, the first image features of the image to be processed are divided into first global features and multiple groups of first local features.

[0101] Unlike conventional image classification tasks, considering the special nature of human body weight recognition tasks, when it is necessary to distinguish whether two images belong to the same person, multiple pieces of information such as head, shirt, and pants can be used for differentiation. Based on this consideration, in this embodiment, the first image features are horizontally segmented to obtain multiple feature blocks. As described in S101, the image to be processed is divided into 192 image blocks; correspondingly, after the feature extraction model, each image block corresponds to a feature block. In S102, each feature block is horizontally divided into k feature sub-blocks, and each feature sub-block is a set of first local features. For example, there are 192 feature blocks in total, and each feature block is further divided into 6 4×8 feature sub-blocks.

[0102] As described in S101, the word vector sequence input to the feature extraction model includes trained classification word vectors, which can represent the global features of the image. The first global feature in S102 is the feature of the classification word vectors obtained from the feature extraction model.

[0103] S103, the multiple sets of first local features are respectively fused with the first global features to obtain the first fused features corresponding to each of the multiple sets of first local features.

[0104] In one embodiment, the feature fusion process includes:

[0105] For each group of the first local features, calculate the average feature of the first local features and the first global features; determine the calculated average feature as the first fused feature corresponding to the first local feature.

[0106] By following the steps above, global features are essentially incorporated into each set of local features.

[0107] S104, the first fusion feature is spliced ​​together to obtain the second image feature of the image to be processed.

[0108] The order in which the fused features are stitched together is consistent with the order in which the features are divided in S102.

[0109] The first fused features can be stitched together into the second image features using a fully connected layer.

[0110] S105, Perform target re-identification on the image to be processed based on the second image features.

[0111] In this embodiment of the application, the target re-identification process includes:

[0112] Calculate the feature similarity (cosine similarity, etc.) between the second image feature and each group of sample image features in the preset feature library; sort the sample image features in descending order of feature similarity to obtain a feature sequence; determine the sample images corresponding to the first N sample image features in the feature sequence as target images that match the image to be processed, where N is a positive integer.

[0113] In this embodiment, after obtaining the image features of the image to be processed, the image features are divided into global features and multiple sets of local features. Then, the multiple sets of local features are fused with the global features, which is equivalent to incorporating global features into each set of local features. Finally, target re-identification is performed based on the image features obtained by stitching together the fused features. In the above method, multiple local information is considered for differentiation when performing the target re-identification task, which helps to improve the accuracy of recognition. Furthermore, global features are incorporated into each set of local information to improve the ability to capture global information. Through the above method, the recognition accuracy of target re-identification is effectively improved.

[0114] In one embodiment, the feature extraction model needs to be pre-trained before step S101. For example, see... Figure 4 This is a schematic diagram of the model training process provided in the embodiments of this application. Figure 4 As shown, the training process includes:

[0115] S401 divides the training image into multiple image blocks.

[0116] S402, generate positional codes corresponding to multiple image patches, and generate word vector sequences for training images.

[0117] For the first training process, the classification word vectors in the word vector sequence in this step are the initial vectors.

[0118] S403, input the word vector sequence into the encoder to obtain the fourth image feature.

[0119] Steps S401-S403 are the same as steps S101, and can be found in the description of the above S101 embodiment.

[0120] S404, the fourth image feature is segmented by position, and the fourth image feature is divided into a second global feature and multiple sets of second local features.

[0121] S405, the multiple sets of second local features are respectively fused with the second global features (feature averaging) to obtain the second fused features corresponding to each of the multiple sets of second local features.

[0122] Steps S404-S405 are the same as steps S102-S103, and can be found in the description of the above S102-S103 embodiments.

[0123] S406, each group of second fusion features is input into its corresponding fully connected classification layer to obtain the loss value.

[0124] S407 calculates the total loss based on the preset loss function and each loss value.

[0125] S408 updates the encoder parameters and classification word vectors based on the total loss.

[0126] Training is complete when the loss value reaches the preset accuracy.

[0127] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0128] Corresponding to the method described in the above embodiments, Figure 5 This is a structural block diagram of the target re-identification device provided in the embodiments of this application. For ease of explanation, only the parts related to the embodiments of this application are shown.

[0129] Reference Figure 5 The device includes:

[0130] The feature acquisition unit 51 is used to acquire the first image features of the image to be processed based on the trained feature extraction model.

[0131] The feature segmentation unit 52 is used to segment the first image features of the image to be processed into first global features and multiple sets of first local features.

[0132] The feature fusion unit 53 is used to fuse the multiple sets of first local features with the first global features respectively to obtain the first fused features corresponding to each of the multiple sets of first local features.

[0133] The feature splicing unit 54 is used to splice the first fused feature to obtain the second image feature of the image to be processed.

[0134] The target recognition unit 55 is used to perform target re-recognition on the image to be processed based on the second image features.

[0135] Optionally, the feature acquisition unit 51 is also used for:

[0136] The image to be processed is divided into multiple image blocks;

[0137] Generate the first word vector corresponding to each of the plurality of image patches;

[0138] Generate a sequence of word vectors based on multiple of the first word vectors;

[0139] The word vector sequence is input into the feature extraction model to obtain the first image features.

[0140] Optionally, the feature acquisition unit 51 is also used for:

[0141] Generate the position codes corresponding to each of the multiple image blocks;

[0142] The position is encoded to generate an encoding vector with the same dimension as the first word vector;

[0143] The first word vectors are added to their respective corresponding encoding vectors to obtain the second word vectors corresponding to the first word vectors.

[0144] The trained classification word vectors and multiple second word vectors are concatenated to form the word vector sequence, wherein the classification word vectors correspond to the first global feature.

[0145] Optionally, the feature extraction model includes multiple encoders connected in sequence, each encoder including an attention module, a multi-layer fully connected module, and a layer normalization module.

[0146] Correspondingly, the feature acquisition unit 51 is also used for:

[0147] For each encoder, the word vector sequence is input into the layer normalization module of the encoder, and a first result is output;

[0148] The first result is input into the attention module to obtain the second result;

[0149] The second result is added to the residual of the word vector sequence to obtain the third result;

[0150] The third result is input into the layer normalization module to obtain the fourth result;

[0151] The fourth result is input into the multi-layer fully connected module to obtain the fifth result;

[0152] The fifth result is added to the residual of the third result to obtain the output result of the encoder, wherein the first image feature is the output result of the last encoder.

[0153] Optionally, the feature fusion unit 53 is also used for:

[0154] Calculate the average feature of each group of the first local features and the first global features;

[0155] The calculated average features are concatenated to form the first fused feature.

[0156] Optionally, the target recognition unit 55 is also used for:

[0157] Calculate the feature similarity between the second image feature and the feature of each group of sample images in the preset feature library;

[0158] The sample image features are sorted in descending order of feature similarity to obtain a feature sequence;

[0159] The sample images corresponding to the first N sample image features in the feature sequence are determined as target images that match the image to be processed.

[0160] Optionally, device 5 also includes:

[0161] The model training unit 56 is used to obtain the fourth image feature of the training image based on the feature extraction model;

[0162] The fourth image feature is divided into a second global feature and multiple sets of second local features;

[0163] The multiple sets of second local features are respectively fused with the second global features to obtain the second fused features corresponding to each of the multiple sets of second local features;

[0164] Calculate the loss value for each group of the second fused features;

[0165] The model parameters of the feature extraction model and the classification word vector are updated based on the calculated loss value of the second fusion feature until the trained feature extraction model and the classification word vector are obtained.

[0166] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0167] in addition, Figure 5 The target re-identification device shown can be a software unit, a hardware unit, or a combination of software and hardware built into an existing terminal device, or it can be integrated into the terminal device as an independent component, or it can exist as an independent terminal device.

[0168] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0169] Figure 6 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. For example... Figure 6 As shown, the terminal device 6 in this embodiment includes: at least one processor 60 ( Figure 6 (Only one is shown) a processor, a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, wherein the processor 60 executes the computer program 62 to implement the steps in any of the above-described target re-identification method embodiments.

[0170] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. This terminal device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 6 This is merely an example of terminal device 6 and does not constitute a limitation on terminal device 6. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, it may also include input / output devices, network access devices, etc.

[0171] The processor 60 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0172] In some embodiments, the memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or memory of the terminal device 6. In other embodiments, the memory 61 may be an external storage device of the terminal device 6, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the terminal device 6. Furthermore, the memory 61 may include both internal and external storage units of the terminal device 6. The memory 61 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 61 can also be used to temporarily store data that has been output or will be output.

[0173] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.

[0174] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments above.

[0175] If the integrated unit is implemented as 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, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / terminal equipment, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0176] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0177] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0178] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

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

[0180] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A target re-identification method, characterized in that, include: The first image features of the image to be processed are obtained based on the trained feature extraction model. The first image features of the image to be processed are divided into first global features and multiple sets of first local features; The plurality of first local features are respectively fused with the first global feature to obtain the first fused feature corresponding to each of the plurality of first local features; By concatenating the first fusion feature, the second image feature of the image to be processed is obtained; Target re-identification is performed on the image to be processed based on the second image features; The step of obtaining the first image features of the image to be processed based on the trained feature extraction model includes: The image to be processed is divided into multiple image blocks; Generate the first word vector corresponding to each of the plurality of image patches; Generate a sequence of word vectors based on multiple of the first word vectors; The word vector sequence is input into the feature extraction model to obtain the first image features; The step of generating a word vector sequence based on a plurality of the first word vectors includes: Generate the position codes corresponding to each of the multiple image blocks; The position is encoded to generate an encoding vector with the same dimension as the first word vector; The first word vectors are added to their respective corresponding encoding vectors to obtain the second word vectors corresponding to the first word vectors. The trained classification word vectors and multiple second word vectors are concatenated to form the word vector sequence, wherein the classification word vectors correspond to the first global feature; The feature extraction model includes multiple encoders connected in sequence, and each encoder includes a self-attention module, a multi-layer fully connected module, and a layer normalization module. For each encoder, the word vector sequence is input into the layer normalization module of the encoder, and a first result is output; The first result is input into the attention module to obtain the second result; The second result is added to the residual of the word vector sequence to obtain the third result; The third result is input into the layer normalization module to obtain the fourth result; The fourth result is input into the multi-layer fully connected module to obtain the fifth result; The fifth result is added to the residual of the third result to obtain the output result of the encoder, wherein the first image feature is the output result of the last encoder; Before obtaining the first image features of the image to be processed based on the trained feature extraction model, the method further includes: The fourth image feature of the training image is obtained based on the feature extraction model; The fourth image feature is divided into a second global feature and multiple sets of second local features; The multiple sets of second local features are respectively fused with the second global features to obtain the second fused features corresponding to each of the multiple sets of second local features; Calculate the loss value for each group of the second fused features; The model parameters of the feature extraction model and the classification word vector are updated based on the calculated loss value of the second fusion feature until the trained feature extraction model and the classification word vector are obtained.

2. The target re-identification method as described in claim 1, characterized in that, The step of fusing the plurality of first local features with the first global feature to obtain the first fused feature corresponding to each of the plurality of first local features includes: For each group of the first local features, calculate the average feature of the first local features and the first global features; The calculated average feature is determined as the first fused feature corresponding to the first local feature.

3. The target re-identification method as described in claim 1, characterized in that, The step of re-identifying the target in the image to be processed based on the second image features includes: Calculate the feature similarity between the second image feature and the feature of each group of sample images in the preset feature library; The sample image features are sorted in descending order of feature similarity to obtain a feature sequence; The sample images corresponding to the first N sample image features in the feature sequence are determined as target images that match the image to be processed.

4. A target re-identification device, characterized in that, include: The feature acquisition unit is used to acquire the first image features of the image to be processed based on the trained feature extraction model. The feature segmentation unit is used to divide the first image features of the image to be processed into a first global feature and multiple sets of first local features; The feature fusion unit is used to fuse the plurality of first local features with the first global feature respectively to obtain the first fused feature corresponding to each of the plurality of first local features; A feature stitching unit is used to stitch together the first fused feature to obtain the second image feature of the image to be processed; The target recognition unit is used to perform target re-recognition on the image to be processed based on the second image features; The feature acquisition unit is further configured to: The image to be processed is divided into multiple image blocks; Generate the first word vector corresponding to each of the plurality of image patches; Generate a sequence of word vectors based on multiple of the first word vectors; The word vector sequence is input into the feature extraction model to obtain the first image features; Generate the position codes corresponding to each of the multiple image blocks; The position is encoded to generate an encoding vector with the same dimension as the first word vector; The first word vectors are added to their respective corresponding encoding vectors to obtain the second word vectors corresponding to the first word vectors. The trained classification word vectors and multiple second word vectors are concatenated to form the word vector sequence, wherein the classification word vectors correspond to the first global feature; The feature acquisition unit is further configured to: The feature extraction model includes multiple encoders connected in sequence, and each encoder includes a self-attention module, a multi-layer fully connected module, and a layer normalization module. For each encoder, the word vector sequence is input into the layer normalization module of the encoder, and a first result is output; The first result is input into the attention module to obtain the second result; The second result is added to the residual of the word vector sequence to obtain the third result; The third result is input into the layer normalization module to obtain the fourth result; The fourth result is input into the multi-layer fully connected module to obtain the fifth result; The fifth result is added to the residual of the third result to obtain the output result of the encoder, wherein the first image feature is the output result of the last encoder; The feature acquisition unit is further configured to: The fourth image feature of the training image is obtained based on the feature extraction model; The fourth image feature is divided into a second global feature and multiple sets of second local features; The multiple sets of second local features are respectively fused with the second global features to obtain the second fused features corresponding to each of the multiple sets of second local features; Calculate the loss value for each group of the second fused features; The model parameters of the feature extraction model and the classification word vector are updated based on the calculated loss value of the second fusion feature until the trained feature extraction model and the classification word vector are obtained.

5. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 3.

6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Pedestrian re-identification method, device, computer device and storage medium

    CN109271870A

  • Image re-identification method and device, electronic equipment and storage medium

    CN113435325A

  • Image processing method and device, equipment, storage medium and computer program product

    CN113642585A